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 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)
55 ;; UNSPEC_VOLATILE usage
60 (UNSPECV_EH_RR 9) ; eh_reg_restore
63 ;; Define an insn type attribute. This is used in function unit delay
65 (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"
66 (const_string "integer"))
69 ; '(pc)' in the following doesn't include the instruction itself; it is
70 ; calculated as if the instruction had zero size.
71 (define_attr "length" ""
72 (if_then_else (eq_attr "type" "branch")
73 (if_then_else (and (ge (minus (match_dup 0) (pc))
75 (lt (minus (match_dup 0) (pc))
81 ;; Processor type -- this attribute must exactly match the processor_type
82 ;; enumeration in rs6000.h.
84 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4"
85 (const (symbol_ref "rs6000_cpu_attr")))
87 (automata_option "ndfa")
100 (include "power4.md")
103 ;; Start with fixed-point load and store insns. Here we put only the more
104 ;; complex forms. Basic data transfer is done later.
106 (define_expand "zero_extendqidi2"
107 [(set (match_operand:DI 0 "gpc_reg_operand" "")
108 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
113 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
114 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
119 [(set_attr "type" "load,*")])
122 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
123 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
125 (clobber (match_scratch:DI 2 "=r,r"))]
130 [(set_attr "type" "compare")
131 (set_attr "length" "4,8")])
134 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
135 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
137 (clobber (match_scratch:DI 2 ""))]
138 "TARGET_POWERPC64 && reload_completed"
140 (zero_extend:DI (match_dup 1)))
142 (compare:CC (match_dup 2)
147 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
148 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
150 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
151 (zero_extend:DI (match_dup 1)))]
156 [(set_attr "type" "compare")
157 (set_attr "length" "4,8")])
160 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
161 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
163 (set (match_operand:DI 0 "gpc_reg_operand" "")
164 (zero_extend:DI (match_dup 1)))]
165 "TARGET_POWERPC64 && reload_completed"
167 (zero_extend:DI (match_dup 1)))
169 (compare:CC (match_dup 0)
173 (define_insn "extendqidi2"
174 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
175 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
180 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
181 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
183 (clobber (match_scratch:DI 2 "=r,r"))]
188 [(set_attr "type" "compare")
189 (set_attr "length" "4,8")])
192 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
193 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
195 (clobber (match_scratch:DI 2 ""))]
196 "TARGET_POWERPC64 && reload_completed"
198 (sign_extend:DI (match_dup 1)))
200 (compare:CC (match_dup 2)
205 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
206 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
208 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
209 (sign_extend:DI (match_dup 1)))]
214 [(set_attr "type" "compare")
215 (set_attr "length" "4,8")])
218 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
219 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
221 (set (match_operand:DI 0 "gpc_reg_operand" "")
222 (sign_extend:DI (match_dup 1)))]
223 "TARGET_POWERPC64 && reload_completed"
225 (sign_extend:DI (match_dup 1)))
227 (compare:CC (match_dup 0)
231 (define_expand "zero_extendhidi2"
232 [(set (match_operand:DI 0 "gpc_reg_operand" "")
233 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
238 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
239 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
244 [(set_attr "type" "load,*")])
247 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
248 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
250 (clobber (match_scratch:DI 2 "=r,r"))]
255 [(set_attr "type" "compare")
256 (set_attr "length" "4,8")])
259 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
260 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
262 (clobber (match_scratch:DI 2 ""))]
263 "TARGET_POWERPC64 && reload_completed"
265 (zero_extend:DI (match_dup 1)))
267 (compare:CC (match_dup 2)
272 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
273 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
275 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
276 (zero_extend:DI (match_dup 1)))]
281 [(set_attr "type" "compare")
282 (set_attr "length" "4,8")])
285 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
286 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
288 (set (match_operand:DI 0 "gpc_reg_operand" "")
289 (zero_extend:DI (match_dup 1)))]
290 "TARGET_POWERPC64 && reload_completed"
292 (zero_extend:DI (match_dup 1)))
294 (compare:CC (match_dup 0)
298 (define_expand "extendhidi2"
299 [(set (match_operand:DI 0 "gpc_reg_operand" "")
300 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
305 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
306 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
311 [(set_attr "type" "load_ext,*")])
314 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
315 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
317 (clobber (match_scratch:DI 2 "=r,r"))]
322 [(set_attr "type" "compare")
323 (set_attr "length" "4,8")])
326 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
327 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
329 (clobber (match_scratch:DI 2 ""))]
330 "TARGET_POWERPC64 && reload_completed"
332 (sign_extend:DI (match_dup 1)))
334 (compare:CC (match_dup 2)
339 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
340 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
342 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
343 (sign_extend:DI (match_dup 1)))]
348 [(set_attr "type" "compare")
349 (set_attr "length" "4,8")])
352 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
353 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
355 (set (match_operand:DI 0 "gpc_reg_operand" "")
356 (sign_extend:DI (match_dup 1)))]
357 "TARGET_POWERPC64 && reload_completed"
359 (sign_extend:DI (match_dup 1)))
361 (compare:CC (match_dup 0)
365 (define_expand "zero_extendsidi2"
366 [(set (match_operand:DI 0 "gpc_reg_operand" "")
367 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
372 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
373 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
378 [(set_attr "type" "load,*")])
381 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
382 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
384 (clobber (match_scratch:DI 2 "=r,r"))]
389 [(set_attr "type" "compare")
390 (set_attr "length" "4,8")])
393 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
394 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
396 (clobber (match_scratch:DI 2 ""))]
397 "TARGET_POWERPC64 && reload_completed"
399 (zero_extend:DI (match_dup 1)))
401 (compare:CC (match_dup 2)
406 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
407 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
409 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
410 (zero_extend:DI (match_dup 1)))]
415 [(set_attr "type" "compare")
416 (set_attr "length" "4,8")])
419 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
420 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
422 (set (match_operand:DI 0 "gpc_reg_operand" "")
423 (zero_extend:DI (match_dup 1)))]
424 "TARGET_POWERPC64 && reload_completed"
426 (zero_extend:DI (match_dup 1)))
428 (compare:CC (match_dup 0)
432 (define_expand "extendsidi2"
433 [(set (match_operand:DI 0 "gpc_reg_operand" "")
434 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
439 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
440 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
445 [(set_attr "type" "load_ext,*")])
448 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
449 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
451 (clobber (match_scratch:DI 2 "=r,r"))]
456 [(set_attr "type" "compare")
457 (set_attr "length" "4,8")])
460 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
461 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
463 (clobber (match_scratch:DI 2 ""))]
464 "TARGET_POWERPC64 && reload_completed"
466 (sign_extend:DI (match_dup 1)))
468 (compare:CC (match_dup 2)
473 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
474 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
476 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
477 (sign_extend:DI (match_dup 1)))]
482 [(set_attr "type" "compare")
483 (set_attr "length" "4,8")])
486 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
487 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
489 (set (match_operand:DI 0 "gpc_reg_operand" "")
490 (sign_extend:DI (match_dup 1)))]
491 "TARGET_POWERPC64 && reload_completed"
493 (sign_extend:DI (match_dup 1)))
495 (compare:CC (match_dup 0)
499 (define_expand "zero_extendqisi2"
500 [(set (match_operand:SI 0 "gpc_reg_operand" "")
501 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
506 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
507 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
511 {rlinm|rlwinm} %0,%1,0,0xff"
512 [(set_attr "type" "load,*")])
515 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
516 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
518 (clobber (match_scratch:SI 2 "=r,r"))]
521 {andil.|andi.} %2,%1,0xff
523 [(set_attr "type" "compare")
524 (set_attr "length" "4,8")])
527 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
528 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
530 (clobber (match_scratch:SI 2 ""))]
533 (zero_extend:SI (match_dup 1)))
535 (compare:CC (match_dup 2)
540 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
541 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
543 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
544 (zero_extend:SI (match_dup 1)))]
547 {andil.|andi.} %0,%1,0xff
549 [(set_attr "type" "compare")
550 (set_attr "length" "4,8")])
553 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
554 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
556 (set (match_operand:SI 0 "gpc_reg_operand" "")
557 (zero_extend:SI (match_dup 1)))]
560 (zero_extend:SI (match_dup 1)))
562 (compare:CC (match_dup 0)
566 (define_expand "extendqisi2"
567 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
568 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
573 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
574 else if (TARGET_POWER)
575 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
577 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
581 (define_insn "extendqisi2_ppc"
582 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
583 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
588 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
589 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
591 (clobber (match_scratch:SI 2 "=r,r"))]
596 [(set_attr "type" "compare")
597 (set_attr "length" "4,8")])
600 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
601 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
603 (clobber (match_scratch:SI 2 ""))]
604 "TARGET_POWERPC && reload_completed"
606 (sign_extend:SI (match_dup 1)))
608 (compare:CC (match_dup 2)
613 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
614 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
616 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
617 (sign_extend:SI (match_dup 1)))]
622 [(set_attr "type" "compare")
623 (set_attr "length" "4,8")])
626 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
627 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
629 (set (match_operand:SI 0 "gpc_reg_operand" "")
630 (sign_extend:SI (match_dup 1)))]
631 "TARGET_POWERPC && reload_completed"
633 (sign_extend:SI (match_dup 1)))
635 (compare:CC (match_dup 0)
639 (define_expand "extendqisi2_power"
640 [(parallel [(set (match_dup 2)
641 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
643 (clobber (scratch:SI))])
644 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
645 (ashiftrt:SI (match_dup 2)
647 (clobber (scratch:SI))])]
650 { operands[1] = gen_lowpart (SImode, operands[1]);
651 operands[2] = gen_reg_rtx (SImode); }")
653 (define_expand "extendqisi2_no_power"
655 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
657 (set (match_operand:SI 0 "gpc_reg_operand" "")
658 (ashiftrt:SI (match_dup 2)
660 "! TARGET_POWER && ! TARGET_POWERPC"
662 { operands[1] = gen_lowpart (SImode, operands[1]);
663 operands[2] = gen_reg_rtx (SImode); }")
665 (define_expand "zero_extendqihi2"
666 [(set (match_operand:HI 0 "gpc_reg_operand" "")
667 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
672 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
673 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
677 {rlinm|rlwinm} %0,%1,0,0xff"
678 [(set_attr "type" "load,*")])
681 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
682 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
684 (clobber (match_scratch:HI 2 "=r,r"))]
687 {andil.|andi.} %2,%1,0xff
689 [(set_attr "type" "compare")
690 (set_attr "length" "4,8")])
693 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
694 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
696 (clobber (match_scratch:HI 2 ""))]
699 (zero_extend:HI (match_dup 1)))
701 (compare:CC (match_dup 2)
706 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
707 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
709 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
710 (zero_extend:HI (match_dup 1)))]
713 {andil.|andi.} %0,%1,0xff
715 [(set_attr "type" "compare")
716 (set_attr "length" "4,8")])
719 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
720 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
722 (set (match_operand:HI 0 "gpc_reg_operand" "")
723 (zero_extend:HI (match_dup 1)))]
726 (zero_extend:HI (match_dup 1)))
728 (compare:CC (match_dup 0)
732 (define_expand "extendqihi2"
733 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
734 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
739 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
740 else if (TARGET_POWER)
741 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
743 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
747 (define_insn "extendqihi2_ppc"
748 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
749 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
754 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
755 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
757 (clobber (match_scratch:HI 2 "=r,r"))]
762 [(set_attr "type" "compare")
763 (set_attr "length" "4,8")])
766 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
767 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
769 (clobber (match_scratch:HI 2 ""))]
770 "TARGET_POWERPC && reload_completed"
772 (sign_extend:HI (match_dup 1)))
774 (compare:CC (match_dup 2)
779 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
780 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
782 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
783 (sign_extend:HI (match_dup 1)))]
788 [(set_attr "type" "compare")
789 (set_attr "length" "4,8")])
792 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
793 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
795 (set (match_operand:HI 0 "gpc_reg_operand" "")
796 (sign_extend:HI (match_dup 1)))]
797 "TARGET_POWERPC && reload_completed"
799 (sign_extend:HI (match_dup 1)))
801 (compare:CC (match_dup 0)
805 (define_expand "extendqihi2_power"
806 [(parallel [(set (match_dup 2)
807 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
809 (clobber (scratch:SI))])
810 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
811 (ashiftrt:SI (match_dup 2)
813 (clobber (scratch:SI))])]
816 { operands[0] = gen_lowpart (SImode, operands[0]);
817 operands[1] = gen_lowpart (SImode, operands[1]);
818 operands[2] = gen_reg_rtx (SImode); }")
820 (define_expand "extendqihi2_no_power"
822 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
824 (set (match_operand:HI 0 "gpc_reg_operand" "")
825 (ashiftrt:SI (match_dup 2)
827 "! TARGET_POWER && ! TARGET_POWERPC"
829 { operands[0] = gen_lowpart (SImode, operands[0]);
830 operands[1] = gen_lowpart (SImode, operands[1]);
831 operands[2] = gen_reg_rtx (SImode); }")
833 (define_expand "zero_extendhisi2"
834 [(set (match_operand:SI 0 "gpc_reg_operand" "")
835 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
840 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
841 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
845 {rlinm|rlwinm} %0,%1,0,0xffff"
846 [(set_attr "type" "load,*")])
849 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
850 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
852 (clobber (match_scratch:SI 2 "=r,r"))]
855 {andil.|andi.} %2,%1,0xffff
857 [(set_attr "type" "compare")
858 (set_attr "length" "4,8")])
861 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
862 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
864 (clobber (match_scratch:SI 2 ""))]
867 (zero_extend:SI (match_dup 1)))
869 (compare:CC (match_dup 2)
874 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
875 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
877 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
878 (zero_extend:SI (match_dup 1)))]
881 {andil.|andi.} %0,%1,0xffff
883 [(set_attr "type" "compare")
884 (set_attr "length" "4,8")])
887 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
888 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
890 (set (match_operand:SI 0 "gpc_reg_operand" "")
891 (zero_extend:SI (match_dup 1)))]
894 (zero_extend:SI (match_dup 1)))
896 (compare:CC (match_dup 0)
900 (define_expand "extendhisi2"
901 [(set (match_operand:SI 0 "gpc_reg_operand" "")
902 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
907 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
908 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
913 [(set_attr "type" "load_ext,*")])
916 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
917 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
919 (clobber (match_scratch:SI 2 "=r,r"))]
924 [(set_attr "type" "compare")
925 (set_attr "length" "4,8")])
928 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
929 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
931 (clobber (match_scratch:SI 2 ""))]
934 (sign_extend:SI (match_dup 1)))
936 (compare:CC (match_dup 2)
941 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
942 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
944 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
945 (sign_extend:SI (match_dup 1)))]
950 [(set_attr "type" "compare")
951 (set_attr "length" "4,8")])
954 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
955 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
957 (set (match_operand:SI 0 "gpc_reg_operand" "")
958 (sign_extend:SI (match_dup 1)))]
961 (sign_extend:SI (match_dup 1)))
963 (compare:CC (match_dup 0)
967 ;; Fixed-point arithmetic insns.
969 ;; Discourage ai/addic because of carry but provide it in an alternative
970 ;; allowing register zero as source.
971 (define_expand "addsi3"
972 [(set (match_operand:SI 0 "gpc_reg_operand" "")
973 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
974 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
978 if (GET_CODE (operands[2]) == CONST_INT
979 && ! add_operand (operands[2], SImode))
981 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
982 ? operands[0] : gen_reg_rtx (SImode));
984 HOST_WIDE_INT val = INTVAL (operands[2]);
985 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
986 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
988 /* The ordering here is important for the prolog expander.
989 When space is allocated from the stack, adding 'low' first may
990 produce a temporary deallocation (which would be bad). */
991 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
992 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
997 (define_insn "*addsi3_internal1"
998 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
999 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1000 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1004 {cal %0,%2(%1)|addi %0,%1,%2}
1006 {cau|addis} %0,%1,%v2"
1007 [(set_attr "length" "4,4,4,4")])
1009 (define_insn "addsi3_high"
1010 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1011 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1012 (high:SI (match_operand 2 "" ""))))]
1013 "TARGET_MACHO && !TARGET_64BIT"
1014 "{cau|addis} %0,%1,ha16(%2)"
1015 [(set_attr "length" "4")])
1017 (define_insn "*addsi3_internal2"
1018 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1019 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1020 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1022 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1023 "! TARGET_POWERPC64"
1025 {cax.|add.} %3,%1,%2
1026 {ai.|addic.} %3,%1,%2
1029 [(set_attr "type" "fast_compare,compare,compare,compare")
1030 (set_attr "length" "4,4,8,8")])
1033 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1034 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1035 (match_operand:SI 2 "reg_or_short_operand" ""))
1037 (clobber (match_scratch:SI 3 ""))]
1038 "! TARGET_POWERPC64 && reload_completed"
1040 (plus:SI (match_dup 1)
1043 (compare:CC (match_dup 3)
1047 (define_insn "*addsi3_internal3"
1048 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1049 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1050 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1052 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1053 (plus:SI (match_dup 1)
1055 "! TARGET_POWERPC64"
1057 {cax.|add.} %0,%1,%2
1058 {ai.|addic.} %0,%1,%2
1061 [(set_attr "type" "fast_compare,compare,compare,compare")
1062 (set_attr "length" "4,4,8,8")])
1065 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1066 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1067 (match_operand:SI 2 "reg_or_short_operand" ""))
1069 (set (match_operand:SI 0 "gpc_reg_operand" "")
1070 (plus:SI (match_dup 1) (match_dup 2)))]
1071 "! TARGET_POWERPC64 && reload_completed"
1073 (plus:SI (match_dup 1)
1076 (compare:CC (match_dup 0)
1080 ;; Split an add that we can't do in one insn into two insns, each of which
1081 ;; does one 16-bit part. This is used by combine. Note that the low-order
1082 ;; add should be last in case the result gets used in an address.
1085 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1086 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1087 (match_operand:SI 2 "non_add_cint_operand" "")))]
1089 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1090 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1093 HOST_WIDE_INT val = INTVAL (operands[2]);
1094 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1095 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1097 operands[3] = GEN_INT (rest);
1098 operands[4] = GEN_INT (low);
1101 (define_insn "one_cmplsi2"
1102 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1103 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1108 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1109 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1111 (clobber (match_scratch:SI 2 "=r,r"))]
1112 "! TARGET_POWERPC64"
1116 [(set_attr "type" "compare")
1117 (set_attr "length" "4,8")])
1120 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1121 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1123 (clobber (match_scratch:SI 2 ""))]
1124 "! TARGET_POWERPC64 && reload_completed"
1126 (not:SI (match_dup 1)))
1128 (compare:CC (match_dup 2)
1133 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1134 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1136 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1137 (not:SI (match_dup 1)))]
1138 "! TARGET_POWERPC64"
1142 [(set_attr "type" "compare")
1143 (set_attr "length" "4,8")])
1146 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1147 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1149 (set (match_operand:SI 0 "gpc_reg_operand" "")
1150 (not:SI (match_dup 1)))]
1151 "! TARGET_POWERPC64 && reload_completed"
1153 (not:SI (match_dup 1)))
1155 (compare:CC (match_dup 0)
1160 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1161 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1162 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1164 "{sf%I1|subf%I1c} %0,%2,%1")
1167 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1168 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1169 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1176 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1177 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1178 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1180 (clobber (match_scratch:SI 3 "=r,r"))]
1183 {sf.|subfc.} %3,%2,%1
1185 [(set_attr "type" "compare")
1186 (set_attr "length" "4,8")])
1189 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1190 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1191 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1193 (clobber (match_scratch:SI 3 "=r,r"))]
1194 "TARGET_POWERPC && ! TARGET_POWERPC64"
1198 [(set_attr "type" "fast_compare")
1199 (set_attr "length" "4,8")])
1202 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1203 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1204 (match_operand:SI 2 "gpc_reg_operand" ""))
1206 (clobber (match_scratch:SI 3 ""))]
1207 "! TARGET_POWERPC64 && reload_completed"
1209 (minus:SI (match_dup 1)
1212 (compare:CC (match_dup 3)
1217 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1218 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1219 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1221 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1222 (minus:SI (match_dup 1) (match_dup 2)))]
1225 {sf.|subfc.} %0,%2,%1
1227 [(set_attr "type" "compare")
1228 (set_attr "length" "4,8")])
1231 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1232 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1233 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1235 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1236 (minus:SI (match_dup 1)
1238 "TARGET_POWERPC && ! TARGET_POWERPC64"
1242 [(set_attr "type" "fast_compare")
1243 (set_attr "length" "4,8")])
1246 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1247 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1248 (match_operand:SI 2 "gpc_reg_operand" ""))
1250 (set (match_operand:SI 0 "gpc_reg_operand" "")
1251 (minus:SI (match_dup 1)
1253 "! TARGET_POWERPC64 && reload_completed"
1255 (minus:SI (match_dup 1)
1258 (compare:CC (match_dup 0)
1262 (define_expand "subsi3"
1263 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1264 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1265 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1269 if (GET_CODE (operands[2]) == CONST_INT)
1271 emit_insn (gen_addsi3 (operands[0], operands[1],
1272 negate_rtx (SImode, operands[2])));
1277 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1278 ;; instruction and some auxiliary computations. Then we just have a single
1279 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1282 (define_expand "sminsi3"
1284 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1285 (match_operand:SI 2 "reg_or_short_operand" ""))
1287 (minus:SI (match_dup 2) (match_dup 1))))
1288 (set (match_operand:SI 0 "gpc_reg_operand" "")
1289 (minus:SI (match_dup 2) (match_dup 3)))]
1290 "TARGET_POWER || TARGET_ISEL"
1295 operands[2] = force_reg (SImode, operands[2]);
1296 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1300 operands[3] = gen_reg_rtx (SImode);
1304 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1305 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1306 (match_operand:SI 2 "reg_or_short_operand" "")))
1307 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1310 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1312 (minus:SI (match_dup 2) (match_dup 1))))
1313 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1316 (define_expand "smaxsi3"
1318 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1319 (match_operand:SI 2 "reg_or_short_operand" ""))
1321 (minus:SI (match_dup 2) (match_dup 1))))
1322 (set (match_operand:SI 0 "gpc_reg_operand" "")
1323 (plus:SI (match_dup 3) (match_dup 1)))]
1324 "TARGET_POWER || TARGET_ISEL"
1329 operands[2] = force_reg (SImode, operands[2]);
1330 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1333 operands[3] = gen_reg_rtx (SImode);
1337 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1338 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1339 (match_operand:SI 2 "reg_or_short_operand" "")))
1340 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1343 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1345 (minus:SI (match_dup 2) (match_dup 1))))
1346 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1349 (define_expand "uminsi3"
1350 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1352 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1354 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1356 (minus:SI (match_dup 4) (match_dup 3))))
1357 (set (match_operand:SI 0 "gpc_reg_operand" "")
1358 (minus:SI (match_dup 2) (match_dup 3)))]
1359 "TARGET_POWER || TARGET_ISEL"
1364 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1367 operands[3] = gen_reg_rtx (SImode);
1368 operands[4] = gen_reg_rtx (SImode);
1369 operands[5] = GEN_INT (-2147483647 - 1);
1372 (define_expand "umaxsi3"
1373 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1375 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1377 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1379 (minus:SI (match_dup 4) (match_dup 3))))
1380 (set (match_operand:SI 0 "gpc_reg_operand" "")
1381 (plus:SI (match_dup 3) (match_dup 1)))]
1382 "TARGET_POWER || TARGET_ISEL"
1387 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1390 operands[3] = gen_reg_rtx (SImode);
1391 operands[4] = gen_reg_rtx (SImode);
1392 operands[5] = GEN_INT (-2147483647 - 1);
1396 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1397 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1398 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1400 (minus:SI (match_dup 2) (match_dup 1))))]
1405 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1407 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1408 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1410 (minus:SI (match_dup 2) (match_dup 1)))
1412 (clobber (match_scratch:SI 3 "=r,r"))]
1417 [(set_attr "type" "delayed_compare")
1418 (set_attr "length" "4,8")])
1421 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1423 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1424 (match_operand:SI 2 "reg_or_short_operand" ""))
1426 (minus:SI (match_dup 2) (match_dup 1)))
1428 (clobber (match_scratch:SI 3 ""))]
1429 "TARGET_POWER && reload_completed"
1431 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1433 (minus:SI (match_dup 2) (match_dup 1))))
1435 (compare:CC (match_dup 3)
1440 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1442 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1443 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1445 (minus:SI (match_dup 2) (match_dup 1)))
1447 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1448 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1450 (minus:SI (match_dup 2) (match_dup 1))))]
1455 [(set_attr "type" "delayed_compare")
1456 (set_attr "length" "4,8")])
1459 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1461 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1462 (match_operand:SI 2 "reg_or_short_operand" ""))
1464 (minus:SI (match_dup 2) (match_dup 1)))
1466 (set (match_operand:SI 0 "gpc_reg_operand" "")
1467 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1469 (minus:SI (match_dup 2) (match_dup 1))))]
1470 "TARGET_POWER && reload_completed"
1472 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1474 (minus:SI (match_dup 2) (match_dup 1))))
1476 (compare:CC (match_dup 0)
1480 ;; We don't need abs with condition code because such comparisons should
1482 (define_expand "abssi2"
1483 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1484 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1490 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1493 else if (! TARGET_POWER)
1495 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1500 (define_insn "*abssi2_power"
1501 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1502 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1506 (define_insn_and_split "abssi2_isel"
1507 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1508 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1509 (clobber (match_scratch:SI 2 "=&b"))
1510 (clobber (match_scratch:CC 3 "=y"))]
1513 "&& reload_completed"
1514 [(set (match_dup 2) (neg:SI (match_dup 1)))
1516 (compare:CC (match_dup 1)
1519 (if_then_else:SI (ge (match_dup 3)
1525 (define_insn_and_split "abssi2_nopower"
1526 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1527 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1528 (clobber (match_scratch:SI 2 "=&r,&r"))]
1529 "! TARGET_POWER && ! TARGET_ISEL"
1531 "&& reload_completed"
1532 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1533 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1534 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1537 (define_insn "*nabs_power"
1538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1539 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1543 (define_insn_and_split "*nabs_nopower"
1544 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1545 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1546 (clobber (match_scratch:SI 2 "=&r,&r"))]
1549 "&& reload_completed"
1550 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1551 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1552 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1555 (define_insn "negsi2"
1556 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1557 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1562 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1563 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1565 (clobber (match_scratch:SI 2 "=r,r"))]
1566 "! TARGET_POWERPC64"
1570 [(set_attr "type" "fast_compare")
1571 (set_attr "length" "4,8")])
1574 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1575 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1577 (clobber (match_scratch:SI 2 ""))]
1578 "! TARGET_POWERPC64 && reload_completed"
1580 (neg:SI (match_dup 1)))
1582 (compare:CC (match_dup 2)
1587 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1588 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1590 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1591 (neg:SI (match_dup 1)))]
1592 "! TARGET_POWERPC64"
1596 [(set_attr "type" "fast_compare")
1597 (set_attr "length" "4,8")])
1600 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1601 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1603 (set (match_operand:SI 0 "gpc_reg_operand" "")
1604 (neg:SI (match_dup 1)))]
1605 "! TARGET_POWERPC64 && reload_completed"
1607 (neg:SI (match_dup 1)))
1609 (compare:CC (match_dup 0)
1613 (define_insn "clzsi2"
1614 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1615 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1617 "{cntlz|cntlzw} %0,%1")
1619 (define_expand "ctzsi2"
1621 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1622 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1624 (clobber (scratch:CC))])
1625 (set (match_dup 4) (clz:SI (match_dup 3)))
1626 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1627 (minus:SI (const_int 31) (match_dup 4)))]
1630 operands[2] = gen_reg_rtx (SImode);
1631 operands[3] = gen_reg_rtx (SImode);
1632 operands[4] = gen_reg_rtx (SImode);
1635 (define_expand "ffssi2"
1637 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1638 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1640 (clobber (scratch:CC))])
1641 (set (match_dup 4) (clz:SI (match_dup 3)))
1642 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1643 (minus:SI (const_int 32) (match_dup 4)))]
1646 operands[2] = gen_reg_rtx (SImode);
1647 operands[3] = gen_reg_rtx (SImode);
1648 operands[4] = gen_reg_rtx (SImode);
1651 (define_expand "mulsi3"
1652 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1653 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1654 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1659 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1661 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1665 (define_insn "mulsi3_mq"
1666 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1667 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1668 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1669 (clobber (match_scratch:SI 3 "=q,q"))]
1672 {muls|mullw} %0,%1,%2
1673 {muli|mulli} %0,%1,%2"
1675 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1676 (const_string "imul3")
1677 (match_operand:SI 2 "short_cint_operand" "")
1678 (const_string "imul2")]
1679 (const_string "imul")))])
1681 (define_insn "mulsi3_no_mq"
1682 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1683 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1684 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1687 {muls|mullw} %0,%1,%2
1688 {muli|mulli} %0,%1,%2"
1690 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1691 (const_string "imul3")
1692 (match_operand:SI 2 "short_cint_operand" "")
1693 (const_string "imul2")]
1694 (const_string "imul")))])
1696 (define_insn "*mulsi3_mq_internal1"
1697 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1698 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1699 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1701 (clobber (match_scratch:SI 3 "=r,r"))
1702 (clobber (match_scratch:SI 4 "=q,q"))]
1705 {muls.|mullw.} %3,%1,%2
1707 [(set_attr "type" "imul_compare")
1708 (set_attr "length" "4,8")])
1711 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1712 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1713 (match_operand:SI 2 "gpc_reg_operand" ""))
1715 (clobber (match_scratch:SI 3 ""))
1716 (clobber (match_scratch:SI 4 ""))]
1717 "TARGET_POWER && reload_completed"
1718 [(parallel [(set (match_dup 3)
1719 (mult:SI (match_dup 1) (match_dup 2)))
1720 (clobber (match_dup 4))])
1722 (compare:CC (match_dup 3)
1726 (define_insn "*mulsi3_no_mq_internal1"
1727 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1728 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1729 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1731 (clobber (match_scratch:SI 3 "=r,r"))]
1734 {muls.|mullw.} %3,%1,%2
1736 [(set_attr "type" "imul_compare")
1737 (set_attr "length" "4,8")])
1740 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1741 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1742 (match_operand:SI 2 "gpc_reg_operand" ""))
1744 (clobber (match_scratch:SI 3 ""))]
1745 "! TARGET_POWER && reload_completed"
1747 (mult:SI (match_dup 1) (match_dup 2)))
1749 (compare:CC (match_dup 3)
1753 (define_insn "*mulsi3_mq_internal2"
1754 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1755 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1756 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1758 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1759 (mult:SI (match_dup 1) (match_dup 2)))
1760 (clobber (match_scratch:SI 4 "=q,q"))]
1763 {muls.|mullw.} %0,%1,%2
1765 [(set_attr "type" "imul_compare")
1766 (set_attr "length" "4,8")])
1769 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1770 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1771 (match_operand:SI 2 "gpc_reg_operand" ""))
1773 (set (match_operand:SI 0 "gpc_reg_operand" "")
1774 (mult:SI (match_dup 1) (match_dup 2)))
1775 (clobber (match_scratch:SI 4 ""))]
1776 "TARGET_POWER && reload_completed"
1777 [(parallel [(set (match_dup 0)
1778 (mult:SI (match_dup 1) (match_dup 2)))
1779 (clobber (match_dup 4))])
1781 (compare:CC (match_dup 0)
1785 (define_insn "*mulsi3_no_mq_internal2"
1786 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1787 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1788 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1790 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1791 (mult:SI (match_dup 1) (match_dup 2)))]
1794 {muls.|mullw.} %0,%1,%2
1796 [(set_attr "type" "imul_compare")
1797 (set_attr "length" "4,8")])
1800 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1801 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1802 (match_operand:SI 2 "gpc_reg_operand" ""))
1804 (set (match_operand:SI 0 "gpc_reg_operand" "")
1805 (mult:SI (match_dup 1) (match_dup 2)))]
1806 "! TARGET_POWER && reload_completed"
1808 (mult:SI (match_dup 1) (match_dup 2)))
1810 (compare:CC (match_dup 0)
1814 ;; Operand 1 is divided by operand 2; quotient goes to operand
1815 ;; 0 and remainder to operand 3.
1816 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1818 (define_expand "divmodsi4"
1819 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1820 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1821 (match_operand:SI 2 "gpc_reg_operand" "")))
1822 (set (match_operand:SI 3 "register_operand" "")
1823 (mod:SI (match_dup 1) (match_dup 2)))])]
1824 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1827 if (! TARGET_POWER && ! TARGET_POWERPC)
1829 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1830 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1831 emit_insn (gen_divss_call ());
1832 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1833 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1838 (define_insn "*divmodsi4_internal"
1839 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1840 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1841 (match_operand:SI 2 "gpc_reg_operand" "r")))
1842 (set (match_operand:SI 3 "register_operand" "=q")
1843 (mod:SI (match_dup 1) (match_dup 2)))]
1846 [(set_attr "type" "idiv")])
1848 (define_expand "udivsi3"
1849 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1850 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1851 (match_operand:SI 2 "gpc_reg_operand" "")))]
1852 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1855 if (! TARGET_POWER && ! TARGET_POWERPC)
1857 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1858 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1859 emit_insn (gen_quous_call ());
1860 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1863 else if (TARGET_POWER)
1865 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1870 (define_insn "udivsi3_mq"
1871 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1872 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1873 (match_operand:SI 2 "gpc_reg_operand" "r")))
1874 (clobber (match_scratch:SI 3 "=q"))]
1875 "TARGET_POWERPC && TARGET_POWER"
1877 [(set_attr "type" "idiv")])
1879 (define_insn "*udivsi3_no_mq"
1880 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1881 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1882 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1883 "TARGET_POWERPC && ! TARGET_POWER"
1885 [(set_attr "type" "idiv")])
1887 ;; For powers of two we can do srai/aze for divide and then adjust for
1888 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1889 ;; used; for PowerPC, force operands into register and do a normal divide;
1890 ;; for AIX common-mode, use quoss call on register operands.
1891 (define_expand "divsi3"
1892 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1893 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1894 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1898 if (GET_CODE (operands[2]) == CONST_INT
1899 && INTVAL (operands[2]) > 0
1900 && exact_log2 (INTVAL (operands[2])) >= 0)
1902 else if (TARGET_POWERPC)
1904 operands[2] = force_reg (SImode, operands[2]);
1907 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1911 else if (TARGET_POWER)
1915 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1916 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1917 emit_insn (gen_quoss_call ());
1918 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1923 (define_insn "divsi3_mq"
1924 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1925 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1926 (match_operand:SI 2 "gpc_reg_operand" "r")))
1927 (clobber (match_scratch:SI 3 "=q"))]
1928 "TARGET_POWERPC && TARGET_POWER"
1930 [(set_attr "type" "idiv")])
1932 (define_insn "*divsi3_no_mq"
1933 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1934 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1935 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1936 "TARGET_POWERPC && ! TARGET_POWER"
1938 [(set_attr "type" "idiv")])
1940 (define_expand "modsi3"
1941 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1942 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1943 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1951 if (GET_CODE (operands[2]) != CONST_INT
1952 || INTVAL (operands[2]) <= 0
1953 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1956 temp1 = gen_reg_rtx (SImode);
1957 temp2 = gen_reg_rtx (SImode);
1959 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1960 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1961 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1966 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1967 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1968 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1970 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1971 [(set_attr "length" "8")])
1974 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1975 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1976 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1978 (clobber (match_scratch:SI 3 "=r,r"))]
1981 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1983 [(set_attr "type" "compare")
1984 (set_attr "length" "8,12")])
1987 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1988 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1989 (match_operand:SI 2 "exact_log2_cint_operand" ""))
1991 (clobber (match_scratch:SI 3 ""))]
1994 (div:SI (match_dup 1) (match_dup 2)))
1996 (compare:CC (match_dup 3)
2001 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2002 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2003 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2005 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2006 (div:SI (match_dup 1) (match_dup 2)))]
2009 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2011 [(set_attr "type" "compare")
2012 (set_attr "length" "8,12")])
2015 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2016 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2017 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2019 (set (match_operand:SI 0 "gpc_reg_operand" "")
2020 (div:SI (match_dup 1) (match_dup 2)))]
2023 (div:SI (match_dup 1) (match_dup 2)))
2025 (compare:CC (match_dup 0)
2030 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2033 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2035 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2036 (match_operand:SI 3 "gpc_reg_operand" "r")))
2037 (set (match_operand:SI 2 "register_operand" "=*q")
2040 (zero_extend:DI (match_dup 1)) (const_int 32))
2041 (zero_extend:DI (match_dup 4)))
2045 [(set_attr "type" "idiv")])
2047 ;; To do unsigned divide we handle the cases of the divisor looking like a
2048 ;; negative number. If it is a constant that is less than 2**31, we don't
2049 ;; have to worry about the branches. So make a few subroutines here.
2051 ;; First comes the normal case.
2052 (define_expand "udivmodsi4_normal"
2053 [(set (match_dup 4) (const_int 0))
2054 (parallel [(set (match_operand:SI 0 "" "")
2055 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2057 (zero_extend:DI (match_operand:SI 1 "" "")))
2058 (match_operand:SI 2 "" "")))
2059 (set (match_operand:SI 3 "" "")
2060 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2062 (zero_extend:DI (match_dup 1)))
2066 { operands[4] = gen_reg_rtx (SImode); }")
2068 ;; This handles the branches.
2069 (define_expand "udivmodsi4_tests"
2070 [(set (match_operand:SI 0 "" "") (const_int 0))
2071 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2072 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2073 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2074 (label_ref (match_operand:SI 4 "" "")) (pc)))
2075 (set (match_dup 0) (const_int 1))
2076 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2077 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2078 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2079 (label_ref (match_dup 4)) (pc)))]
2082 { operands[5] = gen_reg_rtx (CCUNSmode);
2083 operands[6] = gen_reg_rtx (CCmode);
2086 (define_expand "udivmodsi4"
2087 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2088 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2089 (match_operand:SI 2 "reg_or_cint_operand" "")))
2090 (set (match_operand:SI 3 "gpc_reg_operand" "")
2091 (umod:SI (match_dup 1) (match_dup 2)))])]
2099 if (! TARGET_POWERPC)
2101 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2102 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2103 emit_insn (gen_divus_call ());
2104 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2105 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2112 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2114 operands[2] = force_reg (SImode, operands[2]);
2115 label = gen_label_rtx ();
2116 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2117 operands[3], label));
2120 operands[2] = force_reg (SImode, operands[2]);
2122 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2130 ;; AIX architecture-independent common-mode multiply (DImode),
2131 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2132 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2133 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2134 ;; assumed unused if generating common-mode, so ignore.
2135 (define_insn "mulh_call"
2138 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2139 (sign_extend:DI (reg:SI 4)))
2141 (clobber (match_scratch:SI 0 "=l"))]
2142 "! TARGET_POWER && ! TARGET_POWERPC"
2144 [(set_attr "type" "imul")])
2146 (define_insn "mull_call"
2148 (mult:DI (sign_extend:DI (reg:SI 3))
2149 (sign_extend:DI (reg:SI 4))))
2150 (clobber (match_scratch:SI 0 "=l"))
2151 (clobber (reg:SI 0))]
2152 "! TARGET_POWER && ! TARGET_POWERPC"
2154 [(set_attr "type" "imul")])
2156 (define_insn "divss_call"
2158 (div:SI (reg:SI 3) (reg:SI 4)))
2160 (mod:SI (reg:SI 3) (reg:SI 4)))
2161 (clobber (match_scratch:SI 0 "=l"))
2162 (clobber (reg:SI 0))]
2163 "! TARGET_POWER && ! TARGET_POWERPC"
2165 [(set_attr "type" "idiv")])
2167 (define_insn "divus_call"
2169 (udiv:SI (reg:SI 3) (reg:SI 4)))
2171 (umod:SI (reg:SI 3) (reg:SI 4)))
2172 (clobber (match_scratch:SI 0 "=l"))
2173 (clobber (reg:SI 0))
2174 (clobber (match_scratch:CC 1 "=x"))
2175 (clobber (reg:CC 69))]
2176 "! TARGET_POWER && ! TARGET_POWERPC"
2178 [(set_attr "type" "idiv")])
2180 (define_insn "quoss_call"
2182 (div:SI (reg:SI 3) (reg:SI 4)))
2183 (clobber (match_scratch:SI 0 "=l"))]
2184 "! TARGET_POWER && ! TARGET_POWERPC"
2186 [(set_attr "type" "idiv")])
2188 (define_insn "quous_call"
2190 (udiv:SI (reg:SI 3) (reg:SI 4)))
2191 (clobber (match_scratch:SI 0 "=l"))
2192 (clobber (reg:SI 0))
2193 (clobber (match_scratch:CC 1 "=x"))
2194 (clobber (reg:CC 69))]
2195 "! TARGET_POWER && ! TARGET_POWERPC"
2197 [(set_attr "type" "idiv")])
2199 ;; Logical instructions
2200 ;; The logical instructions are mostly combined by using match_operator,
2201 ;; but the plain AND insns are somewhat different because there is no
2202 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2203 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2205 (define_insn "andsi3"
2206 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2207 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2208 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2209 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2213 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2214 {andil.|andi.} %0,%1,%b2
2215 {andiu.|andis.} %0,%1,%u2")
2217 ;; Note to set cr's other than cr0 we do the and immediate and then
2218 ;; the test again -- this avoids a mfcr which on the higher end
2219 ;; machines causes an execution serialization
2221 (define_insn "*andsi3_internal2"
2222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2223 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2224 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2226 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2227 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2228 "! TARGET_POWERPC64"
2231 {andil.|andi.} %3,%1,%b2
2232 {andiu.|andis.} %3,%1,%u2
2233 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2238 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2239 (set_attr "length" "4,4,4,4,8,8,8,8")])
2241 (define_insn "*andsi3_internal3"
2242 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2243 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2244 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2246 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2247 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2251 {andil.|andi.} %3,%1,%b2
2252 {andiu.|andis.} %3,%1,%u2
2253 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2258 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2259 (set_attr "length" "8,4,4,4,8,8,8,8")])
2262 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2263 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2264 (match_operand:SI 2 "and_operand" ""))
2266 (clobber (match_scratch:SI 3 ""))
2267 (clobber (match_scratch:CC 4 ""))]
2269 [(parallel [(set (match_dup 3)
2270 (and:SI (match_dup 1)
2272 (clobber (match_dup 4))])
2274 (compare:CC (match_dup 3)
2278 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2279 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2282 [(set (match_operand:CC 0 "cc_reg_operand" "")
2283 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2284 (match_operand:SI 2 "gpc_reg_operand" ""))
2286 (clobber (match_scratch:SI 3 ""))
2287 (clobber (match_scratch:CC 4 ""))]
2288 "TARGET_POWERPC64 && reload_completed"
2289 [(parallel [(set (match_dup 3)
2290 (and:SI (match_dup 1)
2292 (clobber (match_dup 4))])
2294 (compare:CC (match_dup 3)
2298 (define_insn "*andsi3_internal4"
2299 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2300 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2301 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2303 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2304 (and:SI (match_dup 1)
2306 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2307 "! TARGET_POWERPC64"
2310 {andil.|andi.} %0,%1,%b2
2311 {andiu.|andis.} %0,%1,%u2
2312 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2317 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2318 (set_attr "length" "4,4,4,4,8,8,8,8")])
2320 (define_insn "*andsi3_internal5"
2321 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2322 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2323 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2325 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2326 (and:SI (match_dup 1)
2328 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2332 {andil.|andi.} %0,%1,%b2
2333 {andiu.|andis.} %0,%1,%u2
2334 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2339 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2340 (set_attr "length" "8,4,4,4,8,8,8,8")])
2343 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2344 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2345 (match_operand:SI 2 "and_operand" ""))
2347 (set (match_operand:SI 0 "gpc_reg_operand" "")
2348 (and:SI (match_dup 1)
2350 (clobber (match_scratch:CC 4 ""))]
2352 [(parallel [(set (match_dup 0)
2353 (and:SI (match_dup 1)
2355 (clobber (match_dup 4))])
2357 (compare:CC (match_dup 0)
2362 [(set (match_operand:CC 3 "cc_reg_operand" "")
2363 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2364 (match_operand:SI 2 "gpc_reg_operand" ""))
2366 (set (match_operand:SI 0 "gpc_reg_operand" "")
2367 (and:SI (match_dup 1)
2369 (clobber (match_scratch:CC 4 ""))]
2370 "TARGET_POWERPC64 && reload_completed"
2371 [(parallel [(set (match_dup 0)
2372 (and:SI (match_dup 1)
2374 (clobber (match_dup 4))])
2376 (compare:CC (match_dup 0)
2380 ;; Handle the PowerPC64 rlwinm corner case
2382 (define_insn_and_split "*andsi3_internal6"
2383 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2384 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2385 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2390 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2393 (rotate:SI (match_dup 0) (match_dup 5)))]
2396 int mb = extract_MB (operands[2]);
2397 int me = extract_ME (operands[2]);
2398 operands[3] = GEN_INT (me + 1);
2399 operands[5] = GEN_INT (32 - (me + 1));
2400 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2402 [(set_attr "length" "8")])
2404 (define_insn_and_split "*andsi3_internal7"
2405 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2406 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
2407 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
2409 (clobber (match_scratch:SI 3 "=r,r"))]
2413 [(parallel [(set (match_dup 2)
2414 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
2417 (clobber (match_dup 3))])]
2420 int mb = extract_MB (operands[1]);
2421 int me = extract_ME (operands[1]);
2422 operands[4] = GEN_INT (me + 1);
2423 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2425 [(set_attr "type" "delayed_compare,compare")
2426 (set_attr "length" "4,8")])
2428 (define_insn_and_split "*andsi3_internal8"
2429 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2430 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2431 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
2433 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2434 (and:SI (match_dup 1)
2439 [(parallel [(set (match_dup 3)
2440 (compare:CC (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2444 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2447 (rotate:SI (match_dup 0) (match_dup 6)))]
2450 int mb = extract_MB (operands[2]);
2451 int me = extract_ME (operands[2]);
2452 operands[4] = GEN_INT (me + 1);
2453 operands[6] = GEN_INT (32 - (me + 1));
2454 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2456 [(set_attr "type" "delayed_compare,compare")
2457 (set_attr "length" "8,12")])
2459 (define_expand "iorsi3"
2460 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2461 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2462 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2466 if (GET_CODE (operands[2]) == CONST_INT
2467 && ! logical_operand (operands[2], SImode))
2469 HOST_WIDE_INT value = INTVAL (operands[2]);
2470 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2471 ? operands[0] : gen_reg_rtx (SImode));
2473 emit_insn (gen_iorsi3 (tmp, operands[1],
2474 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2475 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2480 (define_expand "xorsi3"
2481 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2482 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2483 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2487 if (GET_CODE (operands[2]) == CONST_INT
2488 && ! logical_operand (operands[2], SImode))
2490 HOST_WIDE_INT value = INTVAL (operands[2]);
2491 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2492 ? operands[0] : gen_reg_rtx (SImode));
2494 emit_insn (gen_xorsi3 (tmp, operands[1],
2495 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2496 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2501 (define_insn "*boolsi3_internal1"
2502 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2503 (match_operator:SI 3 "boolean_or_operator"
2504 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2505 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2509 {%q3il|%q3i} %0,%1,%b2
2510 {%q3iu|%q3is} %0,%1,%u2")
2512 (define_insn "*boolsi3_internal2"
2513 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2514 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2515 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2516 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2518 (clobber (match_scratch:SI 3 "=r,r"))]
2519 "! TARGET_POWERPC64"
2523 [(set_attr "type" "compare")
2524 (set_attr "length" "4,8")])
2527 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2528 (compare:CC (match_operator:SI 4 "boolean_operator"
2529 [(match_operand:SI 1 "gpc_reg_operand" "")
2530 (match_operand:SI 2 "gpc_reg_operand" "")])
2532 (clobber (match_scratch:SI 3 ""))]
2533 "! TARGET_POWERPC64 && reload_completed"
2534 [(set (match_dup 3) (match_dup 4))
2536 (compare:CC (match_dup 3)
2540 (define_insn "*boolsi3_internal3"
2541 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2542 (compare:CC (match_operator:SI 4 "boolean_operator"
2543 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2544 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2546 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2548 "! TARGET_POWERPC64"
2552 [(set_attr "type" "compare")
2553 (set_attr "length" "4,8")])
2556 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2557 (compare:CC (match_operator:SI 4 "boolean_operator"
2558 [(match_operand:SI 1 "gpc_reg_operand" "")
2559 (match_operand:SI 2 "gpc_reg_operand" "")])
2561 (set (match_operand:SI 0 "gpc_reg_operand" "")
2563 "! TARGET_POWERPC64 && reload_completed"
2564 [(set (match_dup 0) (match_dup 4))
2566 (compare:CC (match_dup 0)
2570 ;; Split a logical operation that we can't do in one insn into two insns,
2571 ;; each of which does one 16-bit part. This is used by combine.
2574 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2575 (match_operator:SI 3 "boolean_or_operator"
2576 [(match_operand:SI 1 "gpc_reg_operand" "")
2577 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2579 [(set (match_dup 0) (match_dup 4))
2580 (set (match_dup 0) (match_dup 5))]
2584 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2585 operands[4] = gen_rtx (GET_CODE (operands[3]), SImode,
2587 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2588 operands[5] = gen_rtx (GET_CODE (operands[3]), SImode,
2592 (define_insn "*boolcsi3_internal1"
2593 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2594 (match_operator:SI 3 "boolean_operator"
2595 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2596 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2600 (define_insn "*boolcsi3_internal2"
2601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2602 (compare:CC (match_operator:SI 4 "boolean_operator"
2603 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2604 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2606 (clobber (match_scratch:SI 3 "=r,r"))]
2607 "! TARGET_POWERPC64"
2611 [(set_attr "type" "compare")
2612 (set_attr "length" "4,8")])
2615 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2616 (compare:CC (match_operator:SI 4 "boolean_operator"
2617 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2618 (match_operand:SI 2 "gpc_reg_operand" "")])
2620 (clobber (match_scratch:SI 3 ""))]
2621 "! TARGET_POWERPC64 && reload_completed"
2622 [(set (match_dup 3) (match_dup 4))
2624 (compare:CC (match_dup 3)
2628 (define_insn "*boolcsi3_internal3"
2629 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2630 (compare:CC (match_operator:SI 4 "boolean_operator"
2631 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2632 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2634 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2636 "! TARGET_POWERPC64"
2640 [(set_attr "type" "compare")
2641 (set_attr "length" "4,8")])
2644 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2645 (compare:CC (match_operator:SI 4 "boolean_operator"
2646 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2647 (match_operand:SI 2 "gpc_reg_operand" "")])
2649 (set (match_operand:SI 0 "gpc_reg_operand" "")
2651 "! TARGET_POWERPC64 && reload_completed"
2652 [(set (match_dup 0) (match_dup 4))
2654 (compare:CC (match_dup 0)
2658 (define_insn "*boolccsi3_internal1"
2659 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2660 (match_operator:SI 3 "boolean_operator"
2661 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2662 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2666 (define_insn "*boolccsi3_internal2"
2667 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2668 (compare:CC (match_operator:SI 4 "boolean_operator"
2669 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2670 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2672 (clobber (match_scratch:SI 3 "=r,r"))]
2673 "! TARGET_POWERPC64"
2677 [(set_attr "type" "compare")
2678 (set_attr "length" "4,8")])
2681 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2682 (compare:CC (match_operator:SI 4 "boolean_operator"
2683 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2684 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2686 (clobber (match_scratch:SI 3 ""))]
2687 "! TARGET_POWERPC64 && reload_completed"
2688 [(set (match_dup 3) (match_dup 4))
2690 (compare:CC (match_dup 3)
2694 (define_insn "*boolccsi3_internal3"
2695 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2696 (compare:CC (match_operator:SI 4 "boolean_operator"
2697 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2698 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2700 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2702 "! TARGET_POWERPC64"
2706 [(set_attr "type" "compare")
2707 (set_attr "length" "4,8")])
2710 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2711 (compare:CC (match_operator:SI 4 "boolean_operator"
2712 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2713 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2715 (set (match_operand:SI 0 "gpc_reg_operand" "")
2717 "! TARGET_POWERPC64 && reload_completed"
2718 [(set (match_dup 0) (match_dup 4))
2720 (compare:CC (match_dup 0)
2724 ;; maskir insn. We need four forms because things might be in arbitrary
2725 ;; orders. Don't define forms that only set CR fields because these
2726 ;; would modify an input register.
2728 (define_insn "*maskir_internal1"
2729 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2730 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2731 (match_operand:SI 1 "gpc_reg_operand" "0"))
2732 (and:SI (match_dup 2)
2733 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2737 (define_insn "*maskir_internal2"
2738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2739 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2740 (match_operand:SI 1 "gpc_reg_operand" "0"))
2741 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2746 (define_insn "*maskir_internal3"
2747 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2748 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2749 (match_operand:SI 3 "gpc_reg_operand" "r"))
2750 (and:SI (not:SI (match_dup 2))
2751 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2755 (define_insn "*maskir_internal4"
2756 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2757 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2758 (match_operand:SI 2 "gpc_reg_operand" "r"))
2759 (and:SI (not:SI (match_dup 2))
2760 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2764 (define_insn "*maskir_internal5"
2765 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2767 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2768 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2769 (and:SI (match_dup 2)
2770 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2772 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2773 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2774 (and:SI (match_dup 2) (match_dup 3))))]
2779 [(set_attr "type" "compare")
2780 (set_attr "length" "4,8")])
2783 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2785 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2786 (match_operand:SI 1 "gpc_reg_operand" ""))
2787 (and:SI (match_dup 2)
2788 (match_operand:SI 3 "gpc_reg_operand" "")))
2790 (set (match_operand:SI 0 "gpc_reg_operand" "")
2791 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2792 (and:SI (match_dup 2) (match_dup 3))))]
2793 "TARGET_POWER && reload_completed"
2795 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2796 (and:SI (match_dup 2) (match_dup 3))))
2798 (compare:CC (match_dup 0)
2802 (define_insn "*maskir_internal6"
2803 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2805 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2806 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2807 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2810 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2811 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2812 (and:SI (match_dup 3) (match_dup 2))))]
2817 [(set_attr "type" "compare")
2818 (set_attr "length" "4,8")])
2821 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2823 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2824 (match_operand:SI 1 "gpc_reg_operand" ""))
2825 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2828 (set (match_operand:SI 0 "gpc_reg_operand" "")
2829 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2830 (and:SI (match_dup 3) (match_dup 2))))]
2831 "TARGET_POWER && reload_completed"
2833 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2834 (and:SI (match_dup 3) (match_dup 2))))
2836 (compare:CC (match_dup 0)
2840 (define_insn "*maskir_internal7"
2841 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2843 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2844 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2845 (and:SI (not:SI (match_dup 2))
2846 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2848 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2849 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2850 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2855 [(set_attr "type" "compare")
2856 (set_attr "length" "4,8")])
2859 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2861 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2862 (match_operand:SI 3 "gpc_reg_operand" ""))
2863 (and:SI (not:SI (match_dup 2))
2864 (match_operand:SI 1 "gpc_reg_operand" "")))
2866 (set (match_operand:SI 0 "gpc_reg_operand" "")
2867 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2868 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2869 "TARGET_POWER && reload_completed"
2871 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2872 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2874 (compare:CC (match_dup 0)
2878 (define_insn "*maskir_internal8"
2879 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2881 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2882 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2883 (and:SI (not:SI (match_dup 2))
2884 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2886 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2887 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2888 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2893 [(set_attr "type" "compare")
2894 (set_attr "length" "4,8")])
2897 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2899 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2900 (match_operand:SI 2 "gpc_reg_operand" ""))
2901 (and:SI (not:SI (match_dup 2))
2902 (match_operand:SI 1 "gpc_reg_operand" "")))
2904 (set (match_operand:SI 0 "gpc_reg_operand" "")
2905 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2906 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2907 "TARGET_POWER && reload_completed"
2909 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2910 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2912 (compare:CC (match_dup 0)
2916 ;; Rotate and shift insns, in all their variants. These support shifts,
2917 ;; field inserts and extracts, and various combinations thereof.
2918 (define_expand "insv"
2919 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2920 (match_operand:SI 1 "const_int_operand" "")
2921 (match_operand:SI 2 "const_int_operand" ""))
2922 (match_operand 3 "gpc_reg_operand" ""))]
2926 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2927 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2928 compiler if the address of the structure is taken later. */
2929 if (GET_CODE (operands[0]) == SUBREG
2930 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2933 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2934 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2936 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2940 (define_insn "insvsi"
2941 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2942 (match_operand:SI 1 "const_int_operand" "i")
2943 (match_operand:SI 2 "const_int_operand" "i"))
2944 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2948 int start = INTVAL (operands[2]) & 31;
2949 int size = INTVAL (operands[1]) & 31;
2951 operands[4] = GEN_INT (32 - start - size);
2952 operands[1] = GEN_INT (start + size - 1);
2953 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2955 [(set_attr "type" "insert_word")])
2957 (define_insn "*insvsi_internal1"
2958 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2959 (match_operand:SI 1 "const_int_operand" "i")
2960 (match_operand:SI 2 "const_int_operand" "i"))
2961 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2962 (match_operand:SI 4 "const_int_operand" "i")))]
2963 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2966 int shift = INTVAL (operands[4]) & 31;
2967 int start = INTVAL (operands[2]) & 31;
2968 int size = INTVAL (operands[1]) & 31;
2970 operands[4] = GEN_INT (shift - start - size);
2971 operands[1] = GEN_INT (start + size - 1);
2972 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2974 [(set_attr "type" "insert_word")])
2976 (define_insn "*insvsi_internal2"
2977 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2978 (match_operand:SI 1 "const_int_operand" "i")
2979 (match_operand:SI 2 "const_int_operand" "i"))
2980 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2981 (match_operand:SI 4 "const_int_operand" "i")))]
2982 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2985 int shift = INTVAL (operands[4]) & 31;
2986 int start = INTVAL (operands[2]) & 31;
2987 int size = INTVAL (operands[1]) & 31;
2989 operands[4] = GEN_INT (32 - shift - start - size);
2990 operands[1] = GEN_INT (start + size - 1);
2991 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2993 [(set_attr "type" "insert_word")])
2995 (define_insn "*insvsi_internal3"
2996 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2997 (match_operand:SI 1 "const_int_operand" "i")
2998 (match_operand:SI 2 "const_int_operand" "i"))
2999 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3000 (match_operand:SI 4 "const_int_operand" "i")))]
3001 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3004 int shift = INTVAL (operands[4]) & 31;
3005 int start = INTVAL (operands[2]) & 31;
3006 int size = INTVAL (operands[1]) & 31;
3008 operands[4] = GEN_INT (32 - shift - start - size);
3009 operands[1] = GEN_INT (start + size - 1);
3010 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3012 [(set_attr "type" "insert_word")])
3014 (define_insn "*insvsi_internal4"
3015 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3016 (match_operand:SI 1 "const_int_operand" "i")
3017 (match_operand:SI 2 "const_int_operand" "i"))
3018 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3019 (match_operand:SI 4 "const_int_operand" "i")
3020 (match_operand:SI 5 "const_int_operand" "i")))]
3021 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3024 int extract_start = INTVAL (operands[5]) & 31;
3025 int extract_size = INTVAL (operands[4]) & 31;
3026 int insert_start = INTVAL (operands[2]) & 31;
3027 int insert_size = INTVAL (operands[1]) & 31;
3029 /* Align extract field with insert field */
3030 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3031 operands[1] = GEN_INT (insert_start + insert_size - 1);
3032 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3034 [(set_attr "type" "insert_word")])
3036 (define_insn "insvdi"
3037 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3038 (match_operand:SI 1 "const_int_operand" "i")
3039 (match_operand:SI 2 "const_int_operand" "i"))
3040 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3044 int start = INTVAL (operands[2]) & 63;
3045 int size = INTVAL (operands[1]) & 63;
3047 operands[1] = GEN_INT (64 - start - size);
3048 return \"rldimi %0,%3,%H1,%H2\";
3051 (define_expand "extzv"
3052 [(set (match_operand 0 "gpc_reg_operand" "")
3053 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3054 (match_operand:SI 2 "const_int_operand" "")
3055 (match_operand:SI 3 "const_int_operand" "")))]
3059 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3060 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3061 compiler if the address of the structure is taken later. */
3062 if (GET_CODE (operands[0]) == SUBREG
3063 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3066 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3067 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3069 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3073 (define_insn "extzvsi"
3074 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3075 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3076 (match_operand:SI 2 "const_int_operand" "i")
3077 (match_operand:SI 3 "const_int_operand" "i")))]
3081 int start = INTVAL (operands[3]) & 31;
3082 int size = INTVAL (operands[2]) & 31;
3084 if (start + size >= 32)
3085 operands[3] = const0_rtx;
3087 operands[3] = GEN_INT (start + size);
3088 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3091 (define_insn "*extzvsi_internal1"
3092 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3093 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3094 (match_operand:SI 2 "const_int_operand" "i,i")
3095 (match_operand:SI 3 "const_int_operand" "i,i"))
3097 (clobber (match_scratch:SI 4 "=r,r"))]
3101 int start = INTVAL (operands[3]) & 31;
3102 int size = INTVAL (operands[2]) & 31;
3104 /* Force split for non-cc0 compare. */
3105 if (which_alternative == 1)
3108 /* If the bit-field being tested fits in the upper or lower half of a
3109 word, it is possible to use andiu. or andil. to test it. This is
3110 useful because the condition register set-use delay is smaller for
3111 andi[ul]. than for rlinm. This doesn't work when the starting bit
3112 position is 0 because the LT and GT bits may be set wrong. */
3114 if ((start > 0 && start + size <= 16) || start >= 16)
3116 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3117 - (1 << (16 - (start & 15) - size))));
3119 return \"{andiu.|andis.} %4,%1,%3\";
3121 return \"{andil.|andi.} %4,%1,%3\";
3124 if (start + size >= 32)
3125 operands[3] = const0_rtx;
3127 operands[3] = GEN_INT (start + size);
3128 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3130 [(set_attr "type" "compare")
3131 (set_attr "length" "4,8")])
3134 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3135 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3136 (match_operand:SI 2 "const_int_operand" "")
3137 (match_operand:SI 3 "const_int_operand" ""))
3139 (clobber (match_scratch:SI 4 ""))]
3142 (zero_extract:SI (match_dup 1) (match_dup 2)
3145 (compare:CC (match_dup 4)
3149 (define_insn "*extzvsi_internal2"
3150 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3151 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3152 (match_operand:SI 2 "const_int_operand" "i,i")
3153 (match_operand:SI 3 "const_int_operand" "i,i"))
3155 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3156 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3160 int start = INTVAL (operands[3]) & 31;
3161 int size = INTVAL (operands[2]) & 31;
3163 /* Force split for non-cc0 compare. */
3164 if (which_alternative == 1)
3167 /* Since we are using the output value, we can't ignore any need for
3168 a shift. The bit-field must end at the LSB. */
3169 if (start >= 16 && start + size == 32)
3171 operands[3] = GEN_INT ((1 << size) - 1);
3172 return \"{andil.|andi.} %0,%1,%3\";
3175 if (start + size >= 32)
3176 operands[3] = const0_rtx;
3178 operands[3] = GEN_INT (start + size);
3179 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3181 [(set_attr "type" "compare")
3182 (set_attr "length" "4,8")])
3185 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3186 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3187 (match_operand:SI 2 "const_int_operand" "")
3188 (match_operand:SI 3 "const_int_operand" ""))
3190 (set (match_operand:SI 0 "gpc_reg_operand" "")
3191 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3194 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3196 (compare:CC (match_dup 0)
3200 (define_insn "extzvdi"
3201 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3202 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3203 (match_operand:SI 2 "const_int_operand" "i")
3204 (match_operand:SI 3 "const_int_operand" "i")))]
3208 int start = INTVAL (operands[3]) & 63;
3209 int size = INTVAL (operands[2]) & 63;
3211 if (start + size >= 64)
3212 operands[3] = const0_rtx;
3214 operands[3] = GEN_INT (start + size);
3215 operands[2] = GEN_INT (64 - size);
3216 return \"rldicl %0,%1,%3,%2\";
3219 (define_insn "*extzvdi_internal1"
3220 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3221 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3222 (match_operand:SI 2 "const_int_operand" "i")
3223 (match_operand:SI 3 "const_int_operand" "i"))
3225 (clobber (match_scratch:DI 4 "=r"))]
3229 int start = INTVAL (operands[3]) & 63;
3230 int size = INTVAL (operands[2]) & 63;
3232 if (start + size >= 64)
3233 operands[3] = const0_rtx;
3235 operands[3] = GEN_INT (start + size);
3236 operands[2] = GEN_INT (64 - size);
3237 return \"rldicl. %4,%1,%3,%2\";
3240 (define_insn "*extzvdi_internal2"
3241 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3242 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3243 (match_operand:SI 2 "const_int_operand" "i")
3244 (match_operand:SI 3 "const_int_operand" "i"))
3246 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3247 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3251 int start = INTVAL (operands[3]) & 63;
3252 int size = INTVAL (operands[2]) & 63;
3254 if (start + size >= 64)
3255 operands[3] = const0_rtx;
3257 operands[3] = GEN_INT (start + size);
3258 operands[2] = GEN_INT (64 - size);
3259 return \"rldicl. %0,%1,%3,%2\";
3262 (define_insn "rotlsi3"
3263 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3264 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3265 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3267 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3269 (define_insn "*rotlsi3_internal2"
3270 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3271 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3272 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3274 (clobber (match_scratch:SI 3 "=r,r"))]
3277 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3279 [(set_attr "type" "delayed_compare")
3280 (set_attr "length" "4,8")])
3283 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3284 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3285 (match_operand:SI 2 "reg_or_cint_operand" ""))
3287 (clobber (match_scratch:SI 3 ""))]
3290 (rotate:SI (match_dup 1) (match_dup 2)))
3292 (compare:CC (match_dup 3)
3296 (define_insn "*rotlsi3_internal3"
3297 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3298 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3299 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3301 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3302 (rotate:SI (match_dup 1) (match_dup 2)))]
3305 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3307 [(set_attr "type" "delayed_compare")
3308 (set_attr "length" "4,8")])
3311 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3312 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3313 (match_operand:SI 2 "reg_or_cint_operand" ""))
3315 (set (match_operand:SI 0 "gpc_reg_operand" "")
3316 (rotate:SI (match_dup 1) (match_dup 2)))]
3319 (rotate:SI (match_dup 1) (match_dup 2)))
3321 (compare:CC (match_dup 0)
3325 (define_insn "*rotlsi3_internal4"
3326 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3327 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3328 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3329 (match_operand:SI 3 "mask_operand" "n")))]
3331 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3333 (define_insn "*rotlsi3_internal5"
3334 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3336 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3337 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3338 (match_operand:SI 3 "mask_operand" "n,n"))
3340 (clobber (match_scratch:SI 4 "=r,r"))]
3343 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3345 [(set_attr "type" "delayed_compare")
3346 (set_attr "length" "4,8")])
3349 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3351 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3352 (match_operand:SI 2 "reg_or_cint_operand" ""))
3353 (match_operand:SI 3 "mask_operand" ""))
3355 (clobber (match_scratch:SI 4 ""))]
3358 (and:SI (rotate:SI (match_dup 1)
3362 (compare:CC (match_dup 4)
3366 (define_insn "*rotlsi3_internal6"
3367 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3369 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3370 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3371 (match_operand:SI 3 "mask_operand" "n,n"))
3373 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3374 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3377 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3379 [(set_attr "type" "delayed_compare")
3380 (set_attr "length" "4,8")])
3383 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3385 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3386 (match_operand:SI 2 "reg_or_cint_operand" ""))
3387 (match_operand:SI 3 "mask_operand" ""))
3389 (set (match_operand:SI 0 "gpc_reg_operand" "")
3390 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3393 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3395 (compare:CC (match_dup 0)
3399 (define_insn "*rotlsi3_internal7"
3400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3403 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3404 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3406 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3408 (define_insn "*rotlsi3_internal8"
3409 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3410 (compare:CC (zero_extend:SI
3412 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3413 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3415 (clobber (match_scratch:SI 3 "=r,r"))]
3418 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3420 [(set_attr "type" "delayed_compare")
3421 (set_attr "length" "4,8")])
3424 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3425 (compare:CC (zero_extend:SI
3427 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3428 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3430 (clobber (match_scratch:SI 3 ""))]
3433 (zero_extend:SI (subreg:QI
3434 (rotate:SI (match_dup 1)
3437 (compare:CC (match_dup 3)
3441 (define_insn "*rotlsi3_internal9"
3442 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3443 (compare:CC (zero_extend:SI
3445 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3446 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3448 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3449 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3452 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3454 [(set_attr "type" "delayed_compare")
3455 (set_attr "length" "4,8")])
3458 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3459 (compare:CC (zero_extend:SI
3461 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3462 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3464 (set (match_operand:SI 0 "gpc_reg_operand" "")
3465 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3468 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3470 (compare:CC (match_dup 0)
3474 (define_insn "*rotlsi3_internal10"
3475 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3478 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3479 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3481 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3483 (define_insn "*rotlsi3_internal11"
3484 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 "=r,r"))]
3493 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3495 [(set_attr "type" "delayed_compare")
3496 (set_attr "length" "4,8")])
3499 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3500 (compare:CC (zero_extend:SI
3502 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3503 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3505 (clobber (match_scratch:SI 3 ""))]
3508 (zero_extend:SI (subreg:HI
3509 (rotate:SI (match_dup 1)
3512 (compare:CC (match_dup 3)
3516 (define_insn "*rotlsi3_internal12"
3517 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3518 (compare:CC (zero_extend:SI
3520 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3521 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3523 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3524 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3527 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3529 [(set_attr "type" "delayed_compare")
3530 (set_attr "length" "4,8")])
3533 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3534 (compare:CC (zero_extend:SI
3536 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3537 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3539 (set (match_operand:SI 0 "gpc_reg_operand" "")
3540 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3543 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3545 (compare:CC (match_dup 0)
3549 ;; Note that we use "sle." instead of "sl." so that we can set
3550 ;; SHIFT_COUNT_TRUNCATED.
3552 (define_expand "ashlsi3"
3553 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3554 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3555 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3560 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3562 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3566 (define_insn "ashlsi3_power"
3567 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3568 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3569 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3570 (clobber (match_scratch:SI 3 "=q,X"))]
3574 {sli|slwi} %0,%1,%h2")
3576 (define_insn "ashlsi3_no_power"
3577 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3578 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3579 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3581 "{sl|slw}%I2 %0,%1,%h2")
3584 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3585 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3586 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3588 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3589 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3593 {sli.|slwi.} %3,%1,%h2
3596 [(set_attr "type" "delayed_compare")
3597 (set_attr "length" "4,4,8,8")])
3600 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3601 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3602 (match_operand:SI 2 "reg_or_cint_operand" ""))
3604 (clobber (match_scratch:SI 3 ""))
3605 (clobber (match_scratch:SI 4 ""))]
3606 "TARGET_POWER && reload_completed"
3607 [(parallel [(set (match_dup 3)
3608 (ashift:SI (match_dup 1) (match_dup 2)))
3609 (clobber (match_dup 4))])
3611 (compare:CC (match_dup 3)
3616 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3617 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3618 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3620 (clobber (match_scratch:SI 3 "=r,r"))]
3621 "! TARGET_POWER && ! TARGET_POWERPC64"
3623 {sl|slw}%I2. %3,%1,%h2
3625 [(set_attr "type" "delayed_compare")
3626 (set_attr "length" "4,8")])
3629 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3630 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3631 (match_operand:SI 2 "reg_or_cint_operand" ""))
3633 (clobber (match_scratch:SI 3 ""))]
3634 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3636 (ashift:SI (match_dup 1) (match_dup 2)))
3638 (compare:CC (match_dup 3)
3643 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3644 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3645 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3647 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3648 (ashift:SI (match_dup 1) (match_dup 2)))
3649 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3653 {sli.|slwi.} %0,%1,%h2
3656 [(set_attr "type" "delayed_compare")
3657 (set_attr "length" "4,4,8,8")])
3660 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3661 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3662 (match_operand:SI 2 "reg_or_cint_operand" ""))
3664 (set (match_operand:SI 0 "gpc_reg_operand" "")
3665 (ashift:SI (match_dup 1) (match_dup 2)))
3666 (clobber (match_scratch:SI 4 ""))]
3667 "TARGET_POWER && reload_completed"
3668 [(parallel [(set (match_dup 0)
3669 (ashift:SI (match_dup 1) (match_dup 2)))
3670 (clobber (match_dup 4))])
3672 (compare:CC (match_dup 0)
3677 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3678 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3679 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3681 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3682 (ashift:SI (match_dup 1) (match_dup 2)))]
3683 "! TARGET_POWER && ! TARGET_POWERPC64"
3685 {sl|slw}%I2. %0,%1,%h2
3687 [(set_attr "type" "delayed_compare")
3688 (set_attr "length" "4,8")])
3691 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3692 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3693 (match_operand:SI 2 "reg_or_cint_operand" ""))
3695 (set (match_operand:SI 0 "gpc_reg_operand" "")
3696 (ashift:SI (match_dup 1) (match_dup 2)))]
3697 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3699 (ashift:SI (match_dup 1) (match_dup 2)))
3701 (compare:CC (match_dup 0)
3706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3707 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3708 (match_operand:SI 2 "const_int_operand" "i"))
3709 (match_operand:SI 3 "mask_operand" "n")))]
3710 "includes_lshift_p (operands[2], operands[3])"
3711 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3714 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3716 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3717 (match_operand:SI 2 "const_int_operand" "i,i"))
3718 (match_operand:SI 3 "mask_operand" "n,n"))
3720 (clobber (match_scratch:SI 4 "=r,r"))]
3721 "includes_lshift_p (operands[2], operands[3])"
3723 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3725 [(set_attr "type" "delayed_compare")
3726 (set_attr "length" "4,8")])
3729 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3731 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3732 (match_operand:SI 2 "const_int_operand" ""))
3733 (match_operand:SI 3 "mask_operand" ""))
3735 (clobber (match_scratch:SI 4 ""))]
3736 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3738 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3741 (compare:CC (match_dup 4)
3746 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3748 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3749 (match_operand:SI 2 "const_int_operand" "i,i"))
3750 (match_operand:SI 3 "mask_operand" "n,n"))
3752 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3753 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3754 "includes_lshift_p (operands[2], operands[3])"
3756 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3758 [(set_attr "type" "delayed_compare")
3759 (set_attr "length" "4,8")])
3762 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3764 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3765 (match_operand:SI 2 "const_int_operand" ""))
3766 (match_operand:SI 3 "mask_operand" ""))
3768 (set (match_operand:SI 0 "gpc_reg_operand" "")
3769 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3770 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3772 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3774 (compare:CC (match_dup 0)
3778 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3780 (define_expand "lshrsi3"
3781 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3782 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3783 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3788 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3790 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3794 (define_insn "lshrsi3_power"
3795 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3796 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3797 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3798 (clobber (match_scratch:SI 3 "=q,X,X"))]
3803 {s%A2i|s%A2wi} %0,%1,%h2")
3805 (define_insn "lshrsi3_no_power"
3806 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3807 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3808 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3812 {sr|srw}%I2 %0,%1,%h2")
3815 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3816 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3817 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3819 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3820 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3825 {s%A2i.|s%A2wi.} %3,%1,%h2
3829 [(set_attr "type" "delayed_compare")
3830 (set_attr "length" "4,4,4,8,8,8")])
3833 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3834 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3835 (match_operand:SI 2 "reg_or_cint_operand" ""))
3837 (clobber (match_scratch:SI 3 ""))
3838 (clobber (match_scratch:SI 4 ""))]
3839 "TARGET_POWER && reload_completed"
3840 [(parallel [(set (match_dup 3)
3841 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3842 (clobber (match_dup 4))])
3844 (compare:CC (match_dup 3)
3849 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3850 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3851 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3853 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3854 "! TARGET_POWER && ! TARGET_POWERPC64"
3857 {sr|srw}%I2. %3,%1,%h2
3860 [(set_attr "type" "delayed_compare")
3861 (set_attr "length" "4,4,8,8")])
3864 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3865 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3866 (match_operand:SI 2 "reg_or_cint_operand" ""))
3868 (clobber (match_scratch:SI 3 ""))]
3869 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3871 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3873 (compare:CC (match_dup 3)
3878 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3879 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3880 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3882 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3883 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3884 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3889 {s%A2i.|s%A2wi.} %0,%1,%h2
3893 [(set_attr "type" "delayed_compare")
3894 (set_attr "length" "4,4,4,8,8,8")])
3897 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3898 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3899 (match_operand:SI 2 "reg_or_cint_operand" ""))
3901 (set (match_operand:SI 0 "gpc_reg_operand" "")
3902 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3903 (clobber (match_scratch:SI 4 ""))]
3904 "TARGET_POWER && reload_completed"
3905 [(parallel [(set (match_dup 0)
3906 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3907 (clobber (match_dup 4))])
3909 (compare:CC (match_dup 0)
3914 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3915 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3916 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3918 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3919 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3920 "! TARGET_POWER && ! TARGET_POWERPC64"
3923 {sr|srw}%I2. %0,%1,%h2
3926 [(set_attr "type" "delayed_compare")
3927 (set_attr "length" "4,4,8,8")])
3930 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3931 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3932 (match_operand:SI 2 "reg_or_cint_operand" ""))
3934 (set (match_operand:SI 0 "gpc_reg_operand" "")
3935 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3936 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3938 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3940 (compare:CC (match_dup 0)
3945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3946 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3947 (match_operand:SI 2 "const_int_operand" "i"))
3948 (match_operand:SI 3 "mask_operand" "n")))]
3949 "includes_rshift_p (operands[2], operands[3])"
3950 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3955 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3956 (match_operand:SI 2 "const_int_operand" "i,i"))
3957 (match_operand:SI 3 "mask_operand" "n,n"))
3959 (clobber (match_scratch:SI 4 "=r,r"))]
3960 "includes_rshift_p (operands[2], operands[3])"
3962 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
3964 [(set_attr "type" "delayed_compare")
3965 (set_attr "length" "4,8")])
3968 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3970 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3971 (match_operand:SI 2 "const_int_operand" ""))
3972 (match_operand:SI 3 "mask_operand" ""))
3974 (clobber (match_scratch:SI 4 ""))]
3975 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
3977 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
3980 (compare:CC (match_dup 4)
3985 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3987 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3988 (match_operand:SI 2 "const_int_operand" "i,i"))
3989 (match_operand:SI 3 "mask_operand" "n,n"))
3991 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3992 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3993 "includes_rshift_p (operands[2], operands[3])"
3995 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
3997 [(set_attr "type" "delayed_compare")
3998 (set_attr "length" "4,8")])
4001 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4003 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4004 (match_operand:SI 2 "const_int_operand" ""))
4005 (match_operand:SI 3 "mask_operand" ""))
4007 (set (match_operand:SI 0 "gpc_reg_operand" "")
4008 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4009 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4011 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4013 (compare:CC (match_dup 0)
4018 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4021 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4022 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4023 "includes_rshift_p (operands[2], GEN_INT (255))"
4024 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4027 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4031 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4032 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4034 (clobber (match_scratch:SI 3 "=r,r"))]
4035 "includes_rshift_p (operands[2], GEN_INT (255))"
4037 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4039 [(set_attr "type" "delayed_compare")
4040 (set_attr "length" "4,8")])
4043 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4047 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4048 (match_operand:SI 2 "const_int_operand" "")) 0))
4050 (clobber (match_scratch:SI 3 ""))]
4051 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4053 (zero_extend:SI (subreg:QI
4054 (lshiftrt:SI (match_dup 1)
4057 (compare:CC (match_dup 3)
4062 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4066 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4067 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4069 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4070 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4071 "includes_rshift_p (operands[2], GEN_INT (255))"
4073 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4075 [(set_attr "type" "delayed_compare")
4076 (set_attr "length" "4,8")])
4079 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4083 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4084 (match_operand:SI 2 "const_int_operand" "")) 0))
4086 (set (match_operand:SI 0 "gpc_reg_operand" "")
4087 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4088 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4090 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4092 (compare:CC (match_dup 0)
4097 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4100 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4101 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4102 "includes_rshift_p (operands[2], GEN_INT (65535))"
4103 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4106 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4110 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4111 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4113 (clobber (match_scratch:SI 3 "=r,r"))]
4114 "includes_rshift_p (operands[2], GEN_INT (65535))"
4116 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4118 [(set_attr "type" "delayed_compare")
4119 (set_attr "length" "4,8")])
4122 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4126 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4127 (match_operand:SI 2 "const_int_operand" "")) 0))
4129 (clobber (match_scratch:SI 3 ""))]
4130 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4132 (zero_extend:SI (subreg:HI
4133 (lshiftrt:SI (match_dup 1)
4136 (compare:CC (match_dup 3)
4141 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4145 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4146 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4148 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4149 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4150 "includes_rshift_p (operands[2], GEN_INT (65535))"
4152 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4154 [(set_attr "type" "delayed_compare")
4155 (set_attr "length" "4,8")])
4158 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4162 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4163 (match_operand:SI 2 "const_int_operand" "")) 0))
4165 (set (match_operand:SI 0 "gpc_reg_operand" "")
4166 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4167 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4169 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4171 (compare:CC (match_dup 0)
4176 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4178 (match_operand:SI 1 "gpc_reg_operand" "r"))
4179 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4185 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4187 (match_operand:SI 1 "gpc_reg_operand" "r"))
4188 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4194 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4196 (match_operand:SI 1 "gpc_reg_operand" "r"))
4197 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4203 (define_expand "ashrsi3"
4204 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4205 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4206 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4211 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4213 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4217 (define_insn "ashrsi3_power"
4218 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4219 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4220 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4221 (clobber (match_scratch:SI 3 "=q,X"))]
4225 {srai|srawi} %0,%1,%h2")
4227 (define_insn "ashrsi3_no_power"
4228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4229 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4230 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4232 "{sra|sraw}%I2 %0,%1,%h2")
4235 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4236 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4237 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4239 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4240 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4244 {srai.|srawi.} %3,%1,%h2
4247 [(set_attr "type" "delayed_compare")
4248 (set_attr "length" "4,4,8,8")])
4251 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4252 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4253 (match_operand:SI 2 "reg_or_cint_operand" ""))
4255 (clobber (match_scratch:SI 3 ""))
4256 (clobber (match_scratch:SI 4 ""))]
4257 "TARGET_POWER && reload_completed"
4258 [(parallel [(set (match_dup 3)
4259 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4260 (clobber (match_dup 4))])
4262 (compare:CC (match_dup 3)
4267 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4268 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4269 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4271 (clobber (match_scratch:SI 3 "=r,r"))]
4274 {sra|sraw}%I2. %3,%1,%h2
4276 [(set_attr "type" "delayed_compare")
4277 (set_attr "length" "4,8")])
4280 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4281 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4282 (match_operand:SI 2 "reg_or_cint_operand" ""))
4284 (clobber (match_scratch:SI 3 ""))]
4285 "! TARGET_POWER && reload_completed"
4287 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4289 (compare:CC (match_dup 3)
4294 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4295 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4296 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4298 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4299 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4300 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4304 {srai.|srawi.} %0,%1,%h2
4307 [(set_attr "type" "delayed_compare")
4308 (set_attr "length" "4,4,8,8")])
4311 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4312 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4313 (match_operand:SI 2 "reg_or_cint_operand" ""))
4315 (set (match_operand:SI 0 "gpc_reg_operand" "")
4316 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4317 (clobber (match_scratch:SI 4 ""))]
4318 "TARGET_POWER && reload_completed"
4319 [(parallel [(set (match_dup 0)
4320 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4321 (clobber (match_dup 4))])
4323 (compare:CC (match_dup 0)
4328 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4329 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4330 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4332 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4333 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4336 {sra|sraw}%I2. %0,%1,%h2
4338 [(set_attr "type" "delayed_compare")
4339 (set_attr "length" "4,8")])
4342 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4343 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4344 (match_operand:SI 2 "reg_or_cint_operand" ""))
4346 (set (match_operand:SI 0 "gpc_reg_operand" "")
4347 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4348 "! TARGET_POWER && reload_completed"
4350 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4352 (compare:CC (match_dup 0)
4356 ;; Floating-point insns, excluding normal data motion.
4358 ;; PowerPC has a full set of single-precision floating point instructions.
4360 ;; For the POWER architecture, we pretend that we have both SFmode and
4361 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4362 ;; The only conversions we will do will be when storing to memory. In that
4363 ;; case, we will use the "frsp" instruction before storing.
4365 ;; Note that when we store into a single-precision memory location, we need to
4366 ;; use the frsp insn first. If the register being stored isn't dead, we
4367 ;; need a scratch register for the frsp. But this is difficult when the store
4368 ;; is done by reload. It is not incorrect to do the frsp on the register in
4369 ;; this case, we just lose precision that we would have otherwise gotten but
4370 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4372 (define_insn "extendsfdf2"
4373 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4374 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4375 "TARGET_HARD_FLOAT && TARGET_FPRS"
4378 if (REGNO (operands[0]) == REGNO (operands[1]))
4381 return \"fmr %0,%1\";
4383 [(set_attr "type" "fp")])
4385 (define_insn "truncdfsf2"
4386 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4387 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4388 "TARGET_HARD_FLOAT && TARGET_FPRS"
4390 [(set_attr "type" "fp")])
4392 (define_insn "aux_truncdfsf2"
4393 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4394 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4395 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4397 [(set_attr "type" "fp")])
4399 (define_expand "negsf2"
4400 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4401 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4405 (define_insn "*negsf2"
4406 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4407 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4408 "TARGET_HARD_FLOAT && TARGET_FPRS"
4410 [(set_attr "type" "fp")])
4412 (define_expand "abssf2"
4413 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4414 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4418 (define_insn "*abssf2"
4419 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4420 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4421 "TARGET_HARD_FLOAT && TARGET_FPRS"
4423 [(set_attr "type" "fp")])
4426 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4427 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4428 "TARGET_HARD_FLOAT && TARGET_FPRS"
4430 [(set_attr "type" "fp")])
4432 (define_expand "addsf3"
4433 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4434 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4435 (match_operand:SF 2 "gpc_reg_operand" "")))]
4440 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4441 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4442 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4443 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4445 [(set_attr "type" "fp")])
4448 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4449 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4450 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4451 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4452 "{fa|fadd} %0,%1,%2"
4453 [(set_attr "type" "fp")])
4455 (define_expand "subsf3"
4456 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4457 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4458 (match_operand:SF 2 "gpc_reg_operand" "")))]
4463 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4464 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4465 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4466 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4468 [(set_attr "type" "fp")])
4471 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4472 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4473 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4474 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4475 "{fs|fsub} %0,%1,%2"
4476 [(set_attr "type" "fp")])
4478 (define_expand "mulsf3"
4479 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4480 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4481 (match_operand:SF 2 "gpc_reg_operand" "")))]
4486 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4487 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4488 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4489 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4491 [(set_attr "type" "fp")])
4494 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4495 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4496 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4497 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4498 "{fm|fmul} %0,%1,%2"
4499 [(set_attr "type" "dmul")])
4501 (define_expand "divsf3"
4502 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4503 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4504 (match_operand:SF 2 "gpc_reg_operand" "")))]
4509 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4510 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4511 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4512 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4514 [(set_attr "type" "sdiv")])
4517 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4518 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4519 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4520 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4521 "{fd|fdiv} %0,%1,%2"
4522 [(set_attr "type" "ddiv")])
4525 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4526 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4527 (match_operand:SF 2 "gpc_reg_operand" "f"))
4528 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4529 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4530 "fmadds %0,%1,%2,%3"
4531 [(set_attr "type" "fp")])
4534 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4535 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4536 (match_operand:SF 2 "gpc_reg_operand" "f"))
4537 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4538 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4539 "{fma|fmadd} %0,%1,%2,%3"
4540 [(set_attr "type" "dmul")])
4543 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4544 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4545 (match_operand:SF 2 "gpc_reg_operand" "f"))
4546 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4547 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4548 "fmsubs %0,%1,%2,%3"
4549 [(set_attr "type" "fp")])
4552 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4553 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4554 (match_operand:SF 2 "gpc_reg_operand" "f"))
4555 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4556 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4557 "{fms|fmsub} %0,%1,%2,%3"
4558 [(set_attr "type" "dmul")])
4561 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4562 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4563 (match_operand:SF 2 "gpc_reg_operand" "f"))
4564 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4565 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4566 && HONOR_SIGNED_ZEROS (SFmode)"
4567 "fnmadds %0,%1,%2,%3"
4568 [(set_attr "type" "fp")])
4571 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4572 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4573 (match_operand:SF 2 "gpc_reg_operand" "f"))
4574 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4575 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4576 && ! HONOR_SIGNED_ZEROS (SFmode)"
4577 "fnmadds %0,%1,%2,%3"
4578 [(set_attr "type" "fp")])
4581 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4582 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4583 (match_operand:SF 2 "gpc_reg_operand" "f"))
4584 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4585 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4586 "{fnma|fnmadd} %0,%1,%2,%3"
4587 [(set_attr "type" "dmul")])
4590 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4591 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4592 (match_operand:SF 2 "gpc_reg_operand" "f"))
4593 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4594 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4595 && ! HONOR_SIGNED_ZEROS (SFmode)"
4596 "{fnma|fnmadd} %0,%1,%2,%3"
4597 [(set_attr "type" "dmul")])
4600 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4601 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4602 (match_operand:SF 2 "gpc_reg_operand" "f"))
4603 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4604 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4605 && HONOR_SIGNED_ZEROS (SFmode)"
4606 "fnmsubs %0,%1,%2,%3"
4607 [(set_attr "type" "fp")])
4610 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4611 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4612 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4613 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4614 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4615 && ! HONOR_SIGNED_ZEROS (SFmode)"
4616 "fnmsubs %0,%1,%2,%3"
4617 [(set_attr "type" "fp")])
4620 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4621 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4622 (match_operand:SF 2 "gpc_reg_operand" "f"))
4623 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4624 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4625 "{fnms|fnmsub} %0,%1,%2,%3"
4626 [(set_attr "type" "dmul")])
4629 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4630 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4631 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4632 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4633 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4634 && ! HONOR_SIGNED_ZEROS (SFmode)"
4635 "{fnms|fnmsub} %0,%1,%2,%3"
4636 [(set_attr "type" "fp")])
4638 (define_expand "sqrtsf2"
4639 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4640 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4641 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4645 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4646 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4647 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4649 [(set_attr "type" "ssqrt")])
4652 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4653 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4654 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4656 [(set_attr "type" "dsqrt")])
4658 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4659 ;; fsel instruction and some auxiliary computations. Then we just have a
4660 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4662 (define_expand "maxsf3"
4663 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4664 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4665 (match_operand:SF 2 "gpc_reg_operand" ""))
4668 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4669 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4671 (define_expand "minsf3"
4672 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4673 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4674 (match_operand:SF 2 "gpc_reg_operand" ""))
4677 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4678 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4681 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4682 (match_operator:SF 3 "min_max_operator"
4683 [(match_operand:SF 1 "gpc_reg_operand" "")
4684 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4685 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4688 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4689 operands[1], operands[2]);
4693 (define_expand "movsicc"
4694 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4695 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4696 (match_operand:SI 2 "gpc_reg_operand" "")
4697 (match_operand:SI 3 "gpc_reg_operand" "")))]
4701 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4707 ;; We use the BASE_REGS for the isel input operands because, if rA is
4708 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4709 ;; because we may switch the operands and rB may end up being rA.
4711 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4712 ;; leave out the mode in operand 4 and use one pattern, but reload can
4713 ;; change the mode underneath our feet and then gets confused trying
4714 ;; to reload the value.
4715 (define_insn "isel_signed"
4716 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4718 (match_operator 1 "comparison_operator"
4719 [(match_operand:CC 4 "cc_reg_operand" "y")
4721 (match_operand:SI 2 "gpc_reg_operand" "b")
4722 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4725 { return output_isel (operands); }"
4726 [(set_attr "length" "4")])
4728 (define_insn "isel_unsigned"
4729 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4731 (match_operator 1 "comparison_operator"
4732 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4734 (match_operand:SI 2 "gpc_reg_operand" "b")
4735 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4738 { return output_isel (operands); }"
4739 [(set_attr "length" "4")])
4741 (define_expand "movsfcc"
4742 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4743 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4744 (match_operand:SF 2 "gpc_reg_operand" "")
4745 (match_operand:SF 3 "gpc_reg_operand" "")))]
4746 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4749 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4755 (define_insn "*fselsfsf4"
4756 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4757 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4758 (match_operand:SF 4 "zero_fp_constant" "F"))
4759 (match_operand:SF 2 "gpc_reg_operand" "f")
4760 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4761 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4763 [(set_attr "type" "fp")])
4765 (define_insn "*fseldfsf4"
4766 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4767 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4768 (match_operand:DF 4 "zero_fp_constant" "F"))
4769 (match_operand:SF 2 "gpc_reg_operand" "f")
4770 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4771 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4773 [(set_attr "type" "fp")])
4775 (define_insn "negdf2"
4776 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4777 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4778 "TARGET_HARD_FLOAT && TARGET_FPRS"
4780 [(set_attr "type" "fp")])
4782 (define_insn "absdf2"
4783 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4784 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4785 "TARGET_HARD_FLOAT && TARGET_FPRS"
4787 [(set_attr "type" "fp")])
4790 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4791 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4792 "TARGET_HARD_FLOAT && TARGET_FPRS"
4794 [(set_attr "type" "fp")])
4796 (define_insn "adddf3"
4797 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4798 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4799 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4800 "TARGET_HARD_FLOAT && TARGET_FPRS"
4801 "{fa|fadd} %0,%1,%2"
4802 [(set_attr "type" "fp")])
4804 (define_insn "subdf3"
4805 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4806 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4807 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4808 "TARGET_HARD_FLOAT && TARGET_FPRS"
4809 "{fs|fsub} %0,%1,%2"
4810 [(set_attr "type" "fp")])
4812 (define_insn "muldf3"
4813 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4814 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4815 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4816 "TARGET_HARD_FLOAT && TARGET_FPRS"
4817 "{fm|fmul} %0,%1,%2"
4818 [(set_attr "type" "dmul")])
4820 (define_insn "divdf3"
4821 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4822 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4823 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4824 "TARGET_HARD_FLOAT && TARGET_FPRS"
4825 "{fd|fdiv} %0,%1,%2"
4826 [(set_attr "type" "ddiv")])
4829 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4830 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4831 (match_operand:DF 2 "gpc_reg_operand" "f"))
4832 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4833 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4834 "{fma|fmadd} %0,%1,%2,%3"
4835 [(set_attr "type" "dmul")])
4838 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4839 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4840 (match_operand:DF 2 "gpc_reg_operand" "f"))
4841 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4842 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4843 "{fms|fmsub} %0,%1,%2,%3"
4844 [(set_attr "type" "dmul")])
4847 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4848 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4849 (match_operand:DF 2 "gpc_reg_operand" "f"))
4850 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4851 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4852 && HONOR_SIGNED_ZEROS (DFmode)"
4853 "{fnma|fnmadd} %0,%1,%2,%3"
4854 [(set_attr "type" "dmul")])
4857 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4858 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4859 (match_operand:DF 2 "gpc_reg_operand" "f"))
4860 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4861 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4862 && ! HONOR_SIGNED_ZEROS (DFmode)"
4863 "{fnma|fnmadd} %0,%1,%2,%3"
4864 [(set_attr "type" "dmul")])
4867 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4868 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4869 (match_operand:DF 2 "gpc_reg_operand" "f"))
4870 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4871 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4872 && HONOR_SIGNED_ZEROS (DFmode)"
4873 "{fnms|fnmsub} %0,%1,%2,%3"
4874 [(set_attr "type" "dmul")])
4877 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4878 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
4879 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4880 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
4881 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4882 && ! HONOR_SIGNED_ZEROS (DFmode)"
4883 "{fnms|fnmsub} %0,%1,%2,%3"
4884 [(set_attr "type" "dmul")])
4886 (define_insn "sqrtdf2"
4887 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4888 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4889 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4891 [(set_attr "type" "dsqrt")])
4893 ;; The conditional move instructions allow us to perform max and min
4894 ;; operations even when
4896 (define_expand "maxdf3"
4897 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4898 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4899 (match_operand:DF 2 "gpc_reg_operand" ""))
4902 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4903 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4905 (define_expand "mindf3"
4906 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4907 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4908 (match_operand:DF 2 "gpc_reg_operand" ""))
4911 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4912 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4915 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4916 (match_operator:DF 3 "min_max_operator"
4917 [(match_operand:DF 1 "gpc_reg_operand" "")
4918 (match_operand:DF 2 "gpc_reg_operand" "")]))]
4919 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4922 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4923 operands[1], operands[2]);
4927 (define_expand "movdfcc"
4928 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4929 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4930 (match_operand:DF 2 "gpc_reg_operand" "")
4931 (match_operand:DF 3 "gpc_reg_operand" "")))]
4932 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4935 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4941 (define_insn "*fseldfdf4"
4942 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4943 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4944 (match_operand:DF 4 "zero_fp_constant" "F"))
4945 (match_operand:DF 2 "gpc_reg_operand" "f")
4946 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4947 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4949 [(set_attr "type" "fp")])
4951 (define_insn "*fselsfdf4"
4952 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4953 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4954 (match_operand:SF 4 "zero_fp_constant" "F"))
4955 (match_operand:DF 2 "gpc_reg_operand" "f")
4956 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4959 [(set_attr "type" "fp")])
4961 ;; Conversions to and from floating-point.
4963 (define_expand "fixunssfsi2"
4964 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4965 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "gpc_reg_operand" ""))))]
4966 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4969 (define_expand "fix_truncsfsi2"
4970 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4971 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
4972 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4975 ; For each of these conversions, there is a define_expand, a define_insn
4976 ; with a '#' template, and a define_split (with C code). The idea is
4977 ; to allow constant folding with the template of the define_insn,
4978 ; then to have the insns split later (between sched1 and final).
4980 (define_expand "floatsidf2"
4981 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
4982 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4985 (clobber (match_dup 4))
4986 (clobber (match_dup 5))
4987 (clobber (match_dup 6))])]
4988 "TARGET_HARD_FLOAT && TARGET_FPRS"
4991 if (TARGET_POWERPC64)
4993 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
4994 rtx t1 = gen_reg_rtx (DImode);
4995 rtx t2 = gen_reg_rtx (DImode);
4996 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5000 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5001 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5002 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5003 operands[5] = gen_reg_rtx (DFmode);
5004 operands[6] = gen_reg_rtx (SImode);
5007 (define_insn "*floatsidf2_internal"
5008 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5009 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5010 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5011 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5012 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5013 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5014 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5015 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5017 [(set_attr "length" "24")])
5020 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5021 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5022 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5023 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5024 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5025 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5026 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5027 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5028 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5029 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5030 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5031 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5032 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5033 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5034 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5037 rtx lowword, highword;
5038 if (GET_CODE (operands[4]) != MEM)
5040 highword = XEXP (operands[4], 0);
5041 lowword = plus_constant (highword, 4);
5042 if (! WORDS_BIG_ENDIAN)
5045 tmp = highword; highword = lowword; lowword = tmp;
5048 emit_insn (gen_xorsi3 (operands[6], operands[1],
5049 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5050 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5051 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5052 emit_move_insn (operands[5], operands[4]);
5053 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5057 (define_expand "floatunssisf2"
5058 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5059 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5060 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5063 (define_expand "floatunssidf2"
5064 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5065 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5068 (clobber (match_dup 4))
5069 (clobber (match_dup 5))])]
5070 "TARGET_HARD_FLOAT && TARGET_FPRS"
5073 if (TARGET_POWERPC64)
5075 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5076 rtx t1 = gen_reg_rtx (DImode);
5077 rtx t2 = gen_reg_rtx (DImode);
5078 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5083 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5084 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5085 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5086 operands[5] = gen_reg_rtx (DFmode);
5089 (define_insn "*floatunssidf2_internal"
5090 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5091 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5092 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5093 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5094 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5095 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5096 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5098 [(set_attr "length" "20")])
5101 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5102 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5103 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5104 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5105 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5106 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5107 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5108 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5109 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5110 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5111 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5112 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5113 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5116 rtx lowword, highword;
5117 if (GET_CODE (operands[4]) != MEM)
5119 highword = XEXP (operands[4], 0);
5120 lowword = plus_constant (highword, 4);
5121 if (! WORDS_BIG_ENDIAN)
5124 tmp = highword; highword = lowword; lowword = tmp;
5127 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5128 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5129 emit_move_insn (operands[5], operands[4]);
5130 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5134 (define_expand "fix_truncdfsi2"
5135 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5136 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5137 (clobber (match_dup 2))
5138 (clobber (match_dup 3))])]
5139 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5142 operands[2] = gen_reg_rtx (DImode);
5143 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5146 (define_insn "*fix_truncdfsi2_internal"
5147 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5148 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5149 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5150 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5151 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5153 [(set_attr "length" "16")])
5156 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5157 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5158 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5159 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5160 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5161 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5162 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5163 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5164 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5168 if (GET_CODE (operands[3]) != MEM)
5170 lowword = XEXP (operands[3], 0);
5171 if (WORDS_BIG_ENDIAN)
5172 lowword = plus_constant (lowword, 4);
5174 emit_insn (gen_fctiwz (operands[2], operands[1]));
5175 emit_move_insn (operands[3], operands[2]);
5176 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5180 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5181 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5182 ; because the first makes it clear that operand 0 is not live
5183 ; before the instruction.
5184 (define_insn "fctiwz"
5185 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5186 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5188 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5189 "{fcirz|fctiwz} %0,%1"
5190 [(set_attr "type" "fp")])
5192 (define_expand "floatsisf2"
5193 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5194 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5195 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5198 (define_insn "floatdidf2"
5199 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5200 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5201 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5203 [(set_attr "type" "fp")])
5205 (define_insn_and_split "floatsidf_ppc64"
5206 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5207 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5208 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5209 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5210 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5211 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5214 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5215 (set (match_dup 2) (match_dup 3))
5216 (set (match_dup 4) (match_dup 2))
5217 (set (match_dup 0) (float:DF (match_dup 4)))]
5220 (define_insn_and_split "floatunssidf_ppc64"
5221 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5222 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5223 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5224 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5225 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5226 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5229 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5230 (set (match_dup 2) (match_dup 3))
5231 (set (match_dup 4) (match_dup 2))
5232 (set (match_dup 0) (float:DF (match_dup 4)))]
5235 (define_insn "fix_truncdfdi2"
5236 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5237 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5238 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5240 [(set_attr "type" "fp")])
5242 (define_expand "floatdisf2"
5243 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5244 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5245 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5248 if (!flag_unsafe_math_optimizations)
5250 rtx label = gen_label_rtx ();
5251 emit_insn (gen_floatdisf2_internal2 (operands[1], label));
5254 emit_insn (gen_floatdisf2_internal1 (operands[0], operands[1]));
5258 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5259 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5260 ;; from double rounding.
5261 (define_insn_and_split "floatdisf2_internal1"
5262 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5263 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5264 (clobber (match_scratch:DF 2 "=f"))]
5265 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5267 "&& reload_completed"
5269 (float:DF (match_dup 1)))
5271 (float_truncate:SF (match_dup 2)))]
5274 ;; Twiddles bits to avoid double rounding.
5275 ;; Bits that might be truncated when converting to DFmode are replaced
5276 ;; by a bit that won't be lost at that stage, but is below the SFmode
5277 ;; rounding position.
5278 (define_expand "floatdisf2_internal2"
5279 [(parallel [(set (match_dup 4)
5280 (compare:CC (and:DI (match_operand:DI 0 "" "")
5283 (set (match_dup 2) (and:DI (match_dup 0) (const_int 2047)))
5284 (clobber (match_scratch:CC 7 ""))])
5285 (set (match_dup 3) (ashiftrt:DI (match_dup 0) (const_int 53)))
5286 (set (match_dup 3) (plus:DI (match_dup 3) (const_int 1)))
5287 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
5288 (label_ref (match_operand:DI 1 "" ""))
5290 (set (match_dup 5) (compare:CCUNS (match_dup 3) (const_int 2)))
5291 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
5292 (label_ref (match_dup 1))
5294 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 2)))
5295 (set (match_dup 0) (ior:DI (match_dup 0) (const_int 2048)))]
5296 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5299 operands[2] = gen_reg_rtx (DImode);
5300 operands[3] = gen_reg_rtx (DImode);
5301 operands[4] = gen_reg_rtx (CCmode);
5302 operands[5] = gen_reg_rtx (CCUNSmode);
5305 ;; Define the DImode operations that can be done in a small number
5306 ;; of instructions. The & constraints are to prevent the register
5307 ;; allocator from allocating registers that overlap with the inputs
5308 ;; (for example, having an input in 7,8 and an output in 6,7). We
5309 ;; also allow for the output being the same as one of the inputs.
5311 (define_insn "*adddi3_noppc64"
5312 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5313 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5314 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5315 "! TARGET_POWERPC64"
5318 if (WORDS_BIG_ENDIAN)
5319 return (GET_CODE (operands[2])) != CONST_INT
5320 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5321 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5323 return (GET_CODE (operands[2])) != CONST_INT
5324 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5325 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5327 [(set_attr "length" "8")])
5329 (define_insn "*subdi3_noppc64"
5330 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5331 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5332 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5333 "! TARGET_POWERPC64"
5336 if (WORDS_BIG_ENDIAN)
5337 return (GET_CODE (operands[1]) != CONST_INT)
5338 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5339 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5341 return (GET_CODE (operands[1]) != CONST_INT)
5342 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5343 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5345 [(set_attr "length" "8")])
5347 (define_insn "*negdi2_noppc64"
5348 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5349 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5350 "! TARGET_POWERPC64"
5353 return (WORDS_BIG_ENDIAN)
5354 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5355 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5357 [(set_attr "length" "8")])
5359 (define_expand "mulsidi3"
5360 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5361 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5362 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5363 "! TARGET_POWERPC64"
5366 if (! TARGET_POWER && ! TARGET_POWERPC)
5368 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5369 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5370 emit_insn (gen_mull_call ());
5371 if (WORDS_BIG_ENDIAN)
5372 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5375 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5376 gen_rtx_REG (SImode, 3));
5377 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5378 gen_rtx_REG (SImode, 4));
5382 else if (TARGET_POWER)
5384 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5389 (define_insn "mulsidi3_mq"
5390 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5391 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5392 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5393 (clobber (match_scratch:SI 3 "=q"))]
5395 "mul %0,%1,%2\;mfmq %L0"
5396 [(set_attr "type" "imul")
5397 (set_attr "length" "8")])
5399 (define_insn "*mulsidi3_no_mq"
5400 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5401 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5402 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5403 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5406 return (WORDS_BIG_ENDIAN)
5407 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5408 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5410 [(set_attr "type" "imul")
5411 (set_attr "length" "8")])
5414 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5415 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5416 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5417 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5420 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5421 (sign_extend:DI (match_dup 2)))
5424 (mult:SI (match_dup 1)
5428 int endian = (WORDS_BIG_ENDIAN == 0);
5429 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5430 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5433 (define_expand "umulsidi3"
5434 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5435 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5436 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5437 "TARGET_POWERPC && ! TARGET_POWERPC64"
5442 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5447 (define_insn "umulsidi3_mq"
5448 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5449 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5450 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5451 (clobber (match_scratch:SI 3 "=q"))]
5452 "TARGET_POWERPC && TARGET_POWER"
5455 return (WORDS_BIG_ENDIAN)
5456 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5457 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5459 [(set_attr "type" "imul")
5460 (set_attr "length" "8")])
5462 (define_insn "*umulsidi3_no_mq"
5463 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5464 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5465 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5466 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5469 return (WORDS_BIG_ENDIAN)
5470 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5471 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5473 [(set_attr "type" "imul")
5474 (set_attr "length" "8")])
5477 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5478 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5479 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5480 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5483 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5484 (zero_extend:DI (match_dup 2)))
5487 (mult:SI (match_dup 1)
5491 int endian = (WORDS_BIG_ENDIAN == 0);
5492 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5493 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5496 (define_expand "smulsi3_highpart"
5497 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5499 (lshiftrt:DI (mult:DI (sign_extend:DI
5500 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5502 (match_operand:SI 2 "gpc_reg_operand" "r")))
5507 if (! TARGET_POWER && ! TARGET_POWERPC)
5509 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5510 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5511 emit_insn (gen_mulh_call ());
5512 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5515 else if (TARGET_POWER)
5517 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5522 (define_insn "smulsi3_highpart_mq"
5523 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5525 (lshiftrt:DI (mult:DI (sign_extend:DI
5526 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5528 (match_operand:SI 2 "gpc_reg_operand" "r")))
5530 (clobber (match_scratch:SI 3 "=q"))]
5533 [(set_attr "type" "imul")])
5535 (define_insn "*smulsi3_highpart_no_mq"
5536 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5538 (lshiftrt:DI (mult:DI (sign_extend:DI
5539 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5541 (match_operand:SI 2 "gpc_reg_operand" "r")))
5543 "TARGET_POWERPC && ! TARGET_POWER"
5545 [(set_attr "type" "imul")])
5547 (define_expand "umulsi3_highpart"
5548 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5550 (lshiftrt:DI (mult:DI (zero_extend:DI
5551 (match_operand:SI 1 "gpc_reg_operand" ""))
5553 (match_operand:SI 2 "gpc_reg_operand" "")))
5560 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5565 (define_insn "umulsi3_highpart_mq"
5566 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5568 (lshiftrt:DI (mult:DI (zero_extend:DI
5569 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5571 (match_operand:SI 2 "gpc_reg_operand" "r")))
5573 (clobber (match_scratch:SI 3 "=q"))]
5574 "TARGET_POWERPC && TARGET_POWER"
5576 [(set_attr "type" "imul")])
5578 (define_insn "*umulsi3_highpart_no_mq"
5579 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5581 (lshiftrt:DI (mult:DI (zero_extend:DI
5582 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5584 (match_operand:SI 2 "gpc_reg_operand" "r")))
5586 "TARGET_POWERPC && ! TARGET_POWER"
5588 [(set_attr "type" "imul")])
5590 ;; If operands 0 and 2 are in the same register, we have a problem. But
5591 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5592 ;; why we have the strange constraints below.
5593 (define_insn "ashldi3_power"
5594 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5595 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5596 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5597 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5600 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5601 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5602 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5603 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5604 [(set_attr "length" "8")])
5606 (define_insn "lshrdi3_power"
5607 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5608 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5609 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5610 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5613 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5614 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5615 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5616 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5617 [(set_attr "length" "8")])
5619 ;; Shift by a variable amount is too complex to be worth open-coding. We
5620 ;; just handle shifts by constants.
5621 (define_insn "ashrdi3_power"
5622 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5623 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5624 (match_operand:SI 2 "const_int_operand" "M,i")))
5625 (clobber (match_scratch:SI 3 "=X,q"))]
5628 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5629 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5630 [(set_attr "length" "8")])
5632 (define_insn "ashrdi3_no_power"
5633 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5634 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5635 (match_operand:SI 2 "const_int_operand" "M,i")))]
5636 "TARGET_32BIT && !TARGET_POWER"
5638 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5639 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5640 [(set_attr "length" "8,12")])
5642 ;; PowerPC64 DImode operations.
5644 (define_expand "adddi3"
5645 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5646 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5647 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5651 if (! TARGET_POWERPC64)
5653 if (non_short_cint_operand (operands[2], DImode))
5657 if (GET_CODE (operands[2]) == CONST_INT
5658 && ! add_operand (operands[2], DImode))
5660 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5661 ? operands[0] : gen_reg_rtx (DImode));
5663 HOST_WIDE_INT val = INTVAL (operands[2]);
5664 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5665 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5667 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5670 /* The ordering here is important for the prolog expander.
5671 When space is allocated from the stack, adding 'low' first may
5672 produce a temporary deallocation (which would be bad). */
5673 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5674 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5679 ;; Discourage ai/addic because of carry but provide it in an alternative
5680 ;; allowing register zero as source.
5682 (define_insn "*adddi3_internal1"
5683 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5684 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5685 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5693 (define_insn "*adddi3_internal2"
5694 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5695 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5696 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5698 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5705 [(set_attr "type" "fast_compare,compare,compare,compare")
5706 (set_attr "length" "4,4,8,8")])
5709 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5710 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5711 (match_operand:DI 2 "reg_or_short_operand" ""))
5713 (clobber (match_scratch:DI 3 ""))]
5714 "TARGET_POWERPC64 && reload_completed"
5716 (plus:DI (match_dup 1) (match_dup 2)))
5718 (compare:CC (match_dup 3)
5722 (define_insn "*adddi3_internal3"
5723 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5724 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5725 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5727 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5728 (plus:DI (match_dup 1) (match_dup 2)))]
5735 [(set_attr "type" "fast_compare,compare,compare,compare")
5736 (set_attr "length" "4,4,8,8")])
5739 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5740 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5741 (match_operand:DI 2 "reg_or_short_operand" ""))
5743 (set (match_operand:DI 0 "gpc_reg_operand" "")
5744 (plus:DI (match_dup 1) (match_dup 2)))]
5745 "TARGET_POWERPC64 && reload_completed"
5747 (plus:DI (match_dup 1) (match_dup 2)))
5749 (compare:CC (match_dup 0)
5753 ;; Split an add that we can't do in one insn into two insns, each of which
5754 ;; does one 16-bit part. This is used by combine. Note that the low-order
5755 ;; add should be last in case the result gets used in an address.
5758 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5759 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5760 (match_operand:DI 2 "non_add_cint_operand" "")))]
5762 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5763 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5766 HOST_WIDE_INT val = INTVAL (operands[2]);
5767 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5768 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5770 operands[4] = GEN_INT (low);
5771 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5772 operands[3] = GEN_INT (rest);
5773 else if (! no_new_pseudos)
5775 operands[3] = gen_reg_rtx (DImode);
5776 emit_move_insn (operands[3], operands[2]);
5777 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5784 (define_insn "one_cmpldi2"
5785 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5786 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5791 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5792 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5794 (clobber (match_scratch:DI 2 "=r,r"))]
5799 [(set_attr "type" "compare")
5800 (set_attr "length" "4,8")])
5803 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5804 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5806 (clobber (match_scratch:DI 2 ""))]
5807 "TARGET_POWERPC64 && reload_completed"
5809 (not:DI (match_dup 1)))
5811 (compare:CC (match_dup 2)
5816 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5817 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5819 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5820 (not:DI (match_dup 1)))]
5825 [(set_attr "type" "compare")
5826 (set_attr "length" "4,8")])
5829 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5830 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5832 (set (match_operand:DI 0 "gpc_reg_operand" "")
5833 (not:DI (match_dup 1)))]
5834 "TARGET_POWERPC64 && reload_completed"
5836 (not:DI (match_dup 1)))
5838 (compare:CC (match_dup 0)
5843 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5844 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
5845 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
5852 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5853 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5854 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5856 (clobber (match_scratch:DI 3 "=r,r"))]
5861 [(set_attr "type" "fast_compare")
5862 (set_attr "length" "4,8")])
5865 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5866 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5867 (match_operand:DI 2 "gpc_reg_operand" ""))
5869 (clobber (match_scratch:DI 3 ""))]
5870 "TARGET_POWERPC64 && reload_completed"
5872 (minus:DI (match_dup 1) (match_dup 2)))
5874 (compare:CC (match_dup 3)
5879 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5880 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5881 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5883 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5884 (minus:DI (match_dup 1) (match_dup 2)))]
5889 [(set_attr "type" "fast_compare")
5890 (set_attr "length" "4,8")])
5893 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5894 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5895 (match_operand:DI 2 "gpc_reg_operand" ""))
5897 (set (match_operand:DI 0 "gpc_reg_operand" "")
5898 (minus:DI (match_dup 1) (match_dup 2)))]
5899 "TARGET_POWERPC64 && reload_completed"
5901 (minus:DI (match_dup 1) (match_dup 2)))
5903 (compare:CC (match_dup 0)
5907 (define_expand "subdi3"
5908 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5909 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
5910 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
5914 if (GET_CODE (operands[2]) == CONST_INT)
5916 emit_insn (gen_adddi3 (operands[0], operands[1],
5917 negate_rtx (DImode, operands[2])));
5922 (define_insn_and_split "absdi2"
5923 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5924 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5925 (clobber (match_scratch:DI 2 "=&r,&r"))]
5928 "&& reload_completed"
5929 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5930 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5931 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5934 (define_insn_and_split "*nabsdi2"
5935 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5936 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5937 (clobber (match_scratch:DI 2 "=&r,&r"))]
5940 "&& reload_completed"
5941 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5942 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5943 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5946 (define_expand "negdi2"
5947 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5948 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
5953 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5954 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5959 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5960 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5962 (clobber (match_scratch:DI 2 "=r,r"))]
5967 [(set_attr "type" "fast_compare")
5968 (set_attr "length" "4,8")])
5971 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5972 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5974 (clobber (match_scratch:DI 2 ""))]
5975 "TARGET_POWERPC64 && reload_completed"
5977 (neg:DI (match_dup 1)))
5979 (compare:CC (match_dup 2)
5984 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5985 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5987 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5988 (neg:DI (match_dup 1)))]
5993 [(set_attr "type" "fast_compare")
5994 (set_attr "length" "4,8")])
5997 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5998 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6000 (set (match_operand:DI 0 "gpc_reg_operand" "")
6001 (neg:DI (match_dup 1)))]
6002 "TARGET_POWERPC64 && reload_completed"
6004 (neg:DI (match_dup 1)))
6006 (compare:CC (match_dup 0)
6010 (define_insn "clzdi2"
6011 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6012 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6016 (define_expand "ctzdi2"
6018 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6019 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6021 (clobber (scratch:CC))])
6022 (set (match_dup 4) (clz:DI (match_dup 3)))
6023 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6024 (minus:DI (const_int 63) (match_dup 4)))]
6027 operands[2] = gen_reg_rtx (DImode);
6028 operands[3] = gen_reg_rtx (DImode);
6029 operands[4] = gen_reg_rtx (DImode);
6032 (define_expand "ffsdi2"
6034 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6035 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6037 (clobber (scratch:CC))])
6038 (set (match_dup 4) (clz:DI (match_dup 3)))
6039 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6040 (minus:DI (const_int 64) (match_dup 4)))]
6043 operands[2] = gen_reg_rtx (DImode);
6044 operands[3] = gen_reg_rtx (DImode);
6045 operands[4] = gen_reg_rtx (DImode);
6048 (define_insn "muldi3"
6049 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6050 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6051 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6054 [(set_attr "type" "lmul")])
6056 (define_insn "*muldi3_internal1"
6057 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6058 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6059 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6061 (clobber (match_scratch:DI 3 "=r,r"))]
6066 [(set_attr "type" "lmul_compare")
6067 (set_attr "length" "4,8")])
6070 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6071 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6072 (match_operand:DI 2 "gpc_reg_operand" ""))
6074 (clobber (match_scratch:DI 3 ""))]
6075 "TARGET_POWERPC64 && reload_completed"
6077 (mult:DI (match_dup 1) (match_dup 2)))
6079 (compare:CC (match_dup 3)
6083 (define_insn "*muldi3_internal2"
6084 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6085 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6086 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6088 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6089 (mult:DI (match_dup 1) (match_dup 2)))]
6094 [(set_attr "type" "lmul_compare")
6095 (set_attr "length" "4,8")])
6098 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6099 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6100 (match_operand:DI 2 "gpc_reg_operand" ""))
6102 (set (match_operand:DI 0 "gpc_reg_operand" "")
6103 (mult:DI (match_dup 1) (match_dup 2)))]
6104 "TARGET_POWERPC64 && reload_completed"
6106 (mult:DI (match_dup 1) (match_dup 2)))
6108 (compare:CC (match_dup 0)
6112 (define_insn "smuldi3_highpart"
6113 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6115 (lshiftrt:TI (mult:TI (sign_extend:TI
6116 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6118 (match_operand:DI 2 "gpc_reg_operand" "r")))
6122 [(set_attr "type" "lmul")])
6124 (define_insn "umuldi3_highpart"
6125 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6127 (lshiftrt:TI (mult:TI (zero_extend:TI
6128 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6130 (match_operand:DI 2 "gpc_reg_operand" "r")))
6134 [(set_attr "type" "lmul")])
6136 (define_expand "divdi3"
6137 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6138 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6139 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6143 if (GET_CODE (operands[2]) == CONST_INT
6144 && INTVAL (operands[2]) > 0
6145 && exact_log2 (INTVAL (operands[2])) >= 0)
6148 operands[2] = force_reg (DImode, operands[2]);
6151 (define_expand "moddi3"
6152 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6153 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6154 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6162 if (GET_CODE (operands[2]) != CONST_INT
6163 || INTVAL (operands[2]) <= 0
6164 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6167 temp1 = gen_reg_rtx (DImode);
6168 temp2 = gen_reg_rtx (DImode);
6170 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6171 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6172 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6177 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6178 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6179 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6181 "sradi %0,%1,%p2\;addze %0,%0"
6182 [(set_attr "length" "8")])
6185 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6186 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6187 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6189 (clobber (match_scratch:DI 3 "=r,r"))]
6192 sradi %3,%1,%p2\;addze. %3,%3
6194 [(set_attr "type" "compare")
6195 (set_attr "length" "8,12")])
6198 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6199 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6200 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6202 (clobber (match_scratch:DI 3 ""))]
6203 "TARGET_POWERPC64 && reload_completed"
6205 (div:DI (match_dup 1) (match_dup 2)))
6207 (compare:CC (match_dup 3)
6212 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6213 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6214 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6216 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6217 (div:DI (match_dup 1) (match_dup 2)))]
6220 sradi %0,%1,%p2\;addze. %0,%0
6222 [(set_attr "type" "compare")
6223 (set_attr "length" "8,12")])
6226 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6227 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6228 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6230 (set (match_operand:DI 0 "gpc_reg_operand" "")
6231 (div:DI (match_dup 1) (match_dup 2)))]
6232 "TARGET_POWERPC64 && reload_completed"
6234 (div:DI (match_dup 1) (match_dup 2)))
6236 (compare:CC (match_dup 0)
6241 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6242 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6243 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6246 [(set_attr "type" "ldiv")])
6248 (define_insn "udivdi3"
6249 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6250 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6251 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6254 [(set_attr "type" "ldiv")])
6256 (define_insn "rotldi3"
6257 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6258 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6259 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6261 "rld%I2cl %0,%1,%H2,0")
6263 (define_insn "*rotldi3_internal2"
6264 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6265 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6266 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6268 (clobber (match_scratch:DI 3 "=r,r"))]
6271 rld%I2cl. %3,%1,%H2,0
6273 [(set_attr "type" "delayed_compare")
6274 (set_attr "length" "4,8")])
6277 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6278 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6279 (match_operand:DI 2 "reg_or_cint_operand" ""))
6281 (clobber (match_scratch:DI 3 ""))]
6282 "TARGET_POWERPC64 && reload_completed"
6284 (rotate:DI (match_dup 1) (match_dup 2)))
6286 (compare:CC (match_dup 3)
6290 (define_insn "*rotldi3_internal3"
6291 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6292 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6293 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6295 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6296 (rotate:DI (match_dup 1) (match_dup 2)))]
6299 rld%I2cl. %0,%1,%H2,0
6301 [(set_attr "type" "delayed_compare")
6302 (set_attr "length" "4,8")])
6305 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6306 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6307 (match_operand:DI 2 "reg_or_cint_operand" ""))
6309 (set (match_operand:DI 0 "gpc_reg_operand" "")
6310 (rotate:DI (match_dup 1) (match_dup 2)))]
6311 "TARGET_POWERPC64 && reload_completed"
6313 (rotate:DI (match_dup 1) (match_dup 2)))
6315 (compare:CC (match_dup 0)
6319 (define_insn "*rotldi3_internal4"
6320 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6321 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6322 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6323 (match_operand:DI 3 "mask64_operand" "n")))]
6325 "rld%I2c%B3 %0,%1,%H2,%S3")
6327 (define_insn "*rotldi3_internal5"
6328 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6330 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6331 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6332 (match_operand:DI 3 "mask64_operand" "n,n"))
6334 (clobber (match_scratch:DI 4 "=r,r"))]
6337 rld%I2c%B3. %4,%1,%H2,%S3
6339 [(set_attr "type" "delayed_compare")
6340 (set_attr "length" "4,8")])
6343 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6345 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6346 (match_operand:DI 2 "reg_or_cint_operand" ""))
6347 (match_operand:DI 3 "mask64_operand" ""))
6349 (clobber (match_scratch:DI 4 ""))]
6350 "TARGET_POWERPC64 && reload_completed"
6352 (and:DI (rotate:DI (match_dup 1)
6356 (compare:CC (match_dup 4)
6360 (define_insn "*rotldi3_internal6"
6361 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6363 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6364 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6365 (match_operand:DI 3 "mask64_operand" "n,n"))
6367 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6368 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6371 rld%I2c%B3. %0,%1,%H2,%S3
6373 [(set_attr "type" "delayed_compare")
6374 (set_attr "length" "4,8")])
6377 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6379 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6380 (match_operand:DI 2 "reg_or_cint_operand" ""))
6381 (match_operand:DI 3 "mask64_operand" ""))
6383 (set (match_operand:DI 0 "gpc_reg_operand" "")
6384 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6385 "TARGET_POWERPC64 && reload_completed"
6387 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6389 (compare:CC (match_dup 0)
6393 (define_insn "*rotldi3_internal7"
6394 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6397 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6398 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6400 "rld%I2cl %0,%1,%H2,56")
6402 (define_insn "*rotldi3_internal8"
6403 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6404 (compare:CC (zero_extend:DI
6406 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6407 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6409 (clobber (match_scratch:DI 3 "=r,r"))]
6412 rld%I2cl. %3,%1,%H2,56
6414 [(set_attr "type" "delayed_compare")
6415 (set_attr "length" "4,8")])
6418 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6419 (compare:CC (zero_extend:DI
6421 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6422 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6424 (clobber (match_scratch:DI 3 ""))]
6425 "TARGET_POWERPC64 && reload_completed"
6427 (zero_extend:DI (subreg:QI
6428 (rotate:DI (match_dup 1)
6431 (compare:CC (match_dup 3)
6435 (define_insn "*rotldi3_internal9"
6436 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6437 (compare:CC (zero_extend:DI
6439 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6440 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6442 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6443 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6446 rld%I2cl. %0,%1,%H2,56
6448 [(set_attr "type" "delayed_compare")
6449 (set_attr "length" "4,8")])
6452 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6453 (compare:CC (zero_extend:DI
6455 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6456 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6458 (set (match_operand:DI 0 "gpc_reg_operand" "")
6459 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6460 "TARGET_POWERPC64 && reload_completed"
6462 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6464 (compare:CC (match_dup 0)
6468 (define_insn "*rotldi3_internal10"
6469 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6472 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6473 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6475 "rld%I2cl %0,%1,%H2,48")
6477 (define_insn "*rotldi3_internal11"
6478 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6479 (compare:CC (zero_extend:DI
6481 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6482 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6484 (clobber (match_scratch:DI 3 "=r,r"))]
6487 rld%I2cl. %3,%1,%H2,48
6489 [(set_attr "type" "delayed_compare")
6490 (set_attr "length" "4,8")])
6493 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6494 (compare:CC (zero_extend:DI
6496 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6497 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6499 (clobber (match_scratch:DI 3 ""))]
6500 "TARGET_POWERPC64 && reload_completed"
6502 (zero_extend:DI (subreg:HI
6503 (rotate:DI (match_dup 1)
6506 (compare:CC (match_dup 3)
6510 (define_insn "*rotldi3_internal12"
6511 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6512 (compare:CC (zero_extend:DI
6514 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6515 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6517 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6518 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6521 rld%I2cl. %0,%1,%H2,48
6523 [(set_attr "type" "delayed_compare")
6524 (set_attr "length" "4,8")])
6527 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6528 (compare:CC (zero_extend:DI
6530 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6531 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6533 (set (match_operand:DI 0 "gpc_reg_operand" "")
6534 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6535 "TARGET_POWERPC64 && reload_completed"
6537 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6539 (compare:CC (match_dup 0)
6543 (define_insn "*rotldi3_internal13"
6544 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6547 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6548 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6550 "rld%I2cl %0,%1,%H2,32")
6552 (define_insn "*rotldi3_internal14"
6553 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6554 (compare:CC (zero_extend:DI
6556 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6557 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6559 (clobber (match_scratch:DI 3 "=r,r"))]
6562 rld%I2cl. %3,%1,%H2,32
6564 [(set_attr "type" "delayed_compare")
6565 (set_attr "length" "4,8")])
6568 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6569 (compare:CC (zero_extend:DI
6571 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6572 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6574 (clobber (match_scratch:DI 3 ""))]
6575 "TARGET_POWERPC64 && reload_completed"
6577 (zero_extend:DI (subreg:SI
6578 (rotate:DI (match_dup 1)
6581 (compare:CC (match_dup 3)
6585 (define_insn "*rotldi3_internal15"
6586 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6587 (compare:CC (zero_extend:DI
6589 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6590 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6592 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6593 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6596 rld%I2cl. %0,%1,%H2,32
6598 [(set_attr "type" "delayed_compare")
6599 (set_attr "length" "4,8")])
6602 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6603 (compare:CC (zero_extend:DI
6605 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6606 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6608 (set (match_operand:DI 0 "gpc_reg_operand" "")
6609 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6610 "TARGET_POWERPC64 && reload_completed"
6612 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6614 (compare:CC (match_dup 0)
6618 (define_expand "ashldi3"
6619 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6620 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6621 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6622 "TARGET_POWERPC64 || TARGET_POWER"
6625 if (TARGET_POWERPC64)
6627 else if (TARGET_POWER)
6629 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6636 (define_insn "*ashldi3_internal1"
6637 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6638 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6639 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6642 [(set_attr "length" "8")])
6644 (define_insn "*ashldi3_internal2"
6645 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6646 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6647 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6649 (clobber (match_scratch:DI 3 "=r,r"))]
6654 [(set_attr "type" "delayed_compare")
6655 (set_attr "length" "4,8")])
6658 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6659 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6660 (match_operand:SI 2 "reg_or_cint_operand" ""))
6662 (clobber (match_scratch:DI 3 ""))]
6663 "TARGET_POWERPC64 && reload_completed"
6665 (ashift:DI (match_dup 1) (match_dup 2)))
6667 (compare:CC (match_dup 3)
6671 (define_insn "*ashldi3_internal3"
6672 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6673 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6674 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6676 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6677 (ashift:DI (match_dup 1) (match_dup 2)))]
6682 [(set_attr "type" "delayed_compare")
6683 (set_attr "length" "4,8")])
6686 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6687 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6688 (match_operand:SI 2 "reg_or_cint_operand" ""))
6690 (set (match_operand:DI 0 "gpc_reg_operand" "")
6691 (ashift:DI (match_dup 1) (match_dup 2)))]
6692 "TARGET_POWERPC64 && reload_completed"
6694 (ashift:DI (match_dup 1) (match_dup 2)))
6696 (compare:CC (match_dup 0)
6700 (define_insn "*ashldi3_internal4"
6701 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6702 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6703 (match_operand:SI 2 "const_int_operand" "i"))
6704 (match_operand:DI 3 "const_int_operand" "n")))]
6705 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6706 "rldic %0,%1,%H2,%W3")
6708 (define_insn "ashldi3_internal5"
6709 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6711 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6712 (match_operand:SI 2 "const_int_operand" "i,i"))
6713 (match_operand:DI 3 "const_int_operand" "n,n"))
6715 (clobber (match_scratch:DI 4 "=r,r"))]
6716 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6718 rldic. %4,%1,%H2,%W3
6720 [(set_attr "type" "delayed_compare")
6721 (set_attr "length" "4,8")])
6724 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6726 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6727 (match_operand:SI 2 "const_int_operand" ""))
6728 (match_operand:DI 3 "const_int_operand" ""))
6730 (clobber (match_scratch:DI 4 ""))]
6731 "TARGET_POWERPC64 && reload_completed
6732 && includes_rldic_lshift_p (operands[2], operands[3])"
6734 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6737 (compare:CC (match_dup 4)
6741 (define_insn "*ashldi3_internal6"
6742 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6744 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6745 (match_operand:SI 2 "const_int_operand" "i,i"))
6746 (match_operand:DI 3 "const_int_operand" "n,n"))
6748 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6749 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6750 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6752 rldic. %0,%1,%H2,%W3
6754 [(set_attr "type" "delayed_compare")
6755 (set_attr "length" "4,8")])
6758 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6760 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6761 (match_operand:SI 2 "const_int_operand" ""))
6762 (match_operand:DI 3 "const_int_operand" ""))
6764 (set (match_operand:DI 0 "gpc_reg_operand" "")
6765 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6766 "TARGET_POWERPC64 && reload_completed
6767 && includes_rldic_lshift_p (operands[2], operands[3])"
6769 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6772 (compare:CC (match_dup 0)
6776 (define_insn "*ashldi3_internal7"
6777 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6778 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6779 (match_operand:SI 2 "const_int_operand" "i"))
6780 (match_operand:DI 3 "mask64_operand" "n")))]
6781 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6782 "rldicr %0,%1,%H2,%S3")
6784 (define_insn "ashldi3_internal8"
6785 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6787 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6788 (match_operand:SI 2 "const_int_operand" "i,i"))
6789 (match_operand:DI 3 "mask64_operand" "n,n"))
6791 (clobber (match_scratch:DI 4 "=r,r"))]
6792 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6794 rldicr. %4,%1,%H2,%S3
6796 [(set_attr "type" "delayed_compare")
6797 (set_attr "length" "4,8")])
6800 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6802 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6803 (match_operand:SI 2 "const_int_operand" ""))
6804 (match_operand:DI 3 "mask64_operand" ""))
6806 (clobber (match_scratch:DI 4 ""))]
6807 "TARGET_POWERPC64 && reload_completed
6808 && includes_rldicr_lshift_p (operands[2], operands[3])"
6810 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6813 (compare:CC (match_dup 4)
6817 (define_insn "*ashldi3_internal9"
6818 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6820 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6821 (match_operand:SI 2 "const_int_operand" "i,i"))
6822 (match_operand:DI 3 "mask64_operand" "n,n"))
6824 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6825 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6826 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6828 rldicr. %0,%1,%H2,%S3
6830 [(set_attr "type" "delayed_compare")
6831 (set_attr "length" "4,8")])
6834 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6836 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6837 (match_operand:SI 2 "const_int_operand" ""))
6838 (match_operand:DI 3 "mask64_operand" ""))
6840 (set (match_operand:DI 0 "gpc_reg_operand" "")
6841 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6842 "TARGET_POWERPC64 && reload_completed
6843 && includes_rldicr_lshift_p (operands[2], operands[3])"
6845 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6848 (compare:CC (match_dup 0)
6852 (define_expand "lshrdi3"
6853 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6854 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6855 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6856 "TARGET_POWERPC64 || TARGET_POWER"
6859 if (TARGET_POWERPC64)
6861 else if (TARGET_POWER)
6863 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6870 (define_insn "*lshrdi3_internal1"
6871 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6872 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6873 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6877 (define_insn "*lshrdi3_internal2"
6878 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6879 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6880 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6882 (clobber (match_scratch:DI 3 "=r,r"))]
6887 [(set_attr "type" "delayed_compare")
6888 (set_attr "length" "4,8")])
6891 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6892 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6893 (match_operand:SI 2 "reg_or_cint_operand" ""))
6895 (clobber (match_scratch:DI 3 ""))]
6896 "TARGET_POWERPC64 && reload_completed"
6898 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6900 (compare:CC (match_dup 3)
6904 (define_insn "*lshrdi3_internal3"
6905 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6906 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6907 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6909 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6910 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6915 [(set_attr "type" "delayed_compare")
6916 (set_attr "length" "4,8")])
6919 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6920 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6921 (match_operand:SI 2 "reg_or_cint_operand" ""))
6923 (set (match_operand:DI 0 "gpc_reg_operand" "")
6924 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6925 "TARGET_POWERPC64 && reload_completed"
6927 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6929 (compare:CC (match_dup 0)
6933 (define_expand "ashrdi3"
6934 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6935 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6936 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6940 if (TARGET_POWERPC64)
6942 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6944 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6947 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT)
6949 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6956 (define_insn "*ashrdi3_internal1"
6957 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6958 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6959 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6961 "srad%I2 %0,%1,%H2")
6963 (define_insn "*ashrdi3_internal2"
6964 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6965 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6966 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6968 (clobber (match_scratch:DI 3 "=r,r"))]
6973 [(set_attr "type" "delayed_compare")
6974 (set_attr "length" "4,8")])
6977 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6978 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6979 (match_operand:SI 2 "reg_or_cint_operand" ""))
6981 (clobber (match_scratch:DI 3 ""))]
6982 "TARGET_POWERPC64 && reload_completed"
6984 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6986 (compare:CC (match_dup 3)
6990 (define_insn "*ashrdi3_internal3"
6991 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6992 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6993 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6995 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6996 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7001 [(set_attr "type" "delayed_compare")
7002 (set_attr "length" "4,8")])
7005 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7006 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7007 (match_operand:SI 2 "reg_or_cint_operand" ""))
7009 (set (match_operand:DI 0 "gpc_reg_operand" "")
7010 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7011 "TARGET_POWERPC64 && reload_completed"
7013 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7015 (compare:CC (match_dup 0)
7019 (define_insn "anddi3"
7020 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
7021 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
7022 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
7023 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
7027 rldic%B2 %0,%1,0,%S2
7031 [(set_attr "length" "4,4,4,4,8")])
7034 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7035 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7036 (match_operand:DI 2 "mask64_2_operand" "")))
7037 (clobber (match_scratch:CC 3 ""))]
7039 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7040 && !mask64_operand (operands[2], DImode)"
7042 (and:DI (rotate:DI (match_dup 1)
7046 (and:DI (rotate:DI (match_dup 0)
7051 build_mask64_2_operands (operands[2], &operands[4]);
7054 (define_insn "*anddi3_internal2"
7055 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7056 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7057 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7059 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7060 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7064 rldic%B2. %3,%1,0,%S2
7073 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7074 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7077 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7078 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7079 (match_operand:DI 2 "and64_operand" ""))
7081 (clobber (match_scratch:DI 3 ""))
7082 (clobber (match_scratch:CC 4 ""))]
7083 "TARGET_POWERPC64 && reload_completed"
7084 [(parallel [(set (match_dup 3)
7085 (and:DI (match_dup 1)
7087 (clobber (match_dup 4))])
7089 (compare:CC (match_dup 3)
7094 [(set (match_operand:CC 0 "cc_reg_operand" "")
7095 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7096 (match_operand:DI 2 "mask64_2_operand" ""))
7098 (clobber (match_scratch:DI 3 ""))
7099 (clobber (match_scratch:CC 4 ""))]
7100 "TARGET_POWERPC64 && reload_completed
7101 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7102 && !mask64_operand (operands[2], DImode)"
7104 (and:DI (rotate:DI (match_dup 1)
7107 (parallel [(set (match_dup 0)
7108 (compare:CC (and:DI (rotate:DI (match_dup 3)
7112 (clobber (match_dup 3))])]
7115 build_mask64_2_operands (operands[2], &operands[5]);
7118 (define_insn "*anddi3_internal3"
7119 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7120 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7121 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7123 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7124 (and:DI (match_dup 1) (match_dup 2)))
7125 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7129 rldic%B2. %0,%1,0,%S2
7138 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7139 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7142 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7143 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7144 (match_operand:DI 2 "and64_operand" ""))
7146 (set (match_operand:DI 0 "gpc_reg_operand" "")
7147 (and:DI (match_dup 1) (match_dup 2)))
7148 (clobber (match_scratch:CC 4 ""))]
7149 "TARGET_POWERPC64 && reload_completed"
7150 [(parallel [(set (match_dup 0)
7151 (and:DI (match_dup 1) (match_dup 2)))
7152 (clobber (match_dup 4))])
7154 (compare:CC (match_dup 0)
7159 [(set (match_operand:CC 3 "cc_reg_operand" "")
7160 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7161 (match_operand:DI 2 "mask64_2_operand" ""))
7163 (set (match_operand:DI 0 "gpc_reg_operand" "")
7164 (and:DI (match_dup 1) (match_dup 2)))
7165 (clobber (match_scratch:CC 4 ""))]
7166 "TARGET_POWERPC64 && reload_completed
7167 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7168 && !mask64_operand (operands[2], DImode)"
7170 (and:DI (rotate:DI (match_dup 1)
7173 (parallel [(set (match_dup 3)
7174 (compare:CC (and:DI (rotate:DI (match_dup 0)
7179 (and:DI (rotate:DI (match_dup 0)
7184 build_mask64_2_operands (operands[2], &operands[5]);
7187 (define_expand "iordi3"
7188 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7189 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7190 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7194 if (non_logical_cint_operand (operands[2], DImode))
7196 HOST_WIDE_INT value;
7197 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7198 ? operands[0] : gen_reg_rtx (DImode));
7200 if (GET_CODE (operands[2]) == CONST_INT)
7202 value = INTVAL (operands[2]);
7203 emit_insn (gen_iordi3 (tmp, operands[1],
7204 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7208 value = CONST_DOUBLE_LOW (operands[2]);
7209 emit_insn (gen_iordi3 (tmp, operands[1],
7210 immed_double_const (value
7211 & (~ (HOST_WIDE_INT) 0xffff),
7215 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7220 (define_expand "xordi3"
7221 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7222 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7223 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7227 if (non_logical_cint_operand (operands[2], DImode))
7229 HOST_WIDE_INT value;
7230 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7231 ? operands[0] : gen_reg_rtx (DImode));
7233 if (GET_CODE (operands[2]) == CONST_INT)
7235 value = INTVAL (operands[2]);
7236 emit_insn (gen_xordi3 (tmp, operands[1],
7237 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7241 value = CONST_DOUBLE_LOW (operands[2]);
7242 emit_insn (gen_xordi3 (tmp, operands[1],
7243 immed_double_const (value
7244 & (~ (HOST_WIDE_INT) 0xffff),
7248 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7253 (define_insn "*booldi3_internal1"
7254 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7255 (match_operator:DI 3 "boolean_or_operator"
7256 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7257 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7264 (define_insn "*booldi3_internal2"
7265 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7266 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7267 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7268 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7270 (clobber (match_scratch:DI 3 "=r,r"))]
7275 [(set_attr "type" "compare")
7276 (set_attr "length" "4,8")])
7279 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7280 (compare:CC (match_operator:DI 4 "boolean_operator"
7281 [(match_operand:DI 1 "gpc_reg_operand" "")
7282 (match_operand:DI 2 "gpc_reg_operand" "")])
7284 (clobber (match_scratch:DI 3 ""))]
7285 "TARGET_POWERPC64 && reload_completed"
7286 [(set (match_dup 3) (match_dup 4))
7288 (compare:CC (match_dup 3)
7292 (define_insn "*booldi3_internal3"
7293 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7294 (compare:CC (match_operator:DI 4 "boolean_operator"
7295 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7296 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7298 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7304 [(set_attr "type" "compare")
7305 (set_attr "length" "4,8")])
7308 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7309 (compare:CC (match_operator:DI 4 "boolean_operator"
7310 [(match_operand:DI 1 "gpc_reg_operand" "")
7311 (match_operand:DI 2 "gpc_reg_operand" "")])
7313 (set (match_operand:DI 0 "gpc_reg_operand" "")
7315 "TARGET_POWERPC64 && reload_completed"
7316 [(set (match_dup 0) (match_dup 4))
7318 (compare:CC (match_dup 0)
7322 ;; Split a logical operation that we can't do in one insn into two insns,
7323 ;; each of which does one 16-bit part. This is used by combine.
7326 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7327 (match_operator:DI 3 "boolean_or_operator"
7328 [(match_operand:DI 1 "gpc_reg_operand" "")
7329 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7331 [(set (match_dup 0) (match_dup 4))
7332 (set (match_dup 0) (match_dup 5))]
7337 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7339 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7340 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7342 i4 = GEN_INT (value & 0xffff);
7346 i3 = GEN_INT (INTVAL (operands[2])
7347 & (~ (HOST_WIDE_INT) 0xffff));
7348 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7350 operands[4] = gen_rtx (GET_CODE (operands[3]), DImode,
7352 operands[5] = gen_rtx (GET_CODE (operands[3]), DImode,
7356 (define_insn "*boolcdi3_internal1"
7357 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7358 (match_operator:DI 3 "boolean_operator"
7359 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7360 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7364 (define_insn "*boolcdi3_internal2"
7365 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7366 (compare:CC (match_operator:DI 4 "boolean_operator"
7367 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7368 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7370 (clobber (match_scratch:DI 3 "=r,r"))]
7375 [(set_attr "type" "compare")
7376 (set_attr "length" "4,8")])
7379 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7380 (compare:CC (match_operator:DI 4 "boolean_operator"
7381 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7382 (match_operand:DI 2 "gpc_reg_operand" "")])
7384 (clobber (match_scratch:DI 3 ""))]
7385 "TARGET_POWERPC64 && reload_completed"
7386 [(set (match_dup 3) (match_dup 4))
7388 (compare:CC (match_dup 3)
7392 (define_insn "*boolcdi3_internal3"
7393 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7394 (compare:CC (match_operator:DI 4 "boolean_operator"
7395 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7396 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7398 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7404 [(set_attr "type" "compare")
7405 (set_attr "length" "4,8")])
7408 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7409 (compare:CC (match_operator:DI 4 "boolean_operator"
7410 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7411 (match_operand:DI 2 "gpc_reg_operand" "")])
7413 (set (match_operand:DI 0 "gpc_reg_operand" "")
7415 "TARGET_POWERPC64 && reload_completed"
7416 [(set (match_dup 0) (match_dup 4))
7418 (compare:CC (match_dup 0)
7422 (define_insn "*boolccdi3_internal1"
7423 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7424 (match_operator:DI 3 "boolean_operator"
7425 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7426 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7430 (define_insn "*boolccdi3_internal2"
7431 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7432 (compare:CC (match_operator:DI 4 "boolean_operator"
7433 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7434 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7436 (clobber (match_scratch:DI 3 "=r,r"))]
7441 [(set_attr "type" "compare")
7442 (set_attr "length" "4,8")])
7445 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7446 (compare:CC (match_operator:DI 4 "boolean_operator"
7447 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7448 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7450 (clobber (match_scratch:DI 3 ""))]
7451 "TARGET_POWERPC64 && reload_completed"
7452 [(set (match_dup 3) (match_dup 4))
7454 (compare:CC (match_dup 3)
7458 (define_insn "*boolccdi3_internal3"
7459 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7460 (compare:CC (match_operator:DI 4 "boolean_operator"
7461 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7462 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7464 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7470 [(set_attr "type" "compare")
7471 (set_attr "length" "4,8")])
7474 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7475 (compare:CC (match_operator:DI 4 "boolean_operator"
7476 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7477 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7479 (set (match_operand:DI 0 "gpc_reg_operand" "")
7481 "TARGET_POWERPC64 && reload_completed"
7482 [(set (match_dup 0) (match_dup 4))
7484 (compare:CC (match_dup 0)
7488 ;; Now define ways of moving data around.
7490 ;; Elf specific ways of loading addresses for non-PIC code.
7491 ;; The output of this could be r0, but we make a very strong
7492 ;; preference for a base register because it will usually
7494 (define_insn "elf_high"
7495 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7496 (high:SI (match_operand 1 "" "")))]
7497 "TARGET_ELF && ! TARGET_64BIT"
7498 "{liu|lis} %0,%1@ha")
7500 (define_insn "elf_low"
7501 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7502 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7503 (match_operand 2 "" "")))]
7504 "TARGET_ELF && ! TARGET_64BIT"
7506 {cal|la} %0,%2@l(%1)
7507 {ai|addic} %0,%1,%K2")
7509 ;; Mach-O PIC trickery.
7510 (define_insn "macho_high"
7511 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7512 (high:SI (match_operand 1 "" "")))]
7513 "TARGET_MACHO && ! TARGET_64BIT"
7514 "{liu|lis} %0,ha16(%1)")
7516 (define_insn "macho_low"
7517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7518 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7519 (match_operand 2 "" "")))]
7520 "TARGET_MACHO && ! TARGET_64BIT"
7522 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
7523 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
7525 ;; Set up a register with a value from the GOT table
7527 (define_expand "movsi_got"
7528 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7529 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7530 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7531 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7534 if (GET_CODE (operands[1]) == CONST)
7536 rtx offset = const0_rtx;
7537 HOST_WIDE_INT value;
7539 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7540 value = INTVAL (offset);
7543 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7544 emit_insn (gen_movsi_got (tmp, operands[1]));
7545 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7550 operands[2] = rs6000_got_register (operands[1]);
7553 (define_insn "*movsi_got_internal"
7554 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7555 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7556 (match_operand:SI 2 "gpc_reg_operand" "b")]
7558 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7559 "{l|lwz} %0,%a1@got(%2)"
7560 [(set_attr "type" "load")])
7562 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7563 ;; didn't get allocated to a hard register.
7565 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7566 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7567 (match_operand:SI 2 "memory_operand" "")]
7569 "DEFAULT_ABI == ABI_V4
7571 && (reload_in_progress || reload_completed)"
7572 [(set (match_dup 0) (match_dup 2))
7573 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7577 ;; For SI, we special-case integers that can't be loaded in one insn. We
7578 ;; do the load 16-bits at a time. We could do this by loading from memory,
7579 ;; and this is even supposed to be faster, but it is simpler not to get
7580 ;; integers in the TOC.
7581 (define_expand "movsi"
7582 [(set (match_operand:SI 0 "general_operand" "")
7583 (match_operand:SI 1 "any_operand" ""))]
7585 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7587 (define_insn "movsi_low"
7588 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7589 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7590 (match_operand 2 "" ""))))]
7591 "TARGET_MACHO && ! TARGET_64BIT"
7592 "{l|lwz} %0,lo16(%2)(%1)"
7593 [(set_attr "type" "load")
7594 (set_attr "length" "4")])
7596 (define_insn "movsi_low_st"
7597 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7598 (match_operand 2 "" "")))
7599 (match_operand:SI 0 "gpc_reg_operand" "r"))]
7600 "TARGET_MACHO && ! TARGET_64BIT"
7601 "{st|stw} %0,lo16(%2)(%1)"
7602 [(set_attr "type" "store")
7603 (set_attr "length" "4")])
7605 (define_insn "movdf_low"
7606 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
7607 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7608 (match_operand 2 "" ""))))]
7609 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7612 switch (which_alternative)
7615 return \"lfd %0,lo16(%2)(%1)\";
7619 operands2[0] = operands[0];
7620 operands2[1] = operands[1];
7621 operands2[2] = operands[2];
7622 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
7623 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
7625 if (MACHO_DYNAMIC_NO_PIC_P)
7626 output_asm_insn (\"{liu|lis} %L0,ha16(%2+4)\", operands);
7628 /* We cannot rely on ha16(low half)==ha16(high half), alas,
7629 although in practice it almost always is. */
7630 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
7632 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
7638 [(set_attr "type" "load")
7639 (set_attr "length" "4,12")])
7641 (define_insn "movdf_low_st"
7642 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7643 (match_operand 2 "" "")))
7644 (match_operand:DF 0 "gpc_reg_operand" "f"))]
7645 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7646 "stfd %0,lo16(%2)(%1)"
7647 [(set_attr "type" "store")
7648 (set_attr "length" "4")])
7650 (define_insn "movsf_low"
7651 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
7652 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7653 (match_operand 2 "" ""))))]
7654 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7657 {l|lwz} %0,lo16(%2)(%1)"
7658 [(set_attr "type" "load")
7659 (set_attr "length" "4")])
7661 (define_insn "movsf_low_st"
7662 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7663 (match_operand 2 "" "")))
7664 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
7665 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7667 stfs %0,lo16(%2)(%1)
7668 {st|stw} %0,lo16(%2)(%1)"
7669 [(set_attr "type" "store")
7670 (set_attr "length" "4")])
7672 (define_insn "*movsi_internal1"
7673 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7674 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7675 "gpc_reg_operand (operands[0], SImode)
7676 || gpc_reg_operand (operands[1], SImode)"
7680 {l%U1%X1|lwz%U1%X1} %0,%1
7681 {st%U0%X0|stw%U0%X0} %1,%0
7691 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7692 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7694 ;; Split a load of a large constant into the appropriate two-insn
7698 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7699 (match_operand:SI 1 "const_int_operand" ""))]
7700 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7701 && (INTVAL (operands[1]) & 0xffff) != 0"
7705 (ior:SI (match_dup 0)
7708 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7710 if (tem == operands[0])
7716 (define_insn "*movsi_internal2"
7717 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7718 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "0,r,r")
7720 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7721 "! TARGET_POWERPC64"
7723 {cmpi|cmpwi} %2,%0,0
7726 [(set_attr "type" "cmp,compare,cmp")
7727 (set_attr "length" "4,4,8")])
7730 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7731 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7733 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7734 "! TARGET_POWERPC64 && reload_completed"
7735 [(set (match_dup 0) (match_dup 1))
7737 (compare:CC (match_dup 0)
7741 (define_expand "movhi"
7742 [(set (match_operand:HI 0 "general_operand" "")
7743 (match_operand:HI 1 "any_operand" ""))]
7745 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7747 (define_insn "*movhi_internal"
7748 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7749 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7750 "gpc_reg_operand (operands[0], HImode)
7751 || gpc_reg_operand (operands[1], HImode)"
7761 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7763 (define_expand "movqi"
7764 [(set (match_operand:QI 0 "general_operand" "")
7765 (match_operand:QI 1 "any_operand" ""))]
7767 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7769 (define_insn "*movqi_internal"
7770 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7771 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7772 "gpc_reg_operand (operands[0], QImode)
7773 || gpc_reg_operand (operands[1], QImode)"
7783 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7785 ;; Here is how to move condition codes around. When we store CC data in
7786 ;; an integer register or memory, we store just the high-order 4 bits.
7787 ;; This lets us not shift in the most common case of CR0.
7788 (define_expand "movcc"
7789 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7790 (match_operand:CC 1 "nonimmediate_operand" ""))]
7794 (define_insn "*movcc_internal1"
7795 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7796 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7797 "register_operand (operands[0], CCmode)
7798 || register_operand (operands[1], CCmode)"
7802 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7804 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7809 {l%U1%X1|lwz%U1%X1} %0,%1
7810 {st%U0%U1|stw%U0%U1} %1,%0"
7812 (cond [(eq_attr "alternative" "0")
7813 (const_string "cr_logical")
7814 (eq_attr "alternative" "1,2")
7815 (const_string "mtcr")
7816 (eq_attr "alternative" "5,7")
7817 (const_string "integer")
7818 (eq_attr "alternative" "6")
7819 (const_string "mfjmpr")
7820 (eq_attr "alternative" "8")
7821 (const_string "mtjmpr")
7822 (eq_attr "alternative" "9")
7823 (const_string "load")
7824 (eq_attr "alternative" "10")
7825 (const_string "store")
7826 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7827 (const_string "mfcrf")
7829 (const_string "mfcr")))
7830 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7832 ;; For floating-point, we normally deal with the floating-point registers
7833 ;; unless -msoft-float is used. The sole exception is that parameter passing
7834 ;; can produce floating-point values in fixed-point registers. Unless the
7835 ;; value is a simple constant or already in memory, we deal with this by
7836 ;; allocating memory and copying the value explicitly via that memory location.
7837 (define_expand "movsf"
7838 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7839 (match_operand:SF 1 "any_operand" ""))]
7841 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7844 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7845 (match_operand:SF 1 "const_double_operand" ""))]
7847 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7848 || (GET_CODE (operands[0]) == SUBREG
7849 && GET_CODE (SUBREG_REG (operands[0])) == REG
7850 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7851 [(set (match_dup 2) (match_dup 3))]
7857 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7858 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7860 if (! TARGET_POWERPC64)
7861 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7863 operands[2] = gen_lowpart (SImode, operands[0]);
7865 operands[3] = gen_int_mode (l, SImode);
7868 (define_insn "*movsf_hardfloat"
7869 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!r,!r")
7870 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,G,Fn"))]
7871 "(gpc_reg_operand (operands[0], SFmode)
7872 || gpc_reg_operand (operands[1], SFmode))
7873 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7876 {l%U1%X1|lwz%U1%X1} %0,%1
7877 {st%U0%X0|stw%U0%X0} %1,%0
7886 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*")
7887 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
7889 (define_insn "*movsf_softfloat"
7890 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7891 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7892 "(gpc_reg_operand (operands[0], SFmode)
7893 || gpc_reg_operand (operands[1], SFmode))
7894 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7900 {l%U1%X1|lwz%U1%X1} %0,%1
7901 {st%U0%X0|stw%U0%X0} %1,%0
7908 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7909 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7912 (define_expand "movdf"
7913 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7914 (match_operand:DF 1 "any_operand" ""))]
7916 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7919 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7920 (match_operand:DF 1 "const_int_operand" ""))]
7921 "! TARGET_POWERPC64 && reload_completed
7922 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7923 || (GET_CODE (operands[0]) == SUBREG
7924 && GET_CODE (SUBREG_REG (operands[0])) == REG
7925 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7926 [(set (match_dup 2) (match_dup 4))
7927 (set (match_dup 3) (match_dup 1))]
7930 int endian = (WORDS_BIG_ENDIAN == 0);
7931 HOST_WIDE_INT value = INTVAL (operands[1]);
7933 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7934 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7935 #if HOST_BITS_PER_WIDE_INT == 32
7936 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7938 operands[4] = GEN_INT (value >> 32);
7939 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7944 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7945 (match_operand:DF 1 "const_double_operand" ""))]
7946 "! TARGET_POWERPC64 && reload_completed
7947 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7948 || (GET_CODE (operands[0]) == SUBREG
7949 && GET_CODE (SUBREG_REG (operands[0])) == REG
7950 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7951 [(set (match_dup 2) (match_dup 4))
7952 (set (match_dup 3) (match_dup 5))]
7955 int endian = (WORDS_BIG_ENDIAN == 0);
7959 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7960 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7962 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7963 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7964 operands[4] = gen_int_mode (l[endian], SImode);
7965 operands[5] = gen_int_mode (l[1 - endian], SImode);
7969 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7970 (match_operand:DF 1 "easy_fp_constant" ""))]
7971 "TARGET_POWERPC64 && reload_completed
7972 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7973 || (GET_CODE (operands[0]) == SUBREG
7974 && GET_CODE (SUBREG_REG (operands[0])) == REG
7975 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7976 [(set (match_dup 2) (match_dup 3))]
7979 int endian = (WORDS_BIG_ENDIAN == 0);
7982 #if HOST_BITS_PER_WIDE_INT >= 64
7986 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7987 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7989 operands[2] = gen_lowpart (DImode, operands[0]);
7990 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
7991 #if HOST_BITS_PER_WIDE_INT >= 64
7992 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
7993 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
7995 operands[3] = gen_int_mode (val, DImode);
7997 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8001 ;; Don't have reload use general registers to load a constant. First,
8002 ;; it might not work if the output operand is the equivalent of
8003 ;; a non-offsettable memref, but also it is less efficient than loading
8004 ;; the constant into an FP register, since it will probably be used there.
8005 ;; The "??" is a kludge until we can figure out a more reasonable way
8006 ;; of handling these non-offsettable values.
8007 (define_insn "*movdf_hardfloat32"
8008 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8009 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8010 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8011 && (gpc_reg_operand (operands[0], DFmode)
8012 || gpc_reg_operand (operands[1], DFmode))"
8015 switch (which_alternative)
8020 /* We normally copy the low-numbered register first. However, if
8021 the first register operand 0 is the same as the second register
8022 of operand 1, we must copy in the opposite order. */
8023 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8024 return \"mr %L0,%L1\;mr %0,%1\";
8026 return \"mr %0,%1\;mr %L0,%L1\";
8028 if (offsettable_memref_p (operands[1])
8029 || (GET_CODE (operands[1]) == MEM
8030 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8031 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8032 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8034 /* If the low-address word is used in the address, we must load
8035 it last. Otherwise, load it first. Note that we cannot have
8036 auto-increment in that case since the address register is
8037 known to be dead. */
8038 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8040 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8042 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8048 addreg = find_addr_reg (XEXP (operands[1], 0));
8049 if (refers_to_regno_p (REGNO (operands[0]),
8050 REGNO (operands[0]) + 1,
8053 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8054 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8055 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8056 return \"{lx|lwzx} %0,%1\";
8060 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8061 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8062 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8063 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8068 if (offsettable_memref_p (operands[0])
8069 || (GET_CODE (operands[0]) == MEM
8070 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8071 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8072 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8073 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8078 addreg = find_addr_reg (XEXP (operands[0], 0));
8079 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8080 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8081 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8082 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8086 return \"fmr %0,%1\";
8088 return \"lfd%U1%X1 %0,%1\";
8090 return \"stfd%U0%X0 %1,%0\";
8097 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*")
8098 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8100 (define_insn "*movdf_softfloat32"
8101 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8102 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8103 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8104 && (gpc_reg_operand (operands[0], DFmode)
8105 || gpc_reg_operand (operands[1], DFmode))"
8108 switch (which_alternative)
8113 /* We normally copy the low-numbered register first. However, if
8114 the first register operand 0 is the same as the second register of
8115 operand 1, we must copy in the opposite order. */
8116 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8117 return \"mr %L0,%L1\;mr %0,%1\";
8119 return \"mr %0,%1\;mr %L0,%L1\";
8121 /* If the low-address word is used in the address, we must load
8122 it last. Otherwise, load it first. Note that we cannot have
8123 auto-increment in that case since the address register is
8124 known to be dead. */
8125 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8127 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8129 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8131 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8138 [(set_attr "type" "*,load,store,*,*,*")
8139 (set_attr "length" "8,8,8,8,12,16")])
8141 (define_insn "*movdf_hardfloat64"
8142 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!cl,!r,!r,!r,!r")
8143 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,r,h,G,H,F"))]
8144 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8145 && (gpc_reg_operand (operands[0], DFmode)
8146 || gpc_reg_operand (operands[1], DFmode))"
8159 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*")
8160 (set_attr "length" "4,4,4,4,4,4,4,4,8,12,16")])
8162 (define_insn "*movdf_softfloat64"
8163 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r")
8164 (match_operand:DF 1 "input_operand" "r,r,h,m,r,G,H,F"))]
8165 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8166 && (gpc_reg_operand (operands[0], DFmode)
8167 || gpc_reg_operand (operands[1], DFmode))"
8177 [(set_attr "type" "*,*,*,load,store,*,*,*")
8178 (set_attr "length" "4,4,4,4,4,8,12,16")])
8180 (define_expand "movtf"
8181 [(set (match_operand:TF 0 "general_operand" "")
8182 (match_operand:TF 1 "any_operand" ""))]
8183 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8184 && TARGET_LONG_DOUBLE_128"
8185 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8187 (define_insn "*movtf_internal"
8188 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,m,!r,!r,!r")
8189 (match_operand:TF 1 "input_operand" "f,m,f,G,H,F"))]
8190 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8191 && TARGET_LONG_DOUBLE_128
8192 && (gpc_reg_operand (operands[0], TFmode)
8193 || gpc_reg_operand (operands[1], TFmode))"
8196 switch (which_alternative)
8201 /* We normally copy the low-numbered register first. However, if
8202 the first register operand 0 is the same as the second register of
8203 operand 1, we must copy in the opposite order. */
8204 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8205 return \"fmr %L0,%L1\;fmr %0,%1\";
8207 return \"fmr %0,%1\;fmr %L0,%L1\";
8209 return \"lfd %0,%1\;lfd %L0,%Y1\";
8211 return \"stfd %1,%0\;stfd %L1,%Y0\";
8218 [(set_attr "type" "fp,fpload,fpstore,*,*,*")
8219 (set_attr "length" "8,8,8,12,16,20")])
8222 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8223 (match_operand:TF 1 "easy_fp_constant" ""))]
8224 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8225 && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_POWERPC64
8226 && TARGET_LONG_DOUBLE_128 && reload_completed
8227 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8228 || (GET_CODE (operands[0]) == SUBREG
8229 && GET_CODE (SUBREG_REG (operands[0])) == REG
8230 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8231 [(set (match_dup 2) (match_dup 6))
8232 (set (match_dup 3) (match_dup 7))
8233 (set (match_dup 4) (match_dup 8))
8234 (set (match_dup 5) (match_dup 9))]
8240 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8241 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8243 operands[2] = operand_subword (operands[0], 0, 0, TFmode);
8244 operands[3] = operand_subword (operands[0], 1, 0, TFmode);
8245 operands[4] = operand_subword (operands[0], 2, 0, TFmode);
8246 operands[5] = operand_subword (operands[0], 3, 0, TFmode);
8247 operands[6] = gen_int_mode (l[0], SImode);
8248 operands[7] = gen_int_mode (l[1], SImode);
8249 operands[8] = gen_int_mode (l[2], SImode);
8250 operands[9] = gen_int_mode (l[3], SImode);
8254 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8255 (match_operand:TF 1 "easy_fp_constant" ""))]
8256 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8257 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
8258 && TARGET_LONG_DOUBLE_128 && reload_completed
8259 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8260 || (GET_CODE (operands[0]) == SUBREG
8261 && GET_CODE (SUBREG_REG (operands[0])) == REG
8262 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8263 [(set (match_dup 2) (match_dup 4))
8264 (set (match_dup 3) (match_dup 5))]
8269 #if HOST_BITS_PER_WIDE_INT >= 64
8273 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8274 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8276 operands[2] = gen_lowpart (DImode, operands[0]);
8277 operands[3] = gen_highpart (DImode, operands[0]);
8278 #if HOST_BITS_PER_WIDE_INT >= 64
8279 val = ((HOST_WIDE_INT)(unsigned long)l[0] << 32
8280 | ((HOST_WIDE_INT)(unsigned long)l[1]));
8281 operands[4] = gen_int_mode (val, DImode);
8283 val = ((HOST_WIDE_INT)(unsigned long)l[2] << 32
8284 | ((HOST_WIDE_INT)(unsigned long)l[3]));
8285 operands[5] = gen_int_mode (val, DImode);
8287 operands[4] = immed_double_const (l[1], l[0], DImode);
8288 operands[5] = immed_double_const (l[3], l[2], DImode);
8292 (define_insn "extenddftf2"
8293 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8294 (float_extend:TF (match_operand:DF 1 "gpc_reg_operand" "f")))]
8295 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8296 && TARGET_LONG_DOUBLE_128"
8299 if (REGNO (operands[0]) == REGNO (operands[1]))
8300 return \"fsub %L0,%L0,%L0\";
8302 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8304 [(set_attr "type" "fp")])
8306 (define_insn "extendsftf2"
8307 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8308 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "f")))]
8309 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8310 && TARGET_LONG_DOUBLE_128"
8313 if (REGNO (operands[0]) == REGNO (operands[1]))
8314 return \"fsub %L0,%L0,%L0\";
8316 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8318 [(set_attr "type" "fp")])
8320 (define_insn "trunctfdf2"
8321 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8322 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8323 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8324 && TARGET_LONG_DOUBLE_128"
8326 [(set_attr "type" "fp")
8327 (set_attr "length" "8")])
8329 (define_insn_and_split "trunctfsf2"
8330 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8331 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8332 (clobber (match_scratch:DF 2 "=f"))]
8333 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
8334 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8336 "&& reload_completed"
8338 (float_truncate:DF (match_dup 1)))
8340 (float_truncate:SF (match_dup 2)))]
8343 (define_insn_and_split "floatditf2"
8344 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8345 (float:TF (match_operand:DI 1 "gpc_reg_operand" "*f")))
8346 (clobber (match_scratch:DF 2 "=f"))]
8347 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8348 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8350 "&& reload_completed"
8352 (float:DF (match_dup 1)))
8354 (float_extend:TF (match_dup 2)))]
8357 (define_insn_and_split "floatsitf2"
8358 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8359 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))
8360 (clobber (match_scratch:DF 2 "=f"))]
8361 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8362 && TARGET_LONG_DOUBLE_128"
8364 "&& reload_completed"
8366 (float:DF (match_dup 1)))
8368 (float_extend:TF (match_dup 2)))]
8371 (define_insn_and_split "fix_trunctfdi2"
8372 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
8373 (fix:DI (match_operand:TF 1 "gpc_reg_operand" "f")))
8374 (clobber (match_scratch:DF 2 "=f"))]
8375 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8376 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8378 "&& reload_completed"
8380 (float_truncate:DF (match_dup 1)))
8382 (fix:DI (match_dup 2)))]
8385 (define_insn_and_split "fix_trunctfsi2"
8386 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8387 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8388 (clobber (match_scratch:DF 2 "=f"))]
8389 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8390 && TARGET_LONG_DOUBLE_128"
8392 "&& reload_completed"
8394 (float_truncate:DF (match_dup 1)))
8396 (fix:SI (match_dup 2)))]
8399 (define_insn "negtf2"
8400 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8401 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8402 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8403 && TARGET_LONG_DOUBLE_128"
8406 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8407 return \"fneg %L0,%L1\;fneg %0,%1\";
8409 return \"fneg %0,%1\;fneg %L0,%L1\";
8411 [(set_attr "type" "fp")
8412 (set_attr "length" "8")])
8414 (define_insn "abstf2"
8415 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8416 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8417 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8418 && TARGET_LONG_DOUBLE_128"
8421 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8422 return \"fabs %L0,%L1\;fabs %0,%1\";
8424 return \"fabs %0,%1\;fabs %L0,%L1\";
8426 [(set_attr "type" "fp")
8427 (set_attr "length" "8")])
8430 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8431 (neg:TF (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f"))))]
8432 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8433 && TARGET_LONG_DOUBLE_128"
8436 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8437 return \"fnabs %L0,%L1\;fnabs %0,%1\";
8439 return \"fnabs %0,%1\;fnabs %L0,%L1\";
8441 [(set_attr "type" "fp")
8442 (set_attr "length" "8")])
8444 ;; Next come the multi-word integer load and store and the load and store
8446 (define_expand "movdi"
8447 [(set (match_operand:DI 0 "general_operand" "")
8448 (match_operand:DI 1 "any_operand" ""))]
8450 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8452 (define_insn "*movdi_internal32"
8453 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8454 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8456 && (gpc_reg_operand (operands[0], DImode)
8457 || gpc_reg_operand (operands[1], DImode))"
8460 switch (which_alternative)
8469 return \"fmr %0,%1\";
8471 return \"lfd%U1%X1 %0,%1\";
8473 return \"stfd%U0%X0 %1,%0\";
8482 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")])
8485 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8486 (match_operand:DI 1 "const_int_operand" ""))]
8487 "! TARGET_POWERPC64 && reload_completed"
8488 [(set (match_dup 2) (match_dup 4))
8489 (set (match_dup 3) (match_dup 1))]
8492 HOST_WIDE_INT value = INTVAL (operands[1]);
8493 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8495 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8497 #if HOST_BITS_PER_WIDE_INT == 32
8498 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8500 operands[4] = GEN_INT (value >> 32);
8501 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8506 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8507 (match_operand:DI 1 "const_double_operand" ""))]
8508 "HOST_BITS_PER_WIDE_INT == 32 && ! TARGET_POWERPC64 && reload_completed"
8509 [(set (match_dup 2) (match_dup 4))
8510 (set (match_dup 3) (match_dup 5))]
8513 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8515 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8517 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8518 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8522 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8523 (match_operand:DI 1 "input_operand" ""))]
8524 "reload_completed && !TARGET_POWERPC64
8525 && gpr_or_gpr_p (operands[0], operands[1])"
8526 [(set (match_dup 2) (match_dup 4))
8527 (set (match_dup 3) (match_dup 5))]
8529 rs6000_split_multireg_move (operands);
8533 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8534 (match_operand:TI 1 "const_double_operand" ""))]
8536 [(set (match_dup 2) (match_dup 4))
8537 (set (match_dup 3) (match_dup 5))]
8540 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8542 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8544 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8546 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8547 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8549 else if (GET_CODE (operands[1]) == CONST_INT)
8551 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8552 operands[5] = operands[1];
8558 (define_insn "*movdi_internal64"
8559 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
8560 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8562 && (gpc_reg_operand (operands[0], DImode)
8563 || gpc_reg_operand (operands[1], DImode))"
8578 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8579 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8581 ;; immediate value valid for a single instruction hiding in a const_double
8583 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8584 (match_operand:DI 1 "const_double_operand" "F"))]
8585 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8586 && GET_CODE (operands[1]) == CONST_DOUBLE
8587 && num_insns_constant (operands[1], DImode) == 1"
8590 return ((unsigned HOST_WIDE_INT)
8591 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8592 ? \"li %0,%1\" : \"lis %0,%v1\";
8595 ;; Generate all one-bits and clear left or right.
8596 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8598 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8599 (match_operand:DI 1 "mask64_operand" ""))]
8600 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8601 [(set (match_dup 0) (const_int -1))
8603 (and:DI (rotate:DI (match_dup 0)
8608 ;; Split a load of a large constant into the appropriate five-instruction
8609 ;; sequence. Handle anything in a constant number of insns.
8610 ;; When non-easy constants can go in the TOC, this should use
8611 ;; easy_fp_constant predicate.
8613 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8614 (match_operand:DI 1 "const_int_operand" ""))]
8615 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8616 [(set (match_dup 0) (match_dup 2))
8617 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8619 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8621 if (tem == operands[0])
8628 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8629 (match_operand:DI 1 "const_double_operand" ""))]
8630 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8631 [(set (match_dup 0) (match_dup 2))
8632 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8634 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8636 if (tem == operands[0])
8642 (define_insn "*movdi_internal2"
8643 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8644 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "0,r,r")
8646 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8652 [(set_attr "type" "cmp,compare,cmp")
8653 (set_attr "length" "4,4,8")])
8656 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8657 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8659 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8660 "TARGET_POWERPC64 && reload_completed"
8661 [(set (match_dup 0) (match_dup 1))
8663 (compare:CC (match_dup 0)
8667 ;; TImode is similar, except that we usually want to compute the address into
8668 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8669 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8670 (define_expand "movti"
8671 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8672 (match_operand:TI 1 "general_operand" ""))
8673 (clobber (scratch:SI))])]
8675 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8677 ;; We say that MQ is clobbered in the last alternative because the first
8678 ;; alternative would never get used otherwise since it would need a reload
8679 ;; while the 2nd alternative would not. We put memory cases first so they
8680 ;; are preferred. Otherwise, we'd try to reload the output instead of
8681 ;; giving the SCRATCH mq.
8683 (define_insn "*movti_power"
8684 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8685 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8686 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8687 "TARGET_POWER && ! TARGET_POWERPC64
8688 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8691 switch (which_alternative)
8698 return \"{stsi|stswi} %1,%P0,16\";
8703 /* If the address is not used in the output, we can use lsi. Otherwise,
8704 fall through to generating four loads. */
8706 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8707 return \"{lsi|lswi} %0,%P1,16\";
8708 /* ... fall through ... */
8713 [(set_attr "type" "store,store,*,load,load")])
8715 (define_insn "*movti_string"
8716 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8717 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))]
8718 "! TARGET_POWER && ! TARGET_POWERPC64
8719 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8722 switch (which_alternative)
8728 return \"{stsi|stswi} %1,%P0,16\";
8733 /* If the address is not used in the output, we can use lsi. Otherwise,
8734 fall through to generating four loads. */
8736 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8737 return \"{lsi|lswi} %0,%P1,16\";
8738 /* ... fall through ... */
8743 [(set_attr "type" "store,store,*,load,load")])
8745 (define_insn "*movti_ppc64"
8746 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,m,r")
8747 (match_operand:TI 1 "input_operand" "r,r,o"))]
8748 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8749 || gpc_reg_operand (operands[1], TImode))"
8754 [(set_attr "type" "*,load,store")])
8757 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8758 (match_operand:TI 1 "input_operand" ""))]
8759 "reload_completed && TARGET_POWERPC64
8760 && gpr_or_gpr_p (operands[0], operands[1])"
8761 [(set (match_dup 2) (match_dup 4))
8762 (set (match_dup 3) (match_dup 5))]
8764 rs6000_split_multireg_move (operands);
8768 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8769 (match_operand:TI 1 "input_operand" ""))]
8770 "reload_completed && !TARGET_POWERPC64
8771 && gpr_or_gpr_p (operands[0], operands[1])"
8772 [(set (match_dup 2) (match_dup 6))
8773 (set (match_dup 3) (match_dup 7))
8774 (set (match_dup 4) (match_dup 8))
8775 (set (match_dup 5) (match_dup 9))]
8777 rs6000_split_multireg_move (operands);
8782 (define_expand "load_multiple"
8783 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8784 (match_operand:SI 1 "" ""))
8785 (use (match_operand:SI 2 "" ""))])]
8786 "TARGET_STRING && !TARGET_POWERPC64"
8794 /* Support only loading a constant number of fixed-point registers from
8795 memory and only bother with this if more than two; the machine
8796 doesn't support more than eight. */
8797 if (GET_CODE (operands[2]) != CONST_INT
8798 || INTVAL (operands[2]) <= 2
8799 || INTVAL (operands[2]) > 8
8800 || GET_CODE (operands[1]) != MEM
8801 || GET_CODE (operands[0]) != REG
8802 || REGNO (operands[0]) >= 32)
8805 count = INTVAL (operands[2]);
8806 regno = REGNO (operands[0]);
8808 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8809 op1 = replace_equiv_address (operands[1],
8810 force_reg (SImode, XEXP (operands[1], 0)));
8812 for (i = 0; i < count; i++)
8813 XVECEXP (operands[3], 0, i)
8814 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8815 adjust_address_nv (op1, SImode, i * 4));
8818 (define_insn "*ldmsi8"
8819 [(match_parallel 0 "load_multiple_operation"
8820 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8821 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8822 (set (match_operand:SI 3 "gpc_reg_operand" "")
8823 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8824 (set (match_operand:SI 4 "gpc_reg_operand" "")
8825 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8826 (set (match_operand:SI 5 "gpc_reg_operand" "")
8827 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8828 (set (match_operand:SI 6 "gpc_reg_operand" "")
8829 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8830 (set (match_operand:SI 7 "gpc_reg_operand" "")
8831 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8832 (set (match_operand:SI 8 "gpc_reg_operand" "")
8833 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8834 (set (match_operand:SI 9 "gpc_reg_operand" "")
8835 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8836 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8838 { return rs6000_output_load_multiple (operands); }"
8839 [(set_attr "type" "load")
8840 (set_attr "length" "32")])
8842 (define_insn "*ldmsi7"
8843 [(match_parallel 0 "load_multiple_operation"
8844 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8845 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8846 (set (match_operand:SI 3 "gpc_reg_operand" "")
8847 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8848 (set (match_operand:SI 4 "gpc_reg_operand" "")
8849 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8850 (set (match_operand:SI 5 "gpc_reg_operand" "")
8851 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8852 (set (match_operand:SI 6 "gpc_reg_operand" "")
8853 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8854 (set (match_operand:SI 7 "gpc_reg_operand" "")
8855 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8856 (set (match_operand:SI 8 "gpc_reg_operand" "")
8857 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8858 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8860 { return rs6000_output_load_multiple (operands); }"
8861 [(set_attr "type" "load")
8862 (set_attr "length" "32")])
8864 (define_insn "*ldmsi6"
8865 [(match_parallel 0 "load_multiple_operation"
8866 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8867 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8868 (set (match_operand:SI 3 "gpc_reg_operand" "")
8869 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8870 (set (match_operand:SI 4 "gpc_reg_operand" "")
8871 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8872 (set (match_operand:SI 5 "gpc_reg_operand" "")
8873 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8874 (set (match_operand:SI 6 "gpc_reg_operand" "")
8875 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8876 (set (match_operand:SI 7 "gpc_reg_operand" "")
8877 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8878 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8880 { return rs6000_output_load_multiple (operands); }"
8881 [(set_attr "type" "load")
8882 (set_attr "length" "32")])
8884 (define_insn "*ldmsi5"
8885 [(match_parallel 0 "load_multiple_operation"
8886 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8887 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8888 (set (match_operand:SI 3 "gpc_reg_operand" "")
8889 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8890 (set (match_operand:SI 4 "gpc_reg_operand" "")
8891 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8892 (set (match_operand:SI 5 "gpc_reg_operand" "")
8893 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8894 (set (match_operand:SI 6 "gpc_reg_operand" "")
8895 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8896 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8898 { return rs6000_output_load_multiple (operands); }"
8899 [(set_attr "type" "load")
8900 (set_attr "length" "32")])
8902 (define_insn "*ldmsi4"
8903 [(match_parallel 0 "load_multiple_operation"
8904 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8905 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8906 (set (match_operand:SI 3 "gpc_reg_operand" "")
8907 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8908 (set (match_operand:SI 4 "gpc_reg_operand" "")
8909 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8910 (set (match_operand:SI 5 "gpc_reg_operand" "")
8911 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8912 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8914 { return rs6000_output_load_multiple (operands); }"
8915 [(set_attr "type" "load")
8916 (set_attr "length" "32")])
8918 (define_insn "*ldmsi3"
8919 [(match_parallel 0 "load_multiple_operation"
8920 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8921 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8922 (set (match_operand:SI 3 "gpc_reg_operand" "")
8923 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8924 (set (match_operand:SI 4 "gpc_reg_operand" "")
8925 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8926 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8928 { return rs6000_output_load_multiple (operands); }"
8929 [(set_attr "type" "load")
8930 (set_attr "length" "32")])
8932 (define_expand "store_multiple"
8933 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8934 (match_operand:SI 1 "" ""))
8935 (clobber (scratch:SI))
8936 (use (match_operand:SI 2 "" ""))])]
8937 "TARGET_STRING && !TARGET_POWERPC64"
8946 /* Support only storing a constant number of fixed-point registers to
8947 memory and only bother with this if more than two; the machine
8948 doesn't support more than eight. */
8949 if (GET_CODE (operands[2]) != CONST_INT
8950 || INTVAL (operands[2]) <= 2
8951 || INTVAL (operands[2]) > 8
8952 || GET_CODE (operands[0]) != MEM
8953 || GET_CODE (operands[1]) != REG
8954 || REGNO (operands[1]) >= 32)
8957 count = INTVAL (operands[2]);
8958 regno = REGNO (operands[1]);
8960 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8961 to = force_reg (SImode, XEXP (operands[0], 0));
8962 op0 = replace_equiv_address (operands[0], to);
8964 XVECEXP (operands[3], 0, 0)
8965 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8966 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8967 gen_rtx_SCRATCH (SImode));
8969 for (i = 1; i < count; i++)
8970 XVECEXP (operands[3], 0, i + 1)
8971 = gen_rtx_SET (VOIDmode,
8972 adjust_address_nv (op0, SImode, i * 4),
8973 gen_rtx_REG (SImode, regno + i));
8976 (define_insn "*store_multiple_power"
8977 [(match_parallel 0 "store_multiple_operation"
8978 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8979 (match_operand:SI 2 "gpc_reg_operand" "r"))
8980 (clobber (match_scratch:SI 3 "=q"))])]
8981 "TARGET_STRING && TARGET_POWER"
8982 "{stsi|stswi} %2,%P1,%O0"
8983 [(set_attr "type" "store")])
8985 (define_insn "*stmsi8"
8986 [(match_parallel 0 "store_multiple_operation"
8987 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8988 (match_operand:SI 2 "gpc_reg_operand" "r"))
8989 (clobber (match_scratch:SI 3 "X"))
8990 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8991 (match_operand:SI 4 "gpc_reg_operand" "r"))
8992 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8993 (match_operand:SI 5 "gpc_reg_operand" "r"))
8994 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8995 (match_operand:SI 6 "gpc_reg_operand" "r"))
8996 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8997 (match_operand:SI 7 "gpc_reg_operand" "r"))
8998 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8999 (match_operand:SI 8 "gpc_reg_operand" "r"))
9000 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9001 (match_operand:SI 9 "gpc_reg_operand" "r"))
9002 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9003 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9004 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9005 "{stsi|stswi} %2,%1,%O0"
9006 [(set_attr "type" "store")])
9008 (define_insn "*stmsi7"
9009 [(match_parallel 0 "store_multiple_operation"
9010 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9011 (match_operand:SI 2 "gpc_reg_operand" "r"))
9012 (clobber (match_scratch:SI 3 "X"))
9013 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9014 (match_operand:SI 4 "gpc_reg_operand" "r"))
9015 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9016 (match_operand:SI 5 "gpc_reg_operand" "r"))
9017 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9018 (match_operand:SI 6 "gpc_reg_operand" "r"))
9019 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9020 (match_operand:SI 7 "gpc_reg_operand" "r"))
9021 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9022 (match_operand:SI 8 "gpc_reg_operand" "r"))
9023 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9024 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9025 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9026 "{stsi|stswi} %2,%1,%O0"
9027 [(set_attr "type" "store")])
9029 (define_insn "*stmsi6"
9030 [(match_parallel 0 "store_multiple_operation"
9031 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9032 (match_operand:SI 2 "gpc_reg_operand" "r"))
9033 (clobber (match_scratch:SI 3 "X"))
9034 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9035 (match_operand:SI 4 "gpc_reg_operand" "r"))
9036 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9037 (match_operand:SI 5 "gpc_reg_operand" "r"))
9038 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9039 (match_operand:SI 6 "gpc_reg_operand" "r"))
9040 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9041 (match_operand:SI 7 "gpc_reg_operand" "r"))
9042 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9043 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9044 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9045 "{stsi|stswi} %2,%1,%O0"
9046 [(set_attr "type" "store")])
9048 (define_insn "*stmsi5"
9049 [(match_parallel 0 "store_multiple_operation"
9050 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9051 (match_operand:SI 2 "gpc_reg_operand" "r"))
9052 (clobber (match_scratch:SI 3 "X"))
9053 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9054 (match_operand:SI 4 "gpc_reg_operand" "r"))
9055 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9056 (match_operand:SI 5 "gpc_reg_operand" "r"))
9057 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9058 (match_operand:SI 6 "gpc_reg_operand" "r"))
9059 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9060 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9061 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9062 "{stsi|stswi} %2,%1,%O0"
9063 [(set_attr "type" "store")])
9065 (define_insn "*stmsi4"
9066 [(match_parallel 0 "store_multiple_operation"
9067 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9068 (match_operand:SI 2 "gpc_reg_operand" "r"))
9069 (clobber (match_scratch:SI 3 "X"))
9070 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9071 (match_operand:SI 4 "gpc_reg_operand" "r"))
9072 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9073 (match_operand:SI 5 "gpc_reg_operand" "r"))
9074 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9075 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9076 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9077 "{stsi|stswi} %2,%1,%O0"
9078 [(set_attr "type" "store")])
9080 (define_insn "*stmsi3"
9081 [(match_parallel 0 "store_multiple_operation"
9082 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9083 (match_operand:SI 2 "gpc_reg_operand" "r"))
9084 (clobber (match_scratch:SI 3 "X"))
9085 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9086 (match_operand:SI 4 "gpc_reg_operand" "r"))
9087 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9088 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9089 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9090 "{stsi|stswi} %2,%1,%O0"
9091 [(set_attr "type" "store")])
9093 ;; String/block move insn.
9094 ;; Argument 0 is the destination
9095 ;; Argument 1 is the source
9096 ;; Argument 2 is the length
9097 ;; Argument 3 is the alignment
9099 (define_expand "movstrsi"
9100 [(parallel [(set (match_operand:BLK 0 "" "")
9101 (match_operand:BLK 1 "" ""))
9102 (use (match_operand:SI 2 "" ""))
9103 (use (match_operand:SI 3 "" ""))])]
9107 if (expand_block_move (operands))
9113 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9114 ;; register allocator doesn't have a clue about allocating 8 word registers.
9115 ;; rD/rS = r5 is preferred, efficient form.
9116 (define_expand "movstrsi_8reg"
9117 [(parallel [(set (match_operand 0 "" "")
9118 (match_operand 1 "" ""))
9119 (use (match_operand 2 "" ""))
9120 (use (match_operand 3 "" ""))
9121 (clobber (reg:SI 5))
9122 (clobber (reg:SI 6))
9123 (clobber (reg:SI 7))
9124 (clobber (reg:SI 8))
9125 (clobber (reg:SI 9))
9126 (clobber (reg:SI 10))
9127 (clobber (reg:SI 11))
9128 (clobber (reg:SI 12))
9129 (clobber (match_scratch:SI 4 ""))])]
9134 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9135 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9136 (use (match_operand:SI 2 "immediate_operand" "i"))
9137 (use (match_operand:SI 3 "immediate_operand" "i"))
9138 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9139 (clobber (reg:SI 6))
9140 (clobber (reg:SI 7))
9141 (clobber (reg:SI 8))
9142 (clobber (reg:SI 9))
9143 (clobber (reg:SI 10))
9144 (clobber (reg:SI 11))
9145 (clobber (reg:SI 12))
9146 (clobber (match_scratch:SI 5 "=q"))]
9147 "TARGET_STRING && TARGET_POWER
9148 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9149 || INTVAL (operands[2]) == 0)
9150 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9151 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9152 && REGNO (operands[4]) == 5"
9153 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9154 [(set_attr "type" "load")
9155 (set_attr "length" "8")])
9158 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9159 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9160 (use (match_operand:SI 2 "immediate_operand" "i"))
9161 (use (match_operand:SI 3 "immediate_operand" "i"))
9162 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9163 (clobber (reg:SI 6))
9164 (clobber (reg:SI 7))
9165 (clobber (reg:SI 8))
9166 (clobber (reg:SI 9))
9167 (clobber (reg:SI 10))
9168 (clobber (reg:SI 11))
9169 (clobber (reg:SI 12))
9170 (clobber (match_scratch:SI 5 "X"))]
9171 "TARGET_STRING && ! TARGET_POWER
9172 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9173 || INTVAL (operands[2]) == 0)
9174 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9175 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9176 && REGNO (operands[4]) == 5"
9177 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9178 [(set_attr "type" "load")
9179 (set_attr "length" "8")])
9182 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9183 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9184 (use (match_operand:SI 2 "immediate_operand" "i"))
9185 (use (match_operand:SI 3 "immediate_operand" "i"))
9186 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9187 (clobber (reg:SI 6))
9188 (clobber (reg:SI 7))
9189 (clobber (reg:SI 8))
9190 (clobber (reg:SI 9))
9191 (clobber (reg:SI 10))
9192 (clobber (reg:SI 11))
9193 (clobber (reg:SI 12))
9194 (clobber (match_scratch:SI 5 "X"))]
9195 "TARGET_STRING && TARGET_POWERPC64
9196 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9197 || INTVAL (operands[2]) == 0)
9198 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9199 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9200 && REGNO (operands[4]) == 5"
9201 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9202 [(set_attr "type" "load")
9203 (set_attr "length" "8")])
9205 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9206 ;; register allocator doesn't have a clue about allocating 6 word registers.
9207 ;; rD/rS = r5 is preferred, efficient form.
9208 (define_expand "movstrsi_6reg"
9209 [(parallel [(set (match_operand 0 "" "")
9210 (match_operand 1 "" ""))
9211 (use (match_operand 2 "" ""))
9212 (use (match_operand 3 "" ""))
9213 (clobber (reg:SI 5))
9214 (clobber (reg:SI 6))
9215 (clobber (reg:SI 7))
9216 (clobber (reg:SI 8))
9217 (clobber (reg:SI 9))
9218 (clobber (reg:SI 10))
9219 (clobber (match_scratch:SI 4 ""))])]
9224 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9225 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9226 (use (match_operand:SI 2 "immediate_operand" "i"))
9227 (use (match_operand:SI 3 "immediate_operand" "i"))
9228 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9229 (clobber (reg:SI 6))
9230 (clobber (reg:SI 7))
9231 (clobber (reg:SI 8))
9232 (clobber (reg:SI 9))
9233 (clobber (reg:SI 10))
9234 (clobber (match_scratch:SI 5 "=q"))]
9235 "TARGET_STRING && TARGET_POWER
9236 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9237 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9238 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9239 && REGNO (operands[4]) == 5"
9240 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9241 [(set_attr "type" "load")
9242 (set_attr "length" "8")])
9245 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9246 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9247 (use (match_operand:SI 2 "immediate_operand" "i"))
9248 (use (match_operand:SI 3 "immediate_operand" "i"))
9249 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9250 (clobber (reg:SI 6))
9251 (clobber (reg:SI 7))
9252 (clobber (reg:SI 8))
9253 (clobber (reg:SI 9))
9254 (clobber (reg:SI 10))
9255 (clobber (match_scratch:SI 5 "X"))]
9256 "TARGET_STRING && ! TARGET_POWER
9257 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9258 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9259 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9260 && REGNO (operands[4]) == 5"
9261 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9262 [(set_attr "type" "load")
9263 (set_attr "length" "8")])
9266 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9267 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9268 (use (match_operand:SI 2 "immediate_operand" "i"))
9269 (use (match_operand:SI 3 "immediate_operand" "i"))
9270 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9271 (clobber (reg:SI 6))
9272 (clobber (reg:SI 7))
9273 (clobber (reg:SI 8))
9274 (clobber (reg:SI 9))
9275 (clobber (reg:SI 10))
9276 (clobber (match_scratch:SI 5 "X"))]
9277 "TARGET_STRING && TARGET_POWERPC64
9278 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9279 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9280 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9281 && REGNO (operands[4]) == 5"
9282 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9283 [(set_attr "type" "load")
9284 (set_attr "length" "8")])
9286 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9287 ;; problems with TImode.
9288 ;; rD/rS = r5 is preferred, efficient form.
9289 (define_expand "movstrsi_4reg"
9290 [(parallel [(set (match_operand 0 "" "")
9291 (match_operand 1 "" ""))
9292 (use (match_operand 2 "" ""))
9293 (use (match_operand 3 "" ""))
9294 (clobber (reg:SI 5))
9295 (clobber (reg:SI 6))
9296 (clobber (reg:SI 7))
9297 (clobber (reg:SI 8))
9298 (clobber (match_scratch:SI 4 ""))])]
9303 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9304 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9305 (use (match_operand:SI 2 "immediate_operand" "i"))
9306 (use (match_operand:SI 3 "immediate_operand" "i"))
9307 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9308 (clobber (reg:SI 6))
9309 (clobber (reg:SI 7))
9310 (clobber (reg:SI 8))
9311 (clobber (match_scratch:SI 5 "=q"))]
9312 "TARGET_STRING && TARGET_POWER
9313 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9314 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9315 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9316 && REGNO (operands[4]) == 5"
9317 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9318 [(set_attr "type" "load")
9319 (set_attr "length" "8")])
9322 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9323 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9324 (use (match_operand:SI 2 "immediate_operand" "i"))
9325 (use (match_operand:SI 3 "immediate_operand" "i"))
9326 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9327 (clobber (reg:SI 6))
9328 (clobber (reg:SI 7))
9329 (clobber (reg:SI 8))
9330 (clobber (match_scratch:SI 5 "X"))]
9331 "TARGET_STRING && ! TARGET_POWER
9332 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9333 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9334 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9335 && REGNO (operands[4]) == 5"
9336 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9337 [(set_attr "type" "load")
9338 (set_attr "length" "8")])
9341 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9342 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9343 (use (match_operand:SI 2 "immediate_operand" "i"))
9344 (use (match_operand:SI 3 "immediate_operand" "i"))
9345 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9346 (clobber (reg:SI 6))
9347 (clobber (reg:SI 7))
9348 (clobber (reg:SI 8))
9349 (clobber (match_scratch:SI 5 "X"))]
9350 "TARGET_STRING && TARGET_POWERPC64
9351 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9352 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9353 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9354 && REGNO (operands[4]) == 5"
9355 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9356 [(set_attr "type" "load")
9357 (set_attr "length" "8")])
9359 ;; Move up to 8 bytes at a time.
9360 (define_expand "movstrsi_2reg"
9361 [(parallel [(set (match_operand 0 "" "")
9362 (match_operand 1 "" ""))
9363 (use (match_operand 2 "" ""))
9364 (use (match_operand 3 "" ""))
9365 (clobber (match_scratch:DI 4 ""))
9366 (clobber (match_scratch:SI 5 ""))])]
9367 "TARGET_STRING && ! TARGET_POWERPC64"
9371 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9372 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9373 (use (match_operand:SI 2 "immediate_operand" "i"))
9374 (use (match_operand:SI 3 "immediate_operand" "i"))
9375 (clobber (match_scratch:DI 4 "=&r"))
9376 (clobber (match_scratch:SI 5 "=q"))]
9377 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9378 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9379 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9380 [(set_attr "type" "load")
9381 (set_attr "length" "8")])
9384 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9385 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9386 (use (match_operand:SI 2 "immediate_operand" "i"))
9387 (use (match_operand:SI 3 "immediate_operand" "i"))
9388 (clobber (match_scratch:DI 4 "=&r"))
9389 (clobber (match_scratch:SI 5 "X"))]
9390 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9391 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9392 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9393 [(set_attr "type" "load")
9394 (set_attr "length" "8")])
9396 ;; Move up to 4 bytes at a time.
9397 (define_expand "movstrsi_1reg"
9398 [(parallel [(set (match_operand 0 "" "")
9399 (match_operand 1 "" ""))
9400 (use (match_operand 2 "" ""))
9401 (use (match_operand 3 "" ""))
9402 (clobber (match_scratch:SI 4 ""))
9403 (clobber (match_scratch:SI 5 ""))])]
9408 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9409 (mem:BLK (match_operand:SI 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 "=q"))]
9414 "TARGET_STRING && TARGET_POWER
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 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9422 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9423 (use (match_operand:SI 2 "immediate_operand" "i"))
9424 (use (match_operand:SI 3 "immediate_operand" "i"))
9425 (clobber (match_scratch:SI 4 "=&r"))
9426 (clobber (match_scratch:SI 5 "X"))]
9427 "TARGET_STRING && ! TARGET_POWER
9428 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9429 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9430 [(set_attr "type" "load")
9431 (set_attr "length" "8")])
9434 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9435 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9436 (use (match_operand:SI 2 "immediate_operand" "i"))
9437 (use (match_operand:SI 3 "immediate_operand" "i"))
9438 (clobber (match_scratch:SI 4 "=&r"))
9439 (clobber (match_scratch:SI 5 "X"))]
9440 "TARGET_STRING && TARGET_POWERPC64
9441 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9442 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9443 [(set_attr "type" "load")
9444 (set_attr "length" "8")])
9447 ;; Define insns that do load or store with update. Some of these we can
9448 ;; get by using pre-decrement or pre-increment, but the hardware can also
9449 ;; do cases where the increment is not the size of the object.
9451 ;; In all these cases, we use operands 0 and 1 for the register being
9452 ;; incremented because those are the operands that local-alloc will
9453 ;; tie and these are the pair most likely to be tieable (and the ones
9454 ;; that will benefit the most).
9456 (define_insn "*movdi_update1"
9457 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9458 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9459 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9460 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9461 (plus:DI (match_dup 1) (match_dup 2)))]
9462 "TARGET_POWERPC64 && TARGET_UPDATE"
9466 [(set_attr "type" "load_ux,load_u")])
9468 (define_insn "movdi_update"
9469 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9470 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9471 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9472 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9473 (plus:DI (match_dup 1) (match_dup 2)))]
9474 "TARGET_POWERPC64 && TARGET_UPDATE"
9478 [(set_attr "type" "store_ux,store_u")])
9480 (define_insn "*movsi_update1"
9481 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9482 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9483 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9484 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9485 (plus:SI (match_dup 1) (match_dup 2)))]
9488 {lux|lwzux} %3,%0,%2
9489 {lu|lwzu} %3,%2(%0)"
9490 [(set_attr "type" "load_ux,load_u")])
9492 (define_insn "*movsi_update2"
9493 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9495 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9496 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9497 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9498 (plus:DI (match_dup 1) (match_dup 2)))]
9501 [(set_attr "type" "load_ext_ux")])
9503 (define_insn "movsi_update"
9504 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9505 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9506 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9507 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9508 (plus:SI (match_dup 1) (match_dup 2)))]
9511 {stux|stwux} %3,%0,%2
9512 {stu|stwu} %3,%2(%0)"
9513 [(set_attr "type" "store_ux,store_u")])
9515 (define_insn "*movhi_update1"
9516 [(set (match_operand:HI 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_ux,load_u")])
9527 (define_insn "*movhi_update2"
9528 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9530 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9531 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9532 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9533 (plus:SI (match_dup 1) (match_dup 2)))]
9538 [(set_attr "type" "load_ux,load_u")])
9540 (define_insn "*movhi_update3"
9541 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9543 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9544 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9545 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9546 (plus:SI (match_dup 1) (match_dup 2)))]
9551 [(set_attr "type" "load_ext_ux,load_ext_u")])
9553 (define_insn "*movhi_update4"
9554 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9555 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9556 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9557 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9558 (plus:SI (match_dup 1) (match_dup 2)))]
9563 [(set_attr "type" "store_ux,store_u")])
9565 (define_insn "*movqi_update1"
9566 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9567 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9568 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9569 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9570 (plus:SI (match_dup 1) (match_dup 2)))]
9575 [(set_attr "type" "load_ux,load_u")])
9577 (define_insn "*movqi_update2"
9578 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9580 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9581 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9582 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9583 (plus:SI (match_dup 1) (match_dup 2)))]
9588 [(set_attr "type" "load_ux,load_u")])
9590 (define_insn "*movqi_update3"
9591 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9592 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9593 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9594 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9595 (plus:SI (match_dup 1) (match_dup 2)))]
9600 [(set_attr "type" "store_ux,store_u")])
9602 (define_insn "*movsf_update1"
9603 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9604 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9605 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9606 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9607 (plus:SI (match_dup 1) (match_dup 2)))]
9608 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9612 [(set_attr "type" "fpload_ux,fpload_u")])
9614 (define_insn "*movsf_update2"
9615 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9616 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9617 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9618 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9619 (plus:SI (match_dup 1) (match_dup 2)))]
9620 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9624 [(set_attr "type" "fpstore_ux,fpstore_u")])
9626 (define_insn "*movsf_update3"
9627 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9628 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9629 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9630 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9631 (plus:SI (match_dup 1) (match_dup 2)))]
9632 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9634 {lux|lwzux} %3,%0,%2
9635 {lu|lwzu} %3,%2(%0)"
9636 [(set_attr "type" "load_ux,load_u")])
9638 (define_insn "*movsf_update4"
9639 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9640 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9641 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9642 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9643 (plus:SI (match_dup 1) (match_dup 2)))]
9644 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9646 {stux|stwux} %3,%0,%2
9647 {stu|stwu} %3,%2(%0)"
9648 [(set_attr "type" "store_ux,store_u")])
9650 (define_insn "*movdf_update1"
9651 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9652 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9653 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9654 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9655 (plus:SI (match_dup 1) (match_dup 2)))]
9656 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9660 [(set_attr "type" "fpload_ux,fpload_u")])
9662 (define_insn "*movdf_update2"
9663 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9664 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9665 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9666 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9667 (plus:SI (match_dup 1) (match_dup 2)))]
9668 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9672 [(set_attr "type" "fpstore_ux,fpstore_u")])
9674 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9677 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
9678 (match_operand:DF 1 "memory_operand" ""))
9679 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
9680 (match_operand:DF 3 "memory_operand" ""))]
9682 && TARGET_HARD_FLOAT && TARGET_FPRS
9683 && registers_ok_for_quad_peep (operands[0], operands[2])
9684 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
9685 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
9689 [(set (match_operand:DF 0 "memory_operand" "")
9690 (match_operand:DF 1 "gpc_reg_operand" "f"))
9691 (set (match_operand:DF 2 "memory_operand" "")
9692 (match_operand:DF 3 "gpc_reg_operand" "f"))]
9694 && TARGET_HARD_FLOAT && TARGET_FPRS
9695 && registers_ok_for_quad_peep (operands[1], operands[3])
9696 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
9697 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
9702 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9703 (define_insn "tls_gd_32"
9704 [(set (match_operand:SI 0 "register_operand" "=b")
9705 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9706 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9708 "HAVE_AS_TLS && !TARGET_64BIT"
9709 "addi %0,%1,%2@got@tlsgd")
9711 (define_insn "tls_gd_64"
9712 [(set (match_operand:DI 0 "register_operand" "=b")
9713 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9714 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9716 "HAVE_AS_TLS && TARGET_64BIT"
9717 "addi %0,%1,%2@got@tlsgd")
9719 (define_insn "tls_ld_32"
9720 [(set (match_operand:SI 0 "register_operand" "=b")
9721 (unspec:SI [(match_operand:SI 1 "register_operand" "b")]
9723 "HAVE_AS_TLS && !TARGET_64BIT"
9724 "addi %0,%1,%&@got@tlsld")
9726 (define_insn "tls_ld_64"
9727 [(set (match_operand:DI 0 "register_operand" "=b")
9728 (unspec:DI [(match_operand:DI 1 "register_operand" "b")]
9730 "HAVE_AS_TLS && TARGET_64BIT"
9731 "addi %0,%1,%&@got@tlsld")
9733 (define_insn "tls_dtprel_32"
9734 [(set (match_operand:SI 0 "register_operand" "=r")
9735 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9736 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9738 "HAVE_AS_TLS && !TARGET_64BIT"
9739 "addi %0,%1,%2@dtprel")
9741 (define_insn "tls_dtprel_64"
9742 [(set (match_operand:DI 0 "register_operand" "=r")
9743 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9744 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9746 "HAVE_AS_TLS && TARGET_64BIT"
9747 "addi %0,%1,%2@dtprel")
9749 (define_insn "tls_dtprel_ha_32"
9750 [(set (match_operand:SI 0 "register_operand" "=r")
9751 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9752 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9753 UNSPEC_TLSDTPRELHA))]
9754 "HAVE_AS_TLS && !TARGET_64BIT"
9755 "addis %0,%1,%2@dtprel@ha")
9757 (define_insn "tls_dtprel_ha_64"
9758 [(set (match_operand:DI 0 "register_operand" "=r")
9759 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9760 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9761 UNSPEC_TLSDTPRELHA))]
9762 "HAVE_AS_TLS && TARGET_64BIT"
9763 "addis %0,%1,%2@dtprel@ha")
9765 (define_insn "tls_dtprel_lo_32"
9766 [(set (match_operand:SI 0 "register_operand" "=r")
9767 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9768 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9769 UNSPEC_TLSDTPRELLO))]
9770 "HAVE_AS_TLS && !TARGET_64BIT"
9771 "addi %0,%1,%2@dtprel@l")
9773 (define_insn "tls_dtprel_lo_64"
9774 [(set (match_operand:DI 0 "register_operand" "=r")
9775 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9776 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9777 UNSPEC_TLSDTPRELLO))]
9778 "HAVE_AS_TLS && TARGET_64BIT"
9779 "addi %0,%1,%2@dtprel@l")
9781 (define_insn "tls_got_dtprel_32"
9782 [(set (match_operand:SI 0 "register_operand" "=r")
9783 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9784 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9785 UNSPEC_TLSGOTDTPREL))]
9786 "HAVE_AS_TLS && !TARGET_64BIT"
9787 "lwz %0,%2@got@dtprel(%1)")
9789 (define_insn "tls_got_dtprel_64"
9790 [(set (match_operand:DI 0 "register_operand" "=r")
9791 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9792 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9793 UNSPEC_TLSGOTDTPREL))]
9794 "HAVE_AS_TLS && TARGET_64BIT"
9795 "ld %0,%2@got@dtprel(%1)")
9797 (define_insn "tls_tprel_32"
9798 [(set (match_operand:SI 0 "register_operand" "=r")
9799 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9800 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9802 "HAVE_AS_TLS && !TARGET_64BIT"
9803 "addi %0,%1,%2@tprel")
9805 (define_insn "tls_tprel_64"
9806 [(set (match_operand:DI 0 "register_operand" "=r")
9807 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9808 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9810 "HAVE_AS_TLS && TARGET_64BIT"
9811 "addi %0,%1,%2@tprel")
9813 (define_insn "tls_tprel_ha_32"
9814 [(set (match_operand:SI 0 "register_operand" "=r")
9815 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9816 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9817 UNSPEC_TLSTPRELHA))]
9818 "HAVE_AS_TLS && !TARGET_64BIT"
9819 "addis %0,%1,%2@tprel@ha")
9821 (define_insn "tls_tprel_ha_64"
9822 [(set (match_operand:DI 0 "register_operand" "=r")
9823 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9824 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9825 UNSPEC_TLSTPRELHA))]
9826 "HAVE_AS_TLS && TARGET_64BIT"
9827 "addis %0,%1,%2@tprel@ha")
9829 (define_insn "tls_tprel_lo_32"
9830 [(set (match_operand:SI 0 "register_operand" "=r")
9831 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9832 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9833 UNSPEC_TLSTPRELLO))]
9834 "HAVE_AS_TLS && !TARGET_64BIT"
9835 "addi %0,%1,%2@tprel@l")
9837 (define_insn "tls_tprel_lo_64"
9838 [(set (match_operand:DI 0 "register_operand" "=r")
9839 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9840 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9841 UNSPEC_TLSTPRELLO))]
9842 "HAVE_AS_TLS && TARGET_64BIT"
9843 "addi %0,%1,%2@tprel@l")
9845 ;; "b" output constraint here and on tls_tls input to support linker tls
9846 ;; optimization. The linker may edit the instructions emitted by a
9847 ;; tls_got_tprel/tls_tls pair to addis,addi.
9848 (define_insn "tls_got_tprel_32"
9849 [(set (match_operand:SI 0 "register_operand" "=b")
9850 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9851 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9852 UNSPEC_TLSGOTTPREL))]
9853 "HAVE_AS_TLS && !TARGET_64BIT"
9854 "lwz %0,%2@got@tprel(%1)")
9856 (define_insn "tls_got_tprel_64"
9857 [(set (match_operand:DI 0 "register_operand" "=b")
9858 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9859 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9860 UNSPEC_TLSGOTTPREL))]
9861 "HAVE_AS_TLS && TARGET_64BIT"
9862 "ld %0,%2@got@tprel(%1)")
9864 (define_insn "tls_tls_32"
9865 [(set (match_operand:SI 0 "register_operand" "=r")
9866 (unspec:SI [(match_operand:SI 1 "register_operand" "b")
9867 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9869 "HAVE_AS_TLS && !TARGET_64BIT"
9872 (define_insn "tls_tls_64"
9873 [(set (match_operand:DI 0 "register_operand" "=r")
9874 (unspec:DI [(match_operand:DI 1 "register_operand" "b")
9875 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9877 "HAVE_AS_TLS && TARGET_64BIT"
9880 ;; Next come insns related to the calling sequence.
9882 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9883 ;; We move the back-chain and decrement the stack pointer.
9885 (define_expand "allocate_stack"
9886 [(set (match_operand 0 "gpc_reg_operand" "=r")
9887 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9889 (minus (reg 1) (match_dup 1)))]
9892 { rtx chain = gen_reg_rtx (Pmode);
9893 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9896 emit_move_insn (chain, stack_bot);
9898 /* Check stack bounds if necessary. */
9899 if (current_function_limit_stack)
9902 available = expand_binop (Pmode, sub_optab,
9903 stack_pointer_rtx, stack_limit_rtx,
9904 NULL_RTX, 1, OPTAB_WIDEN);
9905 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9908 if (GET_CODE (operands[1]) != CONST_INT
9909 || INTVAL (operands[1]) < -32767
9910 || INTVAL (operands[1]) > 32768)
9912 neg_op0 = gen_reg_rtx (Pmode);
9914 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9916 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9919 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9922 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
9923 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9927 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9928 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9929 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9932 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9936 ;; These patterns say how to save and restore the stack pointer. We need not
9937 ;; save the stack pointer at function level since we are careful to
9938 ;; preserve the backchain. At block level, we have to restore the backchain
9939 ;; when we restore the stack pointer.
9941 ;; For nonlocal gotos, we must save both the stack pointer and its
9942 ;; backchain and restore both. Note that in the nonlocal case, the
9943 ;; save area is a memory location.
9945 (define_expand "save_stack_function"
9946 [(match_operand 0 "any_operand" "")
9947 (match_operand 1 "any_operand" "")]
9951 (define_expand "restore_stack_function"
9952 [(match_operand 0 "any_operand" "")
9953 (match_operand 1 "any_operand" "")]
9957 (define_expand "restore_stack_block"
9958 [(use (match_operand 0 "register_operand" ""))
9959 (set (match_dup 2) (match_dup 3))
9960 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9961 (set (match_dup 3) (match_dup 2))]
9965 operands[2] = gen_reg_rtx (Pmode);
9966 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9969 (define_expand "save_stack_nonlocal"
9970 [(match_operand 0 "memory_operand" "")
9971 (match_operand 1 "register_operand" "")]
9975 rtx temp = gen_reg_rtx (Pmode);
9977 /* Copy the backchain to the first word, sp to the second. */
9978 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9979 emit_move_insn (operand_subword (operands[0], 0, 0,
9980 (TARGET_32BIT ? DImode : TImode)),
9982 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
9987 (define_expand "restore_stack_nonlocal"
9988 [(match_operand 0 "register_operand" "")
9989 (match_operand 1 "memory_operand" "")]
9993 rtx temp = gen_reg_rtx (Pmode);
9995 /* Restore the backchain from the first word, sp from the second. */
9996 emit_move_insn (temp,
9997 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
9998 emit_move_insn (operands[0],
9999 operand_subword (operands[1], 1, 0,
10000 (TARGET_32BIT ? DImode : TImode)));
10001 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
10005 ;; TOC register handling.
10007 ;; Code to initialize the TOC register...
10009 (define_insn "load_toc_aix_si"
10010 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10011 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10012 (use (reg:SI 2))])]
10013 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10017 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10018 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10019 operands[2] = gen_rtx_REG (Pmode, 2);
10020 return \"{l|lwz} %0,%1(%2)\";
10022 [(set_attr "type" "load")])
10024 (define_insn "load_toc_aix_di"
10025 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10026 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10027 (use (reg:DI 2))])]
10028 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10032 #ifdef TARGET_RELOCATABLE
10033 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10034 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10036 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10039 strcat (buf, \"@toc\");
10040 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10041 operands[2] = gen_rtx_REG (Pmode, 2);
10042 return \"ld %0,%1(%2)\";
10044 [(set_attr "type" "load")])
10046 (define_insn "load_toc_v4_pic_si"
10047 [(set (match_operand:SI 0 "register_operand" "=l")
10048 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10049 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10050 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10051 [(set_attr "type" "branch")
10052 (set_attr "length" "4")])
10054 (define_insn "load_toc_v4_PIC_1"
10055 [(set (match_operand:SI 0 "register_operand" "=l")
10056 (match_operand:SI 1 "immediate_operand" "s"))
10057 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10058 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10059 "bcl 20,31,%1\\n%1:"
10060 [(set_attr "type" "branch")
10061 (set_attr "length" "4")])
10063 (define_insn "load_toc_v4_PIC_1b"
10064 [(set (match_operand:SI 0 "register_operand" "=l")
10065 (match_operand:SI 1 "immediate_operand" "s"))
10066 (use (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")]
10068 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10069 "bcl 20,31,%1+4\\n%1:\\n\\t.long %2-%1"
10070 [(set_attr "type" "branch")
10071 (set_attr "length" "8")])
10073 (define_insn "load_toc_v4_PIC_2"
10074 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10075 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10076 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10077 (match_operand:SI 3 "immediate_operand" "s")))))]
10078 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10079 "{l|lwz} %0,%2-%3(%1)"
10080 [(set_attr "type" "load")])
10082 (define_insn "load_macho_picbase"
10083 [(set (match_operand:SI 0 "register_operand" "=l")
10084 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10086 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
10087 "bcl 20,31,%1\\n%1:"
10088 [(set_attr "type" "branch")
10089 (set_attr "length" "4")])
10091 (define_insn "macho_correct_pic"
10092 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10093 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10094 (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
10095 (match_operand:SI 3 "immediate_operand" "s")]
10096 UNSPEC_MPIC_CORRECT)))]
10097 "DEFAULT_ABI == ABI_DARWIN"
10098 "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
10099 [(set_attr "length" "8")])
10101 ;; If the TOC is shared over a translation unit, as happens with all
10102 ;; the kinds of PIC that we support, we need to restore the TOC
10103 ;; pointer only when jumping over units of translation.
10104 ;; On Darwin, we need to reload the picbase.
10106 (define_expand "builtin_setjmp_receiver"
10107 [(use (label_ref (match_operand 0 "" "")))]
10108 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10109 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10110 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10114 if (DEFAULT_ABI == ABI_DARWIN)
10116 const char *picbase = machopic_function_base_name ();
10117 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10118 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10122 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10123 CODE_LABEL_NUMBER (operands[0]));
10124 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10126 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10127 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10131 rs6000_emit_load_toc_table (FALSE);
10135 ;; A function pointer under AIX is a pointer to a data area whose first word
10136 ;; contains the actual address of the function, whose second word contains a
10137 ;; pointer to its TOC, and whose third word contains a value to place in the
10138 ;; static chain register (r11). Note that if we load the static chain, our
10139 ;; "trampoline" need not have any executable code.
10141 (define_expand "call_indirect_aix32"
10142 [(set (match_dup 2)
10143 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10144 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10147 (mem:SI (plus:SI (match_dup 0)
10150 (mem:SI (plus:SI (match_dup 0)
10152 (parallel [(call (mem:SI (match_dup 2))
10153 (match_operand 1 "" ""))
10157 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10158 (clobber (scratch:SI))])]
10161 { operands[2] = gen_reg_rtx (SImode); }")
10163 (define_expand "call_indirect_aix64"
10164 [(set (match_dup 2)
10165 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10166 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10169 (mem:DI (plus:DI (match_dup 0)
10172 (mem:DI (plus:DI (match_dup 0)
10174 (parallel [(call (mem:SI (match_dup 2))
10175 (match_operand 1 "" ""))
10179 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10180 (clobber (scratch:SI))])]
10183 { operands[2] = gen_reg_rtx (DImode); }")
10185 (define_expand "call_value_indirect_aix32"
10186 [(set (match_dup 3)
10187 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10188 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10191 (mem:SI (plus:SI (match_dup 1)
10194 (mem:SI (plus:SI (match_dup 1)
10196 (parallel [(set (match_operand 0 "" "")
10197 (call (mem:SI (match_dup 3))
10198 (match_operand 2 "" "")))
10202 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10203 (clobber (scratch:SI))])]
10206 { operands[3] = gen_reg_rtx (SImode); }")
10208 (define_expand "call_value_indirect_aix64"
10209 [(set (match_dup 3)
10210 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10211 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10214 (mem:DI (plus:DI (match_dup 1)
10217 (mem:DI (plus:DI (match_dup 1)
10219 (parallel [(set (match_operand 0 "" "")
10220 (call (mem:SI (match_dup 3))
10221 (match_operand 2 "" "")))
10225 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10226 (clobber (scratch:SI))])]
10229 { operands[3] = gen_reg_rtx (DImode); }")
10231 ;; Now the definitions for the call and call_value insns
10232 (define_expand "call"
10233 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10234 (match_operand 1 "" ""))
10235 (use (match_operand 2 "" ""))
10236 (clobber (scratch:SI))])]
10241 if (MACHOPIC_INDIRECT)
10242 operands[0] = machopic_indirect_call_target (operands[0]);
10245 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10248 operands[0] = XEXP (operands[0], 0);
10250 if (GET_CODE (operands[0]) != SYMBOL_REF
10251 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10252 || (INTVAL (operands[2]) & CALL_LONG) != 0)
10254 if (INTVAL (operands[2]) & CALL_LONG)
10255 operands[0] = rs6000_longcall_ref (operands[0]);
10257 if (DEFAULT_ABI == ABI_V4
10258 || DEFAULT_ABI == ABI_DARWIN)
10259 operands[0] = force_reg (Pmode, operands[0]);
10261 else if (DEFAULT_ABI == ABI_AIX)
10263 /* AIX function pointers are really pointers to a three word
10265 emit_call_insn (TARGET_32BIT
10266 ? gen_call_indirect_aix32 (force_reg (SImode,
10269 : gen_call_indirect_aix64 (force_reg (DImode,
10279 (define_expand "call_value"
10280 [(parallel [(set (match_operand 0 "" "")
10281 (call (mem:SI (match_operand 1 "address_operand" ""))
10282 (match_operand 2 "" "")))
10283 (use (match_operand 3 "" ""))
10284 (clobber (scratch:SI))])]
10289 if (MACHOPIC_INDIRECT)
10290 operands[1] = machopic_indirect_call_target (operands[1]);
10293 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10296 operands[1] = XEXP (operands[1], 0);
10298 if (GET_CODE (operands[1]) != SYMBOL_REF
10299 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10300 || (INTVAL (operands[3]) & CALL_LONG) != 0)
10302 if (INTVAL (operands[3]) & CALL_LONG)
10303 operands[1] = rs6000_longcall_ref (operands[1]);
10305 if (DEFAULT_ABI == ABI_V4
10306 || DEFAULT_ABI == ABI_DARWIN)
10307 operands[0] = force_reg (Pmode, operands[0]);
10309 else if (DEFAULT_ABI == ABI_AIX)
10311 /* AIX function pointers are really pointers to a three word
10313 emit_call_insn (TARGET_32BIT
10314 ? gen_call_value_indirect_aix32 (operands[0],
10318 : gen_call_value_indirect_aix64 (operands[0],
10329 ;; Call to function in current module. No TOC pointer reload needed.
10330 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10331 ;; either the function was not prototyped, or it was prototyped as a
10332 ;; variable argument function. It is > 0 if FP registers were passed
10333 ;; and < 0 if they were not.
10335 (define_insn "*call_local32"
10336 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10337 (match_operand 1 "" "g,g"))
10338 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10339 (clobber (match_scratch:SI 3 "=l,l"))]
10340 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10343 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10344 output_asm_insn (\"crxor 6,6,6\", operands);
10346 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10347 output_asm_insn (\"creqv 6,6,6\", operands);
10349 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10351 [(set_attr "type" "branch")
10352 (set_attr "length" "4,8")])
10354 (define_insn "*call_local64"
10355 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10356 (match_operand 1 "" "g,g"))
10357 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10358 (clobber (match_scratch:SI 3 "=l,l"))]
10359 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10362 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10363 output_asm_insn (\"crxor 6,6,6\", operands);
10365 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10366 output_asm_insn (\"creqv 6,6,6\", operands);
10368 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10370 [(set_attr "type" "branch")
10371 (set_attr "length" "4,8")])
10373 (define_insn "*call_value_local32"
10374 [(set (match_operand 0 "" "")
10375 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10376 (match_operand 2 "" "g,g")))
10377 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10378 (clobber (match_scratch:SI 4 "=l,l"))]
10379 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10382 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10383 output_asm_insn (\"crxor 6,6,6\", operands);
10385 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10386 output_asm_insn (\"creqv 6,6,6\", operands);
10388 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10390 [(set_attr "type" "branch")
10391 (set_attr "length" "4,8")])
10394 (define_insn "*call_value_local64"
10395 [(set (match_operand 0 "" "")
10396 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10397 (match_operand 2 "" "g,g")))
10398 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10399 (clobber (match_scratch:SI 4 "=l,l"))]
10400 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10403 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10404 output_asm_insn (\"crxor 6,6,6\", operands);
10406 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10407 output_asm_insn (\"creqv 6,6,6\", operands);
10409 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10411 [(set_attr "type" "branch")
10412 (set_attr "length" "4,8")])
10414 ;; Call to function which may be in another module. Restore the TOC
10415 ;; pointer (r2) after the call unless this is System V.
10416 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10417 ;; either the function was not prototyped, or it was prototyped as a
10418 ;; variable argument function. It is > 0 if FP registers were passed
10419 ;; and < 0 if they were not.
10421 (define_insn "*call_indirect_nonlocal_aix32"
10422 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10423 (match_operand 1 "" "g"))
10427 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10428 (clobber (match_scratch:SI 2 "=l"))]
10429 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10430 "b%T0l\;{l|lwz} 2,20(1)"
10431 [(set_attr "type" "jmpreg")
10432 (set_attr "length" "8")])
10434 (define_insn "*call_nonlocal_aix32"
10435 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10436 (match_operand 1 "" "g"))
10437 (use (match_operand:SI 2 "immediate_operand" "O"))
10438 (clobber (match_scratch:SI 3 "=l"))]
10440 && DEFAULT_ABI == ABI_AIX
10441 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10443 [(set_attr "type" "branch")
10444 (set_attr "length" "8")])
10446 (define_insn "*call_indirect_nonlocal_aix64"
10447 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10448 (match_operand 1 "" "g"))
10452 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10453 (clobber (match_scratch:SI 2 "=l"))]
10454 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10455 "b%T0l\;ld 2,40(1)"
10456 [(set_attr "type" "jmpreg")
10457 (set_attr "length" "8")])
10459 (define_insn "*call_nonlocal_aix64"
10460 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10461 (match_operand 1 "" "g"))
10462 (use (match_operand:SI 2 "immediate_operand" "O"))
10463 (clobber (match_scratch:SI 3 "=l"))]
10465 && DEFAULT_ABI == ABI_AIX
10466 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10468 [(set_attr "type" "branch")
10469 (set_attr "length" "8")])
10471 (define_insn "*call_value_indirect_nonlocal_aix32"
10472 [(set (match_operand 0 "" "")
10473 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10474 (match_operand 2 "" "g")))
10478 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10479 (clobber (match_scratch:SI 3 "=l"))]
10480 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10481 "b%T1l\;{l|lwz} 2,20(1)"
10482 [(set_attr "type" "jmpreg")
10483 (set_attr "length" "8")])
10485 (define_insn "*call_value_nonlocal_aix32"
10486 [(set (match_operand 0 "" "")
10487 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10488 (match_operand 2 "" "g")))
10489 (use (match_operand:SI 3 "immediate_operand" "O"))
10490 (clobber (match_scratch:SI 4 "=l"))]
10492 && DEFAULT_ABI == ABI_AIX
10493 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10495 [(set_attr "type" "branch")
10496 (set_attr "length" "8")])
10498 (define_insn "*call_value_indirect_nonlocal_aix64"
10499 [(set (match_operand 0 "" "")
10500 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10501 (match_operand 2 "" "g")))
10505 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10506 (clobber (match_scratch:SI 3 "=l"))]
10507 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10508 "b%T1l\;ld 2,40(1)"
10509 [(set_attr "type" "jmpreg")
10510 (set_attr "length" "8")])
10512 (define_insn "*call_value_nonlocal_aix64"
10513 [(set (match_operand 0 "" "")
10514 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10515 (match_operand 2 "" "g")))
10516 (use (match_operand:SI 3 "immediate_operand" "O"))
10517 (clobber (match_scratch:SI 4 "=l"))]
10519 && DEFAULT_ABI == ABI_AIX
10520 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10522 [(set_attr "type" "branch")
10523 (set_attr "length" "8")])
10525 ;; A function pointer under System V is just a normal pointer
10526 ;; operands[0] is the function pointer
10527 ;; operands[1] is the stack size to clean up
10528 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10529 ;; which indicates how to set cr1
10531 (define_insn "*call_indirect_nonlocal_sysv"
10532 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10533 (match_operand 1 "" "g,g"))
10534 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10535 (clobber (match_scratch:SI 3 "=l,l"))]
10536 "DEFAULT_ABI == ABI_V4
10537 || DEFAULT_ABI == ABI_DARWIN"
10539 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10540 output_asm_insn ("crxor 6,6,6", operands);
10542 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10543 output_asm_insn ("creqv 6,6,6", operands);
10547 [(set_attr "type" "jmpreg,jmpreg")
10548 (set_attr "length" "4,8")])
10550 (define_insn "*call_nonlocal_sysv"
10551 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10552 (match_operand 1 "" "g,g"))
10553 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10554 (clobber (match_scratch:SI 3 "=l,l"))]
10555 "(DEFAULT_ABI == ABI_V4
10556 || DEFAULT_ABI == ABI_DARWIN)
10557 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10559 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10560 output_asm_insn ("crxor 6,6,6", operands);
10562 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10563 output_asm_insn ("creqv 6,6,6", operands);
10565 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10567 [(set_attr "type" "branch,branch")
10568 (set_attr "length" "4,8")])
10570 (define_insn "*call_value_indirect_nonlocal_sysv"
10571 [(set (match_operand 0 "" "")
10572 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10573 (match_operand 2 "" "g,g")))
10574 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10575 (clobber (match_scratch:SI 4 "=l,l"))]
10576 "DEFAULT_ABI == ABI_V4
10577 || DEFAULT_ABI == ABI_DARWIN"
10579 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10580 output_asm_insn ("crxor 6,6,6", operands);
10582 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10583 output_asm_insn ("creqv 6,6,6", operands);
10587 [(set_attr "type" "jmpreg,jmpreg")
10588 (set_attr "length" "4,8")])
10590 (define_insn "*call_value_nonlocal_sysv"
10591 [(set (match_operand 0 "" "")
10592 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10593 (match_operand 2 "" "g,g")))
10594 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10595 (clobber (match_scratch:SI 4 "=l,l"))]
10596 "(DEFAULT_ABI == ABI_V4
10597 || DEFAULT_ABI == ABI_DARWIN)
10598 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10600 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10601 output_asm_insn ("crxor 6,6,6", operands);
10603 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10604 output_asm_insn ("creqv 6,6,6", operands);
10606 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 && TARGET_HARD_FLOAT
10960 && 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 && TARGET_HARD_FLOAT && TARGET_FPRS
11326 && TARGET_LONG_DOUBLE_128"
11327 "fcmpu %0,%1,%2\;bne %0,$+4\;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 OV/ORDERED bit.
11353 (define_insn "move_from_CR_ov_bit"
11354 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11355 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11357 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11358 [(set_attr "type" "mfcr")
11359 (set_attr "length" "12")])
11362 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11363 (match_operator:DI 1 "scc_comparison_operator"
11364 [(match_operand 2 "cc_reg_operand" "y")
11367 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11368 [(set (attr "type")
11369 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11370 (const_string "mfcrf")
11372 (const_string "mfcr")))
11373 (set_attr "length" "12")])
11376 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11377 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11378 [(match_operand 2 "cc_reg_operand" "y,y")
11381 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11382 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11383 "! TARGET_POWERPC64"
11385 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11387 [(set_attr "type" "delayed_compare")
11388 (set_attr "length" "12,16")])
11391 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11392 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11393 [(match_operand 2 "cc_reg_operand" "")
11396 (set (match_operand:SI 3 "gpc_reg_operand" "")
11397 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11398 "! TARGET_POWERPC64 && reload_completed"
11399 [(set (match_dup 3)
11400 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11402 (compare:CC (match_dup 3)
11407 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11408 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11409 [(match_operand 2 "cc_reg_operand" "y")
11411 (match_operand:SI 3 "const_int_operand" "n")))]
11415 int is_bit = ccr_bit (operands[1], 1);
11416 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11419 if (is_bit >= put_bit)
11420 count = is_bit - put_bit;
11422 count = 32 - (put_bit - is_bit);
11424 operands[4] = GEN_INT (count);
11425 operands[5] = GEN_INT (put_bit);
11427 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11429 [(set (attr "type")
11430 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11431 (const_string "mfcrf")
11433 (const_string "mfcr")))
11434 (set_attr "length" "12")])
11437 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11439 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11440 [(match_operand 2 "cc_reg_operand" "y,y")
11442 (match_operand:SI 3 "const_int_operand" "n,n"))
11444 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11445 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11450 int is_bit = ccr_bit (operands[1], 1);
11451 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11454 /* Force split for non-cc0 compare. */
11455 if (which_alternative == 1)
11458 if (is_bit >= put_bit)
11459 count = is_bit - put_bit;
11461 count = 32 - (put_bit - is_bit);
11463 operands[5] = GEN_INT (count);
11464 operands[6] = GEN_INT (put_bit);
11466 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11468 [(set_attr "type" "delayed_compare")
11469 (set_attr "length" "12,16")])
11472 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11474 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11475 [(match_operand 2 "cc_reg_operand" "")
11477 (match_operand:SI 3 "const_int_operand" ""))
11479 (set (match_operand:SI 4 "gpc_reg_operand" "")
11480 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11483 [(set (match_dup 4)
11484 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11487 (compare:CC (match_dup 4)
11491 ;; There is a 3 cycle delay between consecutive mfcr instructions
11492 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11495 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11496 (match_operator:SI 1 "scc_comparison_operator"
11497 [(match_operand 2 "cc_reg_operand" "y")
11499 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11500 (match_operator:SI 4 "scc_comparison_operator"
11501 [(match_operand 5 "cc_reg_operand" "y")
11503 "REGNO (operands[2]) != REGNO (operands[5])"
11504 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11505 [(set_attr "type" "mfcr")
11506 (set_attr "length" "20")])
11509 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11510 (match_operator:DI 1 "scc_comparison_operator"
11511 [(match_operand 2 "cc_reg_operand" "y")
11513 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11514 (match_operator:DI 4 "scc_comparison_operator"
11515 [(match_operand 5 "cc_reg_operand" "y")
11517 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11518 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11519 [(set_attr "type" "mfcr")
11520 (set_attr "length" "20")])
11522 ;; There are some scc insns that can be done directly, without a compare.
11523 ;; These are faster because they don't involve the communications between
11524 ;; the FXU and branch units. In fact, we will be replacing all of the
11525 ;; integer scc insns here or in the portable methods in emit_store_flag.
11527 ;; Also support (neg (scc ..)) since that construct is used to replace
11528 ;; branches, (plus (scc ..) ..) since that construct is common and
11529 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11530 ;; cases where it is no more expensive than (neg (scc ..)).
11532 ;; Have reload force a constant into a register for the simple insns that
11533 ;; otherwise won't accept constants. We do this because it is faster than
11534 ;; the cmp/mfcr sequence we would otherwise generate.
11537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11538 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11539 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11540 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11541 "! TARGET_POWERPC64"
11543 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11544 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11545 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11546 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11547 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11548 [(set_attr "length" "12,8,12,12,12")])
11551 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11552 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11553 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11554 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11557 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11558 subfic %3,%1,0\;adde %0,%3,%1
11559 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11560 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11561 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11562 [(set_attr "length" "12,8,12,12,12")])
11565 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11567 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11568 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11570 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11571 (eq:SI (match_dup 1) (match_dup 2)))
11572 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11573 "! TARGET_POWERPC64"
11575 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11576 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11577 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11578 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11579 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11585 [(set_attr "type" "compare")
11586 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11589 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11591 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11592 (match_operand:SI 2 "reg_or_cint_operand" ""))
11594 (set (match_operand:SI 0 "gpc_reg_operand" "")
11595 (eq:SI (match_dup 1) (match_dup 2)))
11596 (clobber (match_scratch:SI 3 ""))]
11597 "! TARGET_POWERPC64 && reload_completed"
11598 [(parallel [(set (match_dup 0)
11599 (eq:SI (match_dup 1) (match_dup 2)))
11600 (clobber (match_dup 3))])
11602 (compare:CC (match_dup 0)
11607 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11609 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11610 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11612 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11613 (eq:DI (match_dup 1) (match_dup 2)))
11614 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11617 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11618 subfic %3,%1,0\;adde. %0,%3,%1
11619 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11620 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11621 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11627 [(set_attr "type" "compare")
11628 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11631 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11633 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11634 (match_operand:DI 2 "reg_or_cint_operand" ""))
11636 (set (match_operand:DI 0 "gpc_reg_operand" "")
11637 (eq:DI (match_dup 1) (match_dup 2)))
11638 (clobber (match_scratch:DI 3 ""))]
11639 "TARGET_POWERPC64 && reload_completed"
11640 [(parallel [(set (match_dup 0)
11641 (eq:DI (match_dup 1) (match_dup 2)))
11642 (clobber (match_dup 3))])
11644 (compare:CC (match_dup 0)
11648 ;; We have insns of the form shown by the first define_insn below. If
11649 ;; there is something inside the comparison operation, we must split it.
11651 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11652 (plus:SI (match_operator 1 "comparison_operator"
11653 [(match_operand:SI 2 "" "")
11654 (match_operand:SI 3
11655 "reg_or_cint_operand" "")])
11656 (match_operand:SI 4 "gpc_reg_operand" "")))
11657 (clobber (match_operand:SI 5 "register_operand" ""))]
11658 "! gpc_reg_operand (operands[2], SImode)"
11659 [(set (match_dup 5) (match_dup 2))
11660 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11664 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11665 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11666 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11667 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11668 "! TARGET_POWERPC64"
11670 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11671 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11672 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11673 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11674 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11675 [(set_attr "length" "12,8,12,12,12")])
11678 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11681 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11682 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11683 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11685 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11686 "! TARGET_POWERPC64"
11688 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11689 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11690 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11691 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11692 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11698 [(set_attr "type" "compare")
11699 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11702 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11705 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11706 (match_operand:SI 2 "reg_or_cint_operand" ""))
11707 (match_operand:SI 3 "gpc_reg_operand" ""))
11709 (clobber (match_scratch:SI 4 ""))]
11710 "! TARGET_POWERPC64 && reload_completed"
11711 [(set (match_dup 4)
11712 (plus:SI (eq:SI (match_dup 1)
11716 (compare:CC (match_dup 4)
11721 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11724 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11725 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11726 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11728 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11729 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11730 "! TARGET_POWERPC64"
11732 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11733 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11734 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11735 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11736 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11742 [(set_attr "type" "compare")
11743 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11746 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11749 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11750 (match_operand:SI 2 "reg_or_cint_operand" ""))
11751 (match_operand:SI 3 "gpc_reg_operand" ""))
11753 (set (match_operand:SI 0 "gpc_reg_operand" "")
11754 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11755 "! TARGET_POWERPC64 && reload_completed"
11756 [(set (match_dup 0)
11757 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11759 (compare:CC (match_dup 0)
11764 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11765 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11766 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11767 "! TARGET_POWERPC64"
11769 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11770 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11771 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11772 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11773 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11774 [(set_attr "length" "12,8,12,12,12")])
11776 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11777 ;; since it nabs/sr is just as fast.
11778 (define_insn "*ne0"
11779 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11780 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11782 (clobber (match_scratch:SI 2 "=&r"))]
11783 "! TARGET_POWER && ! TARGET_POWERPC64 && !TARGET_ISEL"
11784 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11785 [(set_attr "length" "8")])
11788 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11789 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11791 (clobber (match_scratch:DI 2 "=&r"))]
11793 "addic %2,%1,-1\;subfe %0,%2,%1"
11794 [(set_attr "length" "8")])
11796 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11798 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11799 (plus:SI (lshiftrt:SI
11800 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11802 (match_operand:SI 2 "gpc_reg_operand" "r")))
11803 (clobber (match_scratch:SI 3 "=&r"))]
11804 "! TARGET_POWERPC64"
11805 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11806 [(set_attr "length" "8")])
11809 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11810 (plus:DI (lshiftrt:DI
11811 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11813 (match_operand:DI 2 "gpc_reg_operand" "r")))
11814 (clobber (match_scratch:DI 3 "=&r"))]
11816 "addic %3,%1,-1\;addze %0,%2"
11817 [(set_attr "length" "8")])
11820 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11822 (plus:SI (lshiftrt:SI
11823 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11825 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11827 (clobber (match_scratch:SI 3 "=&r,&r"))
11828 (clobber (match_scratch:SI 4 "=X,&r"))]
11829 "! TARGET_POWERPC64"
11831 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11833 [(set_attr "type" "compare")
11834 (set_attr "length" "8,12")])
11837 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11839 (plus:SI (lshiftrt:SI
11840 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11842 (match_operand:SI 2 "gpc_reg_operand" ""))
11844 (clobber (match_scratch:SI 3 ""))
11845 (clobber (match_scratch:SI 4 ""))]
11846 "! TARGET_POWERPC64 && reload_completed"
11847 [(parallel [(set (match_dup 3)
11848 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11851 (clobber (match_dup 4))])
11853 (compare:CC (match_dup 3)
11858 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11860 (plus:DI (lshiftrt:DI
11861 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11863 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11865 (clobber (match_scratch:DI 3 "=&r,&r"))]
11868 addic %3,%1,-1\;addze. %3,%2
11870 [(set_attr "type" "compare")
11871 (set_attr "length" "8,12")])
11874 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11876 (plus:DI (lshiftrt:DI
11877 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11879 (match_operand:DI 2 "gpc_reg_operand" ""))
11881 (clobber (match_scratch:DI 3 ""))]
11882 "TARGET_POWERPC64 && reload_completed"
11883 [(set (match_dup 3)
11884 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11888 (compare:CC (match_dup 3)
11893 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11895 (plus:SI (lshiftrt:SI
11896 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11898 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11900 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11901 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11903 (clobber (match_scratch:SI 3 "=&r,&r"))]
11904 "! TARGET_POWERPC64"
11906 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11908 [(set_attr "type" "compare")
11909 (set_attr "length" "8,12")])
11912 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11914 (plus:SI (lshiftrt:SI
11915 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11917 (match_operand:SI 2 "gpc_reg_operand" ""))
11919 (set (match_operand:SI 0 "gpc_reg_operand" "")
11920 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11922 (clobber (match_scratch:SI 3 ""))]
11923 "! TARGET_POWERPC64 && reload_completed"
11924 [(parallel [(set (match_dup 0)
11925 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11927 (clobber (match_dup 3))])
11929 (compare:CC (match_dup 0)
11934 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11936 (plus:DI (lshiftrt:DI
11937 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11939 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11941 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11942 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11944 (clobber (match_scratch:DI 3 "=&r,&r"))]
11947 addic %3,%1,-1\;addze. %0,%2
11949 [(set_attr "type" "compare")
11950 (set_attr "length" "8,12")])
11953 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11955 (plus:DI (lshiftrt:DI
11956 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11958 (match_operand:DI 2 "gpc_reg_operand" ""))
11960 (set (match_operand:DI 0 "gpc_reg_operand" "")
11961 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11963 (clobber (match_scratch:DI 3 ""))]
11964 "TARGET_POWERPC64 && reload_completed"
11965 [(parallel [(set (match_dup 0)
11966 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11968 (clobber (match_dup 3))])
11970 (compare:CC (match_dup 0)
11975 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11976 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11977 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11978 (clobber (match_scratch:SI 3 "=r,X"))]
11981 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11982 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11983 [(set_attr "length" "12")])
11986 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11988 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11989 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11991 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11992 (le:SI (match_dup 1) (match_dup 2)))
11993 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11996 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11997 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12000 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12001 (set_attr "length" "12,12,16,16")])
12004 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12006 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12007 (match_operand:SI 2 "reg_or_short_operand" ""))
12009 (set (match_operand:SI 0 "gpc_reg_operand" "")
12010 (le:SI (match_dup 1) (match_dup 2)))
12011 (clobber (match_scratch:SI 3 ""))]
12012 "TARGET_POWER && reload_completed"
12013 [(parallel [(set (match_dup 0)
12014 (le:SI (match_dup 1) (match_dup 2)))
12015 (clobber (match_dup 3))])
12017 (compare:CC (match_dup 0)
12022 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12023 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12024 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12025 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12028 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12029 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12030 [(set_attr "length" "12")])
12033 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12035 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12036 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12037 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12039 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12042 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12043 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12046 [(set_attr "type" "compare")
12047 (set_attr "length" "12,12,16,16")])
12050 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12052 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12053 (match_operand:SI 2 "reg_or_short_operand" ""))
12054 (match_operand:SI 3 "gpc_reg_operand" ""))
12056 (clobber (match_scratch:SI 4 ""))]
12057 "TARGET_POWER && reload_completed"
12058 [(set (match_dup 4)
12059 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12062 (compare:CC (match_dup 4)
12067 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12069 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12070 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12071 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12073 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12074 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12077 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12078 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12081 [(set_attr "type" "compare")
12082 (set_attr "length" "12,12,16,16")])
12085 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12087 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12088 (match_operand:SI 2 "reg_or_short_operand" ""))
12089 (match_operand:SI 3 "gpc_reg_operand" ""))
12091 (set (match_operand:SI 0 "gpc_reg_operand" "")
12092 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12093 "TARGET_POWER && reload_completed"
12094 [(set (match_dup 0)
12095 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12097 (compare:CC (match_dup 0)
12102 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12103 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12104 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12107 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12108 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12109 [(set_attr "length" "12")])
12112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12113 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12114 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12115 "! TARGET_POWERPC64"
12116 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12117 [(set_attr "length" "12")])
12120 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12121 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12122 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12124 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12125 [(set_attr "length" "12")])
12128 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12130 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12131 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12133 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12134 (leu:DI (match_dup 1) (match_dup 2)))]
12137 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12139 [(set_attr "type" "compare")
12140 (set_attr "length" "12,16")])
12143 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12145 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12146 (match_operand:DI 2 "reg_or_short_operand" ""))
12148 (set (match_operand:DI 0 "gpc_reg_operand" "")
12149 (leu:DI (match_dup 1) (match_dup 2)))]
12150 "TARGET_POWERPC64 && reload_completed"
12151 [(set (match_dup 0)
12152 (leu:DI (match_dup 1) (match_dup 2)))
12154 (compare:CC (match_dup 0)
12159 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12161 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12162 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12164 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12165 (leu:SI (match_dup 1) (match_dup 2)))]
12166 "! TARGET_POWERPC64"
12168 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12170 [(set_attr "type" "compare")
12171 (set_attr "length" "12,16")])
12174 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12176 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12177 (match_operand:SI 2 "reg_or_short_operand" ""))
12179 (set (match_operand:SI 0 "gpc_reg_operand" "")
12180 (leu:SI (match_dup 1) (match_dup 2)))]
12181 "! TARGET_POWERPC64 && reload_completed"
12182 [(set (match_dup 0)
12183 (leu:SI (match_dup 1) (match_dup 2)))
12185 (compare:CC (match_dup 0)
12190 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12192 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12193 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12195 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12196 (leu:DI (match_dup 1) (match_dup 2)))]
12199 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12201 [(set_attr "type" "compare")
12202 (set_attr "length" "12,16")])
12205 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12206 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12207 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12208 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12209 "! TARGET_POWERPC64"
12210 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12211 [(set_attr "length" "8")])
12214 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12216 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12217 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12218 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12220 (clobber (match_scratch:SI 4 "=&r,&r"))]
12221 "! TARGET_POWERPC64"
12223 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12225 [(set_attr "type" "compare")
12226 (set_attr "length" "8,12")])
12229 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12231 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12232 (match_operand:SI 2 "reg_or_short_operand" ""))
12233 (match_operand:SI 3 "gpc_reg_operand" ""))
12235 (clobber (match_scratch:SI 4 ""))]
12236 "! TARGET_POWERPC64 && reload_completed"
12237 [(set (match_dup 4)
12238 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12241 (compare:CC (match_dup 4)
12246 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12248 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12249 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12250 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12252 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12253 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12254 "! TARGET_POWERPC64"
12256 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12258 [(set_attr "type" "compare")
12259 (set_attr "length" "8,12")])
12262 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12264 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12265 (match_operand:SI 2 "reg_or_short_operand" ""))
12266 (match_operand:SI 3 "gpc_reg_operand" ""))
12268 (set (match_operand:SI 0 "gpc_reg_operand" "")
12269 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12270 "! TARGET_POWERPC64 && reload_completed"
12271 [(set (match_dup 0)
12272 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12274 (compare:CC (match_dup 0)
12279 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12280 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12281 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12282 "! TARGET_POWERPC64"
12283 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12284 [(set_attr "length" "12")])
12287 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12289 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12290 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12291 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12292 "! TARGET_POWERPC64"
12293 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12294 [(set_attr "length" "12")])
12297 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12300 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12301 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12302 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12304 (clobber (match_scratch:SI 4 "=&r,&r"))]
12305 "! TARGET_POWERPC64"
12307 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12309 [(set_attr "type" "compare")
12310 (set_attr "length" "12,16")])
12313 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12316 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12317 (match_operand:SI 2 "reg_or_short_operand" "")))
12318 (match_operand:SI 3 "gpc_reg_operand" ""))
12320 (clobber (match_scratch:SI 4 ""))]
12321 "! TARGET_POWERPC64 && reload_completed"
12322 [(set (match_dup 4)
12323 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12326 (compare:CC (match_dup 4)
12331 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12334 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12335 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12336 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12338 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12339 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12340 "! TARGET_POWERPC64"
12342 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12344 [(set_attr "type" "compare")
12345 (set_attr "length" "12,16")])
12348 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12351 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12352 (match_operand:SI 2 "reg_or_short_operand" "")))
12353 (match_operand:SI 3 "gpc_reg_operand" ""))
12355 (set (match_operand:SI 0 "gpc_reg_operand" "")
12356 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12357 "! TARGET_POWERPC64 && reload_completed"
12358 [(set (match_dup 0)
12359 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12362 (compare:CC (match_dup 0)
12367 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12368 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12369 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12371 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12372 [(set_attr "length" "12")])
12375 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12377 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12378 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12380 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12381 (lt:SI (match_dup 1) (match_dup 2)))]
12384 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12386 [(set_attr "type" "delayed_compare")
12387 (set_attr "length" "12,16")])
12390 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12392 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12393 (match_operand:SI 2 "reg_or_short_operand" ""))
12395 (set (match_operand:SI 0 "gpc_reg_operand" "")
12396 (lt:SI (match_dup 1) (match_dup 2)))]
12397 "TARGET_POWER && reload_completed"
12398 [(set (match_dup 0)
12399 (lt:SI (match_dup 1) (match_dup 2)))
12401 (compare:CC (match_dup 0)
12406 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12407 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12408 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12409 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12411 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12412 [(set_attr "length" "12")])
12415 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12417 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12418 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12419 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12421 (clobber (match_scratch:SI 4 "=&r,&r"))]
12424 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12426 [(set_attr "type" "compare")
12427 (set_attr "length" "12,16")])
12430 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12432 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12433 (match_operand:SI 2 "reg_or_short_operand" ""))
12434 (match_operand:SI 3 "gpc_reg_operand" ""))
12436 (clobber (match_scratch:SI 4 ""))]
12437 "TARGET_POWER && reload_completed"
12438 [(set (match_dup 4)
12439 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12442 (compare:CC (match_dup 4)
12447 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12449 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12450 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12451 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12453 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12454 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12457 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12459 [(set_attr "type" "compare")
12460 (set_attr "length" "12,16")])
12463 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12465 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12466 (match_operand:SI 2 "reg_or_short_operand" ""))
12467 (match_operand:SI 3 "gpc_reg_operand" ""))
12469 (set (match_operand:SI 0 "gpc_reg_operand" "")
12470 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12471 "TARGET_POWER && reload_completed"
12472 [(set (match_dup 0)
12473 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12475 (compare:CC (match_dup 0)
12480 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12481 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12482 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12484 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12485 [(set_attr "length" "12")])
12488 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12489 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12490 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12491 "! TARGET_POWERPC64"
12493 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12494 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12495 [(set_attr "length" "12")])
12498 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12500 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12501 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12503 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12504 (ltu:SI (match_dup 1) (match_dup 2)))]
12505 "! TARGET_POWERPC64"
12507 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12508 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12511 [(set_attr "type" "compare")
12512 (set_attr "length" "12,12,16,16")])
12515 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12517 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12518 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12520 (set (match_operand:SI 0 "gpc_reg_operand" "")
12521 (ltu:SI (match_dup 1) (match_dup 2)))]
12522 "! TARGET_POWERPC64 && reload_completed"
12523 [(set (match_dup 0)
12524 (ltu:SI (match_dup 1) (match_dup 2)))
12526 (compare:CC (match_dup 0)
12531 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12532 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12533 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12534 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12535 "! TARGET_POWERPC64"
12537 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12538 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12539 [(set_attr "length" "12")])
12542 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12544 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12545 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12546 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12548 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12549 "! TARGET_POWERPC64"
12551 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12552 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12555 [(set_attr "type" "compare")
12556 (set_attr "length" "12,12,16,16")])
12559 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12561 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12562 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12563 (match_operand:SI 3 "gpc_reg_operand" ""))
12565 (clobber (match_scratch:SI 4 ""))]
12566 "! TARGET_POWERPC64 && reload_completed"
12567 [(set (match_dup 4)
12568 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12571 (compare:CC (match_dup 4)
12576 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12578 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12579 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12580 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12582 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12583 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12584 "! TARGET_POWERPC64"
12586 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12587 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12590 [(set_attr "type" "compare")
12591 (set_attr "length" "12,12,16,16")])
12594 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12596 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12597 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12598 (match_operand:SI 3 "gpc_reg_operand" ""))
12600 (set (match_operand:SI 0 "gpc_reg_operand" "")
12601 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12602 "! TARGET_POWERPC64 && reload_completed"
12603 [(set (match_dup 0)
12604 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12606 (compare:CC (match_dup 0)
12611 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12612 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12613 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12614 "! TARGET_POWERPC64"
12616 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12617 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12618 [(set_attr "length" "8")])
12621 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12622 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12623 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12624 (clobber (match_scratch:SI 3 "=r"))]
12626 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12627 [(set_attr "length" "12")])
12630 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12632 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12633 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12635 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12636 (ge:SI (match_dup 1) (match_dup 2)))
12637 (clobber (match_scratch:SI 3 "=r,r"))]
12640 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12642 [(set_attr "type" "compare")
12643 (set_attr "length" "12,16")])
12646 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12648 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12649 (match_operand:SI 2 "reg_or_short_operand" ""))
12651 (set (match_operand:SI 0 "gpc_reg_operand" "")
12652 (ge:SI (match_dup 1) (match_dup 2)))
12653 (clobber (match_scratch:SI 3 ""))]
12654 "TARGET_POWER && reload_completed"
12655 [(parallel [(set (match_dup 0)
12656 (ge:SI (match_dup 1) (match_dup 2)))
12657 (clobber (match_dup 3))])
12659 (compare:CC (match_dup 0)
12664 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12665 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12666 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12667 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12669 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12670 [(set_attr "length" "12")])
12673 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12675 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12676 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12677 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12679 (clobber (match_scratch:SI 4 "=&r,&r"))]
12682 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12684 [(set_attr "type" "compare")
12685 (set_attr "length" "12,16")])
12688 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12690 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12691 (match_operand:SI 2 "reg_or_short_operand" ""))
12692 (match_operand:SI 3 "gpc_reg_operand" ""))
12694 (clobber (match_scratch:SI 4 ""))]
12695 "TARGET_POWER && reload_completed"
12696 [(set (match_dup 4)
12697 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12700 (compare:CC (match_dup 4)
12705 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12707 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12708 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12709 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12711 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12712 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12715 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12717 [(set_attr "type" "compare")
12718 (set_attr "length" "12,16")])
12721 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12723 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12724 (match_operand:SI 2 "reg_or_short_operand" ""))
12725 (match_operand:SI 3 "gpc_reg_operand" ""))
12727 (set (match_operand:SI 0 "gpc_reg_operand" "")
12728 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12729 "TARGET_POWER && reload_completed"
12730 [(set (match_dup 0)
12731 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12733 (compare:CC (match_dup 0)
12738 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12739 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12740 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12742 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12743 [(set_attr "length" "12")])
12746 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12747 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12748 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12749 "! TARGET_POWERPC64"
12751 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12752 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12753 [(set_attr "length" "12")])
12756 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12757 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12758 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12761 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12762 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12763 [(set_attr "length" "12")])
12766 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12768 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12769 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12771 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12772 (geu:SI (match_dup 1) (match_dup 2)))]
12773 "! TARGET_POWERPC64"
12775 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12776 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12779 [(set_attr "type" "compare")
12780 (set_attr "length" "12,12,16,16")])
12783 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12785 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12786 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12788 (set (match_operand:SI 0 "gpc_reg_operand" "")
12789 (geu:SI (match_dup 1) (match_dup 2)))]
12790 "! TARGET_POWERPC64 && reload_completed"
12791 [(set (match_dup 0)
12792 (geu:SI (match_dup 1) (match_dup 2)))
12794 (compare:CC (match_dup 0)
12799 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12801 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12802 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12804 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12805 (geu:DI (match_dup 1) (match_dup 2)))]
12808 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12809 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12812 [(set_attr "type" "compare")
12813 (set_attr "length" "12,12,16,16")])
12816 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12818 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12819 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12821 (set (match_operand:DI 0 "gpc_reg_operand" "")
12822 (geu:DI (match_dup 1) (match_dup 2)))]
12823 "TARGET_POWERPC64 && reload_completed"
12824 [(set (match_dup 0)
12825 (geu:DI (match_dup 1) (match_dup 2)))
12827 (compare:CC (match_dup 0)
12832 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12833 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12834 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12835 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12836 "! TARGET_POWERPC64"
12838 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12839 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12840 [(set_attr "length" "8")])
12843 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12845 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12846 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12847 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12849 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12850 "! TARGET_POWERPC64"
12852 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12853 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12856 [(set_attr "type" "compare")
12857 (set_attr "length" "8,8,12,12")])
12860 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12862 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12863 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12864 (match_operand:SI 3 "gpc_reg_operand" ""))
12866 (clobber (match_scratch:SI 4 ""))]
12867 "! TARGET_POWERPC64 && reload_completed"
12868 [(set (match_dup 4)
12869 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12872 (compare:CC (match_dup 4)
12877 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12879 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12880 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12881 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12883 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12884 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12885 "! TARGET_POWERPC64"
12887 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12888 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12891 [(set_attr "type" "compare")
12892 (set_attr "length" "8,8,12,12")])
12895 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12897 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12898 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12899 (match_operand:SI 3 "gpc_reg_operand" ""))
12901 (set (match_operand:SI 0 "gpc_reg_operand" "")
12902 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12903 "! TARGET_POWERPC64 && reload_completed"
12904 [(set (match_dup 0)
12905 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12907 (compare:CC (match_dup 0)
12912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12913 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12914 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12915 "! TARGET_POWERPC64"
12917 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12918 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12919 [(set_attr "length" "12")])
12922 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12924 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12925 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12926 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12927 "! TARGET_POWERPC64"
12929 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12930 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12931 [(set_attr "length" "12")])
12934 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12937 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12938 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12939 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12941 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12942 "! TARGET_POWERPC64"
12944 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12945 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12948 [(set_attr "type" "compare")
12949 (set_attr "length" "12,12,16,16")])
12952 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12955 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12956 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12957 (match_operand:SI 3 "gpc_reg_operand" ""))
12959 (clobber (match_scratch:SI 4 ""))]
12960 "! TARGET_POWERPC64 && reload_completed"
12961 [(set (match_dup 4)
12962 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12965 (compare:CC (match_dup 4)
12970 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12973 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12974 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12975 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12977 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12978 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12979 "! TARGET_POWERPC64"
12981 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12982 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12985 [(set_attr "type" "compare")
12986 (set_attr "length" "12,12,16,16")])
12989 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12992 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12993 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12994 (match_operand:SI 3 "gpc_reg_operand" ""))
12996 (set (match_operand:SI 0 "gpc_reg_operand" "")
12997 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12998 "! TARGET_POWERPC64 && reload_completed"
12999 [(set (match_dup 0)
13000 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13002 (compare:CC (match_dup 0)
13007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13008 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13010 "! TARGET_POWERPC64"
13011 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
13012 [(set_attr "length" "12")])
13015 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13016 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13019 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
13020 [(set_attr "length" "12")])
13023 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13025 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13028 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13029 (gt:SI (match_dup 1) (const_int 0)))]
13030 "! TARGET_POWERPC64"
13032 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
13034 [(set_attr "type" "delayed_compare")
13035 (set_attr "length" "12,16")])
13038 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13040 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13043 (set (match_operand:SI 0 "gpc_reg_operand" "")
13044 (gt:SI (match_dup 1) (const_int 0)))]
13045 "! TARGET_POWERPC64 && reload_completed"
13046 [(set (match_dup 0)
13047 (gt:SI (match_dup 1) (const_int 0)))
13049 (compare:CC (match_dup 0)
13054 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13056 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13059 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13060 (gt:DI (match_dup 1) (const_int 0)))]
13063 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
13065 [(set_attr "type" "delayed_compare")
13066 (set_attr "length" "12,16")])
13069 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13071 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13074 (set (match_operand:DI 0 "gpc_reg_operand" "")
13075 (gt:DI (match_dup 1) (const_int 0)))]
13076 "TARGET_POWERPC64 && reload_completed"
13077 [(set (match_dup 0)
13078 (gt:DI (match_dup 1) (const_int 0)))
13080 (compare:CC (match_dup 0)
13085 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13086 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13087 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13089 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13090 [(set_attr "length" "12")])
13093 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13095 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13096 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13098 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13099 (gt:SI (match_dup 1) (match_dup 2)))]
13102 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13104 [(set_attr "type" "delayed_compare")
13105 (set_attr "length" "12,16")])
13108 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13110 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13111 (match_operand:SI 2 "reg_or_short_operand" ""))
13113 (set (match_operand:SI 0 "gpc_reg_operand" "")
13114 (gt:SI (match_dup 1) (match_dup 2)))]
13115 "TARGET_POWER && reload_completed"
13116 [(set (match_dup 0)
13117 (gt:SI (match_dup 1) (match_dup 2)))
13119 (compare:CC (match_dup 0)
13124 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13125 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13127 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13128 "! TARGET_POWERPC64"
13129 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13130 [(set_attr "length" "12")])
13133 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13134 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13136 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13138 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13139 [(set_attr "length" "12")])
13142 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13144 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13146 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13148 (clobber (match_scratch:SI 3 "=&r,&r"))]
13149 "! TARGET_POWERPC64"
13151 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13153 [(set_attr "type" "compare")
13154 (set_attr "length" "12,16")])
13157 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13159 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13161 (match_operand:SI 2 "gpc_reg_operand" ""))
13163 (clobber (match_scratch:SI 3 ""))]
13164 "! TARGET_POWERPC64 && reload_completed"
13165 [(set (match_dup 3)
13166 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13169 (compare:CC (match_dup 3)
13174 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13176 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13178 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13180 (clobber (match_scratch:DI 3 "=&r,&r"))]
13183 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13185 [(set_attr "type" "compare")
13186 (set_attr "length" "12,16")])
13189 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13191 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13193 (match_operand:DI 2 "gpc_reg_operand" ""))
13195 (clobber (match_scratch:DI 3 ""))]
13196 "TARGET_POWERPC64 && reload_completed"
13197 [(set (match_dup 3)
13198 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13201 (compare:CC (match_dup 3)
13206 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13208 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13210 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13212 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13213 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13214 "! TARGET_POWERPC64"
13216 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13218 [(set_attr "type" "compare")
13219 (set_attr "length" "12,16")])
13222 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13224 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13226 (match_operand:SI 2 "gpc_reg_operand" ""))
13228 (set (match_operand:SI 0 "gpc_reg_operand" "")
13229 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13230 "! TARGET_POWERPC64 && reload_completed"
13231 [(set (match_dup 0)
13232 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13234 (compare:CC (match_dup 0)
13239 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13241 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13243 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13245 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13246 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13249 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13251 [(set_attr "type" "compare")
13252 (set_attr "length" "12,16")])
13255 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13257 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13259 (match_operand:DI 2 "gpc_reg_operand" ""))
13261 (set (match_operand:DI 0 "gpc_reg_operand" "")
13262 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13263 "TARGET_POWERPC64 && reload_completed"
13264 [(set (match_dup 0)
13265 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13267 (compare:CC (match_dup 0)
13272 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13273 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13274 (match_operand:SI 2 "reg_or_short_operand" "r"))
13275 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13277 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13278 [(set_attr "length" "12")])
13281 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13283 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13284 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13285 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13287 (clobber (match_scratch:SI 4 "=&r,&r"))]
13290 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13292 [(set_attr "type" "compare")
13293 (set_attr "length" "12,16")])
13296 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13298 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13299 (match_operand:SI 2 "reg_or_short_operand" ""))
13300 (match_operand:SI 3 "gpc_reg_operand" ""))
13302 (clobber (match_scratch:SI 4 ""))]
13303 "TARGET_POWER && reload_completed"
13304 [(set (match_dup 4)
13305 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13307 (compare:CC (match_dup 4)
13312 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13314 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13315 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13316 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13318 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13319 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13322 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13324 [(set_attr "type" "compare")
13325 (set_attr "length" "12,16")])
13328 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13330 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13331 (match_operand:SI 2 "reg_or_short_operand" ""))
13332 (match_operand:SI 3 "gpc_reg_operand" ""))
13334 (set (match_operand:SI 0 "gpc_reg_operand" "")
13335 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13336 "TARGET_POWER && reload_completed"
13337 [(set (match_dup 0)
13338 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13340 (compare:CC (match_dup 0)
13345 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13346 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13348 "! TARGET_POWERPC64"
13349 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13350 [(set_attr "length" "12")])
13353 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13354 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13357 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13358 [(set_attr "length" "12")])
13361 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13362 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13363 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13365 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13366 [(set_attr "length" "12")])
13369 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13370 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13371 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13372 "! TARGET_POWERPC64"
13373 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13374 [(set_attr "length" "12")])
13377 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13378 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13379 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13381 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13382 [(set_attr "length" "12")])
13385 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13387 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13388 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13390 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13391 (gtu:SI (match_dup 1) (match_dup 2)))]
13392 "! TARGET_POWERPC64"
13394 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13396 [(set_attr "type" "compare")
13397 (set_attr "length" "12,16")])
13400 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13402 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13403 (match_operand:SI 2 "reg_or_short_operand" ""))
13405 (set (match_operand:SI 0 "gpc_reg_operand" "")
13406 (gtu:SI (match_dup 1) (match_dup 2)))]
13407 "! TARGET_POWERPC64 && reload_completed"
13408 [(set (match_dup 0)
13409 (gtu:SI (match_dup 1) (match_dup 2)))
13411 (compare:CC (match_dup 0)
13416 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13418 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13419 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13421 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13422 (gtu:DI (match_dup 1) (match_dup 2)))]
13425 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13427 [(set_attr "type" "compare")
13428 (set_attr "length" "12,16")])
13431 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13433 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13434 (match_operand:DI 2 "reg_or_short_operand" ""))
13436 (set (match_operand:DI 0 "gpc_reg_operand" "")
13437 (gtu:DI (match_dup 1) (match_dup 2)))]
13438 "TARGET_POWERPC64 && reload_completed"
13439 [(set (match_dup 0)
13440 (gtu:DI (match_dup 1) (match_dup 2)))
13442 (compare:CC (match_dup 0)
13447 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13448 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13449 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13450 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13451 "! TARGET_POWERPC64"
13453 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13454 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13455 [(set_attr "length" "8,12")])
13458 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13459 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13460 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13461 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13464 addic %0,%1,%k2\;addze %0,%3
13465 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13466 [(set_attr "length" "8,12")])
13469 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13471 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13472 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13473 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13475 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13476 "! TARGET_POWERPC64"
13478 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13479 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13482 [(set_attr "type" "compare")
13483 (set_attr "length" "8,12,12,16")])
13486 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13488 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13489 (match_operand:SI 2 "reg_or_short_operand" ""))
13490 (match_operand:SI 3 "gpc_reg_operand" ""))
13492 (clobber (match_scratch:SI 4 ""))]
13493 "! TARGET_POWERPC64 && reload_completed"
13494 [(set (match_dup 4)
13495 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13498 (compare:CC (match_dup 4)
13503 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13505 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13506 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13507 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13509 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13512 addic %4,%1,%k2\;addze. %4,%3
13513 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13516 [(set_attr "type" "compare")
13517 (set_attr "length" "8,12,12,16")])
13520 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13522 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13523 (match_operand:DI 2 "reg_or_short_operand" ""))
13524 (match_operand:DI 3 "gpc_reg_operand" ""))
13526 (clobber (match_scratch:DI 4 ""))]
13527 "TARGET_POWERPC64 && reload_completed"
13528 [(set (match_dup 4)
13529 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13532 (compare:CC (match_dup 4)
13537 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13539 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13540 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13541 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13543 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13544 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13545 "! TARGET_POWERPC64"
13547 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13548 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13551 [(set_attr "type" "compare")
13552 (set_attr "length" "8,12,12,16")])
13555 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13557 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13558 (match_operand:SI 2 "reg_or_short_operand" ""))
13559 (match_operand:SI 3 "gpc_reg_operand" ""))
13561 (set (match_operand:SI 0 "gpc_reg_operand" "")
13562 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13563 "! TARGET_POWERPC64 && reload_completed"
13564 [(set (match_dup 0)
13565 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13567 (compare:CC (match_dup 0)
13572 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13574 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13575 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13576 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13578 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13579 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13582 addic %0,%1,%k2\;addze. %0,%3
13583 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13586 [(set_attr "type" "compare")
13587 (set_attr "length" "8,12,12,16")])
13590 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13592 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13593 (match_operand:DI 2 "reg_or_short_operand" ""))
13594 (match_operand:DI 3 "gpc_reg_operand" ""))
13596 (set (match_operand:DI 0 "gpc_reg_operand" "")
13597 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13598 "TARGET_POWERPC64 && reload_completed"
13599 [(set (match_dup 0)
13600 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13602 (compare:CC (match_dup 0)
13607 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13608 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13609 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13610 "! TARGET_POWERPC64"
13611 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13612 [(set_attr "length" "8")])
13615 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13616 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13617 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13619 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13620 [(set_attr "length" "8")])
13622 ;; Define both directions of branch and return. If we need a reload
13623 ;; register, we'd rather use CR0 since it is much easier to copy a
13624 ;; register CC value to there.
13628 (if_then_else (match_operator 1 "branch_comparison_operator"
13630 "cc_reg_operand" "y")
13632 (label_ref (match_operand 0 "" ""))
13637 return output_cbranch (operands[1], \"%l0\", 0, insn);
13639 [(set_attr "type" "branch")])
13643 (if_then_else (match_operator 0 "branch_comparison_operator"
13645 "cc_reg_operand" "y")
13652 return output_cbranch (operands[0], NULL, 0, insn);
13654 [(set_attr "type" "branch")
13655 (set_attr "length" "4")])
13659 (if_then_else (match_operator 1 "branch_comparison_operator"
13661 "cc_reg_operand" "y")
13664 (label_ref (match_operand 0 "" ""))))]
13668 return output_cbranch (operands[1], \"%l0\", 1, insn);
13670 [(set_attr "type" "branch")])
13674 (if_then_else (match_operator 0 "branch_comparison_operator"
13676 "cc_reg_operand" "y")
13683 return output_cbranch (operands[0], NULL, 1, insn);
13685 [(set_attr "type" "branch")
13686 (set_attr "length" "4")])
13688 ;; Logic on condition register values.
13690 ; This pattern matches things like
13691 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13692 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13694 ; which are generated by the branch logic.
13695 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13698 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13699 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13700 [(match_operator:SI 2
13701 "branch_positive_comparison_operator"
13703 "cc_reg_operand" "y,y")
13705 (match_operator:SI 4
13706 "branch_positive_comparison_operator"
13708 "cc_reg_operand" "0,y")
13712 "cr%q1 %E0,%j2,%j4"
13713 [(set_attr "type" "cr_logical,delayed_cr")])
13715 ; Why is the constant -1 here, but 1 in the previous pattern?
13716 ; Because ~1 has all but the low bit set.
13718 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13719 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13720 [(not:SI (match_operator:SI 2
13721 "branch_positive_comparison_operator"
13723 "cc_reg_operand" "y,y")
13725 (match_operator:SI 4
13726 "branch_positive_comparison_operator"
13728 "cc_reg_operand" "0,y")
13732 "cr%q1 %E0,%j2,%j4"
13733 [(set_attr "type" "cr_logical,delayed_cr")])
13736 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13737 (compare:CCEQ (match_operator:SI 1
13738 "branch_positive_comparison_operator"
13740 "cc_reg_operand" "0,y")
13744 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13745 [(set_attr "type" "cr_logical,delayed_cr")])
13747 ;; If we are comparing the result of two comparisons, this can be done
13748 ;; using creqv or crxor.
13750 (define_insn_and_split ""
13751 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13752 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13753 [(match_operand 2 "cc_reg_operand" "y")
13755 (match_operator 3 "branch_comparison_operator"
13756 [(match_operand 4 "cc_reg_operand" "y")
13761 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13765 int positive_1, positive_2;
13767 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13768 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13771 operands[1] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[2]),
13772 GET_CODE (operands[1])),
13774 operands[2], const0_rtx);
13775 else if (GET_MODE (operands[1]) != SImode)
13776 operands[1] = gen_rtx (GET_CODE (operands[1]),
13778 operands[2], const0_rtx);
13781 operands[3] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[4]),
13782 GET_CODE (operands[3])),
13784 operands[4], const0_rtx);
13785 else if (GET_MODE (operands[3]) != SImode)
13786 operands[3] = gen_rtx (GET_CODE (operands[3]),
13788 operands[4], const0_rtx);
13790 if (positive_1 == positive_2)
13792 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13793 operands[5] = constm1_rtx;
13797 operands[5] = const1_rtx;
13801 ;; Unconditional branch and return.
13803 (define_insn "jump"
13805 (label_ref (match_operand 0 "" "")))]
13808 [(set_attr "type" "branch")])
13810 (define_insn "return"
13814 [(set_attr "type" "jmpreg")])
13816 (define_expand "indirect_jump"
13817 [(set (pc) (match_operand 0 "register_operand" ""))]
13822 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13824 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13828 (define_insn "indirect_jumpsi"
13829 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13834 [(set_attr "type" "jmpreg")])
13836 (define_insn "indirect_jumpdi"
13837 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13842 [(set_attr "type" "jmpreg")])
13844 ;; Table jump for switch statements:
13845 (define_expand "tablejump"
13846 [(use (match_operand 0 "" ""))
13847 (use (label_ref (match_operand 1 "" "")))]
13852 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13854 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13858 (define_expand "tablejumpsi"
13859 [(set (match_dup 3)
13860 (plus:SI (match_operand:SI 0 "" "")
13862 (parallel [(set (pc) (match_dup 3))
13863 (use (label_ref (match_operand 1 "" "")))])]
13866 { operands[0] = force_reg (SImode, operands[0]);
13867 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13868 operands[3] = gen_reg_rtx (SImode);
13871 (define_expand "tablejumpdi"
13872 [(set (match_dup 4)
13873 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13875 (plus:DI (match_dup 4)
13877 (parallel [(set (pc) (match_dup 3))
13878 (use (label_ref (match_operand 1 "" "")))])]
13881 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13882 operands[3] = gen_reg_rtx (DImode);
13883 operands[4] = gen_reg_rtx (DImode);
13888 (match_operand:SI 0 "register_operand" "c,*l"))
13889 (use (label_ref (match_operand 1 "" "")))]
13894 [(set_attr "type" "jmpreg")])
13898 (match_operand:DI 0 "register_operand" "c,*l"))
13899 (use (label_ref (match_operand 1 "" "")))]
13904 [(set_attr "type" "jmpreg")])
13909 "{cror 0,0,0|nop}")
13911 ;; Define the subtract-one-and-jump insns, starting with the template
13912 ;; so loop.c knows what to generate.
13914 (define_expand "doloop_end"
13915 [(use (match_operand 0 "" "")) ; loop pseudo
13916 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13917 (use (match_operand 2 "" "")) ; max iterations
13918 (use (match_operand 3 "" "")) ; loop level
13919 (use (match_operand 4 "" ""))] ; label
13923 /* Only use this on innermost loops. */
13924 if (INTVAL (operands[3]) > 1)
13926 if (TARGET_POWERPC64)
13928 if (GET_MODE (operands[0]) != DImode)
13930 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13934 if (GET_MODE (operands[0]) != SImode)
13936 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13941 (define_expand "ctrsi"
13942 [(parallel [(set (pc)
13943 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13945 (label_ref (match_operand 1 "" ""))
13948 (plus:SI (match_dup 0)
13950 (clobber (match_scratch:CC 2 ""))
13951 (clobber (match_scratch:SI 3 ""))])]
13952 "! TARGET_POWERPC64"
13955 (define_expand "ctrdi"
13956 [(parallel [(set (pc)
13957 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13959 (label_ref (match_operand 1 "" ""))
13962 (plus:DI (match_dup 0)
13964 (clobber (match_scratch:CC 2 ""))
13965 (clobber (match_scratch:DI 3 ""))])]
13969 ;; We need to be able to do this for any operand, including MEM, or we
13970 ;; will cause reload to blow up since we don't allow output reloads on
13972 ;; For the length attribute to be calculated correctly, the
13973 ;; label MUST be operand 0.
13975 (define_insn "*ctrsi_internal1"
13977 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
13979 (label_ref (match_operand 0 "" ""))
13981 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
13982 (plus:SI (match_dup 1)
13984 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13985 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
13986 "! TARGET_POWERPC64"
13989 if (which_alternative != 0)
13991 else if (get_attr_length (insn) == 4)
13992 return \"{bdn|bdnz} %l0\";
13994 return \"bdz $+8\;b %l0\";
13996 [(set_attr "type" "branch")
13997 (set_attr "length" "*,12,16,16")])
13999 (define_insn "*ctrsi_internal2"
14001 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14004 (label_ref (match_operand 0 "" ""))))
14005 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14006 (plus:SI (match_dup 1)
14008 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14009 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14010 "! TARGET_POWERPC64"
14013 if (which_alternative != 0)
14015 else if (get_attr_length (insn) == 4)
14016 return \"bdz %l0\";
14018 return \"{bdn|bdnz} $+8\;b %l0\";
14020 [(set_attr "type" "branch")
14021 (set_attr "length" "*,12,16,16")])
14023 (define_insn "*ctrdi_internal1"
14025 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14027 (label_ref (match_operand 0 "" ""))
14029 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14030 (plus:DI (match_dup 1)
14032 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14033 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14037 if (which_alternative != 0)
14039 else if (get_attr_length (insn) == 4)
14040 return \"{bdn|bdnz} %l0\";
14042 return \"bdz $+8\;b %l0\";
14044 [(set_attr "type" "branch")
14045 (set_attr "length" "*,12,16,16")])
14047 (define_insn "*ctrdi_internal2"
14049 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14052 (label_ref (match_operand 0 "" ""))))
14053 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14054 (plus:DI (match_dup 1)
14056 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14057 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14061 if (which_alternative != 0)
14063 else if (get_attr_length (insn) == 4)
14064 return \"bdz %l0\";
14066 return \"{bdn|bdnz} $+8\;b %l0\";
14068 [(set_attr "type" "branch")
14069 (set_attr "length" "*,12,16,16")])
14071 ;; Similar, but we can use GE since we have a REG_NONNEG.
14073 (define_insn "*ctrsi_internal3"
14075 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14077 (label_ref (match_operand 0 "" ""))
14079 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14080 (plus:SI (match_dup 1)
14082 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14083 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14084 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14087 if (which_alternative != 0)
14089 else if (get_attr_length (insn) == 4)
14090 return \"{bdn|bdnz} %l0\";
14092 return \"bdz $+8\;b %l0\";
14094 [(set_attr "type" "branch")
14095 (set_attr "length" "*,12,16,16")])
14097 (define_insn "*ctrsi_internal4"
14099 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14102 (label_ref (match_operand 0 "" ""))))
14103 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14104 (plus:SI (match_dup 1)
14106 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14107 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14108 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14111 if (which_alternative != 0)
14113 else if (get_attr_length (insn) == 4)
14114 return \"bdz %l0\";
14116 return \"{bdn|bdnz} $+8\;b %l0\";
14118 [(set_attr "type" "branch")
14119 (set_attr "length" "*,12,16,16")])
14121 (define_insn "*ctrdi_internal3"
14123 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14125 (label_ref (match_operand 0 "" ""))
14127 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14128 (plus:DI (match_dup 1)
14130 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14131 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14132 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14135 if (which_alternative != 0)
14137 else if (get_attr_length (insn) == 4)
14138 return \"{bdn|bdnz} %l0\";
14140 return \"bdz $+8\;b %l0\";
14142 [(set_attr "type" "branch")
14143 (set_attr "length" "*,12,16,16")])
14145 (define_insn "*ctrdi_internal4"
14147 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14150 (label_ref (match_operand 0 "" ""))))
14151 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14152 (plus:DI (match_dup 1)
14154 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14155 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14156 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14159 if (which_alternative != 0)
14161 else if (get_attr_length (insn) == 4)
14162 return \"bdz %l0\";
14164 return \"{bdn|bdnz} $+8\;b %l0\";
14166 [(set_attr "type" "branch")
14167 (set_attr "length" "*,12,16,16")])
14169 ;; Similar but use EQ
14171 (define_insn "*ctrsi_internal5"
14173 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14175 (label_ref (match_operand 0 "" ""))
14177 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14178 (plus:SI (match_dup 1)
14180 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14181 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14182 "! TARGET_POWERPC64"
14185 if (which_alternative != 0)
14187 else if (get_attr_length (insn) == 4)
14188 return \"bdz %l0\";
14190 return \"{bdn|bdnz} $+8\;b %l0\";
14192 [(set_attr "type" "branch")
14193 (set_attr "length" "*,12,16,16")])
14195 (define_insn "*ctrsi_internal6"
14197 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r,*r")
14200 (label_ref (match_operand 0 "" ""))))
14201 (set (match_operand:SI 2 "register_operand" "=1,*r,m,*q*c*l")
14202 (plus:SI (match_dup 1)
14204 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14205 (clobber (match_scratch:SI 4 "=X,X,&r,r"))]
14206 "! TARGET_POWERPC64"
14209 if (which_alternative != 0)
14211 else if (get_attr_length (insn) == 4)
14212 return \"{bdn|bdnz} %l0\";
14214 return \"bdz $+8\;b %l0\";
14216 [(set_attr "type" "branch")
14217 (set_attr "length" "*,12,16,16")])
14219 (define_insn "*ctrdi_internal5"
14221 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14223 (label_ref (match_operand 0 "" ""))
14225 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14226 (plus:DI (match_dup 1)
14228 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14229 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14233 if (which_alternative != 0)
14235 else if (get_attr_length (insn) == 4)
14236 return \"bdz %l0\";
14238 return \"{bdn|bdnz} $+8\;b %l0\";
14240 [(set_attr "type" "branch")
14241 (set_attr "length" "*,12,16,16")])
14243 (define_insn "*ctrdi_internal6"
14245 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r,*r")
14248 (label_ref (match_operand 0 "" ""))))
14249 (set (match_operand:DI 2 "register_operand" "=1,*r,m,*c*l")
14250 (plus:DI (match_dup 1)
14252 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14253 (clobber (match_scratch:DI 4 "=X,X,&r,r"))]
14257 if (which_alternative != 0)
14259 else if (get_attr_length (insn) == 4)
14260 return \"{bdn|bdnz} %l0\";
14262 return \"bdz $+8\;b %l0\";
14264 [(set_attr "type" "branch")
14265 (set_attr "length" "*,12,16,16")])
14267 ;; Now the splitters if we could not allocate the CTR register
14271 (if_then_else (match_operator 2 "comparison_operator"
14272 [(match_operand:SI 1 "gpc_reg_operand" "")
14274 (match_operand 5 "" "")
14275 (match_operand 6 "" "")))
14276 (set (match_operand:SI 0 "gpc_reg_operand" "")
14277 (plus:SI (match_dup 1)
14279 (clobber (match_scratch:CC 3 ""))
14280 (clobber (match_scratch:SI 4 ""))]
14281 "! TARGET_POWERPC64 && reload_completed"
14282 [(parallel [(set (match_dup 3)
14283 (compare:CC (plus:SI (match_dup 1)
14287 (plus:SI (match_dup 1)
14289 (set (pc) (if_then_else (match_dup 7)
14293 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14298 (if_then_else (match_operator 2 "comparison_operator"
14299 [(match_operand:SI 1 "gpc_reg_operand" "")
14301 (match_operand 5 "" "")
14302 (match_operand 6 "" "")))
14303 (set (match_operand:SI 0 "nonimmediate_operand" "")
14304 (plus:SI (match_dup 1) (const_int -1)))
14305 (clobber (match_scratch:CC 3 ""))
14306 (clobber (match_scratch:SI 4 ""))]
14307 "! TARGET_POWERPC64 && reload_completed
14308 && ! gpc_reg_operand (operands[0], SImode)"
14309 [(parallel [(set (match_dup 3)
14310 (compare:CC (plus:SI (match_dup 1)
14314 (plus:SI (match_dup 1)
14318 (set (pc) (if_then_else (match_dup 7)
14322 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14326 (if_then_else (match_operator 2 "comparison_operator"
14327 [(match_operand:DI 1 "gpc_reg_operand" "")
14329 (match_operand 5 "" "")
14330 (match_operand 6 "" "")))
14331 (set (match_operand:DI 0 "gpc_reg_operand" "")
14332 (plus:DI (match_dup 1)
14334 (clobber (match_scratch:CC 3 ""))
14335 (clobber (match_scratch:DI 4 ""))]
14336 "TARGET_POWERPC64 && reload_completed"
14337 [(parallel [(set (match_dup 3)
14338 (compare:CC (plus:DI (match_dup 1)
14342 (plus:DI (match_dup 1)
14344 (set (pc) (if_then_else (match_dup 7)
14348 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14353 (if_then_else (match_operator 2 "comparison_operator"
14354 [(match_operand:DI 1 "gpc_reg_operand" "")
14356 (match_operand 5 "" "")
14357 (match_operand 6 "" "")))
14358 (set (match_operand:DI 0 "nonimmediate_operand" "")
14359 (plus:DI (match_dup 1) (const_int -1)))
14360 (clobber (match_scratch:CC 3 ""))
14361 (clobber (match_scratch:DI 4 ""))]
14362 "TARGET_POWERPC64 && reload_completed
14363 && ! gpc_reg_operand (operands[0], DImode)"
14364 [(parallel [(set (match_dup 3)
14365 (compare:CC (plus:DI (match_dup 1)
14369 (plus:DI (match_dup 1)
14373 (set (pc) (if_then_else (match_dup 7)
14377 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14381 (define_insn "trap"
14382 [(trap_if (const_int 1) (const_int 0))]
14386 (define_expand "conditional_trap"
14387 [(trap_if (match_operator 0 "trap_comparison_operator"
14388 [(match_dup 2) (match_dup 3)])
14389 (match_operand 1 "const_int_operand" ""))]
14391 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14392 operands[2] = rs6000_compare_op0;
14393 operands[3] = rs6000_compare_op1;")
14396 [(trap_if (match_operator 0 "trap_comparison_operator"
14397 [(match_operand:SI 1 "register_operand" "r")
14398 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14401 "{t|tw}%V0%I2 %1,%2")
14404 [(trap_if (match_operator 0 "trap_comparison_operator"
14405 [(match_operand:DI 1 "register_operand" "r")
14406 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14411 ;; Insns related to generating the function prologue and epilogue.
14413 (define_expand "prologue"
14414 [(use (const_int 0))]
14415 "TARGET_SCHED_PROLOG"
14418 rs6000_emit_prologue ();
14422 (define_insn "*movesi_from_cr_one"
14423 [(match_parallel 0 "mfcr_operation"
14424 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14425 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14426 (match_operand 3 "immediate_operand" "n")]
14427 UNSPEC_MOVESI_FROM_CR))])]
14433 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14435 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14436 operands[4] = GEN_INT (mask);
14437 output_asm_insn (\"mfcr %1,%4\", operands);
14441 [(set_attr "type" "mfcrf")])
14443 (define_insn "movesi_from_cr"
14444 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14445 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14446 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14447 UNSPEC_MOVESI_FROM_CR))]
14450 [(set_attr "type" "mfcr")])
14452 (define_insn "*stmw"
14453 [(match_parallel 0 "stmw_operation"
14454 [(set (match_operand:SI 1 "memory_operand" "=m")
14455 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14457 "{stm|stmw} %2,%1")
14459 (define_insn "*save_fpregs_si"
14460 [(match_parallel 0 "any_operand"
14461 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14462 (use (match_operand:SI 2 "call_operand" "s"))
14463 (set (match_operand:DF 3 "memory_operand" "=m")
14464 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14467 [(set_attr "type" "branch")
14468 (set_attr "length" "4")])
14470 (define_insn "*save_fpregs_di"
14471 [(match_parallel 0 "any_operand"
14472 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14473 (use (match_operand:DI 2 "call_operand" "s"))
14474 (set (match_operand:DF 3 "memory_operand" "=m")
14475 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14478 [(set_attr "type" "branch")
14479 (set_attr "length" "4")])
14481 ; These are to explain that changes to the stack pointer should
14482 ; not be moved over stores to stack memory.
14483 (define_insn "stack_tie"
14484 [(set (match_operand:BLK 0 "memory_operand" "+m")
14485 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14488 [(set_attr "length" "0")])
14491 (define_expand "epilogue"
14492 [(use (const_int 0))]
14493 "TARGET_SCHED_PROLOG"
14496 rs6000_emit_epilogue (FALSE);
14500 ; On some processors, doing the mtcrf one CC register at a time is
14501 ; faster (like on the 604e). On others, doing them all at once is
14502 ; faster; for instance, on the 601 and 750.
14504 (define_expand "movsi_to_cr_one"
14505 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14506 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14507 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14509 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14511 (define_insn "*movsi_to_cr"
14512 [(match_parallel 0 "mtcrf_operation"
14513 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14514 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14515 (match_operand 3 "immediate_operand" "n")]
14516 UNSPEC_MOVESI_TO_CR))])]
14522 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14523 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14524 operands[4] = GEN_INT (mask);
14525 return \"mtcrf %4,%2\";
14527 [(set_attr "type" "mtcr")])
14529 (define_insn "*mtcrfsi"
14530 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14531 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14532 (match_operand 2 "immediate_operand" "n")]
14533 UNSPEC_MOVESI_TO_CR))]
14534 "GET_CODE (operands[0]) == REG
14535 && CR_REGNO_P (REGNO (operands[0]))
14536 && GET_CODE (operands[2]) == CONST_INT
14537 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14539 [(set_attr "type" "mtcr")])
14541 ; The load-multiple instructions have similar properties.
14542 ; Note that "load_multiple" is a name known to the machine-independent
14543 ; code that actually corresponds to the powerpc load-string.
14545 (define_insn "*lmw"
14546 [(match_parallel 0 "lmw_operation"
14547 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14548 (match_operand:SI 2 "memory_operand" "m"))])]
14552 (define_insn "*return_internal_si"
14554 (use (match_operand:SI 0 "register_operand" "lc"))]
14557 [(set_attr "type" "jmpreg")])
14559 (define_insn "*return_internal_di"
14561 (use (match_operand:DI 0 "register_operand" "lc"))]
14564 [(set_attr "type" "jmpreg")])
14566 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14567 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14569 (define_insn "*return_and_restore_fpregs_si"
14570 [(match_parallel 0 "any_operand"
14572 (use (match_operand:SI 1 "register_operand" "l"))
14573 (use (match_operand:SI 2 "call_operand" "s"))
14574 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14575 (match_operand:DF 4 "memory_operand" "m"))])]
14579 (define_insn "*return_and_restore_fpregs_di"
14580 [(match_parallel 0 "any_operand"
14582 (use (match_operand:DI 1 "register_operand" "l"))
14583 (use (match_operand:DI 2 "call_operand" "s"))
14584 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14585 (match_operand:DF 4 "memory_operand" "m"))])]
14589 ; This is used in compiling the unwind routines.
14590 (define_expand "eh_return"
14591 [(use (match_operand 0 "general_operand" ""))]
14596 emit_insn (gen_eh_set_lr_si (operands[0]));
14598 emit_insn (gen_eh_set_lr_di (operands[0]));
14602 ; We can't expand this before we know where the link register is stored.
14603 (define_insn "eh_set_lr_si"
14604 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")]
14606 (clobber (match_scratch:SI 1 "=&b"))]
14610 (define_insn "eh_set_lr_di"
14611 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
14613 (clobber (match_scratch:DI 1 "=&b"))]
14618 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14619 (clobber (match_scratch 1 ""))]
14624 rs6000_stack_t *info = rs6000_stack_info ();
14626 if (info->lr_save_p)
14628 rtx frame_rtx = stack_pointer_rtx;
14632 if (frame_pointer_needed
14633 || current_function_calls_alloca
14634 || info->total_size > 32767)
14636 emit_move_insn (operands[1], gen_rtx_MEM (Pmode, frame_rtx));
14637 frame_rtx = operands[1];
14639 else if (info->push_p)
14640 sp_offset = info->total_size;
14642 tmp = plus_constant (frame_rtx, info->lr_save_offset + sp_offset);
14643 tmp = gen_rtx_MEM (Pmode, tmp);
14644 emit_move_insn (tmp, operands[0]);
14647 emit_move_insn (gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM), operands[0]);
14651 (define_insn "prefetch"
14652 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14653 (match_operand:SI 1 "const_int_operand" "n")
14654 (match_operand:SI 2 "const_int_operand" "n"))]
14658 if (GET_CODE (operands[0]) == REG)
14659 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14660 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14662 [(set_attr "type" "load")])
14664 (include "altivec.md")