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 GNU CC.
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; `unspec' values used in rs6000.md:
27 ;; 0 frsp for POWER machines
29 ;; 5 used to tie the stack contents and the stack pointer
30 ;; 6 address of a word pointing to the TOC
31 ;; 7 address of the TOC (more-or-less)
35 ;; 15 load_macho_picbase
36 ;; 16 macho_correct_pic
40 ;; Define an insn type attribute. This is used in function unit delay
42 (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,branch,cmp,fast_compare,compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mtcr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv"
43 (const_string "integer"))
46 ; '(pc)' in the following doesn't include the instruction itself; it is
47 ; calculated as if the instruction had zero size.
48 (define_attr "length" ""
49 (if_then_else (eq_attr "type" "branch")
50 (if_then_else (and (ge (minus (match_dup 0) (pc))
52 (lt (minus (match_dup 0) (pc))
58 ;; Processor type -- this attribute must exactly match the processor_type
59 ;; enumeration in rs6000.h.
61 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4"
62 (const (symbol_ref "rs6000_cpu_attr")))
64 (automata_option "ndfa")
79 ;; Start with fixed-point load and store insns. Here we put only the more
80 ;; complex forms. Basic data transfer is done later.
82 (define_expand "zero_extendqidi2"
83 [(set (match_operand:DI 0 "gpc_reg_operand" "")
84 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
89 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
90 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
95 [(set_attr "type" "load,*")])
98 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
99 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
101 (clobber (match_scratch:DI 2 "=r,r"))]
106 [(set_attr "type" "compare")
107 (set_attr "length" "4,8")])
110 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
111 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
113 (clobber (match_scratch:DI 2 ""))]
114 "TARGET_POWERPC64 && reload_completed"
116 (zero_extend:DI (match_dup 1)))
118 (compare:CC (match_dup 2)
123 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
124 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
126 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
127 (zero_extend:DI (match_dup 1)))]
132 [(set_attr "type" "compare")
133 (set_attr "length" "4,8")])
136 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
137 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
139 (set (match_operand:DI 0 "gpc_reg_operand" "")
140 (zero_extend:DI (match_dup 1)))]
141 "TARGET_POWERPC64 && reload_completed"
143 (zero_extend:DI (match_dup 1)))
145 (compare:CC (match_dup 0)
149 (define_insn "extendqidi2"
150 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
151 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
156 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
157 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
159 (clobber (match_scratch:DI 2 "=r,r"))]
164 [(set_attr "type" "compare")
165 (set_attr "length" "4,8")])
168 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
169 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
171 (clobber (match_scratch:DI 2 ""))]
172 "TARGET_POWERPC64 && reload_completed"
174 (sign_extend:DI (match_dup 1)))
176 (compare:CC (match_dup 2)
181 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
182 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
184 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
185 (sign_extend:DI (match_dup 1)))]
190 [(set_attr "type" "compare")
191 (set_attr "length" "4,8")])
194 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
195 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
197 (set (match_operand:DI 0 "gpc_reg_operand" "")
198 (sign_extend:DI (match_dup 1)))]
199 "TARGET_POWERPC64 && reload_completed"
201 (sign_extend:DI (match_dup 1)))
203 (compare:CC (match_dup 0)
207 (define_expand "zero_extendhidi2"
208 [(set (match_operand:DI 0 "gpc_reg_operand" "")
209 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
214 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
215 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
220 [(set_attr "type" "load,*")])
223 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
224 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
226 (clobber (match_scratch:DI 2 "=r,r"))]
231 [(set_attr "type" "compare")
232 (set_attr "length" "4,8")])
235 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
236 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
238 (clobber (match_scratch:DI 2 ""))]
239 "TARGET_POWERPC64 && reload_completed"
241 (zero_extend:DI (match_dup 1)))
243 (compare:CC (match_dup 2)
248 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
249 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
251 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
252 (zero_extend:DI (match_dup 1)))]
257 [(set_attr "type" "compare")
258 (set_attr "length" "4,8")])
261 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
262 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
264 (set (match_operand:DI 0 "gpc_reg_operand" "")
265 (zero_extend:DI (match_dup 1)))]
266 "TARGET_POWERPC64 && reload_completed"
268 (zero_extend:DI (match_dup 1)))
270 (compare:CC (match_dup 0)
274 (define_expand "extendhidi2"
275 [(set (match_operand:DI 0 "gpc_reg_operand" "")
276 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
281 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
282 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
287 [(set_attr "type" "load_ext,*")])
290 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
291 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
293 (clobber (match_scratch:DI 2 "=r,r"))]
298 [(set_attr "type" "compare")
299 (set_attr "length" "4,8")])
302 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
303 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
305 (clobber (match_scratch:DI 2 ""))]
306 "TARGET_POWERPC64 && reload_completed"
308 (sign_extend:DI (match_dup 1)))
310 (compare:CC (match_dup 2)
315 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
316 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
318 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
319 (sign_extend:DI (match_dup 1)))]
324 [(set_attr "type" "compare")
325 (set_attr "length" "4,8")])
328 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
329 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
331 (set (match_operand:DI 0 "gpc_reg_operand" "")
332 (sign_extend:DI (match_dup 1)))]
333 "TARGET_POWERPC64 && reload_completed"
335 (sign_extend:DI (match_dup 1)))
337 (compare:CC (match_dup 0)
341 (define_expand "zero_extendsidi2"
342 [(set (match_operand:DI 0 "gpc_reg_operand" "")
343 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
348 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
349 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
354 [(set_attr "type" "load,*")])
357 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
358 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
360 (clobber (match_scratch:DI 2 "=r,r"))]
365 [(set_attr "type" "compare")
366 (set_attr "length" "4,8")])
369 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
370 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
372 (clobber (match_scratch:DI 2 ""))]
373 "TARGET_POWERPC64 && reload_completed"
375 (zero_extend:DI (match_dup 1)))
377 (compare:CC (match_dup 2)
382 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
383 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
385 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
386 (zero_extend:DI (match_dup 1)))]
391 [(set_attr "type" "compare")
392 (set_attr "length" "4,8")])
395 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
396 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
398 (set (match_operand:DI 0 "gpc_reg_operand" "")
399 (zero_extend:DI (match_dup 1)))]
400 "TARGET_POWERPC64 && reload_completed"
402 (zero_extend:DI (match_dup 1)))
404 (compare:CC (match_dup 0)
408 (define_expand "extendsidi2"
409 [(set (match_operand:DI 0 "gpc_reg_operand" "")
410 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
415 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
416 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
421 [(set_attr "type" "load_ext,*")])
424 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
425 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
427 (clobber (match_scratch:DI 2 "=r,r"))]
432 [(set_attr "type" "compare")
433 (set_attr "length" "4,8")])
436 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
437 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
439 (clobber (match_scratch:DI 2 ""))]
440 "TARGET_POWERPC64 && reload_completed"
442 (sign_extend:DI (match_dup 1)))
444 (compare:CC (match_dup 2)
449 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
450 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
452 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
453 (sign_extend:DI (match_dup 1)))]
458 [(set_attr "type" "compare")
459 (set_attr "length" "4,8")])
462 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
463 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
465 (set (match_operand:DI 0 "gpc_reg_operand" "")
466 (sign_extend:DI (match_dup 1)))]
467 "TARGET_POWERPC64 && reload_completed"
469 (sign_extend:DI (match_dup 1)))
471 (compare:CC (match_dup 0)
475 (define_expand "zero_extendqisi2"
476 [(set (match_operand:SI 0 "gpc_reg_operand" "")
477 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
483 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
487 {rlinm|rlwinm} %0,%1,0,0xff"
488 [(set_attr "type" "load,*")])
491 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
492 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
494 (clobber (match_scratch:SI 2 "=r,r"))]
497 {andil.|andi.} %2,%1,0xff
499 [(set_attr "type" "compare")
500 (set_attr "length" "4,8")])
503 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
504 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
506 (clobber (match_scratch:SI 2 ""))]
509 (zero_extend:SI (match_dup 1)))
511 (compare:CC (match_dup 2)
516 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
517 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
519 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
520 (zero_extend:SI (match_dup 1)))]
523 {andil.|andi.} %0,%1,0xff
525 [(set_attr "type" "compare")
526 (set_attr "length" "4,8")])
529 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
530 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
532 (set (match_operand:SI 0 "gpc_reg_operand" "")
533 (zero_extend:SI (match_dup 1)))]
536 (zero_extend:SI (match_dup 1)))
538 (compare:CC (match_dup 0)
542 (define_expand "extendqisi2"
543 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
544 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
549 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
550 else if (TARGET_POWER)
551 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
553 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
557 (define_insn "extendqisi2_ppc"
558 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
559 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
565 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
567 (clobber (match_scratch:SI 2 "=r,r"))]
572 [(set_attr "type" "compare")
573 (set_attr "length" "4,8")])
576 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
577 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
579 (clobber (match_scratch:SI 2 ""))]
580 "TARGET_POWERPC && reload_completed"
582 (sign_extend:SI (match_dup 1)))
584 (compare:CC (match_dup 2)
589 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
590 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
592 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
593 (sign_extend:SI (match_dup 1)))]
598 [(set_attr "type" "compare")
599 (set_attr "length" "4,8")])
602 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
603 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
605 (set (match_operand:SI 0 "gpc_reg_operand" "")
606 (sign_extend:SI (match_dup 1)))]
607 "TARGET_POWERPC && reload_completed"
609 (sign_extend:SI (match_dup 1)))
611 (compare:CC (match_dup 0)
615 (define_expand "extendqisi2_power"
616 [(parallel [(set (match_dup 2)
617 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
619 (clobber (scratch:SI))])
620 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
621 (ashiftrt:SI (match_dup 2)
623 (clobber (scratch:SI))])]
626 { operands[1] = gen_lowpart (SImode, operands[1]);
627 operands[2] = gen_reg_rtx (SImode); }")
629 (define_expand "extendqisi2_no_power"
631 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
633 (set (match_operand:SI 0 "gpc_reg_operand" "")
634 (ashiftrt:SI (match_dup 2)
636 "! TARGET_POWER && ! TARGET_POWERPC"
638 { operands[1] = gen_lowpart (SImode, operands[1]);
639 operands[2] = gen_reg_rtx (SImode); }")
641 (define_expand "zero_extendqihi2"
642 [(set (match_operand:HI 0 "gpc_reg_operand" "")
643 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
648 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
649 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
653 {rlinm|rlwinm} %0,%1,0,0xff"
654 [(set_attr "type" "load,*")])
657 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
658 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
660 (clobber (match_scratch:HI 2 "=r,r"))]
663 {andil.|andi.} %2,%1,0xff
665 [(set_attr "type" "compare")
666 (set_attr "length" "4,8")])
669 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
670 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
672 (clobber (match_scratch:HI 2 ""))]
675 (zero_extend:HI (match_dup 1)))
677 (compare:CC (match_dup 2)
682 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
683 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
685 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
686 (zero_extend:HI (match_dup 1)))]
689 {andil.|andi.} %0,%1,0xff
691 [(set_attr "type" "compare")
692 (set_attr "length" "4,8")])
695 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
696 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
698 (set (match_operand:HI 0 "gpc_reg_operand" "")
699 (zero_extend:HI (match_dup 1)))]
702 (zero_extend:HI (match_dup 1)))
704 (compare:CC (match_dup 0)
708 (define_expand "extendqihi2"
709 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
710 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
715 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
716 else if (TARGET_POWER)
717 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
719 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
723 (define_insn "extendqihi2_ppc"
724 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
725 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
730 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
731 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
733 (clobber (match_scratch:HI 2 "=r,r"))]
738 [(set_attr "type" "compare")
739 (set_attr "length" "4,8")])
742 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
743 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
745 (clobber (match_scratch:HI 2 ""))]
746 "TARGET_POWERPC && reload_completed"
748 (sign_extend:HI (match_dup 1)))
750 (compare:CC (match_dup 2)
755 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
756 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
758 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
759 (sign_extend:HI (match_dup 1)))]
764 [(set_attr "type" "compare")
765 (set_attr "length" "4,8")])
768 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
769 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
771 (set (match_operand:HI 0 "gpc_reg_operand" "")
772 (sign_extend:HI (match_dup 1)))]
773 "TARGET_POWERPC && reload_completed"
775 (sign_extend:HI (match_dup 1)))
777 (compare:CC (match_dup 0)
781 (define_expand "extendqihi2_power"
782 [(parallel [(set (match_dup 2)
783 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
785 (clobber (scratch:SI))])
786 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
787 (ashiftrt:SI (match_dup 2)
789 (clobber (scratch:SI))])]
792 { operands[0] = gen_lowpart (SImode, operands[0]);
793 operands[1] = gen_lowpart (SImode, operands[1]);
794 operands[2] = gen_reg_rtx (SImode); }")
796 (define_expand "extendqihi2_no_power"
798 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
800 (set (match_operand:HI 0 "gpc_reg_operand" "")
801 (ashiftrt:SI (match_dup 2)
803 "! TARGET_POWER && ! TARGET_POWERPC"
805 { operands[0] = gen_lowpart (SImode, operands[0]);
806 operands[1] = gen_lowpart (SImode, operands[1]);
807 operands[2] = gen_reg_rtx (SImode); }")
809 (define_expand "zero_extendhisi2"
810 [(set (match_operand:SI 0 "gpc_reg_operand" "")
811 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
817 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
821 {rlinm|rlwinm} %0,%1,0,0xffff"
822 [(set_attr "type" "load,*")])
825 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
826 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
828 (clobber (match_scratch:SI 2 "=r,r"))]
831 {andil.|andi.} %2,%1,0xffff
833 [(set_attr "type" "compare")
834 (set_attr "length" "4,8")])
837 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
838 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
840 (clobber (match_scratch:SI 2 ""))]
843 (zero_extend:SI (match_dup 1)))
845 (compare:CC (match_dup 2)
850 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
851 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
853 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
854 (zero_extend:SI (match_dup 1)))]
857 {andil.|andi.} %0,%1,0xffff
859 [(set_attr "type" "compare")
860 (set_attr "length" "4,8")])
863 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
864 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
866 (set (match_operand:SI 0 "gpc_reg_operand" "")
867 (zero_extend:SI (match_dup 1)))]
870 (zero_extend:SI (match_dup 1)))
872 (compare:CC (match_dup 0)
876 (define_expand "extendhisi2"
877 [(set (match_operand:SI 0 "gpc_reg_operand" "")
878 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
883 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
884 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
889 [(set_attr "type" "load_ext,*")])
892 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
893 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
895 (clobber (match_scratch:SI 2 "=r,r"))]
900 [(set_attr "type" "compare")
901 (set_attr "length" "4,8")])
904 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
905 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
907 (clobber (match_scratch:SI 2 ""))]
910 (sign_extend:SI (match_dup 1)))
912 (compare:CC (match_dup 2)
917 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
918 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
920 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
921 (sign_extend:SI (match_dup 1)))]
926 [(set_attr "type" "compare")
927 (set_attr "length" "4,8")])
930 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
931 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
933 (set (match_operand:SI 0 "gpc_reg_operand" "")
934 (sign_extend:SI (match_dup 1)))]
937 (sign_extend:SI (match_dup 1)))
939 (compare:CC (match_dup 0)
943 ;; Fixed-point arithmetic insns.
945 ;; Discourage ai/addic because of carry but provide it in an alternative
946 ;; allowing register zero as source.
947 (define_expand "addsi3"
948 [(set (match_operand:SI 0 "gpc_reg_operand" "")
949 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
950 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
954 if (GET_CODE (operands[2]) == CONST_INT
955 && ! add_operand (operands[2], SImode))
957 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
958 ? operands[0] : gen_reg_rtx (SImode));
960 HOST_WIDE_INT val = INTVAL (operands[2]);
961 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
962 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
964 /* The ordering here is important for the prolog expander.
965 When space is allocated from the stack, adding 'low' first may
966 produce a temporary deallocation (which would be bad). */
967 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
968 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
973 (define_insn "*addsi3_internal1"
974 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
975 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
976 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
980 {cal %0,%2(%1)|addi %0,%1,%2}
982 {cau|addis} %0,%1,%v2"
983 [(set_attr "length" "4,4,4,4")])
985 (define_insn "addsi3_high"
986 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
987 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
988 (high:SI (match_operand 2 "" ""))))]
989 "TARGET_MACHO && !TARGET_64BIT"
990 "{cau|addis} %0,%1,ha16(%2)"
991 [(set_attr "length" "4")])
993 (define_insn "*addsi3_internal2"
994 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
995 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
996 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
998 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1001 {cax.|add.} %3,%1,%2
1002 {ai.|addic.} %3,%1,%2
1005 [(set_attr "type" "fast_compare,compare,compare,compare")
1006 (set_attr "length" "4,4,8,8")])
1009 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1010 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1011 (match_operand:SI 2 "reg_or_short_operand" ""))
1013 (clobber (match_scratch:SI 3 ""))]
1014 "! TARGET_POWERPC64 && reload_completed"
1016 (plus:SI (match_dup 1)
1019 (compare:CC (match_dup 3)
1023 (define_insn "*addsi3_internal3"
1024 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1025 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1026 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1028 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1029 (plus:SI (match_dup 1)
1031 "! TARGET_POWERPC64"
1033 {cax.|add.} %0,%1,%2
1034 {ai.|addic.} %0,%1,%2
1037 [(set_attr "type" "fast_compare,compare,compare,compare")
1038 (set_attr "length" "4,4,8,8")])
1041 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1042 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1043 (match_operand:SI 2 "reg_or_short_operand" ""))
1045 (set (match_operand:SI 0 "gpc_reg_operand" "")
1046 (plus:SI (match_dup 1) (match_dup 2)))]
1047 "! TARGET_POWERPC64 && reload_completed"
1049 (plus:SI (match_dup 1)
1052 (compare:CC (match_dup 0)
1056 ;; Split an add that we can't do in one insn into two insns, each of which
1057 ;; does one 16-bit part. This is used by combine. Note that the low-order
1058 ;; add should be last in case the result gets used in an address.
1061 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1062 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1063 (match_operand:SI 2 "non_add_cint_operand" "")))]
1065 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1066 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1069 HOST_WIDE_INT val = INTVAL (operands[2]);
1070 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1071 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1073 operands[3] = GEN_INT (rest);
1074 operands[4] = GEN_INT (low);
1077 (define_insn "one_cmplsi2"
1078 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1079 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1084 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1085 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1087 (clobber (match_scratch:SI 2 "=r,r"))]
1088 "! TARGET_POWERPC64"
1092 [(set_attr "type" "compare")
1093 (set_attr "length" "4,8")])
1096 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1097 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1099 (clobber (match_scratch:SI 2 ""))]
1100 "! TARGET_POWERPC64 && reload_completed"
1102 (not:SI (match_dup 1)))
1104 (compare:CC (match_dup 2)
1109 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1110 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1112 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1113 (not:SI (match_dup 1)))]
1114 "! TARGET_POWERPC64"
1118 [(set_attr "type" "compare")
1119 (set_attr "length" "4,8")])
1122 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1123 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1125 (set (match_operand:SI 0 "gpc_reg_operand" "")
1126 (not:SI (match_dup 1)))]
1127 "! TARGET_POWERPC64 && reload_completed"
1129 (not:SI (match_dup 1)))
1131 (compare:CC (match_dup 0)
1136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1137 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1138 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1140 "{sf%I1|subf%I1c} %0,%2,%1")
1143 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1144 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1145 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1152 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1153 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1154 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1156 (clobber (match_scratch:SI 3 "=r,r"))]
1159 {sf.|subfc.} %3,%2,%1
1161 [(set_attr "type" "compare")
1162 (set_attr "length" "4,8")])
1165 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1166 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1167 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1169 (clobber (match_scratch:SI 3 "=r,r"))]
1170 "TARGET_POWERPC && ! TARGET_POWERPC64"
1174 [(set_attr "type" "fast_compare")
1175 (set_attr "length" "4,8")])
1178 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1179 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1180 (match_operand:SI 2 "gpc_reg_operand" ""))
1182 (clobber (match_scratch:SI 3 ""))]
1183 "! TARGET_POWERPC64 && reload_completed"
1185 (minus:SI (match_dup 1)
1188 (compare:CC (match_dup 3)
1193 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1194 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1195 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1197 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1198 (minus:SI (match_dup 1) (match_dup 2)))]
1201 {sf.|subfc.} %0,%2,%1
1203 [(set_attr "type" "compare")
1204 (set_attr "length" "4,8")])
1207 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1208 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1209 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1211 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1212 (minus:SI (match_dup 1)
1214 "TARGET_POWERPC && ! TARGET_POWERPC64"
1218 [(set_attr "type" "fast_compare")
1219 (set_attr "length" "4,8")])
1222 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1223 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1224 (match_operand:SI 2 "gpc_reg_operand" ""))
1226 (set (match_operand:SI 0 "gpc_reg_operand" "")
1227 (minus:SI (match_dup 1)
1229 "! TARGET_POWERPC64 && reload_completed"
1231 (minus:SI (match_dup 1)
1234 (compare:CC (match_dup 0)
1238 (define_expand "subsi3"
1239 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1240 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1241 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1245 if (GET_CODE (operands[2]) == CONST_INT)
1247 emit_insn (gen_addsi3 (operands[0], operands[1],
1248 negate_rtx (SImode, operands[2])));
1253 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1254 ;; instruction and some auxiliary computations. Then we just have a single
1255 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1258 (define_expand "sminsi3"
1260 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1261 (match_operand:SI 2 "reg_or_short_operand" ""))
1263 (minus:SI (match_dup 2) (match_dup 1))))
1264 (set (match_operand:SI 0 "gpc_reg_operand" "")
1265 (minus:SI (match_dup 2) (match_dup 3)))]
1266 "TARGET_POWER || TARGET_ISEL"
1271 operands[2] = force_reg (SImode, operands[2]);
1272 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1276 operands[3] = gen_reg_rtx (SImode);
1280 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1281 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1282 (match_operand:SI 2 "reg_or_short_operand" "")))
1283 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1286 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1288 (minus:SI (match_dup 2) (match_dup 1))))
1289 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1292 (define_expand "smaxsi3"
1294 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1295 (match_operand:SI 2 "reg_or_short_operand" ""))
1297 (minus:SI (match_dup 2) (match_dup 1))))
1298 (set (match_operand:SI 0 "gpc_reg_operand" "")
1299 (plus:SI (match_dup 3) (match_dup 1)))]
1300 "TARGET_POWER || TARGET_ISEL"
1305 operands[2] = force_reg (SImode, operands[2]);
1306 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1309 operands[3] = gen_reg_rtx (SImode);
1313 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1314 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1315 (match_operand:SI 2 "reg_or_short_operand" "")))
1316 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1319 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1321 (minus:SI (match_dup 2) (match_dup 1))))
1322 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1325 (define_expand "uminsi3"
1326 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1328 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1330 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1332 (minus:SI (match_dup 4) (match_dup 3))))
1333 (set (match_operand:SI 0 "gpc_reg_operand" "")
1334 (minus:SI (match_dup 2) (match_dup 3)))]
1335 "TARGET_POWER || TARGET_ISEL"
1340 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1343 operands[3] = gen_reg_rtx (SImode);
1344 operands[4] = gen_reg_rtx (SImode);
1345 operands[5] = GEN_INT (-2147483647 - 1);
1348 (define_expand "umaxsi3"
1349 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1351 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1353 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1355 (minus:SI (match_dup 4) (match_dup 3))))
1356 (set (match_operand:SI 0 "gpc_reg_operand" "")
1357 (plus:SI (match_dup 3) (match_dup 1)))]
1358 "TARGET_POWER || TARGET_ISEL"
1363 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1366 operands[3] = gen_reg_rtx (SImode);
1367 operands[4] = gen_reg_rtx (SImode);
1368 operands[5] = GEN_INT (-2147483647 - 1);
1372 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1373 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1374 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1376 (minus:SI (match_dup 2) (match_dup 1))))]
1381 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1383 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1384 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1386 (minus:SI (match_dup 2) (match_dup 1)))
1388 (clobber (match_scratch:SI 3 "=r,r"))]
1393 [(set_attr "type" "delayed_compare")
1394 (set_attr "length" "4,8")])
1397 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1399 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1400 (match_operand:SI 2 "reg_or_short_operand" ""))
1402 (minus:SI (match_dup 2) (match_dup 1)))
1404 (clobber (match_scratch:SI 3 ""))]
1405 "TARGET_POWER && reload_completed"
1407 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1409 (minus:SI (match_dup 2) (match_dup 1))))
1411 (compare:CC (match_dup 3)
1416 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1418 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1419 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1421 (minus:SI (match_dup 2) (match_dup 1)))
1423 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1424 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1426 (minus:SI (match_dup 2) (match_dup 1))))]
1431 [(set_attr "type" "delayed_compare")
1432 (set_attr "length" "4,8")])
1435 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1437 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1438 (match_operand:SI 2 "reg_or_short_operand" ""))
1440 (minus:SI (match_dup 2) (match_dup 1)))
1442 (set (match_operand:SI 0 "gpc_reg_operand" "")
1443 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1445 (minus:SI (match_dup 2) (match_dup 1))))]
1446 "TARGET_POWER && reload_completed"
1448 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1450 (minus:SI (match_dup 2) (match_dup 1))))
1452 (compare:CC (match_dup 0)
1456 ;; We don't need abs with condition code because such comparisons should
1458 (define_expand "abssi2"
1459 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1460 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1466 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1469 else if (! TARGET_POWER)
1471 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1476 (define_insn "*abssi2_power"
1477 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1478 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1482 (define_insn_and_split "abssi2_isel"
1483 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1484 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1485 (clobber (match_scratch:SI 2 "=b"))
1486 (clobber (match_scratch:CC 3 "=y"))]
1489 "&& reload_completed"
1490 [(set (match_dup 2) (neg:SI (match_dup 1)))
1492 (compare:CC (match_dup 1)
1495 (if_then_else:SI (ge (match_dup 3)
1501 (define_insn_and_split "abssi2_nopower"
1502 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1503 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1504 (clobber (match_scratch:SI 2 "=&r,&r"))]
1505 "! TARGET_POWER && ! TARGET_ISEL"
1507 "&& reload_completed"
1508 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1509 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1510 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1513 (define_insn "*nabs_power"
1514 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1515 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1519 (define_insn_and_split "*nabs_nopower"
1520 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1521 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1522 (clobber (match_scratch:SI 2 "=&r,&r"))]
1525 "&& reload_completed"
1526 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1527 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1528 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1531 (define_insn "negsi2"
1532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1533 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1538 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1539 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1541 (clobber (match_scratch:SI 2 "=r,r"))]
1542 "! TARGET_POWERPC64"
1546 [(set_attr "type" "fast_compare")
1547 (set_attr "length" "4,8")])
1550 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1551 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1553 (clobber (match_scratch:SI 2 ""))]
1554 "! TARGET_POWERPC64 && reload_completed"
1556 (neg:SI (match_dup 1)))
1558 (compare:CC (match_dup 2)
1563 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1564 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1566 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1567 (neg:SI (match_dup 1)))]
1568 "! TARGET_POWERPC64"
1572 [(set_attr "type" "fast_compare")
1573 (set_attr "length" "4,8")])
1576 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1577 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1579 (set (match_operand:SI 0 "gpc_reg_operand" "")
1580 (neg:SI (match_dup 1)))]
1581 "! TARGET_POWERPC64 && reload_completed"
1583 (neg:SI (match_dup 1)))
1585 (compare:CC (match_dup 0)
1589 (define_insn "clzsi2"
1590 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1591 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1593 "{cntlz|cntlzw} %0,%1")
1595 (define_expand "ctzsi2"
1597 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1598 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1600 (clobber (scratch:CC))])
1601 (set (match_dup 4) (clz:SI (match_dup 3)))
1602 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1603 (minus:SI (const_int 31) (match_dup 4)))]
1606 operands[2] = gen_reg_rtx (SImode);
1607 operands[3] = gen_reg_rtx (SImode);
1608 operands[4] = gen_reg_rtx (SImode);
1611 (define_expand "ffssi2"
1613 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1614 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1616 (clobber (scratch:CC))])
1617 (set (match_dup 4) (clz:SI (match_dup 3)))
1618 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1619 (minus:SI (const_int 32) (match_dup 4)))]
1622 operands[2] = gen_reg_rtx (SImode);
1623 operands[3] = gen_reg_rtx (SImode);
1624 operands[4] = gen_reg_rtx (SImode);
1627 (define_expand "mulsi3"
1628 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1629 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1630 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1635 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1637 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1641 (define_insn "mulsi3_mq"
1642 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1643 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1644 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1645 (clobber (match_scratch:SI 3 "=q,q"))]
1648 {muls|mullw} %0,%1,%2
1649 {muli|mulli} %0,%1,%2"
1651 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1652 (const_string "imul3")
1653 (match_operand:SI 2 "short_cint_operand" "")
1654 (const_string "imul2")]
1655 (const_string "imul")))])
1657 (define_insn "mulsi3_no_mq"
1658 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1659 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1660 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1663 {muls|mullw} %0,%1,%2
1664 {muli|mulli} %0,%1,%2"
1666 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1667 (const_string "imul3")
1668 (match_operand:SI 2 "short_cint_operand" "")
1669 (const_string "imul2")]
1670 (const_string "imul")))])
1672 (define_insn "*mulsi3_mq_internal1"
1673 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1674 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1675 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1677 (clobber (match_scratch:SI 3 "=r,r"))
1678 (clobber (match_scratch:SI 4 "=q,q"))]
1681 {muls.|mullw.} %3,%1,%2
1683 [(set_attr "type" "imul_compare")
1684 (set_attr "length" "4,8")])
1687 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1688 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1689 (match_operand:SI 2 "gpc_reg_operand" ""))
1691 (clobber (match_scratch:SI 3 ""))
1692 (clobber (match_scratch:SI 4 ""))]
1693 "TARGET_POWER && reload_completed"
1694 [(parallel [(set (match_dup 3)
1695 (mult:SI (match_dup 1) (match_dup 2)))
1696 (clobber (match_dup 4))])
1698 (compare:CC (match_dup 3)
1702 (define_insn "*mulsi3_no_mq_internal1"
1703 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1704 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1705 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1707 (clobber (match_scratch:SI 3 "=r,r"))]
1710 {muls.|mullw.} %3,%1,%2
1712 [(set_attr "type" "imul_compare")
1713 (set_attr "length" "4,8")])
1716 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1717 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1718 (match_operand:SI 2 "gpc_reg_operand" ""))
1720 (clobber (match_scratch:SI 3 ""))]
1721 "! TARGET_POWER && reload_completed"
1723 (mult:SI (match_dup 1) (match_dup 2)))
1725 (compare:CC (match_dup 3)
1729 (define_insn "*mulsi3_mq_internal2"
1730 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1731 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1732 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1734 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1735 (mult:SI (match_dup 1) (match_dup 2)))
1736 (clobber (match_scratch:SI 4 "=q,q"))]
1739 {muls.|mullw.} %0,%1,%2
1741 [(set_attr "type" "imul_compare")
1742 (set_attr "length" "4,8")])
1745 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1746 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1747 (match_operand:SI 2 "gpc_reg_operand" ""))
1749 (set (match_operand:SI 0 "gpc_reg_operand" "")
1750 (mult:SI (match_dup 1) (match_dup 2)))
1751 (clobber (match_scratch:SI 4 ""))]
1752 "TARGET_POWER && reload_completed"
1753 [(parallel [(set (match_dup 0)
1754 (mult:SI (match_dup 1) (match_dup 2)))
1755 (clobber (match_dup 4))])
1757 (compare:CC (match_dup 0)
1761 (define_insn "*mulsi3_no_mq_internal2"
1762 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1763 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1764 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1766 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1767 (mult:SI (match_dup 1) (match_dup 2)))]
1770 {muls.|mullw.} %0,%1,%2
1772 [(set_attr "type" "imul_compare")
1773 (set_attr "length" "4,8")])
1776 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1777 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1778 (match_operand:SI 2 "gpc_reg_operand" ""))
1780 (set (match_operand:SI 0 "gpc_reg_operand" "")
1781 (mult:SI (match_dup 1) (match_dup 2)))]
1782 "! TARGET_POWER && reload_completed"
1784 (mult:SI (match_dup 1) (match_dup 2)))
1786 (compare:CC (match_dup 0)
1790 ;; Operand 1 is divided by operand 2; quotient goes to operand
1791 ;; 0 and remainder to operand 3.
1792 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1794 (define_expand "divmodsi4"
1795 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1796 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1797 (match_operand:SI 2 "gpc_reg_operand" "")))
1798 (set (match_operand:SI 3 "register_operand" "")
1799 (mod:SI (match_dup 1) (match_dup 2)))])]
1800 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1803 if (! TARGET_POWER && ! TARGET_POWERPC)
1805 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1806 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1807 emit_insn (gen_divss_call ());
1808 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1809 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1814 (define_insn "*divmodsi4_internal"
1815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1816 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1817 (match_operand:SI 2 "gpc_reg_operand" "r")))
1818 (set (match_operand:SI 3 "register_operand" "=q")
1819 (mod:SI (match_dup 1) (match_dup 2)))]
1822 [(set_attr "type" "idiv")])
1824 (define_expand "udivsi3"
1825 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1826 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1827 (match_operand:SI 2 "gpc_reg_operand" "")))]
1828 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1831 if (! TARGET_POWER && ! TARGET_POWERPC)
1833 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1834 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1835 emit_insn (gen_quous_call ());
1836 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1839 else if (TARGET_POWER)
1841 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1846 (define_insn "udivsi3_mq"
1847 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1848 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1849 (match_operand:SI 2 "gpc_reg_operand" "r")))
1850 (clobber (match_scratch:SI 3 "=q"))]
1851 "TARGET_POWERPC && TARGET_POWER"
1853 [(set_attr "type" "idiv")])
1855 (define_insn "*udivsi3_no_mq"
1856 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1857 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1858 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1859 "TARGET_POWERPC && ! TARGET_POWER"
1861 [(set_attr "type" "idiv")])
1863 ;; For powers of two we can do srai/aze for divide and then adjust for
1864 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1865 ;; used; for PowerPC, force operands into register and do a normal divide;
1866 ;; for AIX common-mode, use quoss call on register operands.
1867 (define_expand "divsi3"
1868 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1869 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1870 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1874 if (GET_CODE (operands[2]) == CONST_INT
1875 && INTVAL (operands[2]) > 0
1876 && exact_log2 (INTVAL (operands[2])) >= 0)
1878 else if (TARGET_POWERPC)
1880 operands[2] = force_reg (SImode, operands[2]);
1883 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1887 else if (TARGET_POWER)
1891 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1892 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1893 emit_insn (gen_quoss_call ());
1894 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1899 (define_insn "divsi3_mq"
1900 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1901 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1902 (match_operand:SI 2 "gpc_reg_operand" "r")))
1903 (clobber (match_scratch:SI 3 "=q"))]
1904 "TARGET_POWERPC && TARGET_POWER"
1906 [(set_attr "type" "idiv")])
1908 (define_insn "*divsi3_no_mq"
1909 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1910 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1911 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1912 "TARGET_POWERPC && ! TARGET_POWER"
1914 [(set_attr "type" "idiv")])
1916 (define_expand "modsi3"
1917 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1918 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1919 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1927 if (GET_CODE (operands[2]) != CONST_INT
1928 || INTVAL (operands[2]) <= 0
1929 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1932 temp1 = gen_reg_rtx (SImode);
1933 temp2 = gen_reg_rtx (SImode);
1935 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1936 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1937 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1942 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1943 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1944 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1946 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1947 [(set_attr "length" "8")])
1950 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1951 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1952 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1954 (clobber (match_scratch:SI 3 "=r,r"))]
1957 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1959 [(set_attr "type" "compare")
1960 (set_attr "length" "8,12")])
1963 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1964 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1965 (match_operand:SI 2 "exact_log2_cint_operand" ""))
1967 (clobber (match_scratch:SI 3 ""))]
1970 (div:SI (match_dup 1) (match_dup 2)))
1972 (compare:CC (match_dup 3)
1977 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1978 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1979 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1981 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1982 (div:SI (match_dup 1) (match_dup 2)))]
1985 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
1987 [(set_attr "type" "compare")
1988 (set_attr "length" "8,12")])
1991 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1992 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1993 (match_operand:SI 2 "exact_log2_cint_operand" ""))
1995 (set (match_operand:SI 0 "gpc_reg_operand" "")
1996 (div:SI (match_dup 1) (match_dup 2)))]
1999 (div:SI (match_dup 1) (match_dup 2)))
2001 (compare:CC (match_dup 0)
2006 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2009 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2011 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2012 (match_operand:SI 3 "gpc_reg_operand" "r")))
2013 (set (match_operand:SI 2 "register_operand" "=*q")
2016 (zero_extend:DI (match_dup 1)) (const_int 32))
2017 (zero_extend:DI (match_dup 4)))
2021 [(set_attr "type" "idiv")])
2023 ;; To do unsigned divide we handle the cases of the divisor looking like a
2024 ;; negative number. If it is a constant that is less than 2**31, we don't
2025 ;; have to worry about the branches. So make a few subroutines here.
2027 ;; First comes the normal case.
2028 (define_expand "udivmodsi4_normal"
2029 [(set (match_dup 4) (const_int 0))
2030 (parallel [(set (match_operand:SI 0 "" "")
2031 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2033 (zero_extend:DI (match_operand:SI 1 "" "")))
2034 (match_operand:SI 2 "" "")))
2035 (set (match_operand:SI 3 "" "")
2036 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2038 (zero_extend:DI (match_dup 1)))
2042 { operands[4] = gen_reg_rtx (SImode); }")
2044 ;; This handles the branches.
2045 (define_expand "udivmodsi4_tests"
2046 [(set (match_operand:SI 0 "" "") (const_int 0))
2047 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2048 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2049 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2050 (label_ref (match_operand:SI 4 "" "")) (pc)))
2051 (set (match_dup 0) (const_int 1))
2052 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2053 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2054 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2055 (label_ref (match_dup 4)) (pc)))]
2058 { operands[5] = gen_reg_rtx (CCUNSmode);
2059 operands[6] = gen_reg_rtx (CCmode);
2062 (define_expand "udivmodsi4"
2063 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2064 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2065 (match_operand:SI 2 "reg_or_cint_operand" "")))
2066 (set (match_operand:SI 3 "gpc_reg_operand" "")
2067 (umod:SI (match_dup 1) (match_dup 2)))])]
2075 if (! TARGET_POWERPC)
2077 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2078 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2079 emit_insn (gen_divus_call ());
2080 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2081 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2088 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2090 operands[2] = force_reg (SImode, operands[2]);
2091 label = gen_label_rtx ();
2092 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2093 operands[3], label));
2096 operands[2] = force_reg (SImode, operands[2]);
2098 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2106 ;; AIX architecture-independent common-mode multiply (DImode),
2107 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2108 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2109 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2110 ;; assumed unused if generating common-mode, so ignore.
2111 (define_insn "mulh_call"
2114 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2115 (sign_extend:DI (reg:SI 4)))
2117 (clobber (match_scratch:SI 0 "=l"))]
2118 "! TARGET_POWER && ! TARGET_POWERPC"
2120 [(set_attr "type" "imul")])
2122 (define_insn "mull_call"
2124 (mult:DI (sign_extend:DI (reg:SI 3))
2125 (sign_extend:DI (reg:SI 4))))
2126 (clobber (match_scratch:SI 0 "=l"))
2127 (clobber (reg:SI 0))]
2128 "! TARGET_POWER && ! TARGET_POWERPC"
2130 [(set_attr "type" "imul")])
2132 (define_insn "divss_call"
2134 (div:SI (reg:SI 3) (reg:SI 4)))
2136 (mod:SI (reg:SI 3) (reg:SI 4)))
2137 (clobber (match_scratch:SI 0 "=l"))
2138 (clobber (reg:SI 0))]
2139 "! TARGET_POWER && ! TARGET_POWERPC"
2141 [(set_attr "type" "idiv")])
2143 (define_insn "divus_call"
2145 (udiv:SI (reg:SI 3) (reg:SI 4)))
2147 (umod:SI (reg:SI 3) (reg:SI 4)))
2148 (clobber (match_scratch:SI 0 "=l"))
2149 (clobber (reg:SI 0))
2150 (clobber (match_scratch:CC 1 "=x"))
2151 (clobber (reg:CC 69))]
2152 "! TARGET_POWER && ! TARGET_POWERPC"
2154 [(set_attr "type" "idiv")])
2156 (define_insn "quoss_call"
2158 (div:SI (reg:SI 3) (reg:SI 4)))
2159 (clobber (match_scratch:SI 0 "=l"))]
2160 "! TARGET_POWER && ! TARGET_POWERPC"
2162 [(set_attr "type" "idiv")])
2164 (define_insn "quous_call"
2166 (udiv:SI (reg:SI 3) (reg:SI 4)))
2167 (clobber (match_scratch:SI 0 "=l"))
2168 (clobber (reg:SI 0))
2169 (clobber (match_scratch:CC 1 "=x"))
2170 (clobber (reg:CC 69))]
2171 "! TARGET_POWER && ! TARGET_POWERPC"
2173 [(set_attr "type" "idiv")])
2175 ;; Logical instructions
2176 ;; The logical instructions are mostly combined by using match_operator,
2177 ;; but the plain AND insns are somewhat different because there is no
2178 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2179 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2181 (define_insn "andsi3"
2182 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2183 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2184 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2185 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2189 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2190 {andil.|andi.} %0,%1,%b2
2191 {andiu.|andis.} %0,%1,%u2")
2193 ;; Note to set cr's other than cr0 we do the and immediate and then
2194 ;; the test again -- this avoids a mfcr which on the higher end
2195 ;; machines causes an execution serialization
2197 (define_insn "*andsi3_internal2"
2198 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2199 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2200 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2202 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2203 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2204 "! TARGET_POWERPC64"
2207 {andil.|andi.} %3,%1,%b2
2208 {andiu.|andis.} %3,%1,%u2
2209 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2214 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2215 (set_attr "length" "4,4,4,4,8,8,8,8")])
2217 (define_insn "*andsi3_internal3"
2218 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2219 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2220 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2222 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2223 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2227 {andil.|andi.} %3,%1,%b2
2228 {andiu.|andis.} %3,%1,%u2
2229 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2234 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2235 (set_attr "length" "8,4,4,4,8,8,8,8")])
2238 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2239 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2240 (match_operand:SI 2 "and_operand" ""))
2242 (clobber (match_scratch:SI 3 ""))
2243 (clobber (match_scratch:CC 4 ""))]
2245 [(parallel [(set (match_dup 3)
2246 (and:SI (match_dup 1)
2248 (clobber (match_dup 4))])
2250 (compare:CC (match_dup 3)
2254 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2255 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2258 [(set (match_operand:CC 0 "cc_reg_operand" "")
2259 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2260 (match_operand:SI 2 "gpc_reg_operand" ""))
2262 (clobber (match_scratch:SI 3 ""))
2263 (clobber (match_scratch:CC 4 ""))]
2264 "TARGET_POWERPC64 && reload_completed"
2265 [(parallel [(set (match_dup 3)
2266 (and:SI (match_dup 1)
2268 (clobber (match_dup 4))])
2270 (compare:CC (match_dup 3)
2274 (define_insn "*andsi3_internal4"
2275 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2276 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2277 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2279 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2280 (and:SI (match_dup 1)
2282 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2283 "! TARGET_POWERPC64"
2286 {andil.|andi.} %0,%1,%b2
2287 {andiu.|andis.} %0,%1,%u2
2288 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2293 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2294 (set_attr "length" "4,4,4,4,8,8,8,8")])
2296 (define_insn "*andsi3_internal5"
2297 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2298 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2299 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2301 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2302 (and:SI (match_dup 1)
2304 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2308 {andil.|andi.} %0,%1,%b2
2309 {andiu.|andis.} %0,%1,%u2
2310 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2315 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2316 (set_attr "length" "8,4,4,4,8,8,8,8")])
2319 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2320 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2321 (match_operand:SI 2 "and_operand" ""))
2323 (set (match_operand:SI 0 "gpc_reg_operand" "")
2324 (and:SI (match_dup 1)
2326 (clobber (match_scratch:CC 4 ""))]
2328 [(parallel [(set (match_dup 0)
2329 (and:SI (match_dup 1)
2331 (clobber (match_dup 4))])
2333 (compare:CC (match_dup 0)
2338 [(set (match_operand:CC 3 "cc_reg_operand" "")
2339 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2340 (match_operand:SI 2 "gpc_reg_operand" ""))
2342 (set (match_operand:SI 0 "gpc_reg_operand" "")
2343 (and:SI (match_dup 1)
2345 (clobber (match_scratch:CC 4 ""))]
2346 "TARGET_POWERPC64 && reload_completed"
2347 [(parallel [(set (match_dup 0)
2348 (and:SI (match_dup 1)
2350 (clobber (match_dup 4))])
2352 (compare:CC (match_dup 0)
2356 ;; Handle the PowerPC64 rlwinm corner case
2358 (define_insn_and_split "*andsi3_internal6"
2359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2360 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2361 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2366 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2369 (rotate:SI (match_dup 0) (match_dup 5)))]
2372 int mb = extract_MB (operands[2]);
2373 int me = extract_ME (operands[2]);
2374 operands[3] = GEN_INT (me + 1);
2375 operands[5] = GEN_INT (32 - (me + 1));
2376 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2378 [(set_attr "length" "8")])
2380 (define_insn_and_split "*andsi3_internal7"
2381 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2382 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
2383 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
2385 (clobber (match_scratch:SI 3 "=r,r"))]
2389 [(parallel [(set (match_dup 2)
2390 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
2393 (clobber (match_dup 3))])]
2396 int mb = extract_MB (operands[1]);
2397 int me = extract_ME (operands[1]);
2398 operands[4] = GEN_INT (me + 1);
2399 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2401 [(set_attr "type" "delayed_compare,compare")
2402 (set_attr "length" "4,8")])
2404 (define_insn_and_split "*andsi3_internal8"
2405 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2406 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2407 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
2409 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2410 (and:SI (match_dup 1)
2415 [(parallel [(set (match_dup 3)
2416 (compare:CC (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2420 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2423 (rotate:SI (match_dup 0) (match_dup 6)))]
2426 int mb = extract_MB (operands[2]);
2427 int me = extract_ME (operands[2]);
2428 operands[4] = GEN_INT (me + 1);
2429 operands[6] = GEN_INT (32 - (me + 1));
2430 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2432 [(set_attr "type" "delayed_compare,compare")
2433 (set_attr "length" "8,12")])
2435 (define_expand "iorsi3"
2436 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2437 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2438 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2442 if (GET_CODE (operands[2]) == CONST_INT
2443 && ! logical_operand (operands[2], SImode))
2445 HOST_WIDE_INT value = INTVAL (operands[2]);
2446 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2447 ? operands[0] : gen_reg_rtx (SImode));
2449 emit_insn (gen_iorsi3 (tmp, operands[1],
2450 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2451 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2456 (define_expand "xorsi3"
2457 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2458 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2459 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2463 if (GET_CODE (operands[2]) == CONST_INT
2464 && ! logical_operand (operands[2], SImode))
2466 HOST_WIDE_INT value = INTVAL (operands[2]);
2467 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2468 ? operands[0] : gen_reg_rtx (SImode));
2470 emit_insn (gen_xorsi3 (tmp, operands[1],
2471 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2472 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2477 (define_insn "*boolsi3_internal1"
2478 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2479 (match_operator:SI 3 "boolean_or_operator"
2480 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2481 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2485 {%q3il|%q3i} %0,%1,%b2
2486 {%q3iu|%q3is} %0,%1,%u2")
2488 (define_insn "*boolsi3_internal2"
2489 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2490 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2491 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2492 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2494 (clobber (match_scratch:SI 3 "=r,r"))]
2495 "! TARGET_POWERPC64"
2499 [(set_attr "type" "compare")
2500 (set_attr "length" "4,8")])
2503 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2504 (compare:CC (match_operator:SI 4 "boolean_operator"
2505 [(match_operand:SI 1 "gpc_reg_operand" "")
2506 (match_operand:SI 2 "gpc_reg_operand" "")])
2508 (clobber (match_scratch:SI 3 ""))]
2509 "! TARGET_POWERPC64 && reload_completed"
2510 [(set (match_dup 3) (match_dup 4))
2512 (compare:CC (match_dup 3)
2516 (define_insn "*boolsi3_internal3"
2517 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2518 (compare:CC (match_operator:SI 4 "boolean_operator"
2519 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2520 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2522 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2524 "! TARGET_POWERPC64"
2528 [(set_attr "type" "compare")
2529 (set_attr "length" "4,8")])
2532 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2533 (compare:CC (match_operator:SI 4 "boolean_operator"
2534 [(match_operand:SI 1 "gpc_reg_operand" "")
2535 (match_operand:SI 2 "gpc_reg_operand" "")])
2537 (set (match_operand:SI 0 "gpc_reg_operand" "")
2539 "! TARGET_POWERPC64 && reload_completed"
2540 [(set (match_dup 0) (match_dup 4))
2542 (compare:CC (match_dup 0)
2546 ;; Split a logical operation that we can't do in one insn into two insns,
2547 ;; each of which does one 16-bit part. This is used by combine.
2550 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2551 (match_operator:SI 3 "boolean_or_operator"
2552 [(match_operand:SI 1 "gpc_reg_operand" "")
2553 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2555 [(set (match_dup 0) (match_dup 4))
2556 (set (match_dup 0) (match_dup 5))]
2560 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2561 operands[4] = gen_rtx (GET_CODE (operands[3]), SImode,
2563 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2564 operands[5] = gen_rtx (GET_CODE (operands[3]), SImode,
2568 (define_insn "*boolcsi3_internal1"
2569 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2570 (match_operator:SI 3 "boolean_operator"
2571 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2572 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2576 (define_insn "*boolcsi3_internal2"
2577 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2578 (compare:CC (match_operator:SI 4 "boolean_operator"
2579 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2580 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2582 (clobber (match_scratch:SI 3 "=r,r"))]
2583 "! TARGET_POWERPC64"
2587 [(set_attr "type" "compare")
2588 (set_attr "length" "4,8")])
2591 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2592 (compare:CC (match_operator:SI 4 "boolean_operator"
2593 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2594 (match_operand:SI 2 "gpc_reg_operand" "")])
2596 (clobber (match_scratch:SI 3 ""))]
2597 "! TARGET_POWERPC64 && reload_completed"
2598 [(set (match_dup 3) (match_dup 4))
2600 (compare:CC (match_dup 3)
2604 (define_insn "*boolcsi3_internal3"
2605 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2606 (compare:CC (match_operator:SI 4 "boolean_operator"
2607 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2608 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2610 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2612 "! TARGET_POWERPC64"
2616 [(set_attr "type" "compare")
2617 (set_attr "length" "4,8")])
2620 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2621 (compare:CC (match_operator:SI 4 "boolean_operator"
2622 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2623 (match_operand:SI 2 "gpc_reg_operand" "")])
2625 (set (match_operand:SI 0 "gpc_reg_operand" "")
2627 "! TARGET_POWERPC64 && reload_completed"
2628 [(set (match_dup 0) (match_dup 4))
2630 (compare:CC (match_dup 0)
2634 (define_insn "*boolccsi3_internal1"
2635 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2636 (match_operator:SI 3 "boolean_operator"
2637 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2638 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2642 (define_insn "*boolccsi3_internal2"
2643 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2644 (compare:CC (match_operator:SI 4 "boolean_operator"
2645 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2646 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2648 (clobber (match_scratch:SI 3 "=r,r"))]
2649 "! TARGET_POWERPC64"
2653 [(set_attr "type" "compare")
2654 (set_attr "length" "4,8")])
2657 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2658 (compare:CC (match_operator:SI 4 "boolean_operator"
2659 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2660 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2662 (clobber (match_scratch:SI 3 ""))]
2663 "! TARGET_POWERPC64 && reload_completed"
2664 [(set (match_dup 3) (match_dup 4))
2666 (compare:CC (match_dup 3)
2670 (define_insn "*boolccsi3_internal3"
2671 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2672 (compare:CC (match_operator:SI 4 "boolean_operator"
2673 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2674 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2676 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2678 "! TARGET_POWERPC64"
2682 [(set_attr "type" "compare")
2683 (set_attr "length" "4,8")])
2686 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2687 (compare:CC (match_operator:SI 4 "boolean_operator"
2688 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2689 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2691 (set (match_operand:SI 0 "gpc_reg_operand" "")
2693 "! TARGET_POWERPC64 && reload_completed"
2694 [(set (match_dup 0) (match_dup 4))
2696 (compare:CC (match_dup 0)
2700 ;; maskir insn. We need four forms because things might be in arbitrary
2701 ;; orders. Don't define forms that only set CR fields because these
2702 ;; would modify an input register.
2704 (define_insn "*maskir_internal1"
2705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2706 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2707 (match_operand:SI 1 "gpc_reg_operand" "0"))
2708 (and:SI (match_dup 2)
2709 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2713 (define_insn "*maskir_internal2"
2714 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2715 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2716 (match_operand:SI 1 "gpc_reg_operand" "0"))
2717 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2722 (define_insn "*maskir_internal3"
2723 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2724 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2725 (match_operand:SI 3 "gpc_reg_operand" "r"))
2726 (and:SI (not:SI (match_dup 2))
2727 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2731 (define_insn "*maskir_internal4"
2732 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2733 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2734 (match_operand:SI 2 "gpc_reg_operand" "r"))
2735 (and:SI (not:SI (match_dup 2))
2736 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2740 (define_insn "*maskir_internal5"
2741 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2743 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2744 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2745 (and:SI (match_dup 2)
2746 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2748 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2749 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2750 (and:SI (match_dup 2) (match_dup 3))))]
2755 [(set_attr "type" "compare")
2756 (set_attr "length" "4,8")])
2759 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2761 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2762 (match_operand:SI 1 "gpc_reg_operand" ""))
2763 (and:SI (match_dup 2)
2764 (match_operand:SI 3 "gpc_reg_operand" "")))
2766 (set (match_operand:SI 0 "gpc_reg_operand" "")
2767 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2768 (and:SI (match_dup 2) (match_dup 3))))]
2769 "TARGET_POWER && reload_completed"
2771 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2772 (and:SI (match_dup 2) (match_dup 3))))
2774 (compare:CC (match_dup 0)
2778 (define_insn "*maskir_internal6"
2779 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2781 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2782 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2783 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2786 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2787 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2788 (and:SI (match_dup 3) (match_dup 2))))]
2793 [(set_attr "type" "compare")
2794 (set_attr "length" "4,8")])
2797 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2799 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2800 (match_operand:SI 1 "gpc_reg_operand" ""))
2801 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2804 (set (match_operand:SI 0 "gpc_reg_operand" "")
2805 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2806 (and:SI (match_dup 3) (match_dup 2))))]
2807 "TARGET_POWER && reload_completed"
2809 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2810 (and:SI (match_dup 3) (match_dup 2))))
2812 (compare:CC (match_dup 0)
2816 (define_insn "*maskir_internal7"
2817 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2819 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2820 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2821 (and:SI (not:SI (match_dup 2))
2822 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2824 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2825 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2826 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2831 [(set_attr "type" "compare")
2832 (set_attr "length" "4,8")])
2835 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2837 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2838 (match_operand:SI 3 "gpc_reg_operand" ""))
2839 (and:SI (not:SI (match_dup 2))
2840 (match_operand:SI 1 "gpc_reg_operand" "")))
2842 (set (match_operand:SI 0 "gpc_reg_operand" "")
2843 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2844 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2845 "TARGET_POWER && reload_completed"
2847 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2848 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2850 (compare:CC (match_dup 0)
2854 (define_insn "*maskir_internal8"
2855 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2857 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2858 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2859 (and:SI (not:SI (match_dup 2))
2860 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2862 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2863 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2864 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2869 [(set_attr "type" "compare")
2870 (set_attr "length" "4,8")])
2873 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2875 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2876 (match_operand:SI 2 "gpc_reg_operand" ""))
2877 (and:SI (not:SI (match_dup 2))
2878 (match_operand:SI 1 "gpc_reg_operand" "")))
2880 (set (match_operand:SI 0 "gpc_reg_operand" "")
2881 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2882 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2883 "TARGET_POWER && reload_completed"
2885 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2886 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2888 (compare:CC (match_dup 0)
2892 ;; Rotate and shift insns, in all their variants. These support shifts,
2893 ;; field inserts and extracts, and various combinations thereof.
2894 (define_expand "insv"
2895 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2896 (match_operand:SI 1 "const_int_operand" "")
2897 (match_operand:SI 2 "const_int_operand" ""))
2898 (match_operand 3 "gpc_reg_operand" ""))]
2902 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2903 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2904 compiler if the address of the structure is taken later. */
2905 if (GET_CODE (operands[0]) == SUBREG
2906 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2909 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2910 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2912 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2916 (define_insn "insvsi"
2917 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2918 (match_operand:SI 1 "const_int_operand" "i")
2919 (match_operand:SI 2 "const_int_operand" "i"))
2920 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2924 int start = INTVAL (operands[2]) & 31;
2925 int size = INTVAL (operands[1]) & 31;
2927 operands[4] = GEN_INT (32 - start - size);
2928 operands[1] = GEN_INT (start + size - 1);
2929 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2932 (define_insn "*insvsi_internal1"
2933 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2934 (match_operand:SI 1 "const_int_operand" "i")
2935 (match_operand:SI 2 "const_int_operand" "i"))
2936 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2937 (match_operand:SI 4 "const_int_operand" "i")))]
2938 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2941 int shift = INTVAL (operands[4]) & 31;
2942 int start = INTVAL (operands[2]) & 31;
2943 int size = INTVAL (operands[1]) & 31;
2945 operands[4] = GEN_INT (shift - start - size);
2946 operands[1] = GEN_INT (start + size - 1);
2947 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2950 (define_insn "*insvsi_internal2"
2951 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2952 (match_operand:SI 1 "const_int_operand" "i")
2953 (match_operand:SI 2 "const_int_operand" "i"))
2954 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2955 (match_operand:SI 4 "const_int_operand" "i")))]
2956 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2959 int shift = INTVAL (operands[4]) & 31;
2960 int start = INTVAL (operands[2]) & 31;
2961 int size = INTVAL (operands[1]) & 31;
2963 operands[4] = GEN_INT (32 - shift - start - size);
2964 operands[1] = GEN_INT (start + size - 1);
2965 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2968 (define_insn "*insvsi_internal3"
2969 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2970 (match_operand:SI 1 "const_int_operand" "i")
2971 (match_operand:SI 2 "const_int_operand" "i"))
2972 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2973 (match_operand:SI 4 "const_int_operand" "i")))]
2974 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2977 int shift = INTVAL (operands[4]) & 31;
2978 int start = INTVAL (operands[2]) & 31;
2979 int size = INTVAL (operands[1]) & 31;
2981 operands[4] = GEN_INT (32 - shift - start - size);
2982 operands[1] = GEN_INT (start + size - 1);
2983 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2986 (define_insn "*insvsi_internal4"
2987 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2988 (match_operand:SI 1 "const_int_operand" "i")
2989 (match_operand:SI 2 "const_int_operand" "i"))
2990 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2991 (match_operand:SI 4 "const_int_operand" "i")
2992 (match_operand:SI 5 "const_int_operand" "i")))]
2993 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2996 int extract_start = INTVAL (operands[5]) & 31;
2997 int extract_size = INTVAL (operands[4]) & 31;
2998 int insert_start = INTVAL (operands[2]) & 31;
2999 int insert_size = INTVAL (operands[1]) & 31;
3001 /* Align extract field with insert field */
3002 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3003 operands[1] = GEN_INT (insert_start + insert_size - 1);
3004 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3007 (define_insn "insvdi"
3008 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3009 (match_operand:SI 1 "const_int_operand" "i")
3010 (match_operand:SI 2 "const_int_operand" "i"))
3011 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3015 int start = INTVAL (operands[2]) & 63;
3016 int size = INTVAL (operands[1]) & 63;
3018 operands[1] = GEN_INT (64 - start - size);
3019 return \"rldimi %0,%3,%H1,%H2\";
3022 (define_expand "extzv"
3023 [(set (match_operand 0 "gpc_reg_operand" "")
3024 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3025 (match_operand:SI 2 "const_int_operand" "")
3026 (match_operand:SI 3 "const_int_operand" "")))]
3030 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3031 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3032 compiler if the address of the structure is taken later. */
3033 if (GET_CODE (operands[0]) == SUBREG
3034 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3037 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3038 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3040 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3044 (define_insn "extzvsi"
3045 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3046 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3047 (match_operand:SI 2 "const_int_operand" "i")
3048 (match_operand:SI 3 "const_int_operand" "i")))]
3052 int start = INTVAL (operands[3]) & 31;
3053 int size = INTVAL (operands[2]) & 31;
3055 if (start + size >= 32)
3056 operands[3] = const0_rtx;
3058 operands[3] = GEN_INT (start + size);
3059 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3062 (define_insn "*extzvsi_internal1"
3063 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3064 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3065 (match_operand:SI 2 "const_int_operand" "i,i")
3066 (match_operand:SI 3 "const_int_operand" "i,i"))
3068 (clobber (match_scratch:SI 4 "=r,r"))]
3072 int start = INTVAL (operands[3]) & 31;
3073 int size = INTVAL (operands[2]) & 31;
3075 /* Force split for non-cc0 compare. */
3076 if (which_alternative == 1)
3079 /* If the bit-field being tested fits in the upper or lower half of a
3080 word, it is possible to use andiu. or andil. to test it. This is
3081 useful because the condition register set-use delay is smaller for
3082 andi[ul]. than for rlinm. This doesn't work when the starting bit
3083 position is 0 because the LT and GT bits may be set wrong. */
3085 if ((start > 0 && start + size <= 16) || start >= 16)
3087 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3088 - (1 << (16 - (start & 15) - size))));
3090 return \"{andiu.|andis.} %4,%1,%3\";
3092 return \"{andil.|andi.} %4,%1,%3\";
3095 if (start + size >= 32)
3096 operands[3] = const0_rtx;
3098 operands[3] = GEN_INT (start + size);
3099 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3101 [(set_attr "type" "compare")
3102 (set_attr "length" "4,8")])
3105 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3106 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3107 (match_operand:SI 2 "const_int_operand" "")
3108 (match_operand:SI 3 "const_int_operand" ""))
3110 (clobber (match_scratch:SI 4 ""))]
3113 (zero_extract:SI (match_dup 1) (match_dup 2)
3116 (compare:CC (match_dup 4)
3120 (define_insn "*extzvsi_internal2"
3121 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3122 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3123 (match_operand:SI 2 "const_int_operand" "i,i")
3124 (match_operand:SI 3 "const_int_operand" "i,i"))
3126 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3127 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3131 int start = INTVAL (operands[3]) & 31;
3132 int size = INTVAL (operands[2]) & 31;
3134 /* Force split for non-cc0 compare. */
3135 if (which_alternative == 1)
3138 /* Since we are using the output value, we can't ignore any need for
3139 a shift. The bit-field must end at the LSB. */
3140 if (start >= 16 && start + size == 32)
3142 operands[3] = GEN_INT ((1 << size) - 1);
3143 return \"{andil.|andi.} %0,%1,%3\";
3146 if (start + size >= 32)
3147 operands[3] = const0_rtx;
3149 operands[3] = GEN_INT (start + size);
3150 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3152 [(set_attr "type" "compare")
3153 (set_attr "length" "4,8")])
3156 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3157 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3158 (match_operand:SI 2 "const_int_operand" "")
3159 (match_operand:SI 3 "const_int_operand" ""))
3161 (set (match_operand:SI 0 "gpc_reg_operand" "")
3162 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3165 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3167 (compare:CC (match_dup 0)
3171 (define_insn "extzvdi"
3172 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3173 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3174 (match_operand:SI 2 "const_int_operand" "i")
3175 (match_operand:SI 3 "const_int_operand" "i")))]
3179 int start = INTVAL (operands[3]) & 63;
3180 int size = INTVAL (operands[2]) & 63;
3182 if (start + size >= 64)
3183 operands[3] = const0_rtx;
3185 operands[3] = GEN_INT (start + size);
3186 operands[2] = GEN_INT (64 - size);
3187 return \"rldicl %0,%1,%3,%2\";
3190 (define_insn "*extzvdi_internal1"
3191 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3192 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3193 (match_operand:SI 2 "const_int_operand" "i")
3194 (match_operand:SI 3 "const_int_operand" "i"))
3196 (clobber (match_scratch:DI 4 "=r"))]
3200 int start = INTVAL (operands[3]) & 63;
3201 int size = INTVAL (operands[2]) & 63;
3203 if (start + size >= 64)
3204 operands[3] = const0_rtx;
3206 operands[3] = GEN_INT (start + size);
3207 operands[2] = GEN_INT (64 - size);
3208 return \"rldicl. %4,%1,%3,%2\";
3211 (define_insn "*extzvdi_internal2"
3212 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3213 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3214 (match_operand:SI 2 "const_int_operand" "i")
3215 (match_operand:SI 3 "const_int_operand" "i"))
3217 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3218 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3222 int start = INTVAL (operands[3]) & 63;
3223 int size = INTVAL (operands[2]) & 63;
3225 if (start + size >= 64)
3226 operands[3] = const0_rtx;
3228 operands[3] = GEN_INT (start + size);
3229 operands[2] = GEN_INT (64 - size);
3230 return \"rldicl. %0,%1,%3,%2\";
3233 (define_insn "rotlsi3"
3234 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3235 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3236 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3238 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3240 (define_insn "*rotlsi3_internal2"
3241 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3242 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3243 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3245 (clobber (match_scratch:SI 3 "=r,r"))]
3248 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3250 [(set_attr "type" "delayed_compare")
3251 (set_attr "length" "4,8")])
3254 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3255 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3256 (match_operand:SI 2 "reg_or_cint_operand" ""))
3258 (clobber (match_scratch:SI 3 ""))]
3261 (rotate:SI (match_dup 1) (match_dup 2)))
3263 (compare:CC (match_dup 3)
3267 (define_insn "*rotlsi3_internal3"
3268 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3269 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3270 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3272 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3273 (rotate:SI (match_dup 1) (match_dup 2)))]
3276 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3278 [(set_attr "type" "delayed_compare")
3279 (set_attr "length" "4,8")])
3282 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3283 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3284 (match_operand:SI 2 "reg_or_cint_operand" ""))
3286 (set (match_operand:SI 0 "gpc_reg_operand" "")
3287 (rotate:SI (match_dup 1) (match_dup 2)))]
3290 (rotate:SI (match_dup 1) (match_dup 2)))
3292 (compare:CC (match_dup 0)
3296 (define_insn "*rotlsi3_internal4"
3297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3298 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3299 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3300 (match_operand:SI 3 "mask_operand" "n")))]
3302 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3304 (define_insn "*rotlsi3_internal5"
3305 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3307 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3308 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3309 (match_operand:SI 3 "mask_operand" "n,n"))
3311 (clobber (match_scratch:SI 4 "=r,r"))]
3314 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3316 [(set_attr "type" "delayed_compare")
3317 (set_attr "length" "4,8")])
3320 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3322 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3323 (match_operand:SI 2 "reg_or_cint_operand" ""))
3324 (match_operand:SI 3 "mask_operand" ""))
3326 (clobber (match_scratch:SI 4 ""))]
3329 (and:SI (rotate:SI (match_dup 1)
3333 (compare:CC (match_dup 4)
3337 (define_insn "*rotlsi3_internal6"
3338 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3340 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3341 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3342 (match_operand:SI 3 "mask_operand" "n,n"))
3344 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3345 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3348 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3350 [(set_attr "type" "delayed_compare")
3351 (set_attr "length" "4,8")])
3354 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3356 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3357 (match_operand:SI 2 "reg_or_cint_operand" ""))
3358 (match_operand:SI 3 "mask_operand" ""))
3360 (set (match_operand:SI 0 "gpc_reg_operand" "")
3361 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3364 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3366 (compare:CC (match_dup 0)
3370 (define_insn "*rotlsi3_internal7"
3371 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3374 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3375 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3377 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3379 (define_insn "*rotlsi3_internal8"
3380 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3381 (compare:CC (zero_extend:SI
3383 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3384 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3386 (clobber (match_scratch:SI 3 "=r,r"))]
3389 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3391 [(set_attr "type" "delayed_compare")
3392 (set_attr "length" "4,8")])
3395 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3396 (compare:CC (zero_extend:SI
3398 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3399 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3401 (clobber (match_scratch:SI 3 ""))]
3404 (zero_extend:SI (subreg:QI
3405 (rotate:SI (match_dup 1)
3408 (compare:CC (match_dup 3)
3412 (define_insn "*rotlsi3_internal9"
3413 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3414 (compare:CC (zero_extend:SI
3416 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3417 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3419 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3420 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3423 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3425 [(set_attr "type" "delayed_compare")
3426 (set_attr "length" "4,8")])
3429 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3430 (compare:CC (zero_extend:SI
3432 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3433 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3435 (set (match_operand:SI 0 "gpc_reg_operand" "")
3436 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3439 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3441 (compare:CC (match_dup 0)
3445 (define_insn "*rotlsi3_internal10"
3446 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3449 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3450 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3452 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3454 (define_insn "*rotlsi3_internal11"
3455 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3456 (compare:CC (zero_extend:SI
3458 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3459 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3461 (clobber (match_scratch:SI 3 "=r,r"))]
3464 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3466 [(set_attr "type" "delayed_compare")
3467 (set_attr "length" "4,8")])
3470 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3471 (compare:CC (zero_extend:SI
3473 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3474 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3476 (clobber (match_scratch:SI 3 ""))]
3479 (zero_extend:SI (subreg:HI
3480 (rotate:SI (match_dup 1)
3483 (compare:CC (match_dup 3)
3487 (define_insn "*rotlsi3_internal12"
3488 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3489 (compare:CC (zero_extend:SI
3491 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3492 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3494 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3495 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3498 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3500 [(set_attr "type" "delayed_compare")
3501 (set_attr "length" "4,8")])
3504 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3505 (compare:CC (zero_extend:SI
3507 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3508 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3510 (set (match_operand:SI 0 "gpc_reg_operand" "")
3511 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3514 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3516 (compare:CC (match_dup 0)
3520 ;; Note that we use "sle." instead of "sl." so that we can set
3521 ;; SHIFT_COUNT_TRUNCATED.
3523 (define_expand "ashlsi3"
3524 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3525 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3526 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3531 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3533 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3537 (define_insn "ashlsi3_power"
3538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3539 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3540 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3541 (clobber (match_scratch:SI 3 "=q,X"))]
3545 {sli|slwi} %0,%1,%h2")
3547 (define_insn "ashlsi3_no_power"
3548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3549 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3550 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3552 "{sl|slw}%I2 %0,%1,%h2")
3555 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3556 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3557 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3559 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3560 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3564 {sli.|slwi.} %3,%1,%h2
3567 [(set_attr "type" "delayed_compare")
3568 (set_attr "length" "4,4,8,8")])
3571 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3572 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3573 (match_operand:SI 2 "reg_or_cint_operand" ""))
3575 (clobber (match_scratch:SI 3 ""))
3576 (clobber (match_scratch:SI 4 ""))]
3577 "TARGET_POWER && reload_completed"
3578 [(parallel [(set (match_dup 3)
3579 (ashift:SI (match_dup 1) (match_dup 2)))
3580 (clobber (match_dup 4))])
3582 (compare:CC (match_dup 3)
3587 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3588 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3589 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3591 (clobber (match_scratch:SI 3 "=r,r"))]
3592 "! TARGET_POWER && ! TARGET_POWERPC64"
3594 {sl|slw}%I2. %3,%1,%h2
3596 [(set_attr "type" "delayed_compare")
3597 (set_attr "length" "4,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 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3607 (ashift:SI (match_dup 1) (match_dup 2)))
3609 (compare:CC (match_dup 3)
3614 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3615 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3616 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3618 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3619 (ashift:SI (match_dup 1) (match_dup 2)))
3620 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3624 {sli.|slwi.} %0,%1,%h2
3627 [(set_attr "type" "delayed_compare")
3628 (set_attr "length" "4,4,8,8")])
3631 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3632 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3633 (match_operand:SI 2 "reg_or_cint_operand" ""))
3635 (set (match_operand:SI 0 "gpc_reg_operand" "")
3636 (ashift:SI (match_dup 1) (match_dup 2)))
3637 (clobber (match_scratch:SI 4 ""))]
3638 "TARGET_POWER && reload_completed"
3639 [(parallel [(set (match_dup 0)
3640 (ashift:SI (match_dup 1) (match_dup 2)))
3641 (clobber (match_dup 4))])
3643 (compare:CC (match_dup 0)
3648 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3649 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3650 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3652 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3653 (ashift:SI (match_dup 1) (match_dup 2)))]
3654 "! TARGET_POWER && ! TARGET_POWERPC64"
3656 {sl|slw}%I2. %0,%1,%h2
3658 [(set_attr "type" "delayed_compare")
3659 (set_attr "length" "4,8")])
3662 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3663 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3664 (match_operand:SI 2 "reg_or_cint_operand" ""))
3666 (set (match_operand:SI 0 "gpc_reg_operand" "")
3667 (ashift:SI (match_dup 1) (match_dup 2)))]
3668 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3670 (ashift:SI (match_dup 1) (match_dup 2)))
3672 (compare:CC (match_dup 0)
3677 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3678 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3679 (match_operand:SI 2 "const_int_operand" "i"))
3680 (match_operand:SI 3 "mask_operand" "n")))]
3681 "includes_lshift_p (operands[2], operands[3])"
3682 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3685 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3687 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3688 (match_operand:SI 2 "const_int_operand" "i,i"))
3689 (match_operand:SI 3 "mask_operand" "n,n"))
3691 (clobber (match_scratch:SI 4 "=r,r"))]
3692 "includes_lshift_p (operands[2], operands[3])"
3694 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3696 [(set_attr "type" "delayed_compare")
3697 (set_attr "length" "4,8")])
3700 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3702 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3703 (match_operand:SI 2 "const_int_operand" ""))
3704 (match_operand:SI 3 "mask_operand" ""))
3706 (clobber (match_scratch:SI 4 ""))]
3707 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3709 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3712 (compare:CC (match_dup 4)
3717 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3719 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3720 (match_operand:SI 2 "const_int_operand" "i,i"))
3721 (match_operand:SI 3 "mask_operand" "n,n"))
3723 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3724 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3725 "includes_lshift_p (operands[2], operands[3])"
3727 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3729 [(set_attr "type" "delayed_compare")
3730 (set_attr "length" "4,8")])
3733 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3735 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3736 (match_operand:SI 2 "const_int_operand" ""))
3737 (match_operand:SI 3 "mask_operand" ""))
3739 (set (match_operand:SI 0 "gpc_reg_operand" "")
3740 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3741 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3743 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3745 (compare:CC (match_dup 0)
3749 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3751 (define_expand "lshrsi3"
3752 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3753 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3754 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3759 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3761 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3765 (define_insn "lshrsi3_power"
3766 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3767 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3768 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3769 (clobber (match_scratch:SI 3 "=q,X,X"))]
3774 {s%A2i|s%A2wi} %0,%1,%h2")
3776 (define_insn "lshrsi3_no_power"
3777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3778 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3779 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3783 {sr|srw}%I2 %0,%1,%h2")
3786 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3787 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3788 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3790 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3791 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3796 {s%A2i.|s%A2wi.} %3,%1,%h2
3800 [(set_attr "type" "delayed_compare")
3801 (set_attr "length" "4,4,4,8,8,8")])
3804 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3805 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3806 (match_operand:SI 2 "reg_or_cint_operand" ""))
3808 (clobber (match_scratch:SI 3 ""))
3809 (clobber (match_scratch:SI 4 ""))]
3810 "TARGET_POWER && reload_completed"
3811 [(parallel [(set (match_dup 3)
3812 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3813 (clobber (match_dup 4))])
3815 (compare:CC (match_dup 3)
3820 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3821 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3822 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3824 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3825 "! TARGET_POWER && ! TARGET_POWERPC64"
3828 {sr|srw}%I2. %3,%1,%h2
3831 [(set_attr "type" "delayed_compare")
3832 (set_attr "length" "4,4,8,8")])
3835 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3836 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3837 (match_operand:SI 2 "reg_or_cint_operand" ""))
3839 (clobber (match_scratch:SI 3 ""))]
3840 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3842 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3844 (compare:CC (match_dup 3)
3849 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3850 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3851 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3853 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3854 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3855 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3860 {s%A2i.|s%A2wi.} %0,%1,%h2
3864 [(set_attr "type" "delayed_compare")
3865 (set_attr "length" "4,4,4,8,8,8")])
3868 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3869 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3870 (match_operand:SI 2 "reg_or_cint_operand" ""))
3872 (set (match_operand:SI 0 "gpc_reg_operand" "")
3873 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3874 (clobber (match_scratch:SI 4 ""))]
3875 "TARGET_POWER && reload_completed"
3876 [(parallel [(set (match_dup 0)
3877 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3878 (clobber (match_dup 4))])
3880 (compare:CC (match_dup 0)
3885 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3886 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3887 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3889 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3890 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3891 "! TARGET_POWER && ! TARGET_POWERPC64"
3894 {sr|srw}%I2. %0,%1,%h2
3897 [(set_attr "type" "delayed_compare")
3898 (set_attr "length" "4,4,8,8")])
3901 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3902 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3903 (match_operand:SI 2 "reg_or_cint_operand" ""))
3905 (set (match_operand:SI 0 "gpc_reg_operand" "")
3906 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3907 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3909 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3911 (compare:CC (match_dup 0)
3916 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3917 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3918 (match_operand:SI 2 "const_int_operand" "i"))
3919 (match_operand:SI 3 "mask_operand" "n")))]
3920 "includes_rshift_p (operands[2], operands[3])"
3921 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3924 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3926 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3927 (match_operand:SI 2 "const_int_operand" "i,i"))
3928 (match_operand:SI 3 "mask_operand" "n,n"))
3930 (clobber (match_scratch:SI 4 "=r,r"))]
3931 "includes_rshift_p (operands[2], operands[3])"
3933 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
3935 [(set_attr "type" "delayed_compare")
3936 (set_attr "length" "4,8")])
3939 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3941 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3942 (match_operand:SI 2 "const_int_operand" ""))
3943 (match_operand:SI 3 "mask_operand" ""))
3945 (clobber (match_scratch:SI 4 ""))]
3946 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
3948 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
3951 (compare:CC (match_dup 4)
3956 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3958 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3959 (match_operand:SI 2 "const_int_operand" "i,i"))
3960 (match_operand:SI 3 "mask_operand" "n,n"))
3962 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3963 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3964 "includes_rshift_p (operands[2], operands[3])"
3966 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
3968 [(set_attr "type" "delayed_compare")
3969 (set_attr "length" "4,8")])
3972 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3974 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3975 (match_operand:SI 2 "const_int_operand" ""))
3976 (match_operand:SI 3 "mask_operand" ""))
3978 (set (match_operand:SI 0 "gpc_reg_operand" "")
3979 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3980 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
3982 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3984 (compare:CC (match_dup 0)
3989 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3992 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3993 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
3994 "includes_rshift_p (operands[2], GEN_INT (255))"
3995 "{rlinm|rlwinm} %0,%1,%s2,0xff")
3998 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4002 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4003 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4005 (clobber (match_scratch:SI 3 "=r,r"))]
4006 "includes_rshift_p (operands[2], GEN_INT (255))"
4008 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4010 [(set_attr "type" "delayed_compare")
4011 (set_attr "length" "4,8")])
4014 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4018 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4019 (match_operand:SI 2 "const_int_operand" "")) 0))
4021 (clobber (match_scratch:SI 3 ""))]
4022 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4024 (zero_extend:SI (subreg:QI
4025 (lshiftrt:SI (match_dup 1)
4028 (compare:CC (match_dup 3)
4033 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4037 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4038 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4040 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4041 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4042 "includes_rshift_p (operands[2], GEN_INT (255))"
4044 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4046 [(set_attr "type" "delayed_compare")
4047 (set_attr "length" "4,8")])
4050 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4054 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4055 (match_operand:SI 2 "const_int_operand" "")) 0))
4057 (set (match_operand:SI 0 "gpc_reg_operand" "")
4058 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4059 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4061 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4063 (compare:CC (match_dup 0)
4068 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4071 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4072 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4073 "includes_rshift_p (operands[2], GEN_INT (65535))"
4074 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4077 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4081 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4082 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4084 (clobber (match_scratch:SI 3 "=r,r"))]
4085 "includes_rshift_p (operands[2], GEN_INT (65535))"
4087 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4089 [(set_attr "type" "delayed_compare")
4090 (set_attr "length" "4,8")])
4093 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4097 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4098 (match_operand:SI 2 "const_int_operand" "")) 0))
4100 (clobber (match_scratch:SI 3 ""))]
4101 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4103 (zero_extend:SI (subreg:HI
4104 (lshiftrt:SI (match_dup 1)
4107 (compare:CC (match_dup 3)
4112 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4116 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4117 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4119 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4120 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4121 "includes_rshift_p (operands[2], GEN_INT (65535))"
4123 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4125 [(set_attr "type" "delayed_compare")
4126 (set_attr "length" "4,8")])
4129 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4133 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4134 (match_operand:SI 2 "const_int_operand" "")) 0))
4136 (set (match_operand:SI 0 "gpc_reg_operand" "")
4137 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4138 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4140 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4142 (compare:CC (match_dup 0)
4147 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4149 (match_operand:SI 1 "gpc_reg_operand" "r"))
4150 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4156 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4158 (match_operand:SI 1 "gpc_reg_operand" "r"))
4159 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4165 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4167 (match_operand:SI 1 "gpc_reg_operand" "r"))
4168 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4174 (define_expand "ashrsi3"
4175 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4176 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4177 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4182 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4184 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4188 (define_insn "ashrsi3_power"
4189 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4190 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4191 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4192 (clobber (match_scratch:SI 3 "=q,X"))]
4196 {srai|srawi} %0,%1,%h2")
4198 (define_insn "ashrsi3_no_power"
4199 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4200 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4201 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4203 "{sra|sraw}%I2 %0,%1,%h2")
4206 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4207 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4208 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4210 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4211 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4215 {srai.|srawi.} %3,%1,%h2
4218 [(set_attr "type" "delayed_compare")
4219 (set_attr "length" "4,4,8,8")])
4222 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4223 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4224 (match_operand:SI 2 "reg_or_cint_operand" ""))
4226 (clobber (match_scratch:SI 3 ""))
4227 (clobber (match_scratch:SI 4 ""))]
4228 "TARGET_POWER && reload_completed"
4229 [(parallel [(set (match_dup 3)
4230 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4231 (clobber (match_dup 4))])
4233 (compare:CC (match_dup 3)
4238 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4239 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4240 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4242 (clobber (match_scratch:SI 3 "=r,r"))]
4245 {sra|sraw}%I2. %3,%1,%h2
4247 [(set_attr "type" "delayed_compare")
4248 (set_attr "length" "4,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 "! TARGET_POWER && reload_completed"
4258 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4260 (compare:CC (match_dup 3)
4265 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4266 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4267 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4269 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4270 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4271 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4275 {srai.|srawi.} %0,%1,%h2
4278 [(set_attr "type" "delayed_compare")
4279 (set_attr "length" "4,4,8,8")])
4282 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4283 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4284 (match_operand:SI 2 "reg_or_cint_operand" ""))
4286 (set (match_operand:SI 0 "gpc_reg_operand" "")
4287 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4288 (clobber (match_scratch:SI 4 ""))]
4289 "TARGET_POWER && reload_completed"
4290 [(parallel [(set (match_dup 0)
4291 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4292 (clobber (match_dup 4))])
4294 (compare:CC (match_dup 0)
4299 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4300 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4301 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4303 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4304 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4307 {sra|sraw}%I2. %0,%1,%h2
4309 [(set_attr "type" "delayed_compare")
4310 (set_attr "length" "4,8")])
4313 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4314 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4315 (match_operand:SI 2 "reg_or_cint_operand" ""))
4317 (set (match_operand:SI 0 "gpc_reg_operand" "")
4318 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4319 "! TARGET_POWER && reload_completed"
4321 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4323 (compare:CC (match_dup 0)
4327 ;; Floating-point insns, excluding normal data motion.
4329 ;; PowerPC has a full set of single-precision floating point instructions.
4331 ;; For the POWER architecture, we pretend that we have both SFmode and
4332 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4333 ;; The only conversions we will do will be when storing to memory. In that
4334 ;; case, we will use the "frsp" instruction before storing.
4336 ;; Note that when we store into a single-precision memory location, we need to
4337 ;; use the frsp insn first. If the register being stored isn't dead, we
4338 ;; need a scratch register for the frsp. But this is difficult when the store
4339 ;; is done by reload. It is not incorrect to do the frsp on the register in
4340 ;; this case, we just lose precision that we would have otherwise gotten but
4341 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4343 (define_insn "extendsfdf2"
4344 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4345 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4346 "TARGET_HARD_FLOAT && TARGET_FPRS"
4349 if (REGNO (operands[0]) == REGNO (operands[1]))
4352 return \"fmr %0,%1\";
4354 [(set_attr "type" "fp")])
4356 (define_insn "truncdfsf2"
4357 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4358 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4359 "TARGET_HARD_FLOAT && TARGET_FPRS"
4361 [(set_attr "type" "fp")])
4363 (define_insn "aux_truncdfsf2"
4364 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4365 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
4366 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4368 [(set_attr "type" "fp")])
4370 (define_expand "negsf2"
4371 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4372 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4376 (define_insn "*negsf2"
4377 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4378 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4379 "TARGET_HARD_FLOAT && TARGET_FPRS"
4381 [(set_attr "type" "fp")])
4383 (define_expand "abssf2"
4384 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4385 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4389 (define_insn "*abssf2"
4390 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4391 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4392 "TARGET_HARD_FLOAT && TARGET_FPRS"
4394 [(set_attr "type" "fp")])
4397 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4398 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4399 "TARGET_HARD_FLOAT && TARGET_FPRS"
4401 [(set_attr "type" "fp")])
4403 (define_expand "addsf3"
4404 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4405 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4406 (match_operand:SF 2 "gpc_reg_operand" "")))]
4411 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4412 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4413 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4414 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4416 [(set_attr "type" "fp")])
4419 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4420 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4421 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4422 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4423 "{fa|fadd} %0,%1,%2"
4424 [(set_attr "type" "fp")])
4426 (define_expand "subsf3"
4427 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4428 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4429 (match_operand:SF 2 "gpc_reg_operand" "")))]
4434 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4435 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4436 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4437 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4439 [(set_attr "type" "fp")])
4442 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4443 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4444 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4445 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4446 "{fs|fsub} %0,%1,%2"
4447 [(set_attr "type" "fp")])
4449 (define_expand "mulsf3"
4450 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4451 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4452 (match_operand:SF 2 "gpc_reg_operand" "")))]
4457 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4458 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4459 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4460 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4462 [(set_attr "type" "fp")])
4465 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4466 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4467 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4468 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4469 "{fm|fmul} %0,%1,%2"
4470 [(set_attr "type" "dmul")])
4472 (define_expand "divsf3"
4473 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4474 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4475 (match_operand:SF 2 "gpc_reg_operand" "")))]
4480 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4481 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4482 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4483 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4485 [(set_attr "type" "sdiv")])
4488 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4489 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4490 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4491 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4492 "{fd|fdiv} %0,%1,%2"
4493 [(set_attr "type" "ddiv")])
4496 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4497 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4498 (match_operand:SF 2 "gpc_reg_operand" "f"))
4499 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4500 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4501 "fmadds %0,%1,%2,%3"
4502 [(set_attr "type" "fp")])
4505 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4506 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4507 (match_operand:SF 2 "gpc_reg_operand" "f"))
4508 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4509 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4510 "{fma|fmadd} %0,%1,%2,%3"
4511 [(set_attr "type" "dmul")])
4514 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4515 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4516 (match_operand:SF 2 "gpc_reg_operand" "f"))
4517 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4518 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4519 "fmsubs %0,%1,%2,%3"
4520 [(set_attr "type" "fp")])
4523 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4524 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4525 (match_operand:SF 2 "gpc_reg_operand" "f"))
4526 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4527 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4528 "{fms|fmsub} %0,%1,%2,%3"
4529 [(set_attr "type" "dmul")])
4532 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4533 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4534 (match_operand:SF 2 "gpc_reg_operand" "f"))
4535 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4536 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4537 && HONOR_SIGNED_ZEROS (SFmode)"
4538 "fnmadds %0,%1,%2,%3"
4539 [(set_attr "type" "fp")])
4542 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4543 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4544 (match_operand:SF 2 "gpc_reg_operand" "f"))
4545 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4546 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4547 && ! HONOR_SIGNED_ZEROS (SFmode)"
4548 "fnmadds %0,%1,%2,%3"
4549 [(set_attr "type" "fp")])
4552 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4553 (neg:SF (plus: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 "{fnma|fnmadd} %0,%1,%2,%3"
4558 [(set_attr "type" "dmul")])
4561 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4562 (minus:SF (mult:SF (neg: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 "{fnma|fnmadd} %0,%1,%2,%3"
4568 [(set_attr "type" "dmul")])
4571 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4572 (neg:SF (minus:SF (mult: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 "fnmsubs %0,%1,%2,%3"
4578 [(set_attr "type" "fp")])
4581 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4582 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4583 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4584 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4585 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4586 && ! HONOR_SIGNED_ZEROS (SFmode)"
4587 "fnmsubs %0,%1,%2,%3"
4588 [(set_attr "type" "fp")])
4591 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4592 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4593 (match_operand:SF 2 "gpc_reg_operand" "f"))
4594 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4595 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4596 "{fnms|fnmsub} %0,%1,%2,%3"
4597 [(set_attr "type" "dmul")])
4600 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4601 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4602 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4603 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4604 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4605 && ! HONOR_SIGNED_ZEROS (SFmode)"
4606 "{fnms|fnmsub} %0,%1,%2,%3"
4607 [(set_attr "type" "fp")])
4609 (define_expand "sqrtsf2"
4610 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4611 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4612 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4616 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4617 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4618 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4620 [(set_attr "type" "ssqrt")])
4623 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4624 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4625 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4627 [(set_attr "type" "dsqrt")])
4629 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4630 ;; fsel instruction and some auxiliary computations. Then we just have a
4631 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4633 (define_expand "maxsf3"
4634 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4635 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4636 (match_operand:SF 2 "gpc_reg_operand" ""))
4639 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4640 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4642 (define_expand "minsf3"
4643 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4644 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4645 (match_operand:SF 2 "gpc_reg_operand" ""))
4648 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4649 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4652 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4653 (match_operator:SF 3 "min_max_operator"
4654 [(match_operand:SF 1 "gpc_reg_operand" "")
4655 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4656 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4659 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4660 operands[1], operands[2]);
4664 (define_expand "movsicc"
4665 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4666 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4667 (match_operand:SI 2 "gpc_reg_operand" "")
4668 (match_operand:SI 3 "gpc_reg_operand" "")))]
4672 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4678 ;; We use the BASE_REGS for the isel input operands because, if rA is
4679 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4680 ;; because we may switch the operands and rB may end up being rA.
4682 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4683 ;; leave out the mode in operand 4 and use one pattern, but reload can
4684 ;; change the mode underneath our feet and then gets confused trying
4685 ;; to reload the value.
4686 (define_insn "isel_signed"
4687 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4689 (match_operator 1 "comparison_operator"
4690 [(match_operand:CC 4 "cc_reg_operand" "y")
4692 (match_operand:SI 2 "gpc_reg_operand" "b")
4693 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4696 { return output_isel (operands); }"
4697 [(set_attr "length" "4")])
4699 (define_insn "isel_unsigned"
4700 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4702 (match_operator 1 "comparison_operator"
4703 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4705 (match_operand:SI 2 "gpc_reg_operand" "b")
4706 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4709 { return output_isel (operands); }"
4710 [(set_attr "length" "4")])
4712 (define_expand "movsfcc"
4713 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4714 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4715 (match_operand:SF 2 "gpc_reg_operand" "")
4716 (match_operand:SF 3 "gpc_reg_operand" "")))]
4717 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4720 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4726 (define_insn "*fselsfsf4"
4727 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4728 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4729 (match_operand:SF 4 "zero_fp_constant" "F"))
4730 (match_operand:SF 2 "gpc_reg_operand" "f")
4731 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4732 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4734 [(set_attr "type" "fp")])
4736 (define_insn "*fseldfsf4"
4737 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4738 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4739 (match_operand:DF 4 "zero_fp_constant" "F"))
4740 (match_operand:SF 2 "gpc_reg_operand" "f")
4741 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4742 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4744 [(set_attr "type" "fp")])
4746 (define_insn "negdf2"
4747 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4748 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4749 "TARGET_HARD_FLOAT && TARGET_FPRS"
4751 [(set_attr "type" "fp")])
4753 (define_insn "absdf2"
4754 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4755 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4756 "TARGET_HARD_FLOAT && TARGET_FPRS"
4758 [(set_attr "type" "fp")])
4761 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4762 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4763 "TARGET_HARD_FLOAT && TARGET_FPRS"
4765 [(set_attr "type" "fp")])
4767 (define_insn "adddf3"
4768 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4769 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4770 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4771 "TARGET_HARD_FLOAT && TARGET_FPRS"
4772 "{fa|fadd} %0,%1,%2"
4773 [(set_attr "type" "fp")])
4775 (define_insn "subdf3"
4776 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4777 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4778 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4779 "TARGET_HARD_FLOAT && TARGET_FPRS"
4780 "{fs|fsub} %0,%1,%2"
4781 [(set_attr "type" "fp")])
4783 (define_insn "muldf3"
4784 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4785 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4786 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4787 "TARGET_HARD_FLOAT && TARGET_FPRS"
4788 "{fm|fmul} %0,%1,%2"
4789 [(set_attr "type" "dmul")])
4791 (define_insn "divdf3"
4792 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4793 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4794 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4795 "TARGET_HARD_FLOAT && TARGET_FPRS"
4796 "{fd|fdiv} %0,%1,%2"
4797 [(set_attr "type" "ddiv")])
4800 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4801 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4802 (match_operand:DF 2 "gpc_reg_operand" "f"))
4803 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4804 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4805 "{fma|fmadd} %0,%1,%2,%3"
4806 [(set_attr "type" "dmul")])
4809 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4810 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4811 (match_operand:DF 2 "gpc_reg_operand" "f"))
4812 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4813 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4814 "{fms|fmsub} %0,%1,%2,%3"
4815 [(set_attr "type" "dmul")])
4818 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4819 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4820 (match_operand:DF 2 "gpc_reg_operand" "f"))
4821 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4822 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4823 && HONOR_SIGNED_ZEROS (DFmode)"
4824 "{fnma|fnmadd} %0,%1,%2,%3"
4825 [(set_attr "type" "dmul")])
4828 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4829 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4830 (match_operand:DF 2 "gpc_reg_operand" "f"))
4831 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4832 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4833 && ! HONOR_SIGNED_ZEROS (DFmode)"
4834 "{fnma|fnmadd} %0,%1,%2,%3"
4835 [(set_attr "type" "dmul")])
4838 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4839 (neg:DF (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 && HONOR_SIGNED_ZEROS (DFmode)"
4844 "{fnms|fnmsub} %0,%1,%2,%3"
4845 [(set_attr "type" "dmul")])
4848 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4849 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
4850 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4851 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
4852 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4853 && ! HONOR_SIGNED_ZEROS (DFmode)"
4854 "{fnms|fnmsub} %0,%1,%2,%3"
4855 [(set_attr "type" "dmul")])
4857 (define_insn "sqrtdf2"
4858 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4859 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4860 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4862 [(set_attr "type" "dsqrt")])
4864 ;; The conditional move instructions allow us to perform max and min
4865 ;; operations even when
4867 (define_expand "maxdf3"
4868 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4869 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4870 (match_operand:DF 2 "gpc_reg_operand" ""))
4873 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4874 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4876 (define_expand "mindf3"
4877 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4878 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4879 (match_operand:DF 2 "gpc_reg_operand" ""))
4882 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4883 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4886 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4887 (match_operator:DF 3 "min_max_operator"
4888 [(match_operand:DF 1 "gpc_reg_operand" "")
4889 (match_operand:DF 2 "gpc_reg_operand" "")]))]
4890 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4893 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4894 operands[1], operands[2]);
4898 (define_expand "movdfcc"
4899 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4900 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4901 (match_operand:DF 2 "gpc_reg_operand" "")
4902 (match_operand:DF 3 "gpc_reg_operand" "")))]
4903 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4906 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4912 (define_insn "*fseldfdf4"
4913 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4914 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4915 (match_operand:DF 4 "zero_fp_constant" "F"))
4916 (match_operand:DF 2 "gpc_reg_operand" "f")
4917 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4918 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4920 [(set_attr "type" "fp")])
4922 (define_insn "*fselsfdf4"
4923 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4924 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4925 (match_operand:SF 4 "zero_fp_constant" "F"))
4926 (match_operand:DF 2 "gpc_reg_operand" "f")
4927 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4930 [(set_attr "type" "fp")])
4932 ;; Conversions to and from floating-point.
4934 (define_expand "fixunssfsi2"
4935 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4936 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "gpc_reg_operand" ""))))]
4937 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4940 (define_expand "fix_truncsfsi2"
4941 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4942 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
4943 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4946 ; For each of these conversions, there is a define_expand, a define_insn
4947 ; with a '#' template, and a define_split (with C code). The idea is
4948 ; to allow constant folding with the template of the define_insn,
4949 ; then to have the insns split later (between sched1 and final).
4951 (define_expand "floatsidf2"
4952 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
4953 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4956 (clobber (match_dup 4))
4957 (clobber (match_dup 5))
4958 (clobber (match_dup 6))])]
4959 "TARGET_HARD_FLOAT && TARGET_FPRS"
4962 if (TARGET_POWERPC64)
4964 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
4965 rtx t1 = gen_reg_rtx (DImode);
4966 rtx t2 = gen_reg_rtx (DImode);
4967 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
4971 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
4972 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
4973 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
4974 operands[5] = gen_reg_rtx (DFmode);
4975 operands[6] = gen_reg_rtx (SImode);
4978 (define_insn "*floatsidf2_internal"
4979 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
4980 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
4981 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
4982 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
4983 (clobber (match_operand:DF 4 "memory_operand" "=o"))
4984 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
4985 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
4986 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
4988 [(set_attr "length" "24")])
4991 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4992 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4993 (use (match_operand:SI 2 "gpc_reg_operand" ""))
4994 (use (match_operand:DF 3 "gpc_reg_operand" ""))
4995 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
4996 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
4997 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
4998 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
4999 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5000 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5001 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5002 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5003 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5004 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5005 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5008 rtx lowword, highword;
5009 if (GET_CODE (operands[4]) != MEM)
5011 highword = XEXP (operands[4], 0);
5012 lowword = plus_constant (highword, 4);
5013 if (! WORDS_BIG_ENDIAN)
5016 tmp = highword; highword = lowword; lowword = tmp;
5019 emit_insn (gen_xorsi3 (operands[6], operands[1],
5020 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5021 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5022 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5023 emit_move_insn (operands[5], operands[4]);
5024 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5028 (define_expand "floatunssisf2"
5029 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5030 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5031 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5034 (define_expand "floatunssidf2"
5035 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5036 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5039 (clobber (match_dup 4))
5040 (clobber (match_dup 5))])]
5041 "TARGET_HARD_FLOAT && TARGET_FPRS"
5044 if (TARGET_POWERPC64)
5046 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5047 rtx t1 = gen_reg_rtx (DImode);
5048 rtx t2 = gen_reg_rtx (DImode);
5049 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5054 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5055 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5056 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5057 operands[5] = gen_reg_rtx (DFmode);
5060 (define_insn "*floatunssidf2_internal"
5061 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5062 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5063 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5064 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5065 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5066 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5067 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5069 [(set_attr "length" "20")])
5072 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5073 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5074 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5075 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5076 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5077 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5078 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5079 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5080 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5081 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5082 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5083 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5084 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5087 rtx lowword, highword;
5088 if (GET_CODE (operands[4]) != MEM)
5090 highword = XEXP (operands[4], 0);
5091 lowword = plus_constant (highword, 4);
5092 if (! WORDS_BIG_ENDIAN)
5095 tmp = highword; highword = lowword; lowword = tmp;
5098 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5099 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5100 emit_move_insn (operands[5], operands[4]);
5101 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5105 (define_expand "fix_truncdfsi2"
5106 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5107 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5108 (clobber (match_dup 2))
5109 (clobber (match_dup 3))])]
5110 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5113 operands[2] = gen_reg_rtx (DImode);
5114 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5117 (define_insn "*fix_truncdfsi2_internal"
5118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5119 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5120 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5121 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5122 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5124 [(set_attr "length" "16")])
5127 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5128 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5129 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5130 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5131 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5132 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5133 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5134 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5135 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5139 if (GET_CODE (operands[3]) != MEM)
5141 lowword = XEXP (operands[3], 0);
5142 if (WORDS_BIG_ENDIAN)
5143 lowword = plus_constant (lowword, 4);
5145 emit_insn (gen_fctiwz (operands[2], operands[1]));
5146 emit_move_insn (operands[3], operands[2]);
5147 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5151 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] 10))
5152 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5153 ; because the first makes it clear that operand 0 is not live
5154 ; before the instruction.
5155 (define_insn "fctiwz"
5156 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5157 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))] 10))]
5158 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5159 "{fcirz|fctiwz} %0,%1"
5160 [(set_attr "type" "fp")])
5162 (define_expand "floatsisf2"
5163 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5164 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5165 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5168 (define_insn "floatdidf2"
5169 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5170 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5171 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5173 [(set_attr "type" "fp")])
5175 (define_insn_and_split "floatsidf_ppc64"
5176 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5177 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5178 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5179 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5180 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5181 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5184 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5185 (set (match_dup 2) (match_dup 3))
5186 (set (match_dup 4) (match_dup 2))
5187 (set (match_dup 0) (float:DF (match_dup 4)))]
5190 (define_insn_and_split "floatunssidf_ppc64"
5191 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5192 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5193 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5194 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5195 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5196 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5199 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5200 (set (match_dup 2) (match_dup 3))
5201 (set (match_dup 4) (match_dup 2))
5202 (set (match_dup 0) (float:DF (match_dup 4)))]
5205 (define_insn "fix_truncdfdi2"
5206 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5207 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5208 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5210 [(set_attr "type" "fp")])
5212 (define_expand "floatdisf2"
5213 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5214 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5215 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5218 if (!flag_unsafe_math_optimizations)
5220 rtx label = gen_label_rtx ();
5221 emit_insn (gen_floatdisf2_internal2 (operands[1], label));
5224 emit_insn (gen_floatdisf2_internal1 (operands[0], operands[1]));
5228 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5229 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5230 ;; from double rounding.
5231 (define_insn_and_split "floatdisf2_internal1"
5232 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5233 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5234 (clobber (match_scratch:DF 2 "=f"))]
5235 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5237 "&& reload_completed"
5239 (float:DF (match_dup 1)))
5241 (float_truncate:SF (match_dup 2)))]
5244 ;; Twiddles bits to avoid double rounding.
5245 ;; Bits that might be truncated when converting to DFmode are replaced
5246 ;; by a bit that won't be lost at that stage, but is below the SFmode
5247 ;; rounding position.
5248 (define_expand "floatdisf2_internal2"
5249 [(parallel [(set (match_dup 4)
5250 (compare:CC (and:DI (match_operand:DI 0 "" "")
5253 (set (match_dup 2) (and:DI (match_dup 0) (const_int 2047)))
5254 (clobber (match_scratch:CC 7 ""))])
5255 (set (match_dup 3) (ashiftrt:DI (match_dup 0) (const_int 53)))
5256 (set (match_dup 3) (plus:DI (match_dup 3) (const_int 1)))
5257 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
5258 (label_ref (match_operand:DI 1 "" ""))
5260 (set (match_dup 5) (compare:CCUNS (match_dup 3) (const_int 2)))
5261 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
5262 (label_ref (match_dup 1))
5264 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 2)))
5265 (set (match_dup 0) (ior:DI (match_dup 0) (const_int 2048)))]
5266 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5269 operands[2] = gen_reg_rtx (DImode);
5270 operands[3] = gen_reg_rtx (DImode);
5271 operands[4] = gen_reg_rtx (CCmode);
5272 operands[5] = gen_reg_rtx (CCUNSmode);
5275 ;; Define the DImode operations that can be done in a small number
5276 ;; of instructions. The & constraints are to prevent the register
5277 ;; allocator from allocating registers that overlap with the inputs
5278 ;; (for example, having an input in 7,8 and an output in 6,7). We
5279 ;; also allow for the output being the same as one of the inputs.
5281 (define_insn "*adddi3_noppc64"
5282 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5283 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5284 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5285 "! TARGET_POWERPC64"
5288 if (WORDS_BIG_ENDIAN)
5289 return (GET_CODE (operands[2])) != CONST_INT
5290 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5291 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5293 return (GET_CODE (operands[2])) != CONST_INT
5294 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5295 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5297 [(set_attr "length" "8")])
5299 (define_insn "*subdi3_noppc64"
5300 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5301 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5302 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5303 "! TARGET_POWERPC64"
5306 if (WORDS_BIG_ENDIAN)
5307 return (GET_CODE (operands[1]) != CONST_INT)
5308 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5309 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5311 return (GET_CODE (operands[1]) != CONST_INT)
5312 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5313 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5315 [(set_attr "length" "8")])
5317 (define_insn "*negdi2_noppc64"
5318 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5319 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5320 "! TARGET_POWERPC64"
5323 return (WORDS_BIG_ENDIAN)
5324 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5325 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5327 [(set_attr "length" "8")])
5329 (define_expand "mulsidi3"
5330 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5331 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5332 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5333 "! TARGET_POWERPC64"
5336 if (! TARGET_POWER && ! TARGET_POWERPC)
5338 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5339 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5340 emit_insn (gen_mull_call ());
5341 if (WORDS_BIG_ENDIAN)
5342 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5345 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5346 gen_rtx_REG (SImode, 3));
5347 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5348 gen_rtx_REG (SImode, 4));
5352 else if (TARGET_POWER)
5354 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5359 (define_insn "mulsidi3_mq"
5360 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5361 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5362 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5363 (clobber (match_scratch:SI 3 "=q"))]
5365 "mul %0,%1,%2\;mfmq %L0"
5366 [(set_attr "type" "imul")
5367 (set_attr "length" "8")])
5369 (define_insn "*mulsidi3_no_mq"
5370 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5371 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5372 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5373 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5376 return (WORDS_BIG_ENDIAN)
5377 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5378 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5380 [(set_attr "type" "imul")
5381 (set_attr "length" "8")])
5384 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5385 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5386 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5387 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5390 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5391 (sign_extend:DI (match_dup 2)))
5394 (mult:SI (match_dup 1)
5398 int endian = (WORDS_BIG_ENDIAN == 0);
5399 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5400 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5403 (define_expand "umulsidi3"
5404 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5405 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5406 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5407 "TARGET_POWERPC && ! TARGET_POWERPC64"
5412 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5417 (define_insn "umulsidi3_mq"
5418 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5419 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5420 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5421 (clobber (match_scratch:SI 3 "=q"))]
5422 "TARGET_POWERPC && TARGET_POWER"
5425 return (WORDS_BIG_ENDIAN)
5426 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5427 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5429 [(set_attr "type" "imul")
5430 (set_attr "length" "8")])
5432 (define_insn "*umulsidi3_no_mq"
5433 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5434 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5435 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5436 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5439 return (WORDS_BIG_ENDIAN)
5440 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5441 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5443 [(set_attr "type" "imul")
5444 (set_attr "length" "8")])
5447 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5448 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5449 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5450 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5453 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5454 (zero_extend:DI (match_dup 2)))
5457 (mult:SI (match_dup 1)
5461 int endian = (WORDS_BIG_ENDIAN == 0);
5462 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5463 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5466 (define_expand "smulsi3_highpart"
5467 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5469 (lshiftrt:DI (mult:DI (sign_extend:DI
5470 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5472 (match_operand:SI 2 "gpc_reg_operand" "r")))
5477 if (! TARGET_POWER && ! TARGET_POWERPC)
5479 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5480 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5481 emit_insn (gen_mulh_call ());
5482 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5485 else if (TARGET_POWER)
5487 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5492 (define_insn "smulsi3_highpart_mq"
5493 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5495 (lshiftrt:DI (mult:DI (sign_extend:DI
5496 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5498 (match_operand:SI 2 "gpc_reg_operand" "r")))
5500 (clobber (match_scratch:SI 3 "=q"))]
5503 [(set_attr "type" "imul")])
5505 (define_insn "*smulsi3_highpart_no_mq"
5506 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5508 (lshiftrt:DI (mult:DI (sign_extend:DI
5509 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5511 (match_operand:SI 2 "gpc_reg_operand" "r")))
5513 "TARGET_POWERPC && ! TARGET_POWER"
5515 [(set_attr "type" "imul")])
5517 (define_expand "umulsi3_highpart"
5518 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5520 (lshiftrt:DI (mult:DI (zero_extend:DI
5521 (match_operand:SI 1 "gpc_reg_operand" ""))
5523 (match_operand:SI 2 "gpc_reg_operand" "")))
5530 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5535 (define_insn "umulsi3_highpart_mq"
5536 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5538 (lshiftrt:DI (mult:DI (zero_extend:DI
5539 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5541 (match_operand:SI 2 "gpc_reg_operand" "r")))
5543 (clobber (match_scratch:SI 3 "=q"))]
5544 "TARGET_POWERPC && TARGET_POWER"
5546 [(set_attr "type" "imul")])
5548 (define_insn "*umulsi3_highpart_no_mq"
5549 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5551 (lshiftrt:DI (mult:DI (zero_extend:DI
5552 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5554 (match_operand:SI 2 "gpc_reg_operand" "r")))
5556 "TARGET_POWERPC && ! TARGET_POWER"
5558 [(set_attr "type" "imul")])
5560 ;; If operands 0 and 2 are in the same register, we have a problem. But
5561 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5562 ;; why we have the strange constraints below.
5563 (define_insn "ashldi3_power"
5564 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5565 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5566 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5567 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5570 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5571 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5572 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5573 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5574 [(set_attr "length" "8")])
5576 (define_insn "lshrdi3_power"
5577 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5578 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5579 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5580 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5583 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5584 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5585 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5586 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5587 [(set_attr "length" "8")])
5589 ;; Shift by a variable amount is too complex to be worth open-coding. We
5590 ;; just handle shifts by constants.
5591 (define_insn "ashrdi3_power"
5592 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5593 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5594 (match_operand:SI 2 "const_int_operand" "M,i")))
5595 (clobber (match_scratch:SI 3 "=X,q"))]
5598 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5599 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5600 [(set_attr "length" "8")])
5602 (define_insn "ashrdi3_no_power"
5603 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5604 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5605 (match_operand:SI 2 "const_int_operand" "M,i")))]
5606 "TARGET_32BIT && !TARGET_POWER"
5608 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5609 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5610 [(set_attr "length" "8,12")])
5612 ;; PowerPC64 DImode operations.
5614 (define_expand "adddi3"
5615 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5616 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5617 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5621 if (! TARGET_POWERPC64)
5623 if (non_short_cint_operand (operands[2], DImode))
5627 if (GET_CODE (operands[2]) == CONST_INT
5628 && ! add_operand (operands[2], DImode))
5630 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5631 ? operands[0] : gen_reg_rtx (DImode));
5633 HOST_WIDE_INT val = INTVAL (operands[2]);
5634 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5635 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5637 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5640 /* The ordering here is important for the prolog expander.
5641 When space is allocated from the stack, adding 'low' first may
5642 produce a temporary deallocation (which would be bad). */
5643 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5644 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5649 ;; Discourage ai/addic because of carry but provide it in an alternative
5650 ;; allowing register zero as source.
5652 (define_insn "*adddi3_internal1"
5653 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5654 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5655 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5663 (define_insn "*adddi3_internal2"
5664 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5665 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5666 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5668 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5675 [(set_attr "type" "fast_compare,compare,compare,compare")
5676 (set_attr "length" "4,4,8,8")])
5679 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5680 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5681 (match_operand:DI 2 "reg_or_short_operand" ""))
5683 (clobber (match_scratch:DI 3 ""))]
5684 "TARGET_POWERPC64 && reload_completed"
5686 (plus:DI (match_dup 1) (match_dup 2)))
5688 (compare:CC (match_dup 3)
5692 (define_insn "*adddi3_internal3"
5693 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5694 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5695 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5697 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5698 (plus:DI (match_dup 1) (match_dup 2)))]
5705 [(set_attr "type" "fast_compare,compare,compare,compare")
5706 (set_attr "length" "4,4,8,8")])
5709 [(set (match_operand:CC 3 "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 (set (match_operand:DI 0 "gpc_reg_operand" "")
5714 (plus:DI (match_dup 1) (match_dup 2)))]
5715 "TARGET_POWERPC64 && reload_completed"
5717 (plus:DI (match_dup 1) (match_dup 2)))
5719 (compare:CC (match_dup 0)
5723 ;; Split an add that we can't do in one insn into two insns, each of which
5724 ;; does one 16-bit part. This is used by combine. Note that the low-order
5725 ;; add should be last in case the result gets used in an address.
5728 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5729 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5730 (match_operand:DI 2 "non_add_cint_operand" "")))]
5732 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5733 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5736 HOST_WIDE_INT val = INTVAL (operands[2]);
5737 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5738 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5740 operands[4] = GEN_INT (low);
5741 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5742 operands[3] = GEN_INT (rest);
5743 else if (! no_new_pseudos)
5745 operands[3] = gen_reg_rtx (DImode);
5746 emit_move_insn (operands[3], operands[2]);
5747 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5754 (define_insn "one_cmpldi2"
5755 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5756 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5761 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5762 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5764 (clobber (match_scratch:DI 2 "=r,r"))]
5769 [(set_attr "type" "compare")
5770 (set_attr "length" "4,8")])
5773 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5774 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5776 (clobber (match_scratch:DI 2 ""))]
5777 "TARGET_POWERPC64 && reload_completed"
5779 (not:DI (match_dup 1)))
5781 (compare:CC (match_dup 2)
5786 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5787 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5789 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5790 (not:DI (match_dup 1)))]
5795 [(set_attr "type" "compare")
5796 (set_attr "length" "4,8")])
5799 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5800 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5802 (set (match_operand:DI 0 "gpc_reg_operand" "")
5803 (not:DI (match_dup 1)))]
5804 "TARGET_POWERPC64 && reload_completed"
5806 (not:DI (match_dup 1)))
5808 (compare:CC (match_dup 0)
5813 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5814 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
5815 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
5822 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5823 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5824 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5826 (clobber (match_scratch:DI 3 "=r,r"))]
5831 [(set_attr "type" "fast_compare")
5832 (set_attr "length" "4,8")])
5835 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5836 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5837 (match_operand:DI 2 "gpc_reg_operand" ""))
5839 (clobber (match_scratch:DI 3 ""))]
5840 "TARGET_POWERPC64 && reload_completed"
5842 (minus:DI (match_dup 1) (match_dup 2)))
5844 (compare:CC (match_dup 3)
5849 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5850 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5851 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5853 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5854 (minus:DI (match_dup 1) (match_dup 2)))]
5859 [(set_attr "type" "fast_compare")
5860 (set_attr "length" "4,8")])
5863 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5864 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5865 (match_operand:DI 2 "gpc_reg_operand" ""))
5867 (set (match_operand:DI 0 "gpc_reg_operand" "")
5868 (minus:DI (match_dup 1) (match_dup 2)))]
5869 "TARGET_POWERPC64 && reload_completed"
5871 (minus:DI (match_dup 1) (match_dup 2)))
5873 (compare:CC (match_dup 0)
5877 (define_expand "subdi3"
5878 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5879 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
5880 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
5884 if (GET_CODE (operands[2]) == CONST_INT)
5886 emit_insn (gen_adddi3 (operands[0], operands[1],
5887 negate_rtx (DImode, operands[2])));
5892 (define_insn_and_split "absdi2"
5893 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5894 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5895 (clobber (match_scratch:DI 2 "=&r,&r"))]
5898 "&& reload_completed"
5899 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5900 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5901 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5904 (define_insn_and_split "*nabsdi2"
5905 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5906 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5907 (clobber (match_scratch:DI 2 "=&r,&r"))]
5910 "&& reload_completed"
5911 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5912 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5913 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5916 (define_expand "negdi2"
5917 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5918 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
5923 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5924 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5929 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5930 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5932 (clobber (match_scratch:DI 2 "=r,r"))]
5937 [(set_attr "type" "fast_compare")
5938 (set_attr "length" "4,8")])
5941 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5942 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5944 (clobber (match_scratch:DI 2 ""))]
5945 "TARGET_POWERPC64 && reload_completed"
5947 (neg:DI (match_dup 1)))
5949 (compare:CC (match_dup 2)
5954 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5955 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5957 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5958 (neg:DI (match_dup 1)))]
5963 [(set_attr "type" "fast_compare")
5964 (set_attr "length" "4,8")])
5967 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5968 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5970 (set (match_operand:DI 0 "gpc_reg_operand" "")
5971 (neg:DI (match_dup 1)))]
5972 "TARGET_POWERPC64 && reload_completed"
5974 (neg:DI (match_dup 1)))
5976 (compare:CC (match_dup 0)
5980 (define_insn "clzdi2"
5981 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5982 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5986 (define_expand "ctzdi2"
5988 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
5989 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
5991 (clobber (scratch:CC))])
5992 (set (match_dup 4) (clz:DI (match_dup 3)))
5993 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5994 (minus:DI (const_int 63) (match_dup 4)))]
5997 operands[2] = gen_reg_rtx (DImode);
5998 operands[3] = gen_reg_rtx (DImode);
5999 operands[4] = gen_reg_rtx (DImode);
6002 (define_expand "ffsdi2"
6004 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6005 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6007 (clobber (scratch:CC))])
6008 (set (match_dup 4) (clz:DI (match_dup 3)))
6009 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6010 (minus:DI (const_int 64) (match_dup 4)))]
6013 operands[2] = gen_reg_rtx (DImode);
6014 operands[3] = gen_reg_rtx (DImode);
6015 operands[4] = gen_reg_rtx (DImode);
6018 (define_insn "muldi3"
6019 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6020 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6021 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6024 [(set_attr "type" "lmul")])
6026 (define_insn "*muldi3_internal1"
6027 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6028 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6029 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6031 (clobber (match_scratch:DI 3 "=r,r"))]
6036 [(set_attr "type" "lmul_compare")
6037 (set_attr "length" "4,8")])
6040 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6041 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6042 (match_operand:DI 2 "gpc_reg_operand" ""))
6044 (clobber (match_scratch:DI 3 ""))]
6045 "TARGET_POWERPC64 && reload_completed"
6047 (mult:DI (match_dup 1) (match_dup 2)))
6049 (compare:CC (match_dup 3)
6053 (define_insn "*muldi3_internal2"
6054 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6055 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6056 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6058 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6059 (mult:DI (match_dup 1) (match_dup 2)))]
6064 [(set_attr "type" "lmul_compare")
6065 (set_attr "length" "4,8")])
6068 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6069 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6070 (match_operand:DI 2 "gpc_reg_operand" ""))
6072 (set (match_operand:DI 0 "gpc_reg_operand" "")
6073 (mult:DI (match_dup 1) (match_dup 2)))]
6074 "TARGET_POWERPC64 && reload_completed"
6076 (mult:DI (match_dup 1) (match_dup 2)))
6078 (compare:CC (match_dup 0)
6082 (define_insn "smuldi3_highpart"
6083 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6085 (lshiftrt:TI (mult:TI (sign_extend:TI
6086 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6088 (match_operand:DI 2 "gpc_reg_operand" "r")))
6092 [(set_attr "type" "lmul")])
6094 (define_insn "umuldi3_highpart"
6095 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6097 (lshiftrt:TI (mult:TI (zero_extend:TI
6098 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6100 (match_operand:DI 2 "gpc_reg_operand" "r")))
6104 [(set_attr "type" "lmul")])
6106 (define_expand "divdi3"
6107 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6108 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6109 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6113 if (GET_CODE (operands[2]) == CONST_INT
6114 && INTVAL (operands[2]) > 0
6115 && exact_log2 (INTVAL (operands[2])) >= 0)
6118 operands[2] = force_reg (DImode, operands[2]);
6121 (define_expand "moddi3"
6122 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6123 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6124 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6132 if (GET_CODE (operands[2]) != CONST_INT
6133 || INTVAL (operands[2]) <= 0
6134 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6137 temp1 = gen_reg_rtx (DImode);
6138 temp2 = gen_reg_rtx (DImode);
6140 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6141 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6142 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6147 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6148 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6149 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6151 "sradi %0,%1,%p2\;addze %0,%0"
6152 [(set_attr "length" "8")])
6155 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6156 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6157 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6159 (clobber (match_scratch:DI 3 "=r,r"))]
6162 sradi %3,%1,%p2\;addze. %3,%3
6164 [(set_attr "type" "compare")
6165 (set_attr "length" "8,12")])
6168 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6169 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6170 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6172 (clobber (match_scratch:DI 3 ""))]
6173 "TARGET_POWERPC64 && reload_completed"
6175 (div:DI (match_dup 1) (match_dup 2)))
6177 (compare:CC (match_dup 3)
6182 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6183 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6184 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6186 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6187 (div:DI (match_dup 1) (match_dup 2)))]
6190 sradi %0,%1,%p2\;addze. %0,%0
6192 [(set_attr "type" "compare")
6193 (set_attr "length" "8,12")])
6196 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6197 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6198 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6200 (set (match_operand:DI 0 "gpc_reg_operand" "")
6201 (div:DI (match_dup 1) (match_dup 2)))]
6202 "TARGET_POWERPC64 && reload_completed"
6204 (div:DI (match_dup 1) (match_dup 2)))
6206 (compare:CC (match_dup 0)
6211 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6212 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6213 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6216 [(set_attr "type" "ldiv")])
6218 (define_insn "udivdi3"
6219 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6220 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6221 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6224 [(set_attr "type" "ldiv")])
6226 (define_insn "rotldi3"
6227 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6228 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6229 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6231 "rld%I2cl %0,%1,%H2,0")
6233 (define_insn "*rotldi3_internal2"
6234 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6235 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6236 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6238 (clobber (match_scratch:DI 3 "=r,r"))]
6241 rld%I2cl. %3,%1,%H2,0
6243 [(set_attr "type" "delayed_compare")
6244 (set_attr "length" "4,8")])
6247 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6248 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6249 (match_operand:DI 2 "reg_or_cint_operand" ""))
6251 (clobber (match_scratch:DI 3 ""))]
6252 "TARGET_POWERPC64 && reload_completed"
6254 (rotate:DI (match_dup 1) (match_dup 2)))
6256 (compare:CC (match_dup 3)
6260 (define_insn "*rotldi3_internal3"
6261 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6262 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6263 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6265 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6266 (rotate:DI (match_dup 1) (match_dup 2)))]
6269 rld%I2cl. %0,%1,%H2,0
6271 [(set_attr "type" "delayed_compare")
6272 (set_attr "length" "4,8")])
6275 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6276 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6277 (match_operand:DI 2 "reg_or_cint_operand" ""))
6279 (set (match_operand:DI 0 "gpc_reg_operand" "")
6280 (rotate:DI (match_dup 1) (match_dup 2)))]
6281 "TARGET_POWERPC64 && reload_completed"
6283 (rotate:DI (match_dup 1) (match_dup 2)))
6285 (compare:CC (match_dup 0)
6289 (define_insn "*rotldi3_internal4"
6290 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6291 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6292 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6293 (match_operand:DI 3 "mask64_operand" "n")))]
6295 "rld%I2c%B3 %0,%1,%H2,%S3")
6297 (define_insn "*rotldi3_internal5"
6298 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6300 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6301 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6302 (match_operand:DI 3 "mask64_operand" "n,n"))
6304 (clobber (match_scratch:DI 4 "=r,r"))]
6307 rld%I2c%B3. %4,%1,%H2,%S3
6309 [(set_attr "type" "delayed_compare")
6310 (set_attr "length" "4,8")])
6313 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6315 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6316 (match_operand:DI 2 "reg_or_cint_operand" ""))
6317 (match_operand:DI 3 "mask64_operand" ""))
6319 (clobber (match_scratch:DI 4 ""))]
6320 "TARGET_POWERPC64 && reload_completed"
6322 (and:DI (rotate:DI (match_dup 1)
6326 (compare:CC (match_dup 4)
6330 (define_insn "*rotldi3_internal6"
6331 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6333 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6334 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6335 (match_operand:DI 3 "mask64_operand" "n,n"))
6337 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6338 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6341 rld%I2c%B3. %0,%1,%H2,%S3
6343 [(set_attr "type" "delayed_compare")
6344 (set_attr "length" "4,8")])
6347 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6349 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6350 (match_operand:DI 2 "reg_or_cint_operand" ""))
6351 (match_operand:DI 3 "mask64_operand" ""))
6353 (set (match_operand:DI 0 "gpc_reg_operand" "")
6354 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6355 "TARGET_POWERPC64 && reload_completed"
6357 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6359 (compare:CC (match_dup 0)
6363 (define_insn "*rotldi3_internal7"
6364 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6367 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6368 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6370 "rld%I2cl %0,%1,%H2,56")
6372 (define_insn "*rotldi3_internal8"
6373 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6374 (compare:CC (zero_extend:DI
6376 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6377 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6379 (clobber (match_scratch:DI 3 "=r,r"))]
6382 rld%I2cl. %3,%1,%H2,56
6384 [(set_attr "type" "delayed_compare")
6385 (set_attr "length" "4,8")])
6388 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6389 (compare:CC (zero_extend:DI
6391 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6392 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6394 (clobber (match_scratch:DI 3 ""))]
6395 "TARGET_POWERPC64 && reload_completed"
6397 (zero_extend:DI (subreg:QI
6398 (rotate:DI (match_dup 1)
6401 (compare:CC (match_dup 3)
6405 (define_insn "*rotldi3_internal9"
6406 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6407 (compare:CC (zero_extend:DI
6409 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6410 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6412 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6413 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6416 rld%I2cl. %0,%1,%H2,56
6418 [(set_attr "type" "delayed_compare")
6419 (set_attr "length" "4,8")])
6422 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6423 (compare:CC (zero_extend:DI
6425 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6426 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6428 (set (match_operand:DI 0 "gpc_reg_operand" "")
6429 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6430 "TARGET_POWERPC64 && reload_completed"
6432 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6434 (compare:CC (match_dup 0)
6438 (define_insn "*rotldi3_internal10"
6439 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6442 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6443 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6445 "rld%I2cl %0,%1,%H2,48")
6447 (define_insn "*rotldi3_internal11"
6448 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6449 (compare:CC (zero_extend:DI
6451 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6452 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6454 (clobber (match_scratch:DI 3 "=r,r"))]
6457 rld%I2cl. %3,%1,%H2,48
6459 [(set_attr "type" "delayed_compare")
6460 (set_attr "length" "4,8")])
6463 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6464 (compare:CC (zero_extend:DI
6466 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6467 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6469 (clobber (match_scratch:DI 3 ""))]
6470 "TARGET_POWERPC64 && reload_completed"
6472 (zero_extend:DI (subreg:HI
6473 (rotate:DI (match_dup 1)
6476 (compare:CC (match_dup 3)
6480 (define_insn "*rotldi3_internal12"
6481 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6482 (compare:CC (zero_extend:DI
6484 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6485 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6487 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6488 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6491 rld%I2cl. %0,%1,%H2,48
6493 [(set_attr "type" "delayed_compare")
6494 (set_attr "length" "4,8")])
6497 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6498 (compare:CC (zero_extend:DI
6500 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6501 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6503 (set (match_operand:DI 0 "gpc_reg_operand" "")
6504 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6505 "TARGET_POWERPC64 && reload_completed"
6507 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6509 (compare:CC (match_dup 0)
6513 (define_insn "*rotldi3_internal13"
6514 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6517 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6518 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6520 "rld%I2cl %0,%1,%H2,32")
6522 (define_insn "*rotldi3_internal14"
6523 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6524 (compare:CC (zero_extend:DI
6526 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6527 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6529 (clobber (match_scratch:DI 3 "=r,r"))]
6532 rld%I2cl. %3,%1,%H2,32
6534 [(set_attr "type" "delayed_compare")
6535 (set_attr "length" "4,8")])
6538 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6539 (compare:CC (zero_extend:DI
6541 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6542 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6544 (clobber (match_scratch:DI 3 ""))]
6545 "TARGET_POWERPC64 && reload_completed"
6547 (zero_extend:DI (subreg:SI
6548 (rotate:DI (match_dup 1)
6551 (compare:CC (match_dup 3)
6555 (define_insn "*rotldi3_internal15"
6556 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6557 (compare:CC (zero_extend:DI
6559 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6560 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6562 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6563 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6566 rld%I2cl. %0,%1,%H2,32
6568 [(set_attr "type" "delayed_compare")
6569 (set_attr "length" "4,8")])
6572 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6573 (compare:CC (zero_extend:DI
6575 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6576 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6578 (set (match_operand:DI 0 "gpc_reg_operand" "")
6579 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6580 "TARGET_POWERPC64 && reload_completed"
6582 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6584 (compare:CC (match_dup 0)
6588 (define_expand "ashldi3"
6589 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6590 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6591 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6592 "TARGET_POWERPC64 || TARGET_POWER"
6595 if (TARGET_POWERPC64)
6597 else if (TARGET_POWER)
6599 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6606 (define_insn "*ashldi3_internal1"
6607 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6608 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6609 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6612 [(set_attr "length" "8")])
6614 (define_insn "*ashldi3_internal2"
6615 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6616 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6617 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6619 (clobber (match_scratch:DI 3 "=r,r"))]
6624 [(set_attr "type" "delayed_compare")
6625 (set_attr "length" "4,8")])
6628 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6629 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6630 (match_operand:SI 2 "reg_or_cint_operand" ""))
6632 (clobber (match_scratch:DI 3 ""))]
6633 "TARGET_POWERPC64 && reload_completed"
6635 (ashift:DI (match_dup 1) (match_dup 2)))
6637 (compare:CC (match_dup 3)
6641 (define_insn "*ashldi3_internal3"
6642 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6643 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6644 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6646 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6647 (ashift:DI (match_dup 1) (match_dup 2)))]
6652 [(set_attr "type" "delayed_compare")
6653 (set_attr "length" "4,8")])
6656 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6657 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6658 (match_operand:SI 2 "reg_or_cint_operand" ""))
6660 (set (match_operand:DI 0 "gpc_reg_operand" "")
6661 (ashift:DI (match_dup 1) (match_dup 2)))]
6662 "TARGET_POWERPC64 && reload_completed"
6664 (ashift:DI (match_dup 1) (match_dup 2)))
6666 (compare:CC (match_dup 0)
6670 (define_insn "*ashldi3_internal4"
6671 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6672 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6673 (match_operand:SI 2 "const_int_operand" "i"))
6674 (match_operand:DI 3 "const_int_operand" "n")))]
6675 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6676 "rldic %0,%1,%H2,%W3")
6678 (define_insn "ashldi3_internal5"
6679 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6681 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6682 (match_operand:SI 2 "const_int_operand" "i,i"))
6683 (match_operand:DI 3 "const_int_operand" "n,n"))
6685 (clobber (match_scratch:DI 4 "=r,r"))]
6686 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6688 rldic. %4,%1,%H2,%W3
6690 [(set_attr "type" "delayed_compare")
6691 (set_attr "length" "4,8")])
6694 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6696 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6697 (match_operand:SI 2 "const_int_operand" ""))
6698 (match_operand:DI 3 "const_int_operand" ""))
6700 (clobber (match_scratch:DI 4 ""))]
6701 "TARGET_POWERPC64 && reload_completed
6702 && includes_rldic_lshift_p (operands[2], operands[3])"
6704 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6707 (compare:CC (match_dup 4)
6711 (define_insn "*ashldi3_internal6"
6712 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6714 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6715 (match_operand:SI 2 "const_int_operand" "i,i"))
6716 (match_operand:DI 3 "const_int_operand" "n,n"))
6718 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6719 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6720 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6722 rldic. %0,%1,%H2,%W3
6724 [(set_attr "type" "delayed_compare")
6725 (set_attr "length" "4,8")])
6728 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6730 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6731 (match_operand:SI 2 "const_int_operand" ""))
6732 (match_operand:DI 3 "const_int_operand" ""))
6734 (set (match_operand:DI 0 "gpc_reg_operand" "")
6735 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6736 "TARGET_POWERPC64 && reload_completed
6737 && includes_rldic_lshift_p (operands[2], operands[3])"
6739 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6742 (compare:CC (match_dup 0)
6746 (define_insn "*ashldi3_internal7"
6747 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6748 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6749 (match_operand:SI 2 "const_int_operand" "i"))
6750 (match_operand:DI 3 "mask64_operand" "n")))]
6751 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6752 "rldicr %0,%1,%H2,%S3")
6754 (define_insn "ashldi3_internal8"
6755 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6757 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6758 (match_operand:SI 2 "const_int_operand" "i,i"))
6759 (match_operand:DI 3 "mask64_operand" "n,n"))
6761 (clobber (match_scratch:DI 4 "=r,r"))]
6762 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6764 rldicr. %4,%1,%H2,%S3
6766 [(set_attr "type" "delayed_compare")
6767 (set_attr "length" "4,8")])
6770 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6772 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6773 (match_operand:SI 2 "const_int_operand" ""))
6774 (match_operand:DI 3 "mask64_operand" ""))
6776 (clobber (match_scratch:DI 4 ""))]
6777 "TARGET_POWERPC64 && reload_completed
6778 && includes_rldicr_lshift_p (operands[2], operands[3])"
6780 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6783 (compare:CC (match_dup 4)
6787 (define_insn "*ashldi3_internal9"
6788 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6790 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6791 (match_operand:SI 2 "const_int_operand" "i,i"))
6792 (match_operand:DI 3 "mask64_operand" "n,n"))
6794 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6795 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6796 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6798 rldicr. %0,%1,%H2,%S3
6800 [(set_attr "type" "delayed_compare")
6801 (set_attr "length" "4,8")])
6804 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6806 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6807 (match_operand:SI 2 "const_int_operand" ""))
6808 (match_operand:DI 3 "mask64_operand" ""))
6810 (set (match_operand:DI 0 "gpc_reg_operand" "")
6811 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6812 "TARGET_POWERPC64 && reload_completed
6813 && includes_rldicr_lshift_p (operands[2], operands[3])"
6815 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6818 (compare:CC (match_dup 0)
6822 (define_expand "lshrdi3"
6823 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6824 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6825 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6826 "TARGET_POWERPC64 || TARGET_POWER"
6829 if (TARGET_POWERPC64)
6831 else if (TARGET_POWER)
6833 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6840 (define_insn "*lshrdi3_internal1"
6841 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6842 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6843 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6847 (define_insn "*lshrdi3_internal2"
6848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6849 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6850 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6852 (clobber (match_scratch:DI 3 "=r,r"))]
6857 [(set_attr "type" "delayed_compare")
6858 (set_attr "length" "4,8")])
6861 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6862 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6863 (match_operand:SI 2 "reg_or_cint_operand" ""))
6865 (clobber (match_scratch:DI 3 ""))]
6866 "TARGET_POWERPC64 && reload_completed"
6868 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6870 (compare:CC (match_dup 3)
6874 (define_insn "*lshrdi3_internal3"
6875 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6876 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6877 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6879 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6880 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6885 [(set_attr "type" "delayed_compare")
6886 (set_attr "length" "4,8")])
6889 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6890 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6891 (match_operand:SI 2 "reg_or_cint_operand" ""))
6893 (set (match_operand:DI 0 "gpc_reg_operand" "")
6894 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6895 "TARGET_POWERPC64 && reload_completed"
6897 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6899 (compare:CC (match_dup 0)
6903 (define_expand "ashrdi3"
6904 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6905 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6906 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6910 if (TARGET_POWERPC64)
6912 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6914 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6917 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT)
6919 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6926 (define_insn "*ashrdi3_internal1"
6927 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6928 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6929 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6931 "srad%I2 %0,%1,%H2")
6933 (define_insn "*ashrdi3_internal2"
6934 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6935 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6936 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6938 (clobber (match_scratch:DI 3 "=r,r"))]
6943 [(set_attr "type" "delayed_compare")
6944 (set_attr "length" "4,8")])
6947 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6948 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6949 (match_operand:SI 2 "reg_or_cint_operand" ""))
6951 (clobber (match_scratch:DI 3 ""))]
6952 "TARGET_POWERPC64 && reload_completed"
6954 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6956 (compare:CC (match_dup 3)
6960 (define_insn "*ashrdi3_internal3"
6961 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6962 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6963 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6965 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6966 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6971 [(set_attr "type" "delayed_compare")
6972 (set_attr "length" "4,8")])
6975 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6976 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6977 (match_operand:SI 2 "reg_or_cint_operand" ""))
6979 (set (match_operand:DI 0 "gpc_reg_operand" "")
6980 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6981 "TARGET_POWERPC64 && reload_completed"
6983 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6985 (compare:CC (match_dup 0)
6989 (define_insn "anddi3"
6990 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
6991 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
6992 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
6993 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
6997 rldic%B2 %0,%1,0,%S2
7001 [(set_attr "length" "4,4,4,4,8")])
7004 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7005 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7006 (match_operand:DI 2 "mask64_2_operand" "")))
7007 (clobber (match_scratch:CC 3 ""))]
7009 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7010 && !mask64_operand (operands[2], DImode)"
7012 (and:DI (rotate:DI (match_dup 1)
7016 (and:DI (rotate:DI (match_dup 0)
7021 build_mask64_2_operands (operands[2], &operands[4]);
7024 (define_insn "*anddi3_internal2"
7025 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7026 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7027 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7029 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7030 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7034 rldic%B2. %3,%1,0,%S2
7043 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7044 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7047 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7048 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7049 (match_operand:DI 2 "and64_operand" ""))
7051 (clobber (match_scratch:DI 3 ""))
7052 (clobber (match_scratch:CC 4 ""))]
7053 "TARGET_POWERPC64 && reload_completed"
7054 [(parallel [(set (match_dup 3)
7055 (and:DI (match_dup 1)
7057 (clobber (match_dup 4))])
7059 (compare:CC (match_dup 3)
7064 [(set (match_operand:CC 0 "cc_reg_operand" "")
7065 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7066 (match_operand:DI 2 "mask64_2_operand" ""))
7068 (clobber (match_scratch:DI 3 ""))
7069 (clobber (match_scratch:CC 4 ""))]
7070 "TARGET_POWERPC64 && reload_completed
7071 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7072 && !mask64_operand (operands[2], DImode)"
7074 (and:DI (rotate:DI (match_dup 1)
7077 (parallel [(set (match_dup 0)
7078 (compare:CC (and:DI (rotate:DI (match_dup 3)
7082 (clobber (match_dup 3))])]
7085 build_mask64_2_operands (operands[2], &operands[5]);
7088 (define_insn "*anddi3_internal3"
7089 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7090 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7091 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7093 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7094 (and:DI (match_dup 1) (match_dup 2)))
7095 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7099 rldic%B2. %0,%1,0,%S2
7108 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7109 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7112 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7113 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7114 (match_operand:DI 2 "and64_operand" ""))
7116 (set (match_operand:DI 0 "gpc_reg_operand" "")
7117 (and:DI (match_dup 1) (match_dup 2)))
7118 (clobber (match_scratch:CC 4 ""))]
7119 "TARGET_POWERPC64 && reload_completed"
7120 [(parallel [(set (match_dup 0)
7121 (and:DI (match_dup 1) (match_dup 2)))
7122 (clobber (match_dup 4))])
7124 (compare:CC (match_dup 0)
7129 [(set (match_operand:CC 3 "cc_reg_operand" "")
7130 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7131 (match_operand:DI 2 "mask64_2_operand" ""))
7133 (set (match_operand:DI 0 "gpc_reg_operand" "")
7134 (and:DI (match_dup 1) (match_dup 2)))
7135 (clobber (match_scratch:CC 4 ""))]
7136 "TARGET_POWERPC64 && reload_completed
7137 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7138 && !mask64_operand (operands[2], DImode)"
7140 (and:DI (rotate:DI (match_dup 1)
7143 (parallel [(set (match_dup 3)
7144 (compare:CC (and:DI (rotate:DI (match_dup 0)
7149 (and:DI (rotate:DI (match_dup 0)
7154 build_mask64_2_operands (operands[2], &operands[5]);
7157 (define_expand "iordi3"
7158 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7159 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7160 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7164 if (non_logical_cint_operand (operands[2], DImode))
7166 HOST_WIDE_INT value;
7167 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7168 ? operands[0] : gen_reg_rtx (DImode));
7170 if (GET_CODE (operands[2]) == CONST_INT)
7172 value = INTVAL (operands[2]);
7173 emit_insn (gen_iordi3 (tmp, operands[1],
7174 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7178 value = CONST_DOUBLE_LOW (operands[2]);
7179 emit_insn (gen_iordi3 (tmp, operands[1],
7180 immed_double_const (value
7181 & (~ (HOST_WIDE_INT) 0xffff),
7185 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7190 (define_expand "xordi3"
7191 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7192 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7193 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7197 if (non_logical_cint_operand (operands[2], DImode))
7199 HOST_WIDE_INT value;
7200 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7201 ? operands[0] : gen_reg_rtx (DImode));
7203 if (GET_CODE (operands[2]) == CONST_INT)
7205 value = INTVAL (operands[2]);
7206 emit_insn (gen_xordi3 (tmp, operands[1],
7207 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7211 value = CONST_DOUBLE_LOW (operands[2]);
7212 emit_insn (gen_xordi3 (tmp, operands[1],
7213 immed_double_const (value
7214 & (~ (HOST_WIDE_INT) 0xffff),
7218 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7223 (define_insn "*booldi3_internal1"
7224 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7225 (match_operator:DI 3 "boolean_or_operator"
7226 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7227 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7234 (define_insn "*booldi3_internal2"
7235 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7236 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7237 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7238 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7240 (clobber (match_scratch:DI 3 "=r,r"))]
7245 [(set_attr "type" "compare")
7246 (set_attr "length" "4,8")])
7249 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7250 (compare:CC (match_operator:DI 4 "boolean_operator"
7251 [(match_operand:DI 1 "gpc_reg_operand" "")
7252 (match_operand:DI 2 "gpc_reg_operand" "")])
7254 (clobber (match_scratch:DI 3 ""))]
7255 "TARGET_POWERPC64 && reload_completed"
7256 [(set (match_dup 3) (match_dup 4))
7258 (compare:CC (match_dup 3)
7262 (define_insn "*booldi3_internal3"
7263 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7264 (compare:CC (match_operator:DI 4 "boolean_operator"
7265 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7266 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7268 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7274 [(set_attr "type" "compare")
7275 (set_attr "length" "4,8")])
7278 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7279 (compare:CC (match_operator:DI 4 "boolean_operator"
7280 [(match_operand:DI 1 "gpc_reg_operand" "")
7281 (match_operand:DI 2 "gpc_reg_operand" "")])
7283 (set (match_operand:DI 0 "gpc_reg_operand" "")
7285 "TARGET_POWERPC64 && reload_completed"
7286 [(set (match_dup 0) (match_dup 4))
7288 (compare:CC (match_dup 0)
7292 ;; Split a logical operation that we can't do in one insn into two insns,
7293 ;; each of which does one 16-bit part. This is used by combine.
7296 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7297 (match_operator:DI 3 "boolean_or_operator"
7298 [(match_operand:DI 1 "gpc_reg_operand" "")
7299 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7301 [(set (match_dup 0) (match_dup 4))
7302 (set (match_dup 0) (match_dup 5))]
7307 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7309 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7310 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7312 i4 = GEN_INT (value & 0xffff);
7316 i3 = GEN_INT (INTVAL (operands[2])
7317 & (~ (HOST_WIDE_INT) 0xffff));
7318 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7320 operands[4] = gen_rtx (GET_CODE (operands[3]), DImode,
7322 operands[5] = gen_rtx (GET_CODE (operands[3]), DImode,
7326 (define_insn "*boolcdi3_internal1"
7327 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7328 (match_operator:DI 3 "boolean_operator"
7329 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7330 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7334 (define_insn "*boolcdi3_internal2"
7335 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7336 (compare:CC (match_operator:DI 4 "boolean_operator"
7337 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7338 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7340 (clobber (match_scratch:DI 3 "=r,r"))]
7345 [(set_attr "type" "compare")
7346 (set_attr "length" "4,8")])
7349 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7350 (compare:CC (match_operator:DI 4 "boolean_operator"
7351 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7352 (match_operand:DI 2 "gpc_reg_operand" "")])
7354 (clobber (match_scratch:DI 3 ""))]
7355 "TARGET_POWERPC64 && reload_completed"
7356 [(set (match_dup 3) (match_dup 4))
7358 (compare:CC (match_dup 3)
7362 (define_insn "*boolcdi3_internal3"
7363 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7364 (compare:CC (match_operator:DI 4 "boolean_operator"
7365 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7366 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7368 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7374 [(set_attr "type" "compare")
7375 (set_attr "length" "4,8")])
7378 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7379 (compare:CC (match_operator:DI 4 "boolean_operator"
7380 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7381 (match_operand:DI 2 "gpc_reg_operand" "")])
7383 (set (match_operand:DI 0 "gpc_reg_operand" "")
7385 "TARGET_POWERPC64 && reload_completed"
7386 [(set (match_dup 0) (match_dup 4))
7388 (compare:CC (match_dup 0)
7392 (define_insn "*boolccdi3_internal1"
7393 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7394 (match_operator:DI 3 "boolean_operator"
7395 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7396 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7400 (define_insn "*boolccdi3_internal2"
7401 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7402 (compare:CC (match_operator:DI 4 "boolean_operator"
7403 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7404 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7406 (clobber (match_scratch:DI 3 "=r,r"))]
7411 [(set_attr "type" "compare")
7412 (set_attr "length" "4,8")])
7415 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7416 (compare:CC (match_operator:DI 4 "boolean_operator"
7417 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7418 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7420 (clobber (match_scratch:DI 3 ""))]
7421 "TARGET_POWERPC64 && reload_completed"
7422 [(set (match_dup 3) (match_dup 4))
7424 (compare:CC (match_dup 3)
7428 (define_insn "*boolccdi3_internal3"
7429 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7430 (compare:CC (match_operator:DI 4 "boolean_operator"
7431 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7432 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7434 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7440 [(set_attr "type" "compare")
7441 (set_attr "length" "4,8")])
7444 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7445 (compare:CC (match_operator:DI 4 "boolean_operator"
7446 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7447 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7449 (set (match_operand:DI 0 "gpc_reg_operand" "")
7451 "TARGET_POWERPC64 && reload_completed"
7452 [(set (match_dup 0) (match_dup 4))
7454 (compare:CC (match_dup 0)
7458 ;; Now define ways of moving data around.
7460 ;; Elf specific ways of loading addresses for non-PIC code.
7461 ;; The output of this could be r0, but we make a very strong
7462 ;; preference for a base register because it will usually
7464 (define_insn "elf_high"
7465 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7466 (high:SI (match_operand 1 "" "")))]
7467 "TARGET_ELF && ! TARGET_64BIT"
7468 "{liu|lis} %0,%1@ha")
7470 (define_insn "elf_low"
7471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7472 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7473 (match_operand 2 "" "")))]
7474 "TARGET_ELF && ! TARGET_64BIT"
7476 {cal|la} %0,%2@l(%1)
7477 {ai|addic} %0,%1,%K2")
7479 ;; Mach-O PIC trickery.
7480 (define_insn "macho_high"
7481 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7482 (high:SI (match_operand 1 "" "")))]
7483 "TARGET_MACHO && ! TARGET_64BIT"
7484 "{liu|lis} %0,ha16(%1)")
7486 (define_insn "macho_low"
7487 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7488 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7489 (match_operand 2 "" "")))]
7490 "TARGET_MACHO && ! TARGET_64BIT"
7492 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
7493 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
7495 ;; Set up a register with a value from the GOT table
7497 (define_expand "movsi_got"
7498 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7499 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7501 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7504 if (GET_CODE (operands[1]) == CONST)
7506 rtx offset = const0_rtx;
7507 HOST_WIDE_INT value;
7509 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7510 value = INTVAL (offset);
7513 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7514 emit_insn (gen_movsi_got (tmp, operands[1]));
7515 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7520 operands[2] = rs6000_got_register (operands[1]);
7523 (define_insn "*movsi_got_internal"
7524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7525 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7526 (match_operand:SI 2 "gpc_reg_operand" "b")] 8))]
7527 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7528 "{l|lwz} %0,%a1@got(%2)"
7529 [(set_attr "type" "load")])
7531 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7532 ;; didn't get allocated to a hard register.
7534 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7535 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7536 (match_operand:SI 2 "memory_operand" "")] 8))]
7537 "DEFAULT_ABI == ABI_V4
7539 && (reload_in_progress || reload_completed)"
7540 [(set (match_dup 0) (match_dup 2))
7541 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)] 8))]
7544 ;; For SI, we special-case integers that can't be loaded in one insn. We
7545 ;; do the load 16-bits at a time. We could do this by loading from memory,
7546 ;; and this is even supposed to be faster, but it is simpler not to get
7547 ;; integers in the TOC.
7548 (define_expand "movsi"
7549 [(set (match_operand:SI 0 "general_operand" "")
7550 (match_operand:SI 1 "any_operand" ""))]
7552 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7554 (define_insn "movsi_low"
7555 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7556 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7557 (match_operand 2 "" ""))))]
7558 "TARGET_MACHO && ! TARGET_64BIT"
7559 "{l|lwz} %0,lo16(%2)(%1)"
7560 [(set_attr "type" "load")
7561 (set_attr "length" "4")])
7563 (define_insn "movsi_low_st"
7564 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7565 (match_operand 2 "" "")))
7566 (match_operand:SI 0 "gpc_reg_operand" "r"))]
7567 "TARGET_MACHO && ! TARGET_64BIT"
7568 "{st|stw} %0,lo16(%2)(%1)"
7569 [(set_attr "type" "store")
7570 (set_attr "length" "4")])
7572 (define_insn "movdf_low"
7573 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
7574 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7575 (match_operand 2 "" ""))))]
7576 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7579 switch (which_alternative)
7582 return \"lfd %0,lo16(%2)(%1)\";
7586 operands2[0] = operands[0];
7587 operands2[1] = operands[1];
7588 operands2[2] = operands[2];
7589 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
7590 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
7592 if (MACHO_DYNAMIC_NO_PIC_P)
7593 output_asm_insn (\"{liu|lis} %L0,ha16(%2+4)\", operands);
7595 /* We cannot rely on ha16(low half)==ha16(high half), alas,
7596 although in practice it almost always is. */
7597 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
7599 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
7605 [(set_attr "type" "load")
7606 (set_attr "length" "4,12")])
7608 (define_insn "movdf_low_st"
7609 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7610 (match_operand 2 "" "")))
7611 (match_operand:DF 0 "gpc_reg_operand" "f"))]
7612 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7613 "stfd %0,lo16(%2)(%1)"
7614 [(set_attr "type" "store")
7615 (set_attr "length" "4")])
7617 (define_insn "movsf_low"
7618 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
7619 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7620 (match_operand 2 "" ""))))]
7621 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7624 {l|lwz} %0,lo16(%2)(%1)"
7625 [(set_attr "type" "load")
7626 (set_attr "length" "4")])
7628 (define_insn "movsf_low_st"
7629 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7630 (match_operand 2 "" "")))
7631 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
7632 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7634 stfs %0,lo16(%2)(%1)
7635 {st|stw} %0,lo16(%2)(%1)"
7636 [(set_attr "type" "store")
7637 (set_attr "length" "4")])
7639 (define_insn "*movsi_internal1"
7640 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7641 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7642 "gpc_reg_operand (operands[0], SImode)
7643 || gpc_reg_operand (operands[1], SImode)"
7647 {l%U1%X1|lwz%U1%X1} %0,%1
7648 {st%U0%X0|stw%U0%X0} %1,%0
7658 [(set_attr "type" "*,*,load,store,*,*,*,*,*,*,mtjmpr,*,*")
7659 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7661 ;; Split a load of a large constant into the appropriate two-insn
7665 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7666 (match_operand:SI 1 "const_int_operand" ""))]
7667 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7668 && (INTVAL (operands[1]) & 0xffff) != 0"
7672 (ior:SI (match_dup 0)
7675 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7677 if (tem == operands[0])
7683 (define_insn "*movsi_internal2"
7684 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
7685 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r,r")
7687 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
7688 "! TARGET_POWERPC64"
7692 [(set_attr "type" "compare")
7693 (set_attr "length" "4,8")])
7696 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7697 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7699 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7700 "! TARGET_POWERPC64 && reload_completed"
7701 [(set (match_dup 0) (match_dup 1))
7703 (compare:CC (match_dup 0)
7707 (define_expand "movhi"
7708 [(set (match_operand:HI 0 "general_operand" "")
7709 (match_operand:HI 1 "any_operand" ""))]
7711 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7713 (define_insn "*movhi_internal"
7714 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7715 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7716 "gpc_reg_operand (operands[0], HImode)
7717 || gpc_reg_operand (operands[1], HImode)"
7727 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
7729 (define_expand "movqi"
7730 [(set (match_operand:QI 0 "general_operand" "")
7731 (match_operand:QI 1 "any_operand" ""))]
7733 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7735 (define_insn "*movqi_internal"
7736 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7737 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7738 "gpc_reg_operand (operands[0], QImode)
7739 || gpc_reg_operand (operands[1], QImode)"
7749 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
7751 ;; Here is how to move condition codes around. When we store CC data in
7752 ;; an integer register or memory, we store just the high-order 4 bits.
7753 ;; This lets us not shift in the most common case of CR0.
7754 (define_expand "movcc"
7755 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7756 (match_operand:CC 1 "nonimmediate_operand" ""))]
7760 (define_insn "*movcc_internal1"
7761 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7762 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7763 "register_operand (operands[0], CCmode)
7764 || register_operand (operands[1], CCmode)"
7768 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7770 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7775 {l%U1%X1|lwz%U1%X1} %0,%1
7776 {st%U0%U1|stw%U0%U1} %1,%0"
7777 [(set_attr "type" "cr_logical,mtcr,mtcr,mfcr,mfcr,*,*,*,mtjmpr,load,store")
7778 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7780 ;; For floating-point, we normally deal with the floating-point registers
7781 ;; unless -msoft-float is used. The sole exception is that parameter passing
7782 ;; can produce floating-point values in fixed-point registers. Unless the
7783 ;; value is a simple constant or already in memory, we deal with this by
7784 ;; allocating memory and copying the value explicitly via that memory location.
7785 (define_expand "movsf"
7786 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7787 (match_operand:SF 1 "any_operand" ""))]
7789 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7792 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7793 (match_operand:SF 1 "const_double_operand" ""))]
7795 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7796 || (GET_CODE (operands[0]) == SUBREG
7797 && GET_CODE (SUBREG_REG (operands[0])) == REG
7798 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7799 [(set (match_dup 2) (match_dup 3))]
7805 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7806 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7808 if (! TARGET_POWERPC64)
7809 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7811 operands[2] = gen_lowpart (SImode, operands[0]);
7813 operands[3] = gen_int_mode (l, SImode);
7816 (define_insn "*movsf_hardfloat"
7817 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!r,!r")
7818 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,G,Fn"))]
7819 "(gpc_reg_operand (operands[0], SFmode)
7820 || gpc_reg_operand (operands[1], SFmode))
7821 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7824 {l%U1%X1|lwz%U1%X1} %0,%1
7825 {st%U0%X0|stw%U0%X0} %1,%0
7834 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*")
7835 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
7837 (define_insn "*movsf_softfloat"
7838 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r")
7839 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn"))]
7840 "(gpc_reg_operand (operands[0], SFmode)
7841 || gpc_reg_operand (operands[1], SFmode))
7842 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7848 {l%U1%X1|lwz%U1%X1} %0,%1
7849 {st%U0%X0|stw%U0%X0} %1,%0
7855 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*")
7856 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
7859 (define_expand "movdf"
7860 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7861 (match_operand:DF 1 "any_operand" ""))]
7863 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7866 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7867 (match_operand:DF 1 "const_int_operand" ""))]
7868 "! TARGET_POWERPC64 && reload_completed
7869 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7870 || (GET_CODE (operands[0]) == SUBREG
7871 && GET_CODE (SUBREG_REG (operands[0])) == REG
7872 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7873 [(set (match_dup 2) (match_dup 4))
7874 (set (match_dup 3) (match_dup 1))]
7877 int endian = (WORDS_BIG_ENDIAN == 0);
7878 HOST_WIDE_INT value = INTVAL (operands[1]);
7880 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7881 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7882 #if HOST_BITS_PER_WIDE_INT == 32
7883 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7885 operands[4] = GEN_INT (value >> 32);
7886 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7891 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7892 (match_operand:DF 1 "const_double_operand" ""))]
7893 "! TARGET_POWERPC64 && reload_completed
7894 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7895 || (GET_CODE (operands[0]) == SUBREG
7896 && GET_CODE (SUBREG_REG (operands[0])) == REG
7897 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7898 [(set (match_dup 2) (match_dup 4))
7899 (set (match_dup 3) (match_dup 5))]
7902 int endian = (WORDS_BIG_ENDIAN == 0);
7906 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7907 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7909 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7910 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7911 operands[4] = gen_int_mode (l[endian], SImode);
7912 operands[5] = gen_int_mode (l[1 - endian], SImode);
7916 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7917 (match_operand:DF 1 "easy_fp_constant" ""))]
7918 "TARGET_POWERPC64 && reload_completed
7919 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7920 || (GET_CODE (operands[0]) == SUBREG
7921 && GET_CODE (SUBREG_REG (operands[0])) == REG
7922 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7923 [(set (match_dup 2) (match_dup 3))]
7926 int endian = (WORDS_BIG_ENDIAN == 0);
7929 #if HOST_BITS_PER_WIDE_INT >= 64
7933 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7934 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7936 operands[2] = gen_lowpart (DImode, operands[0]);
7937 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
7938 #if HOST_BITS_PER_WIDE_INT >= 64
7939 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
7940 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
7942 operands[3] = gen_int_mode (val, DImode);
7944 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
7948 ;; Don't have reload use general registers to load a constant. First,
7949 ;; it might not work if the output operand is the equivalent of
7950 ;; a non-offsettable memref, but also it is less efficient than loading
7951 ;; the constant into an FP register, since it will probably be used there.
7952 ;; The "??" is a kludge until we can figure out a more reasonable way
7953 ;; of handling these non-offsettable values.
7954 (define_insn "*movdf_hardfloat32"
7955 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
7956 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
7957 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7958 && (gpc_reg_operand (operands[0], DFmode)
7959 || gpc_reg_operand (operands[1], DFmode))"
7962 switch (which_alternative)
7967 /* We normally copy the low-numbered register first. However, if
7968 the first register operand 0 is the same as the second register
7969 of operand 1, we must copy in the opposite order. */
7970 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7971 return \"mr %L0,%L1\;mr %0,%1\";
7973 return \"mr %0,%1\;mr %L0,%L1\";
7975 if (offsettable_memref_p (operands[1])
7976 || (GET_CODE (operands[1]) == MEM
7977 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
7978 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
7979 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
7981 /* If the low-address word is used in the address, we must load
7982 it last. Otherwise, load it first. Note that we cannot have
7983 auto-increment in that case since the address register is
7984 known to be dead. */
7985 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7987 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7989 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7995 addreg = find_addr_reg (XEXP (operands[1], 0));
7996 if (refers_to_regno_p (REGNO (operands[0]),
7997 REGNO (operands[0]) + 1,
8000 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8001 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8002 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8003 return \"{lx|lwzx} %0,%1\";
8007 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8008 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8009 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8010 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8015 if (offsettable_memref_p (operands[0])
8016 || (GET_CODE (operands[0]) == MEM
8017 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8018 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8019 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8020 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8025 addreg = find_addr_reg (XEXP (operands[0], 0));
8026 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8027 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8028 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8029 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8033 return \"fmr %0,%1\";
8035 return \"lfd%U1%X1 %0,%1\";
8037 return \"stfd%U0%X0 %1,%0\";
8044 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*")
8045 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8047 (define_insn "*movdf_softfloat32"
8048 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8049 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8050 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8051 && (gpc_reg_operand (operands[0], DFmode)
8052 || gpc_reg_operand (operands[1], DFmode))"
8055 switch (which_alternative)
8060 /* We normally copy the low-numbered register first. However, if
8061 the first register operand 0 is the same as the second register of
8062 operand 1, we must copy in the opposite order. */
8063 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8064 return \"mr %L0,%L1\;mr %0,%1\";
8066 return \"mr %0,%1\;mr %L0,%L1\";
8068 /* If the low-address word is used in the address, we must load
8069 it last. Otherwise, load it first. Note that we cannot have
8070 auto-increment in that case since the address register is
8071 known to be dead. */
8072 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8074 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8076 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8078 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8085 [(set_attr "type" "*,load,store,*,*,*")
8086 (set_attr "length" "8,8,8,8,12,16")])
8088 (define_insn "*movdf_hardfloat64"
8089 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!cl,!r,!r,!r,!r")
8090 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,r,h,G,H,F"))]
8091 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8092 && (gpc_reg_operand (operands[0], DFmode)
8093 || gpc_reg_operand (operands[1], DFmode))"
8106 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*")
8107 (set_attr "length" "4,4,4,4,4,4,4,4,8,12,16")])
8109 (define_insn "*movdf_softfloat64"
8110 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r")
8111 (match_operand:DF 1 "input_operand" "r,r,h,m,r,G,H,F"))]
8112 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8113 && (gpc_reg_operand (operands[0], DFmode)
8114 || gpc_reg_operand (operands[1], DFmode))"
8124 [(set_attr "type" "*,*,*,load,store,*,*,*")
8125 (set_attr "length" "4,4,4,4,4,8,12,16")])
8127 (define_expand "movtf"
8128 [(set (match_operand:TF 0 "general_operand" "")
8129 (match_operand:TF 1 "any_operand" ""))]
8130 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8131 && TARGET_LONG_DOUBLE_128"
8132 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8134 (define_insn "*movtf_internal"
8135 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,m,!r,!r,!r")
8136 (match_operand:TF 1 "input_operand" "f,m,f,G,H,F"))]
8137 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8138 && TARGET_LONG_DOUBLE_128
8139 && (gpc_reg_operand (operands[0], TFmode)
8140 || gpc_reg_operand (operands[1], TFmode))"
8143 switch (which_alternative)
8148 /* We normally copy the low-numbered register first. However, if
8149 the first register operand 0 is the same as the second register of
8150 operand 1, we must copy in the opposite order. */
8151 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8152 return \"fmr %L0,%L1\;fmr %0,%1\";
8154 return \"fmr %0,%1\;fmr %L0,%L1\";
8156 return \"lfd %0,%1\;lfd %L0,%Y1\";
8158 return \"stfd %1,%0\;stfd %L1,%Y0\";
8165 [(set_attr "type" "fp,fpload,fpstore,*,*,*")
8166 (set_attr "length" "8,8,8,12,16,20")])
8169 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8170 (match_operand:TF 1 "easy_fp_constant" ""))]
8171 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8172 && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_POWERPC64
8173 && TARGET_LONG_DOUBLE_128 && reload_completed
8174 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8175 || (GET_CODE (operands[0]) == SUBREG
8176 && GET_CODE (SUBREG_REG (operands[0])) == REG
8177 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8178 [(set (match_dup 2) (match_dup 6))
8179 (set (match_dup 3) (match_dup 7))
8180 (set (match_dup 4) (match_dup 8))
8181 (set (match_dup 5) (match_dup 9))]
8187 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8188 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8190 operands[2] = operand_subword (operands[0], 0, 0, TFmode);
8191 operands[3] = operand_subword (operands[0], 1, 0, TFmode);
8192 operands[4] = operand_subword (operands[0], 2, 0, TFmode);
8193 operands[5] = operand_subword (operands[0], 3, 0, TFmode);
8194 operands[6] = gen_int_mode (l[0], SImode);
8195 operands[7] = gen_int_mode (l[1], SImode);
8196 operands[8] = gen_int_mode (l[2], SImode);
8197 operands[9] = gen_int_mode (l[3], SImode);
8201 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8202 (match_operand:TF 1 "easy_fp_constant" ""))]
8203 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8204 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
8205 && TARGET_LONG_DOUBLE_128 && reload_completed
8206 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8207 || (GET_CODE (operands[0]) == SUBREG
8208 && GET_CODE (SUBREG_REG (operands[0])) == REG
8209 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8210 [(set (match_dup 2) (match_dup 4))
8211 (set (match_dup 3) (match_dup 5))]
8216 #if HOST_BITS_PER_WIDE_INT >= 64
8220 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8221 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8223 operands[2] = gen_lowpart (DImode, operands[0]);
8224 operands[3] = gen_highpart (DImode, operands[0]);
8225 #if HOST_BITS_PER_WIDE_INT >= 64
8226 val = ((HOST_WIDE_INT)(unsigned long)l[0] << 32
8227 | ((HOST_WIDE_INT)(unsigned long)l[1]));
8228 operands[4] = gen_int_mode (val, DImode);
8230 val = ((HOST_WIDE_INT)(unsigned long)l[2] << 32
8231 | ((HOST_WIDE_INT)(unsigned long)l[3]));
8232 operands[5] = gen_int_mode (val, DImode);
8234 operands[4] = immed_double_const (l[1], l[0], DImode);
8235 operands[5] = immed_double_const (l[3], l[2], DImode);
8239 (define_insn "extenddftf2"
8240 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8241 (float_extend:TF (match_operand:DF 1 "gpc_reg_operand" "f")))]
8242 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8243 && TARGET_LONG_DOUBLE_128"
8246 if (REGNO (operands[0]) == REGNO (operands[1]))
8247 return \"fsub %L0,%L0,%L0\";
8249 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8251 [(set_attr "type" "fp")])
8253 (define_insn "extendsftf2"
8254 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8255 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "f")))]
8256 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8257 && TARGET_LONG_DOUBLE_128"
8260 if (REGNO (operands[0]) == REGNO (operands[1]))
8261 return \"fsub %L0,%L0,%L0\";
8263 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8265 [(set_attr "type" "fp")])
8267 (define_insn "trunctfdf2"
8268 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8269 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8270 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8271 && TARGET_LONG_DOUBLE_128"
8273 [(set_attr "type" "fp")
8274 (set_attr "length" "8")])
8276 (define_insn_and_split "trunctfsf2"
8277 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8278 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8279 (clobber (match_scratch:DF 2 "=f"))]
8280 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
8281 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8283 "&& reload_completed"
8285 (float_truncate:DF (match_dup 1)))
8287 (float_truncate:SF (match_dup 2)))]
8290 (define_insn_and_split "floatditf2"
8291 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8292 (float:TF (match_operand:DI 1 "gpc_reg_operand" "*f")))
8293 (clobber (match_scratch:DF 2 "=f"))]
8294 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8295 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8297 "&& reload_completed"
8299 (float:DF (match_dup 1)))
8301 (float_extend:TF (match_dup 2)))]
8304 (define_insn_and_split "floatsitf2"
8305 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8306 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))
8307 (clobber (match_scratch:DF 2 "=f"))]
8308 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8309 && TARGET_LONG_DOUBLE_128"
8311 "&& reload_completed"
8313 (float:DF (match_dup 1)))
8315 (float_extend:TF (match_dup 2)))]
8318 (define_insn_and_split "fix_trunctfdi2"
8319 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
8320 (fix:DI (match_operand:TF 1 "gpc_reg_operand" "f")))
8321 (clobber (match_scratch:DF 2 "=f"))]
8322 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8323 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8325 "&& reload_completed"
8327 (float_truncate:DF (match_dup 1)))
8329 (fix:DI (match_dup 2)))]
8332 (define_insn_and_split "fix_trunctfsi2"
8333 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8334 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8335 (clobber (match_scratch:DF 2 "=f"))]
8336 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8337 && TARGET_LONG_DOUBLE_128"
8339 "&& reload_completed"
8341 (float_truncate:DF (match_dup 1)))
8343 (fix:SI (match_dup 2)))]
8346 (define_insn "negtf2"
8347 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8348 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8349 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8350 && TARGET_LONG_DOUBLE_128"
8353 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8354 return \"fneg %L0,%L1\;fneg %0,%1\";
8356 return \"fneg %0,%1\;fneg %L0,%L1\";
8358 [(set_attr "type" "fp")
8359 (set_attr "length" "8")])
8361 (define_insn "abstf2"
8362 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8363 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8364 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8365 && TARGET_LONG_DOUBLE_128"
8368 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8369 return \"fabs %L0,%L1\;fabs %0,%1\";
8371 return \"fabs %0,%1\;fabs %L0,%L1\";
8373 [(set_attr "type" "fp")
8374 (set_attr "length" "8")])
8377 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8378 (neg:TF (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f"))))]
8379 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8380 && TARGET_LONG_DOUBLE_128"
8383 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8384 return \"fnabs %L0,%L1\;fnabs %0,%1\";
8386 return \"fnabs %0,%1\;fnabs %L0,%L1\";
8388 [(set_attr "type" "fp")
8389 (set_attr "length" "8")])
8391 ;; Next come the multi-word integer load and store and the load and store
8393 (define_expand "movdi"
8394 [(set (match_operand:DI 0 "general_operand" "")
8395 (match_operand:DI 1 "any_operand" ""))]
8397 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8399 (define_insn "*movdi_internal32"
8400 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8401 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8403 && (gpc_reg_operand (operands[0], DImode)
8404 || gpc_reg_operand (operands[1], DImode))"
8407 switch (which_alternative)
8412 /* We normally copy the low-numbered register first. However, if
8413 the first register operand 0 is the same as the second register of
8414 operand 1, we must copy in the opposite order. */
8415 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8416 return \"mr %L0,%L1\;mr %0,%1\";
8418 return \"mr %0,%1\;mr %L0,%L1\";
8420 /* If the low-address word is used in the address, we must load it
8421 last. Otherwise, load it first. Note that we cannot have
8422 auto-increment in that case since the address register is known to be
8424 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8426 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8428 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8430 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8432 return \"fmr %0,%1\";
8434 return \"lfd%U1%X1 %0,%1\";
8436 return \"stfd%U0%X0 %1,%0\";
8445 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
8446 (set_attr "length" "8,8,8,4,4,4,8,12,8,12,16")])
8449 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8450 (match_operand:DI 1 "const_int_operand" ""))]
8451 "! TARGET_POWERPC64 && reload_completed"
8452 [(set (match_dup 2) (match_dup 4))
8453 (set (match_dup 3) (match_dup 1))]
8456 HOST_WIDE_INT value = INTVAL (operands[1]);
8457 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8459 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8461 #if HOST_BITS_PER_WIDE_INT == 32
8462 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8464 operands[4] = GEN_INT (value >> 32);
8465 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8470 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8471 (match_operand:DI 1 "const_double_operand" ""))]
8472 "HOST_BITS_PER_WIDE_INT == 32 && ! TARGET_POWERPC64 && reload_completed"
8473 [(set (match_dup 2) (match_dup 4))
8474 (set (match_dup 3) (match_dup 5))]
8477 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8479 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8481 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8482 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8486 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8487 (match_operand:TI 1 "const_double_operand" ""))]
8489 [(set (match_dup 2) (match_dup 4))
8490 (set (match_dup 3) (match_dup 5))]
8493 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8495 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8497 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8499 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8500 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8502 else if (GET_CODE (operands[1]) == CONST_INT)
8504 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8505 operands[5] = operands[1];
8511 (define_insn "*movdi_internal64"
8512 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
8513 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8515 && (gpc_reg_operand (operands[0], DImode)
8516 || gpc_reg_operand (operands[1], DImode))"
8531 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
8532 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8534 ;; immediate value valid for a single instruction hiding in a const_double
8536 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8537 (match_operand:DI 1 "const_double_operand" "F"))]
8538 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8539 && GET_CODE (operands[1]) == CONST_DOUBLE
8540 && num_insns_constant (operands[1], DImode) == 1"
8543 return ((unsigned HOST_WIDE_INT)
8544 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8545 ? \"li %0,%1\" : \"lis %0,%v1\";
8548 ;; Generate all one-bits and clear left or right.
8549 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8551 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8552 (match_operand:DI 1 "mask64_operand" ""))]
8553 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8554 [(set (match_dup 0) (const_int -1))
8556 (and:DI (rotate:DI (match_dup 0)
8561 ;; Split a load of a large constant into the appropriate five-instruction
8562 ;; sequence. Handle anything in a constant number of insns.
8563 ;; When non-easy constants can go in the TOC, this should use
8564 ;; easy_fp_constant predicate.
8566 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8567 (match_operand:DI 1 "const_int_operand" ""))]
8568 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8569 [(set (match_dup 0) (match_dup 2))
8570 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8572 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8574 if (tem == operands[0])
8581 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8582 (match_operand:DI 1 "const_double_operand" ""))]
8583 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8584 [(set (match_dup 0) (match_dup 2))
8585 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8587 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8589 if (tem == operands[0])
8595 ;; Split a load of a large constant into the appropriate five-instruction
8596 (define_insn "*movdi_internal2"
8597 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
8598 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r,r")
8600 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
8605 [(set_attr "type" "compare")
8606 (set_attr "length" "4,8")])
8609 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8610 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8612 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8613 "TARGET_POWERPC64 && reload_completed"
8614 [(set (match_dup 0) (match_dup 1))
8616 (compare:CC (match_dup 0)
8620 ;; TImode is similar, except that we usually want to compute the address into
8621 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8622 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8623 (define_expand "movti"
8624 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8625 (match_operand:TI 1 "general_operand" ""))
8626 (clobber (scratch:SI))])]
8627 "TARGET_STRING || TARGET_POWERPC64"
8628 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8630 ;; We say that MQ is clobbered in the last alternative because the first
8631 ;; alternative would never get used otherwise since it would need a reload
8632 ;; while the 2nd alternative would not. We put memory cases first so they
8633 ;; are preferred. Otherwise, we'd try to reload the output instead of
8634 ;; giving the SCRATCH mq.
8635 (define_insn "*movti_power"
8636 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8637 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8638 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8639 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
8640 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8643 switch (which_alternative)
8649 return \"{stsi|stswi} %1,%P0,16\";
8651 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
8653 /* Normally copy registers with lowest numbered register copied first.
8654 But copy in the other order if the first register of the output
8655 is the second, third, or fourth register in the input. */
8656 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
8657 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
8658 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
8660 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
8662 /* If the address is not used in the output, we can use lsi. Otherwise,
8663 fall through to generating four loads. */
8664 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
8665 return \"{lsi|lswi} %0,%P1,16\";
8666 /* ... fall through ... */
8668 /* If the address register is the same as the register for the lowest-
8669 addressed word, load it last. Similarly for the next two words.
8670 Otherwise load lowest address to highest. */
8671 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8673 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
8674 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
8675 REGNO (operands[0]) + 2, operands[1], 0))
8676 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
8677 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
8678 REGNO (operands[0]) + 3, operands[1], 0))
8679 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
8681 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
8684 [(set_attr "type" "store,store,*,load,load")
8685 (set_attr "length" "4,16,16,4,16")])
8687 (define_insn "*movti_string"
8688 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8689 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))]
8690 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
8691 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8694 switch (which_alternative)
8700 return \"{stsi|stswi} %1,%P0,16\";
8702 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
8704 /* Normally copy registers with lowest numbered register copied first.
8705 But copy in the other order if the first register of the output
8706 is the second, third, or fourth register in the input. */
8707 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
8708 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
8709 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
8711 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
8713 /* If the address is not used in the output, we can use lsi. Otherwise,
8714 fall through to generating four loads. */
8715 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
8716 return \"{lsi|lswi} %0,%P1,16\";
8717 /* ... fall through ... */
8719 /* If the address register is the same as the register for the lowest-
8720 addressed word, load it last. Similarly for the next two words.
8721 Otherwise load lowest address to highest. */
8722 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8724 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
8725 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
8726 REGNO (operands[0]) + 2, operands[1], 0))
8727 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
8728 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
8729 REGNO (operands[0]) + 3, operands[1], 0))
8730 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
8732 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
8735 [(set_attr "type" "store,store,*,load,load")
8736 (set_attr "length" "4,16,16,4,16")])
8738 (define_insn "*movti_ppc64"
8739 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
8740 (match_operand:TI 1 "input_operand" "r,m,r"))]
8741 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8742 || gpc_reg_operand (operands[1], TImode))"
8745 switch (which_alternative)
8750 /* We normally copy the low-numbered register first. However, if
8751 the first register operand 0 is the same as the second register of
8752 operand 1, we must copy in the opposite order. */
8753 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8754 return \"mr %L0,%L1\;mr %0,%1\";
8756 return \"mr %0,%1\;mr %L0,%L1\";
8758 /* If the low-address word is used in the address, we must load it
8759 last. Otherwise, load it first. Note that we cannot have
8760 auto-increment in that case since the address register is known to be
8762 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8764 return \"ld %L0,%L1\;ld %0,%1\";
8766 return \"ld%U1 %0,%1\;ld %L0,%L1\";
8768 return \"std%U0 %1,%0\;std %L1,%L0\";
8771 [(set_attr "type" "*,load,store")
8772 (set_attr "length" "8,8,8")])
8774 (define_expand "load_multiple"
8775 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8776 (match_operand:SI 1 "" ""))
8777 (use (match_operand:SI 2 "" ""))])]
8778 "TARGET_STRING && !TARGET_POWERPC64"
8786 /* Support only loading a constant number of fixed-point registers from
8787 memory and only bother with this if more than two; the machine
8788 doesn't support more than eight. */
8789 if (GET_CODE (operands[2]) != CONST_INT
8790 || INTVAL (operands[2]) <= 2
8791 || INTVAL (operands[2]) > 8
8792 || GET_CODE (operands[1]) != MEM
8793 || GET_CODE (operands[0]) != REG
8794 || REGNO (operands[0]) >= 32)
8797 count = INTVAL (operands[2]);
8798 regno = REGNO (operands[0]);
8800 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8801 op1 = replace_equiv_address (operands[1],
8802 force_reg (SImode, XEXP (operands[1], 0)));
8804 for (i = 0; i < count; i++)
8805 XVECEXP (operands[3], 0, i)
8806 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8807 adjust_address_nv (op1, SImode, i * 4));
8810 (define_insn "*ldmsi8"
8811 [(match_parallel 0 "load_multiple_operation"
8812 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8813 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8814 (set (match_operand:SI 3 "gpc_reg_operand" "")
8815 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8816 (set (match_operand:SI 4 "gpc_reg_operand" "")
8817 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8818 (set (match_operand:SI 5 "gpc_reg_operand" "")
8819 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8820 (set (match_operand:SI 6 "gpc_reg_operand" "")
8821 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8822 (set (match_operand:SI 7 "gpc_reg_operand" "")
8823 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8824 (set (match_operand:SI 8 "gpc_reg_operand" "")
8825 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8826 (set (match_operand:SI 9 "gpc_reg_operand" "")
8827 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8828 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8830 { return rs6000_output_load_multiple (operands); }"
8831 [(set_attr "type" "load")
8832 (set_attr "length" "32")])
8834 (define_insn "*ldmsi7"
8835 [(match_parallel 0 "load_multiple_operation"
8836 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8837 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8838 (set (match_operand:SI 3 "gpc_reg_operand" "")
8839 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8840 (set (match_operand:SI 4 "gpc_reg_operand" "")
8841 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8842 (set (match_operand:SI 5 "gpc_reg_operand" "")
8843 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8844 (set (match_operand:SI 6 "gpc_reg_operand" "")
8845 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8846 (set (match_operand:SI 7 "gpc_reg_operand" "")
8847 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8848 (set (match_operand:SI 8 "gpc_reg_operand" "")
8849 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8850 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8852 { return rs6000_output_load_multiple (operands); }"
8853 [(set_attr "type" "load")
8854 (set_attr "length" "32")])
8856 (define_insn "*ldmsi6"
8857 [(match_parallel 0 "load_multiple_operation"
8858 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8859 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8860 (set (match_operand:SI 3 "gpc_reg_operand" "")
8861 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8862 (set (match_operand:SI 4 "gpc_reg_operand" "")
8863 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8864 (set (match_operand:SI 5 "gpc_reg_operand" "")
8865 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8866 (set (match_operand:SI 6 "gpc_reg_operand" "")
8867 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8868 (set (match_operand:SI 7 "gpc_reg_operand" "")
8869 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8870 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8872 { return rs6000_output_load_multiple (operands); }"
8873 [(set_attr "type" "load")
8874 (set_attr "length" "32")])
8876 (define_insn "*ldmsi5"
8877 [(match_parallel 0 "load_multiple_operation"
8878 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8879 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8880 (set (match_operand:SI 3 "gpc_reg_operand" "")
8881 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8882 (set (match_operand:SI 4 "gpc_reg_operand" "")
8883 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8884 (set (match_operand:SI 5 "gpc_reg_operand" "")
8885 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8886 (set (match_operand:SI 6 "gpc_reg_operand" "")
8887 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8888 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8890 { return rs6000_output_load_multiple (operands); }"
8891 [(set_attr "type" "load")
8892 (set_attr "length" "32")])
8894 (define_insn "*ldmsi4"
8895 [(match_parallel 0 "load_multiple_operation"
8896 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8897 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8898 (set (match_operand:SI 3 "gpc_reg_operand" "")
8899 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8900 (set (match_operand:SI 4 "gpc_reg_operand" "")
8901 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8902 (set (match_operand:SI 5 "gpc_reg_operand" "")
8903 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8904 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8906 { return rs6000_output_load_multiple (operands); }"
8907 [(set_attr "type" "load")
8908 (set_attr "length" "32")])
8910 (define_insn "*ldmsi3"
8911 [(match_parallel 0 "load_multiple_operation"
8912 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8913 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8914 (set (match_operand:SI 3 "gpc_reg_operand" "")
8915 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8916 (set (match_operand:SI 4 "gpc_reg_operand" "")
8917 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8918 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8920 { return rs6000_output_load_multiple (operands); }"
8921 [(set_attr "type" "load")
8922 (set_attr "length" "32")])
8924 (define_expand "store_multiple"
8925 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8926 (match_operand:SI 1 "" ""))
8927 (clobber (scratch:SI))
8928 (use (match_operand:SI 2 "" ""))])]
8929 "TARGET_STRING && !TARGET_POWERPC64"
8938 /* Support only storing a constant number of fixed-point registers to
8939 memory and only bother with this if more than two; the machine
8940 doesn't support more than eight. */
8941 if (GET_CODE (operands[2]) != CONST_INT
8942 || INTVAL (operands[2]) <= 2
8943 || INTVAL (operands[2]) > 8
8944 || GET_CODE (operands[0]) != MEM
8945 || GET_CODE (operands[1]) != REG
8946 || REGNO (operands[1]) >= 32)
8949 count = INTVAL (operands[2]);
8950 regno = REGNO (operands[1]);
8952 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8953 to = force_reg (SImode, XEXP (operands[0], 0));
8954 op0 = replace_equiv_address (operands[0], to);
8956 XVECEXP (operands[3], 0, 0)
8957 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8958 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8959 gen_rtx_SCRATCH (SImode));
8961 for (i = 1; i < count; i++)
8962 XVECEXP (operands[3], 0, i + 1)
8963 = gen_rtx_SET (VOIDmode,
8964 adjust_address_nv (op0, SImode, i * 4),
8965 gen_rtx_REG (SImode, regno + i));
8968 (define_insn "*store_multiple_power"
8969 [(match_parallel 0 "store_multiple_operation"
8970 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8971 (match_operand:SI 2 "gpc_reg_operand" "r"))
8972 (clobber (match_scratch:SI 3 "=q"))])]
8973 "TARGET_STRING && TARGET_POWER"
8974 "{stsi|stswi} %2,%P1,%O0"
8975 [(set_attr "type" "store")])
8977 (define_insn "*stmsi8"
8978 [(match_parallel 0 "store_multiple_operation"
8979 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8980 (match_operand:SI 2 "gpc_reg_operand" "r"))
8981 (clobber (match_scratch:SI 3 "X"))
8982 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8983 (match_operand:SI 4 "gpc_reg_operand" "r"))
8984 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8985 (match_operand:SI 5 "gpc_reg_operand" "r"))
8986 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8987 (match_operand:SI 6 "gpc_reg_operand" "r"))
8988 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8989 (match_operand:SI 7 "gpc_reg_operand" "r"))
8990 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8991 (match_operand:SI 8 "gpc_reg_operand" "r"))
8992 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8993 (match_operand:SI 9 "gpc_reg_operand" "r"))
8994 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8995 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8996 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8997 "{stsi|stswi} %2,%1,%O0"
8998 [(set_attr "type" "store")])
9000 (define_insn "*stmsi7"
9001 [(match_parallel 0 "store_multiple_operation"
9002 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9003 (match_operand:SI 2 "gpc_reg_operand" "r"))
9004 (clobber (match_scratch:SI 3 "X"))
9005 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9006 (match_operand:SI 4 "gpc_reg_operand" "r"))
9007 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9008 (match_operand:SI 5 "gpc_reg_operand" "r"))
9009 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9010 (match_operand:SI 6 "gpc_reg_operand" "r"))
9011 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9012 (match_operand:SI 7 "gpc_reg_operand" "r"))
9013 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9014 (match_operand:SI 8 "gpc_reg_operand" "r"))
9015 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9016 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9017 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9018 "{stsi|stswi} %2,%1,%O0"
9019 [(set_attr "type" "store")])
9021 (define_insn "*stmsi6"
9022 [(match_parallel 0 "store_multiple_operation"
9023 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9024 (match_operand:SI 2 "gpc_reg_operand" "r"))
9025 (clobber (match_scratch:SI 3 "X"))
9026 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9027 (match_operand:SI 4 "gpc_reg_operand" "r"))
9028 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9029 (match_operand:SI 5 "gpc_reg_operand" "r"))
9030 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9031 (match_operand:SI 6 "gpc_reg_operand" "r"))
9032 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9033 (match_operand:SI 7 "gpc_reg_operand" "r"))
9034 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9035 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9036 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9037 "{stsi|stswi} %2,%1,%O0"
9038 [(set_attr "type" "store")])
9040 (define_insn "*stmsi5"
9041 [(match_parallel 0 "store_multiple_operation"
9042 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9043 (match_operand:SI 2 "gpc_reg_operand" "r"))
9044 (clobber (match_scratch:SI 3 "X"))
9045 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9046 (match_operand:SI 4 "gpc_reg_operand" "r"))
9047 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9048 (match_operand:SI 5 "gpc_reg_operand" "r"))
9049 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9050 (match_operand:SI 6 "gpc_reg_operand" "r"))
9051 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9052 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9053 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9054 "{stsi|stswi} %2,%1,%O0"
9055 [(set_attr "type" "store")])
9057 (define_insn "*stmsi4"
9058 [(match_parallel 0 "store_multiple_operation"
9059 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9060 (match_operand:SI 2 "gpc_reg_operand" "r"))
9061 (clobber (match_scratch:SI 3 "X"))
9062 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9063 (match_operand:SI 4 "gpc_reg_operand" "r"))
9064 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9065 (match_operand:SI 5 "gpc_reg_operand" "r"))
9066 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9067 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9068 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9069 "{stsi|stswi} %2,%1,%O0"
9070 [(set_attr "type" "store")])
9072 (define_insn "*stmsi3"
9073 [(match_parallel 0 "store_multiple_operation"
9074 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9075 (match_operand:SI 2 "gpc_reg_operand" "r"))
9076 (clobber (match_scratch:SI 3 "X"))
9077 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9078 (match_operand:SI 4 "gpc_reg_operand" "r"))
9079 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9080 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9081 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9082 "{stsi|stswi} %2,%1,%O0"
9083 [(set_attr "type" "store")])
9085 ;; String/block move insn.
9086 ;; Argument 0 is the destination
9087 ;; Argument 1 is the source
9088 ;; Argument 2 is the length
9089 ;; Argument 3 is the alignment
9091 (define_expand "movstrsi"
9092 [(parallel [(set (match_operand:BLK 0 "" "")
9093 (match_operand:BLK 1 "" ""))
9094 (use (match_operand:SI 2 "" ""))
9095 (use (match_operand:SI 3 "" ""))])]
9099 if (expand_block_move (operands))
9105 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9106 ;; register allocator doesn't have a clue about allocating 8 word registers.
9107 ;; rD/rS = r5 is preferred, efficient form.
9108 (define_expand "movstrsi_8reg"
9109 [(parallel [(set (match_operand 0 "" "")
9110 (match_operand 1 "" ""))
9111 (use (match_operand 2 "" ""))
9112 (use (match_operand 3 "" ""))
9113 (clobber (reg:SI 5))
9114 (clobber (reg:SI 6))
9115 (clobber (reg:SI 7))
9116 (clobber (reg:SI 8))
9117 (clobber (reg:SI 9))
9118 (clobber (reg:SI 10))
9119 (clobber (reg:SI 11))
9120 (clobber (reg:SI 12))
9121 (clobber (match_scratch:SI 4 ""))])]
9126 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9127 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9128 (use (match_operand:SI 2 "immediate_operand" "i"))
9129 (use (match_operand:SI 3 "immediate_operand" "i"))
9130 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9131 (clobber (reg:SI 6))
9132 (clobber (reg:SI 7))
9133 (clobber (reg:SI 8))
9134 (clobber (reg:SI 9))
9135 (clobber (reg:SI 10))
9136 (clobber (reg:SI 11))
9137 (clobber (reg:SI 12))
9138 (clobber (match_scratch:SI 5 "=q"))]
9139 "TARGET_STRING && TARGET_POWER
9140 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9141 || INTVAL (operands[2]) == 0)
9142 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9143 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9144 && REGNO (operands[4]) == 5"
9145 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9146 [(set_attr "type" "load")
9147 (set_attr "length" "8")])
9150 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9151 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9152 (use (match_operand:SI 2 "immediate_operand" "i"))
9153 (use (match_operand:SI 3 "immediate_operand" "i"))
9154 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9155 (clobber (reg:SI 6))
9156 (clobber (reg:SI 7))
9157 (clobber (reg:SI 8))
9158 (clobber (reg:SI 9))
9159 (clobber (reg:SI 10))
9160 (clobber (reg:SI 11))
9161 (clobber (reg:SI 12))
9162 (clobber (match_scratch:SI 5 "X"))]
9163 "TARGET_STRING && ! TARGET_POWER
9164 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9165 || INTVAL (operands[2]) == 0)
9166 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9167 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9168 && REGNO (operands[4]) == 5"
9169 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9170 [(set_attr "type" "load")
9171 (set_attr "length" "8")])
9174 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9175 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9176 (use (match_operand:SI 2 "immediate_operand" "i"))
9177 (use (match_operand:SI 3 "immediate_operand" "i"))
9178 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9179 (clobber (reg:SI 6))
9180 (clobber (reg:SI 7))
9181 (clobber (reg:SI 8))
9182 (clobber (reg:SI 9))
9183 (clobber (reg:SI 10))
9184 (clobber (reg:SI 11))
9185 (clobber (reg:SI 12))
9186 (clobber (match_scratch:SI 5 "X"))]
9187 "TARGET_STRING && TARGET_POWERPC64
9188 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9189 || INTVAL (operands[2]) == 0)
9190 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9191 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9192 && REGNO (operands[4]) == 5"
9193 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9194 [(set_attr "type" "load")
9195 (set_attr "length" "8")])
9197 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9198 ;; register allocator doesn't have a clue about allocating 6 word registers.
9199 ;; rD/rS = r5 is preferred, efficient form.
9200 (define_expand "movstrsi_6reg"
9201 [(parallel [(set (match_operand 0 "" "")
9202 (match_operand 1 "" ""))
9203 (use (match_operand 2 "" ""))
9204 (use (match_operand 3 "" ""))
9205 (clobber (reg:SI 5))
9206 (clobber (reg:SI 6))
9207 (clobber (reg:SI 7))
9208 (clobber (reg:SI 8))
9209 (clobber (reg:SI 9))
9210 (clobber (reg:SI 10))
9211 (clobber (match_scratch:SI 4 ""))])]
9216 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9217 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9218 (use (match_operand:SI 2 "immediate_operand" "i"))
9219 (use (match_operand:SI 3 "immediate_operand" "i"))
9220 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9221 (clobber (reg:SI 6))
9222 (clobber (reg:SI 7))
9223 (clobber (reg:SI 8))
9224 (clobber (reg:SI 9))
9225 (clobber (reg:SI 10))
9226 (clobber (match_scratch:SI 5 "=q"))]
9227 "TARGET_STRING && TARGET_POWER
9228 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9229 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9230 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9231 && REGNO (operands[4]) == 5"
9232 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9233 [(set_attr "type" "load")
9234 (set_attr "length" "8")])
9237 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9238 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9239 (use (match_operand:SI 2 "immediate_operand" "i"))
9240 (use (match_operand:SI 3 "immediate_operand" "i"))
9241 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9242 (clobber (reg:SI 6))
9243 (clobber (reg:SI 7))
9244 (clobber (reg:SI 8))
9245 (clobber (reg:SI 9))
9246 (clobber (reg:SI 10))
9247 (clobber (match_scratch:SI 5 "X"))]
9248 "TARGET_STRING && ! TARGET_POWER
9249 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9250 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9251 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9252 && REGNO (operands[4]) == 5"
9253 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9254 [(set_attr "type" "load")
9255 (set_attr "length" "8")])
9258 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9259 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9260 (use (match_operand:SI 2 "immediate_operand" "i"))
9261 (use (match_operand:SI 3 "immediate_operand" "i"))
9262 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9263 (clobber (reg:SI 6))
9264 (clobber (reg:SI 7))
9265 (clobber (reg:SI 8))
9266 (clobber (reg:SI 9))
9267 (clobber (reg:SI 10))
9268 (clobber (match_scratch:SI 5 "X"))]
9269 "TARGET_STRING && TARGET_POWERPC64
9270 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9271 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9272 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9273 && REGNO (operands[4]) == 5"
9274 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9275 [(set_attr "type" "load")
9276 (set_attr "length" "8")])
9278 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9279 ;; problems with TImode.
9280 ;; rD/rS = r5 is preferred, efficient form.
9281 (define_expand "movstrsi_4reg"
9282 [(parallel [(set (match_operand 0 "" "")
9283 (match_operand 1 "" ""))
9284 (use (match_operand 2 "" ""))
9285 (use (match_operand 3 "" ""))
9286 (clobber (reg:SI 5))
9287 (clobber (reg:SI 6))
9288 (clobber (reg:SI 7))
9289 (clobber (reg:SI 8))
9290 (clobber (match_scratch:SI 4 ""))])]
9295 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9296 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9297 (use (match_operand:SI 2 "immediate_operand" "i"))
9298 (use (match_operand:SI 3 "immediate_operand" "i"))
9299 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9300 (clobber (reg:SI 6))
9301 (clobber (reg:SI 7))
9302 (clobber (reg:SI 8))
9303 (clobber (match_scratch:SI 5 "=q"))]
9304 "TARGET_STRING && TARGET_POWER
9305 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9306 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9307 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9308 && REGNO (operands[4]) == 5"
9309 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9310 [(set_attr "type" "load")
9311 (set_attr "length" "8")])
9314 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9315 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9316 (use (match_operand:SI 2 "immediate_operand" "i"))
9317 (use (match_operand:SI 3 "immediate_operand" "i"))
9318 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9319 (clobber (reg:SI 6))
9320 (clobber (reg:SI 7))
9321 (clobber (reg:SI 8))
9322 (clobber (match_scratch:SI 5 "X"))]
9323 "TARGET_STRING && ! TARGET_POWER
9324 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9325 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9326 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9327 && REGNO (operands[4]) == 5"
9328 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9329 [(set_attr "type" "load")
9330 (set_attr "length" "8")])
9333 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9334 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9335 (use (match_operand:SI 2 "immediate_operand" "i"))
9336 (use (match_operand:SI 3 "immediate_operand" "i"))
9337 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9338 (clobber (reg:SI 6))
9339 (clobber (reg:SI 7))
9340 (clobber (reg:SI 8))
9341 (clobber (match_scratch:SI 5 "X"))]
9342 "TARGET_STRING && TARGET_POWERPC64
9343 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9344 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9345 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9346 && REGNO (operands[4]) == 5"
9347 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9348 [(set_attr "type" "load")
9349 (set_attr "length" "8")])
9351 ;; Move up to 8 bytes at a time.
9352 (define_expand "movstrsi_2reg"
9353 [(parallel [(set (match_operand 0 "" "")
9354 (match_operand 1 "" ""))
9355 (use (match_operand 2 "" ""))
9356 (use (match_operand 3 "" ""))
9357 (clobber (match_scratch:DI 4 ""))
9358 (clobber (match_scratch:SI 5 ""))])]
9359 "TARGET_STRING && ! TARGET_POWERPC64"
9363 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9364 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9365 (use (match_operand:SI 2 "immediate_operand" "i"))
9366 (use (match_operand:SI 3 "immediate_operand" "i"))
9367 (clobber (match_scratch:DI 4 "=&r"))
9368 (clobber (match_scratch:SI 5 "=q"))]
9369 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9370 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9371 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9372 [(set_attr "type" "load")
9373 (set_attr "length" "8")])
9376 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9377 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9378 (use (match_operand:SI 2 "immediate_operand" "i"))
9379 (use (match_operand:SI 3 "immediate_operand" "i"))
9380 (clobber (match_scratch:DI 4 "=&r"))
9381 (clobber (match_scratch:SI 5 "X"))]
9382 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9383 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9384 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9385 [(set_attr "type" "load")
9386 (set_attr "length" "8")])
9388 ;; Move up to 4 bytes at a time.
9389 (define_expand "movstrsi_1reg"
9390 [(parallel [(set (match_operand 0 "" "")
9391 (match_operand 1 "" ""))
9392 (use (match_operand 2 "" ""))
9393 (use (match_operand 3 "" ""))
9394 (clobber (match_scratch:SI 4 ""))
9395 (clobber (match_scratch:SI 5 ""))])]
9400 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9401 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9402 (use (match_operand:SI 2 "immediate_operand" "i"))
9403 (use (match_operand:SI 3 "immediate_operand" "i"))
9404 (clobber (match_scratch:SI 4 "=&r"))
9405 (clobber (match_scratch:SI 5 "=q"))]
9406 "TARGET_STRING && TARGET_POWER
9407 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9408 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9409 [(set_attr "type" "load")
9410 (set_attr "length" "8")])
9413 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9414 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9415 (use (match_operand:SI 2 "immediate_operand" "i"))
9416 (use (match_operand:SI 3 "immediate_operand" "i"))
9417 (clobber (match_scratch:SI 4 "=&r"))
9418 (clobber (match_scratch:SI 5 "X"))]
9419 "TARGET_STRING && ! TARGET_POWER
9420 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9421 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9422 [(set_attr "type" "load")
9423 (set_attr "length" "8")])
9426 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9427 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9428 (use (match_operand:SI 2 "immediate_operand" "i"))
9429 (use (match_operand:SI 3 "immediate_operand" "i"))
9430 (clobber (match_scratch:SI 4 "=&r"))
9431 (clobber (match_scratch:SI 5 "X"))]
9432 "TARGET_STRING && TARGET_POWERPC64
9433 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9434 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9435 [(set_attr "type" "load")
9436 (set_attr "length" "8")])
9439 ;; Define insns that do load or store with update. Some of these we can
9440 ;; get by using pre-decrement or pre-increment, but the hardware can also
9441 ;; do cases where the increment is not the size of the object.
9443 ;; In all these cases, we use operands 0 and 1 for the register being
9444 ;; incremented because those are the operands that local-alloc will
9445 ;; tie and these are the pair most likely to be tieable (and the ones
9446 ;; that will benefit the most).
9448 (define_insn "*movdi_update1"
9449 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9450 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9451 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9452 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9453 (plus:DI (match_dup 1) (match_dup 2)))]
9454 "TARGET_POWERPC64 && TARGET_UPDATE"
9458 [(set_attr "type" "load_ux,load_u")])
9460 (define_insn "movdi_update"
9461 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9462 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9463 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9464 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9465 (plus:DI (match_dup 1) (match_dup 2)))]
9466 "TARGET_POWERPC64 && TARGET_UPDATE"
9470 [(set_attr "type" "store_ux,store_u")])
9472 (define_insn "*movsi_update1"
9473 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9474 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9475 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9476 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9477 (plus:SI (match_dup 1) (match_dup 2)))]
9480 {lux|lwzux} %3,%0,%2
9481 {lu|lwzu} %3,%2(%0)"
9482 [(set_attr "type" "load_ux,load_u")])
9484 (define_insn "*movsi_update2"
9485 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9487 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9488 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9489 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9490 (plus:DI (match_dup 1) (match_dup 2)))]
9493 [(set_attr "type" "load_ext_ux")])
9495 (define_insn "movsi_update"
9496 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9497 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9498 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9499 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9500 (plus:SI (match_dup 1) (match_dup 2)))]
9503 {stux|stwux} %3,%0,%2
9504 {stu|stwu} %3,%2(%0)"
9505 [(set_attr "type" "store_ux,store_u")])
9507 (define_insn "*movhi_update1"
9508 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9509 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9510 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9511 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9512 (plus:SI (match_dup 1) (match_dup 2)))]
9517 [(set_attr "type" "load_ux,load_u")])
9519 (define_insn "*movhi_update2"
9520 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9522 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9523 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9524 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9525 (plus:SI (match_dup 1) (match_dup 2)))]
9530 [(set_attr "type" "load_ux,load_u")])
9532 (define_insn "*movhi_update3"
9533 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9535 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9536 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9537 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9538 (plus:SI (match_dup 1) (match_dup 2)))]
9543 [(set_attr "type" "load_ext_ux,load_ext_u")])
9545 (define_insn "*movhi_update4"
9546 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9547 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9548 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9549 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9550 (plus:SI (match_dup 1) (match_dup 2)))]
9555 [(set_attr "type" "store_ux,store_u")])
9557 (define_insn "*movqi_update1"
9558 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9559 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9560 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9561 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9562 (plus:SI (match_dup 1) (match_dup 2)))]
9567 [(set_attr "type" "load_ux,load_u")])
9569 (define_insn "*movqi_update2"
9570 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9572 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9573 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9574 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9575 (plus:SI (match_dup 1) (match_dup 2)))]
9580 [(set_attr "type" "load_ux,load_u")])
9582 (define_insn "*movqi_update3"
9583 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9584 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9585 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9586 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9587 (plus:SI (match_dup 1) (match_dup 2)))]
9592 [(set_attr "type" "store_ux,store_u")])
9594 (define_insn "*movsf_update1"
9595 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9596 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9597 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9598 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9599 (plus:SI (match_dup 1) (match_dup 2)))]
9600 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9604 [(set_attr "type" "fpload_ux,fpload_u")])
9606 (define_insn "*movsf_update2"
9607 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9608 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9609 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9610 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9611 (plus:SI (match_dup 1) (match_dup 2)))]
9612 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9616 [(set_attr "type" "fpstore_ux,fpstore_u")])
9618 (define_insn "*movsf_update3"
9619 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9620 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9621 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9622 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9623 (plus:SI (match_dup 1) (match_dup 2)))]
9624 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9626 {lux|lwzux} %3,%0,%2
9627 {lu|lwzu} %3,%2(%0)"
9628 [(set_attr "type" "load_ux,load_u")])
9630 (define_insn "*movsf_update4"
9631 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9632 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9633 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9634 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9635 (plus:SI (match_dup 1) (match_dup 2)))]
9636 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9638 {stux|stwux} %3,%0,%2
9639 {stu|stwu} %3,%2(%0)"
9640 [(set_attr "type" "store_ux,store_u")])
9642 (define_insn "*movdf_update1"
9643 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9644 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9645 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9646 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9647 (plus:SI (match_dup 1) (match_dup 2)))]
9648 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9652 [(set_attr "type" "fpload_ux,fpload_u")])
9654 (define_insn "*movdf_update2"
9655 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9656 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9657 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9658 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9659 (plus:SI (match_dup 1) (match_dup 2)))]
9660 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9664 [(set_attr "type" "fpstore_ux,fpstore_u")])
9666 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9669 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
9670 (match_operand:DF 1 "memory_operand" ""))
9671 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
9672 (match_operand:DF 3 "memory_operand" ""))]
9674 && TARGET_HARD_FLOAT && TARGET_FPRS
9675 && registers_ok_for_quad_peep (operands[0], operands[2])
9676 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
9677 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
9681 [(set (match_operand:DF 0 "memory_operand" "")
9682 (match_operand:DF 1 "gpc_reg_operand" "f"))
9683 (set (match_operand:DF 2 "memory_operand" "")
9684 (match_operand:DF 3 "gpc_reg_operand" "f"))]
9686 && TARGET_HARD_FLOAT && TARGET_FPRS
9687 && registers_ok_for_quad_peep (operands[1], operands[3])
9688 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
9689 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
9692 ;; Next come insns related to the calling sequence.
9694 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9695 ;; We move the back-chain and decrement the stack pointer.
9697 (define_expand "allocate_stack"
9698 [(set (match_operand 0 "gpc_reg_operand" "=r")
9699 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9701 (minus (reg 1) (match_dup 1)))]
9704 { rtx chain = gen_reg_rtx (Pmode);
9705 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9708 emit_move_insn (chain, stack_bot);
9710 /* Check stack bounds if necessary. */
9711 if (current_function_limit_stack)
9714 available = expand_binop (Pmode, sub_optab,
9715 stack_pointer_rtx, stack_limit_rtx,
9716 NULL_RTX, 1, OPTAB_WIDEN);
9717 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9720 if (GET_CODE (operands[1]) != CONST_INT
9721 || INTVAL (operands[1]) < -32767
9722 || INTVAL (operands[1]) > 32768)
9724 neg_op0 = gen_reg_rtx (Pmode);
9726 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9728 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9731 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9734 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
9735 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9739 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9740 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9741 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9744 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9748 ;; These patterns say how to save and restore the stack pointer. We need not
9749 ;; save the stack pointer at function level since we are careful to
9750 ;; preserve the backchain. At block level, we have to restore the backchain
9751 ;; when we restore the stack pointer.
9753 ;; For nonlocal gotos, we must save both the stack pointer and its
9754 ;; backchain and restore both. Note that in the nonlocal case, the
9755 ;; save area is a memory location.
9757 (define_expand "save_stack_function"
9758 [(match_operand 0 "any_operand" "")
9759 (match_operand 1 "any_operand" "")]
9763 (define_expand "restore_stack_function"
9764 [(match_operand 0 "any_operand" "")
9765 (match_operand 1 "any_operand" "")]
9769 (define_expand "restore_stack_block"
9770 [(use (match_operand 0 "register_operand" ""))
9771 (set (match_dup 2) (match_dup 3))
9772 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9773 (set (match_dup 3) (match_dup 2))]
9777 operands[2] = gen_reg_rtx (Pmode);
9778 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9781 (define_expand "save_stack_nonlocal"
9782 [(match_operand 0 "memory_operand" "")
9783 (match_operand 1 "register_operand" "")]
9787 rtx temp = gen_reg_rtx (Pmode);
9789 /* Copy the backchain to the first word, sp to the second. */
9790 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9791 emit_move_insn (operand_subword (operands[0], 0, 0,
9792 (TARGET_32BIT ? DImode : TImode)),
9794 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
9799 (define_expand "restore_stack_nonlocal"
9800 [(match_operand 0 "register_operand" "")
9801 (match_operand 1 "memory_operand" "")]
9805 rtx temp = gen_reg_rtx (Pmode);
9807 /* Restore the backchain from the first word, sp from the second. */
9808 emit_move_insn (temp,
9809 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
9810 emit_move_insn (operands[0],
9811 operand_subword (operands[1], 1, 0,
9812 (TARGET_32BIT ? DImode : TImode)));
9813 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9817 ;; TOC register handling.
9819 ;; Code to initialize the TOC register...
9821 (define_insn "load_toc_aix_si"
9822 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9823 (unspec:SI [(const_int 0)] 7))
9825 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9829 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9830 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9831 operands[2] = gen_rtx_REG (Pmode, 2);
9832 return \"{l|lwz} %0,%1(%2)\";
9834 [(set_attr "type" "load")])
9836 (define_insn "load_toc_aix_di"
9837 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9838 (unspec:DI [(const_int 0)] 7))
9840 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9844 #ifdef TARGET_RELOCATABLE
9845 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9846 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9848 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9851 strcat (buf, \"@toc\");
9852 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9853 operands[2] = gen_rtx_REG (Pmode, 2);
9854 return \"ld %0,%1(%2)\";
9856 [(set_attr "type" "load")])
9858 (define_insn "load_toc_v4_pic_si"
9859 [(set (match_operand:SI 0 "register_operand" "=l")
9860 (unspec:SI [(const_int 0)] 7))]
9861 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9862 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9863 [(set_attr "type" "branch")
9864 (set_attr "length" "4")])
9866 (define_insn "load_toc_v4_PIC_1"
9867 [(set (match_operand:SI 0 "register_operand" "=l")
9868 (match_operand:SI 1 "immediate_operand" "s"))
9869 (unspec [(match_dup 1)] 7)]
9870 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9871 "bcl 20,31,%1\\n%1:"
9872 [(set_attr "type" "branch")
9873 (set_attr "length" "4")])
9875 (define_insn "load_toc_v4_PIC_1b"
9876 [(set (match_operand:SI 0 "register_operand" "=l")
9877 (match_operand:SI 1 "immediate_operand" "s"))
9878 (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
9879 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9880 "bcl 20,31,%1\\n\\t.long %2-%1+4\\n%1:"
9881 [(set_attr "type" "branch")
9882 (set_attr "length" "8")])
9884 (define_insn "load_toc_v4_PIC_2"
9885 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9886 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9887 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
9888 (match_operand:SI 3 "immediate_operand" "s")))))]
9889 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9890 "{l|lwz} %0,%2-%3(%1)"
9891 [(set_attr "type" "load")])
9893 (define_insn "load_macho_picbase"
9894 [(set (match_operand:SI 0 "register_operand" "=l")
9895 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")] 15))]
9896 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
9897 "bcl 20,31,%1\\n%1:"
9898 [(set_attr "type" "branch")
9899 (set_attr "length" "4")])
9901 (define_insn "macho_correct_pic"
9902 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9903 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9904 (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
9905 (match_operand:SI 3 "immediate_operand" "s")]
9907 "DEFAULT_ABI == ABI_DARWIN"
9908 "addis %0,%1,ha16(%2-%3)\n\taddi %0,%0,lo16(%2-%3)"
9909 [(set_attr "length" "8")])
9911 ;; If the TOC is shared over a translation unit, as happens with all
9912 ;; the kinds of PIC that we support, we need to restore the TOC
9913 ;; pointer only when jumping over units of translation.
9914 ;; On Darwin, we need to reload the picbase.
9916 (define_expand "builtin_setjmp_receiver"
9917 [(use (label_ref (match_operand 0 "" "")))]
9918 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
9919 || (TARGET_TOC && TARGET_MINIMAL_TOC)
9920 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
9924 if (DEFAULT_ABI == ABI_DARWIN)
9926 const char *picbase = machopic_function_base_name ();
9927 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1));
9928 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
9932 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
9933 CODE_LABEL_NUMBER (operands[0]));
9934 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (tmplab, -1));
9936 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
9937 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
9941 rs6000_emit_load_toc_table (FALSE);
9945 ;; A function pointer under AIX is a pointer to a data area whose first word
9946 ;; contains the actual address of the function, whose second word contains a
9947 ;; pointer to its TOC, and whose third word contains a value to place in the
9948 ;; static chain register (r11). Note that if we load the static chain, our
9949 ;; "trampoline" need not have any executable code.
9951 (define_expand "call_indirect_aix32"
9953 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
9954 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9957 (mem:SI (plus:SI (match_dup 0)
9960 (mem:SI (plus:SI (match_dup 0)
9962 (parallel [(call (mem:SI (match_dup 2))
9963 (match_operand 1 "" ""))
9967 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9968 (clobber (scratch:SI))])]
9971 { operands[2] = gen_reg_rtx (SImode); }")
9973 (define_expand "call_indirect_aix64"
9975 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
9976 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9979 (mem:DI (plus:DI (match_dup 0)
9982 (mem:DI (plus:DI (match_dup 0)
9984 (parallel [(call (mem:SI (match_dup 2))
9985 (match_operand 1 "" ""))
9989 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9990 (clobber (scratch:SI))])]
9993 { operands[2] = gen_reg_rtx (DImode); }")
9995 (define_expand "call_value_indirect_aix32"
9997 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
9998 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10001 (mem:SI (plus:SI (match_dup 1)
10004 (mem:SI (plus:SI (match_dup 1)
10006 (parallel [(set (match_operand 0 "" "")
10007 (call (mem:SI (match_dup 3))
10008 (match_operand 2 "" "")))
10012 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10013 (clobber (scratch:SI))])]
10016 { operands[3] = gen_reg_rtx (SImode); }")
10018 (define_expand "call_value_indirect_aix64"
10019 [(set (match_dup 3)
10020 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10021 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10024 (mem:DI (plus:DI (match_dup 1)
10027 (mem:DI (plus:DI (match_dup 1)
10029 (parallel [(set (match_operand 0 "" "")
10030 (call (mem:SI (match_dup 3))
10031 (match_operand 2 "" "")))
10035 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10036 (clobber (scratch:SI))])]
10039 { operands[3] = gen_reg_rtx (DImode); }")
10041 ;; Now the definitions for the call and call_value insns
10042 (define_expand "call"
10043 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10044 (match_operand 1 "" ""))
10045 (use (match_operand 2 "" ""))
10046 (clobber (scratch:SI))])]
10051 if (MACHOPIC_INDIRECT)
10052 operands[0] = machopic_indirect_call_target (operands[0]);
10055 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10058 operands[0] = XEXP (operands[0], 0);
10060 if (GET_CODE (operands[0]) != SYMBOL_REF
10061 || (INTVAL (operands[2]) & CALL_LONG) != 0)
10063 if (INTVAL (operands[2]) & CALL_LONG)
10064 operands[0] = rs6000_longcall_ref (operands[0]);
10066 if (DEFAULT_ABI == ABI_V4
10067 || DEFAULT_ABI == ABI_DARWIN)
10068 operands[0] = force_reg (Pmode, operands[0]);
10070 else if (DEFAULT_ABI == ABI_AIX)
10072 /* AIX function pointers are really pointers to a three word
10074 emit_call_insn (TARGET_32BIT
10075 ? gen_call_indirect_aix32 (force_reg (SImode,
10078 : gen_call_indirect_aix64 (force_reg (DImode,
10088 (define_expand "call_value"
10089 [(parallel [(set (match_operand 0 "" "")
10090 (call (mem:SI (match_operand 1 "address_operand" ""))
10091 (match_operand 2 "" "")))
10092 (use (match_operand 3 "" ""))
10093 (clobber (scratch:SI))])]
10098 if (MACHOPIC_INDIRECT)
10099 operands[1] = machopic_indirect_call_target (operands[1]);
10102 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10105 operands[1] = XEXP (operands[1], 0);
10107 if (GET_CODE (operands[1]) != SYMBOL_REF
10108 || (INTVAL (operands[3]) & CALL_LONG) != 0)
10110 if (INTVAL (operands[3]) & CALL_LONG)
10111 operands[1] = rs6000_longcall_ref (operands[1]);
10113 if (DEFAULT_ABI == ABI_V4
10114 || DEFAULT_ABI == ABI_DARWIN)
10115 operands[0] = force_reg (Pmode, operands[0]);
10117 else if (DEFAULT_ABI == ABI_AIX)
10119 /* AIX function pointers are really pointers to a three word
10121 emit_call_insn (TARGET_32BIT
10122 ? gen_call_value_indirect_aix32 (operands[0],
10126 : gen_call_value_indirect_aix64 (operands[0],
10137 ;; Call to function in current module. No TOC pointer reload needed.
10138 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10139 ;; either the function was not prototyped, or it was prototyped as a
10140 ;; variable argument function. It is > 0 if FP registers were passed
10141 ;; and < 0 if they were not.
10143 (define_insn "*call_local32"
10144 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10145 (match_operand 1 "" "g,g"))
10146 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10147 (clobber (match_scratch:SI 3 "=l,l"))]
10148 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10151 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10152 output_asm_insn (\"crxor 6,6,6\", operands);
10154 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10155 output_asm_insn (\"creqv 6,6,6\", operands);
10157 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10159 [(set_attr "type" "branch")
10160 (set_attr "length" "4,8")])
10162 (define_insn "*call_local64"
10163 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10164 (match_operand 1 "" "g,g"))
10165 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10166 (clobber (match_scratch:SI 3 "=l,l"))]
10167 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10170 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10171 output_asm_insn (\"crxor 6,6,6\", operands);
10173 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10174 output_asm_insn (\"creqv 6,6,6\", operands);
10176 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10178 [(set_attr "type" "branch")
10179 (set_attr "length" "4,8")])
10181 (define_insn "*call_value_local32"
10182 [(set (match_operand 0 "" "")
10183 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10184 (match_operand 2 "" "g,g")))
10185 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10186 (clobber (match_scratch:SI 4 "=l,l"))]
10187 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10190 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10191 output_asm_insn (\"crxor 6,6,6\", operands);
10193 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10194 output_asm_insn (\"creqv 6,6,6\", operands);
10196 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10198 [(set_attr "type" "branch")
10199 (set_attr "length" "4,8")])
10202 (define_insn "*call_value_local64"
10203 [(set (match_operand 0 "" "")
10204 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10205 (match_operand 2 "" "g,g")))
10206 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10207 (clobber (match_scratch:SI 4 "=l,l"))]
10208 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10211 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10212 output_asm_insn (\"crxor 6,6,6\", operands);
10214 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10215 output_asm_insn (\"creqv 6,6,6\", operands);
10217 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10219 [(set_attr "type" "branch")
10220 (set_attr "length" "4,8")])
10222 ;; Call to function which may be in another module. Restore the TOC
10223 ;; pointer (r2) after the call unless this is System V.
10224 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10225 ;; either the function was not prototyped, or it was prototyped as a
10226 ;; variable argument function. It is > 0 if FP registers were passed
10227 ;; and < 0 if they were not.
10229 (define_insn "*call_indirect_nonlocal_aix32"
10230 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10231 (match_operand 1 "" "g"))
10235 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10236 (clobber (match_scratch:SI 2 "=l"))]
10237 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10238 "b%T0l\;{l|lwz} 2,20(1)"
10239 [(set_attr "type" "jmpreg")
10240 (set_attr "length" "8")])
10242 (define_insn "*call_nonlocal_aix32"
10243 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10244 (match_operand 1 "" "g"))
10245 (use (match_operand:SI 2 "immediate_operand" "O"))
10246 (clobber (match_scratch:SI 3 "=l"))]
10248 && DEFAULT_ABI == ABI_AIX
10249 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10251 [(set_attr "type" "branch")
10252 (set_attr "length" "8")])
10254 (define_insn "*call_indirect_nonlocal_aix64"
10255 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10256 (match_operand 1 "" "g"))
10260 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10261 (clobber (match_scratch:SI 2 "=l"))]
10262 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10263 "b%T0l\;ld 2,40(1)"
10264 [(set_attr "type" "jmpreg")
10265 (set_attr "length" "8")])
10267 (define_insn "*call_nonlocal_aix64"
10268 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10269 (match_operand 1 "" "g"))
10270 (use (match_operand:SI 2 "immediate_operand" "O"))
10271 (clobber (match_scratch:SI 3 "=l"))]
10273 && DEFAULT_ABI == ABI_AIX
10274 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10276 [(set_attr "type" "branch")
10277 (set_attr "length" "8")])
10279 (define_insn "*call_value_indirect_nonlocal_aix32"
10280 [(set (match_operand 0 "" "")
10281 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10282 (match_operand 2 "" "g")))
10286 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10287 (clobber (match_scratch:SI 3 "=l"))]
10288 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10289 "b%T1l\;{l|lwz} 2,20(1)"
10290 [(set_attr "type" "jmpreg")
10291 (set_attr "length" "8")])
10293 (define_insn "*call_value_nonlocal_aix32"
10294 [(set (match_operand 0 "" "")
10295 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10296 (match_operand 2 "" "g")))
10297 (use (match_operand:SI 3 "immediate_operand" "O"))
10298 (clobber (match_scratch:SI 4 "=l"))]
10300 && DEFAULT_ABI == ABI_AIX
10301 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10303 [(set_attr "type" "branch")
10304 (set_attr "length" "8")])
10306 (define_insn "*call_value_indirect_nonlocal_aix64"
10307 [(set (match_operand 0 "" "")
10308 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10309 (match_operand 2 "" "g")))
10313 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10314 (clobber (match_scratch:SI 3 "=l"))]
10315 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10316 "b%T1l\;ld 2,40(1)"
10317 [(set_attr "type" "jmpreg")
10318 (set_attr "length" "8")])
10320 (define_insn "*call_value_nonlocal_aix64"
10321 [(set (match_operand 0 "" "")
10322 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10323 (match_operand 2 "" "g")))
10324 (use (match_operand:SI 3 "immediate_operand" "O"))
10325 (clobber (match_scratch:SI 4 "=l"))]
10327 && DEFAULT_ABI == ABI_AIX
10328 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10330 [(set_attr "type" "branch")
10331 (set_attr "length" "8")])
10333 ;; A function pointer under System V is just a normal pointer
10334 ;; operands[0] is the function pointer
10335 ;; operands[1] is the stack size to clean up
10336 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10337 ;; which indicates how to set cr1
10339 (define_insn "*call_indirect_nonlocal_sysv"
10340 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10341 (match_operand 1 "" "g,g"))
10342 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10343 (clobber (match_scratch:SI 3 "=l,l"))]
10344 "DEFAULT_ABI == ABI_V4
10345 || DEFAULT_ABI == ABI_DARWIN"
10347 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10348 output_asm_insn ("crxor 6,6,6", operands);
10350 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10351 output_asm_insn ("creqv 6,6,6", operands);
10355 [(set_attr "type" "jmpreg,jmpreg")
10356 (set_attr "length" "4,8")])
10358 (define_insn "*call_nonlocal_sysv"
10359 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10360 (match_operand 1 "" "g,g"))
10361 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10362 (clobber (match_scratch:SI 3 "=l,l"))]
10363 "(DEFAULT_ABI == ABI_V4
10364 || DEFAULT_ABI == ABI_DARWIN)
10365 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10367 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10368 output_asm_insn ("crxor 6,6,6", operands);
10370 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10371 output_asm_insn ("creqv 6,6,6", operands);
10373 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10375 [(set_attr "type" "branch,branch")
10376 (set_attr "length" "4,8")])
10378 (define_insn "*call_value_indirect_nonlocal_sysv"
10379 [(set (match_operand 0 "" "")
10380 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10381 (match_operand 2 "" "g,g")))
10382 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10383 (clobber (match_scratch:SI 4 "=l,l"))]
10384 "DEFAULT_ABI == ABI_V4
10385 || DEFAULT_ABI == ABI_DARWIN"
10387 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10388 output_asm_insn ("crxor 6,6,6", operands);
10390 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10391 output_asm_insn ("creqv 6,6,6", operands);
10395 [(set_attr "type" "jmpreg,jmpreg")
10396 (set_attr "length" "4,8")])
10398 (define_insn "*call_value_nonlocal_sysv"
10399 [(set (match_operand 0 "" "")
10400 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10401 (match_operand 2 "" "g,g")))
10402 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10403 (clobber (match_scratch:SI 4 "=l,l"))]
10404 "(DEFAULT_ABI == ABI_V4
10405 || DEFAULT_ABI == ABI_DARWIN)
10406 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10408 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10409 output_asm_insn ("crxor 6,6,6", operands);
10411 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10412 output_asm_insn ("creqv 6,6,6", operands);
10414 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10416 [(set_attr "type" "branch,branch")
10417 (set_attr "length" "4,8")])
10419 ;; Call subroutine returning any type.
10420 (define_expand "untyped_call"
10421 [(parallel [(call (match_operand 0 "" "")
10423 (match_operand 1 "" "")
10424 (match_operand 2 "" "")])]
10430 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10432 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10434 rtx set = XVECEXP (operands[2], 0, i);
10435 emit_move_insn (SET_DEST (set), SET_SRC (set));
10438 /* The optimizer does not know that the call sets the function value
10439 registers we stored in the result block. We avoid problems by
10440 claiming that all hard registers are used and clobbered at this
10442 emit_insn (gen_blockage ());
10447 ;; sibling call patterns
10448 (define_expand "sibcall"
10449 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10450 (match_operand 1 "" ""))
10451 (use (match_operand 2 "" ""))
10452 (use (match_operand 3 "" ""))
10458 if (MACHOPIC_INDIRECT)
10459 operands[0] = machopic_indirect_call_target (operands[0]);
10462 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10465 operands[0] = XEXP (operands[0], 0);
10466 operands[3] = gen_reg_rtx (SImode);
10470 ;; this and similar patterns must be marked as using LR, otherwise
10471 ;; dataflow will try to delete the store into it. This is true
10472 ;; even when the actual reg to jump to is in CTR, when LR was
10473 ;; saved and restored around the PIC-setting BCL.
10474 (define_insn "*sibcall_local32"
10475 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10476 (match_operand 1 "" "g,g"))
10477 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10478 (use (match_operand:SI 3 "register_operand" "l,l"))
10480 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10483 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10484 output_asm_insn (\"crxor 6,6,6\", operands);
10486 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10487 output_asm_insn (\"creqv 6,6,6\", operands);
10489 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10491 [(set_attr "type" "branch")
10492 (set_attr "length" "4,8")])
10494 (define_insn "*sibcall_local64"
10495 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10496 (match_operand 1 "" "g,g"))
10497 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10498 (use (match_operand:SI 3 "register_operand" "l,l"))
10500 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10503 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10504 output_asm_insn (\"crxor 6,6,6\", operands);
10506 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10507 output_asm_insn (\"creqv 6,6,6\", operands);
10509 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10511 [(set_attr "type" "branch")
10512 (set_attr "length" "4,8")])
10514 (define_insn "*sibcall_value_local32"
10515 [(set (match_operand 0 "" "")
10516 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10517 (match_operand 2 "" "g,g")))
10518 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10519 (use (match_operand:SI 4 "register_operand" "l,l"))
10521 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10524 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10525 output_asm_insn (\"crxor 6,6,6\", operands);
10527 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10528 output_asm_insn (\"creqv 6,6,6\", operands);
10530 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10532 [(set_attr "type" "branch")
10533 (set_attr "length" "4,8")])
10536 (define_insn "*sibcall_value_local64"
10537 [(set (match_operand 0 "" "")
10538 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10539 (match_operand 2 "" "g,g")))
10540 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10541 (use (match_operand:SI 4 "register_operand" "l,l"))
10543 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10546 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10547 output_asm_insn (\"crxor 6,6,6\", operands);
10549 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10550 output_asm_insn (\"creqv 6,6,6\", operands);
10552 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10554 [(set_attr "type" "branch")
10555 (set_attr "length" "4,8")])
10557 (define_insn "*sibcall_nonlocal_aix32"
10558 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10559 (match_operand 1 "" "g"))
10560 (use (match_operand:SI 2 "immediate_operand" "O"))
10561 (use (match_operand:SI 3 "register_operand" "l"))
10564 && DEFAULT_ABI == ABI_AIX
10565 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10567 [(set_attr "type" "branch")
10568 (set_attr "length" "4")])
10570 (define_insn "*sibcall_nonlocal_aix64"
10571 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10572 (match_operand 1 "" "g"))
10573 (use (match_operand:SI 2 "immediate_operand" "O"))
10574 (use (match_operand:SI 3 "register_operand" "l"))
10577 && DEFAULT_ABI == ABI_AIX
10578 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10580 [(set_attr "type" "branch")
10581 (set_attr "length" "4")])
10583 (define_insn "*sibcall_value_nonlocal_aix32"
10584 [(set (match_operand 0 "" "")
10585 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10586 (match_operand 2 "" "g")))
10587 (use (match_operand:SI 3 "immediate_operand" "O"))
10588 (use (match_operand:SI 4 "register_operand" "l"))
10591 && DEFAULT_ABI == ABI_AIX
10592 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10594 [(set_attr "type" "branch")
10595 (set_attr "length" "4")])
10597 (define_insn "*sibcall_value_nonlocal_aix64"
10598 [(set (match_operand 0 "" "")
10599 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10600 (match_operand 2 "" "g")))
10601 (use (match_operand:SI 3 "immediate_operand" "O"))
10602 (use (match_operand:SI 4 "register_operand" "l"))
10605 && DEFAULT_ABI == ABI_AIX
10606 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10608 [(set_attr "type" "branch")
10609 (set_attr "length" "4")])
10611 (define_insn "*sibcall_nonlocal_sysv"
10612 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10613 (match_operand 1 "" ""))
10614 (use (match_operand 2 "immediate_operand" "O,n"))
10615 (use (match_operand:SI 3 "register_operand" "l,l"))
10617 "(DEFAULT_ABI == ABI_DARWIN
10618 || DEFAULT_ABI == ABI_V4)
10619 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10622 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10623 output_asm_insn (\"crxor 6,6,6\", operands);
10625 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10626 output_asm_insn (\"creqv 6,6,6\", operands);
10628 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10630 [(set_attr "type" "branch,branch")
10631 (set_attr "length" "4,8")])
10633 (define_expand "sibcall_value"
10634 [(parallel [(set (match_operand 0 "register_operand" "")
10635 (call (mem:SI (match_operand 1 "address_operand" ""))
10636 (match_operand 2 "" "")))
10637 (use (match_operand 3 "" ""))
10638 (use (match_operand 4 "" ""))
10644 if (MACHOPIC_INDIRECT)
10645 operands[1] = machopic_indirect_call_target (operands[1]);
10648 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10651 operands[1] = XEXP (operands[1], 0);
10652 operands[4] = gen_reg_rtx (SImode);
10656 (define_insn "*sibcall_value_nonlocal_sysv"
10657 [(set (match_operand 0 "" "")
10658 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10659 (match_operand 2 "" "")))
10660 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10661 (use (match_operand:SI 4 "register_operand" "l,l"))
10663 "(DEFAULT_ABI == ABI_DARWIN
10664 || DEFAULT_ABI == ABI_V4)
10665 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10668 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10669 output_asm_insn (\"crxor 6,6,6\", operands);
10671 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10672 output_asm_insn (\"creqv 6,6,6\", operands);
10674 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10676 [(set_attr "type" "branch,branch")
10677 (set_attr "length" "4,8")])
10679 (define_expand "sibcall_epilogue"
10680 [(use (const_int 0))]
10681 "TARGET_SCHED_PROLOG"
10684 rs6000_emit_epilogue (TRUE);
10688 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10689 ;; all of memory. This blocks insns from being moved across this point.
10691 (define_insn "blockage"
10692 [(unspec_volatile [(const_int 0)] 0)]
10696 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10697 ;; signed & unsigned, and one type of branch.
10699 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10700 ;; insns, and branches. We store the operands of compares until we see
10702 (define_expand "cmpsi"
10704 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10705 (match_operand:SI 1 "reg_or_short_operand" "")))]
10709 /* Take care of the possibility that operands[1] might be negative but
10710 this might be a logical operation. That insn doesn't exist. */
10711 if (GET_CODE (operands[1]) == CONST_INT
10712 && INTVAL (operands[1]) < 0)
10713 operands[1] = force_reg (SImode, operands[1]);
10715 rs6000_compare_op0 = operands[0];
10716 rs6000_compare_op1 = operands[1];
10717 rs6000_compare_fp_p = 0;
10721 (define_expand "cmpdi"
10723 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10724 (match_operand:DI 1 "reg_or_short_operand" "")))]
10728 /* Take care of the possibility that operands[1] might be negative but
10729 this might be a logical operation. That insn doesn't exist. */
10730 if (GET_CODE (operands[1]) == CONST_INT
10731 && INTVAL (operands[1]) < 0)
10732 operands[1] = force_reg (DImode, operands[1]);
10734 rs6000_compare_op0 = operands[0];
10735 rs6000_compare_op1 = operands[1];
10736 rs6000_compare_fp_p = 0;
10740 (define_expand "cmpsf"
10741 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10742 (match_operand:SF 1 "gpc_reg_operand" "")))]
10743 "TARGET_HARD_FLOAT"
10746 rs6000_compare_op0 = operands[0];
10747 rs6000_compare_op1 = operands[1];
10748 rs6000_compare_fp_p = 1;
10752 (define_expand "cmpdf"
10753 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10754 (match_operand:DF 1 "gpc_reg_operand" "")))]
10755 "TARGET_HARD_FLOAT && TARGET_FPRS"
10758 rs6000_compare_op0 = operands[0];
10759 rs6000_compare_op1 = operands[1];
10760 rs6000_compare_fp_p = 1;
10764 (define_expand "cmptf"
10765 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10766 (match_operand:TF 1 "gpc_reg_operand" "")))]
10767 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
10768 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10771 rs6000_compare_op0 = operands[0];
10772 rs6000_compare_op1 = operands[1];
10773 rs6000_compare_fp_p = 1;
10777 (define_expand "beq"
10778 [(use (match_operand 0 "" ""))]
10780 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10782 (define_expand "bne"
10783 [(use (match_operand 0 "" ""))]
10785 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10787 (define_expand "bge"
10788 [(use (match_operand 0 "" ""))]
10790 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10792 (define_expand "bgt"
10793 [(use (match_operand 0 "" ""))]
10795 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10797 (define_expand "ble"
10798 [(use (match_operand 0 "" ""))]
10800 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10802 (define_expand "blt"
10803 [(use (match_operand 0 "" ""))]
10805 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10807 (define_expand "bgeu"
10808 [(use (match_operand 0 "" ""))]
10810 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10812 (define_expand "bgtu"
10813 [(use (match_operand 0 "" ""))]
10815 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10817 (define_expand "bleu"
10818 [(use (match_operand 0 "" ""))]
10820 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10822 (define_expand "bltu"
10823 [(use (match_operand 0 "" ""))]
10825 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10827 (define_expand "bunordered"
10828 [(use (match_operand 0 "" ""))]
10830 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10832 (define_expand "bordered"
10833 [(use (match_operand 0 "" ""))]
10835 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10837 (define_expand "buneq"
10838 [(use (match_operand 0 "" ""))]
10840 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10842 (define_expand "bunge"
10843 [(use (match_operand 0 "" ""))]
10845 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10847 (define_expand "bungt"
10848 [(use (match_operand 0 "" ""))]
10850 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10852 (define_expand "bunle"
10853 [(use (match_operand 0 "" ""))]
10855 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10857 (define_expand "bunlt"
10858 [(use (match_operand 0 "" ""))]
10860 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10862 (define_expand "bltgt"
10863 [(use (match_operand 0 "" ""))]
10865 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10867 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10868 ;; For SEQ, likewise, except that comparisons with zero should be done
10869 ;; with an scc insns. However, due to the order that combine see the
10870 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10871 ;; the cases we don't want to handle.
10872 (define_expand "seq"
10873 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10875 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10877 (define_expand "sne"
10878 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10882 if (! rs6000_compare_fp_p)
10885 rs6000_emit_sCOND (NE, operands[0]);
10889 ;; A > 0 is best done using the portable sequence, so fail in that case.
10890 (define_expand "sgt"
10891 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10895 if (! rs6000_compare_fp_p
10896 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10899 rs6000_emit_sCOND (GT, operands[0]);
10903 ;; A < 0 is best done in the portable way for A an integer.
10904 (define_expand "slt"
10905 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10909 if (! rs6000_compare_fp_p
10910 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10913 rs6000_emit_sCOND (LT, operands[0]);
10917 ;; A >= 0 is best done the portable way for A an integer.
10918 (define_expand "sge"
10919 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10923 if (! rs6000_compare_fp_p
10924 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10927 rs6000_emit_sCOND (GE, operands[0]);
10931 ;; A <= 0 is best done the portable way for A an integer.
10932 (define_expand "sle"
10933 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10937 if (! rs6000_compare_fp_p
10938 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10941 rs6000_emit_sCOND (LE, operands[0]);
10945 (define_expand "sgtu"
10946 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10948 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10950 (define_expand "sltu"
10951 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10953 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10955 (define_expand "sgeu"
10956 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10958 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10960 (define_expand "sleu"
10961 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10963 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10965 ;; Here are the actual compare insns.
10966 (define_insn "*cmpsi_internal1"
10967 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10968 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10969 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
10971 "{cmp%I2|cmpw%I2} %0,%1,%2"
10972 [(set_attr "type" "cmp")])
10974 (define_insn "*cmpdi_internal1"
10975 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10976 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
10977 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
10980 [(set_attr "type" "cmp")])
10982 ;; If we are comparing a register for equality with a large constant,
10983 ;; we can do this with an XOR followed by a compare. But we need a scratch
10984 ;; register for the result of the XOR.
10987 [(set (match_operand:CC 0 "cc_reg_operand" "")
10988 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10989 (match_operand:SI 2 "non_short_cint_operand" "")))
10990 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
10991 "find_single_use (operands[0], insn, 0)
10992 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
10993 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
10994 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
10995 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
10998 /* Get the constant we are comparing against, C, and see what it looks like
10999 sign-extended to 16 bits. Then see what constant could be XOR'ed
11000 with C to get the sign-extended value. */
11002 HOST_WIDE_INT c = INTVAL (operands[2]);
11003 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11004 HOST_WIDE_INT xorv = c ^ sextc;
11006 operands[4] = GEN_INT (xorv);
11007 operands[5] = GEN_INT (sextc);
11010 (define_insn "*cmpsi_internal2"
11011 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11012 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11013 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11015 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11016 [(set_attr "type" "cmp")])
11018 (define_insn "*cmpdi_internal2"
11019 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11020 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11021 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11023 "cmpld%I2 %0,%1,%b2"
11024 [(set_attr "type" "cmp")])
11026 ;; The following two insns don't exist as single insns, but if we provide
11027 ;; them, we can swap an add and compare, which will enable us to overlap more
11028 ;; of the required delay between a compare and branch. We generate code for
11029 ;; them by splitting.
11032 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11033 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11034 (match_operand:SI 2 "short_cint_operand" "i")))
11035 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11036 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11039 [(set_attr "length" "8")])
11042 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11043 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11044 (match_operand:SI 2 "u_short_cint_operand" "i")))
11045 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11046 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11049 [(set_attr "length" "8")])
11052 [(set (match_operand:CC 3 "cc_reg_operand" "")
11053 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11054 (match_operand:SI 2 "short_cint_operand" "")))
11055 (set (match_operand:SI 0 "gpc_reg_operand" "")
11056 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11058 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11059 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11062 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11063 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11064 (match_operand:SI 2 "u_short_cint_operand" "")))
11065 (set (match_operand:SI 0 "gpc_reg_operand" "")
11066 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11068 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11069 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11071 (define_insn "*cmpsf_internal1"
11072 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11073 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11074 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11075 "TARGET_HARD_FLOAT && TARGET_FPRS"
11077 [(set_attr "type" "fpcompare")])
11079 (define_insn "*cmpdf_internal1"
11080 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11081 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11082 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11083 "TARGET_HARD_FLOAT && TARGET_FPRS"
11085 [(set_attr "type" "fpcompare")])
11087 ;; Only need to compare second words if first words equal
11088 (define_insn "*cmptf_internal1"
11089 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11090 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11091 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11092 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
11093 && TARGET_LONG_DOUBLE_128"
11094 "fcmpu %0,%1,%2\;bne %0,$+4\;fcmpu %0,%L1,%L2"
11095 [(set_attr "type" "fpcompare")
11096 (set_attr "length" "12")])
11098 ;; Now we have the scc insns. We can do some combinations because of the
11099 ;; way the machine works.
11101 ;; Note that this is probably faster if we can put an insn between the
11102 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11103 ;; cases the insns below which don't use an intermediate CR field will
11104 ;; be used instead.
11106 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11107 (match_operator:SI 1 "scc_comparison_operator"
11108 [(match_operand 2 "cc_reg_operand" "y")
11111 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11112 [(set_attr "type" "mfcr")
11113 (set_attr "length" "12")])
11115 ;; Same as above, but get the OV/ORDERED bit.
11116 (define_insn "move_from_CR_ov_bit"
11117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11118 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] 724))]
11120 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11121 [(set_attr "type" "mfcr")
11122 (set_attr "length" "12")])
11125 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11126 (match_operator:DI 1 "scc_comparison_operator"
11127 [(match_operand 2 "cc_reg_operand" "y")
11130 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11131 [(set_attr "type" "mfcr")
11132 (set_attr "length" "12")])
11135 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11136 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11137 [(match_operand 2 "cc_reg_operand" "y,y")
11140 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11141 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11142 "! TARGET_POWERPC64"
11144 %D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1
11146 [(set_attr "type" "delayed_compare")
11147 (set_attr "length" "12,16")])
11150 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11151 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11152 [(match_operand 2 "cc_reg_operand" "")
11155 (set (match_operand:SI 3 "gpc_reg_operand" "")
11156 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11157 "! TARGET_POWERPC64 && reload_completed"
11158 [(set (match_dup 3)
11159 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11161 (compare:CC (match_dup 3)
11166 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11167 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11168 [(match_operand 2 "cc_reg_operand" "y")
11170 (match_operand:SI 3 "const_int_operand" "n")))]
11174 int is_bit = ccr_bit (operands[1], 1);
11175 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11178 if (is_bit >= put_bit)
11179 count = is_bit - put_bit;
11181 count = 32 - (put_bit - is_bit);
11183 operands[4] = GEN_INT (count);
11184 operands[5] = GEN_INT (put_bit);
11186 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11188 [(set_attr "type" "mfcr")
11189 (set_attr "length" "12")])
11192 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11194 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11195 [(match_operand 2 "cc_reg_operand" "y,y")
11197 (match_operand:SI 3 "const_int_operand" "n,n"))
11199 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11200 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11205 int is_bit = ccr_bit (operands[1], 1);
11206 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11209 /* Force split for non-cc0 compare. */
11210 if (which_alternative == 1)
11213 if (is_bit >= put_bit)
11214 count = is_bit - put_bit;
11216 count = 32 - (put_bit - is_bit);
11218 operands[5] = GEN_INT (count);
11219 operands[6] = GEN_INT (put_bit);
11221 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11223 [(set_attr "type" "delayed_compare")
11224 (set_attr "length" "12,16")])
11227 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11229 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11230 [(match_operand 2 "cc_reg_operand" "")
11232 (match_operand:SI 3 "const_int_operand" ""))
11234 (set (match_operand:SI 4 "gpc_reg_operand" "")
11235 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11238 [(set (match_dup 4)
11239 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11242 (compare:CC (match_dup 4)
11246 ;; There is a 3 cycle delay between consecutive mfcr instructions
11247 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11250 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11251 (match_operator:SI 1 "scc_comparison_operator"
11252 [(match_operand 2 "cc_reg_operand" "y")
11254 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11255 (match_operator:SI 4 "scc_comparison_operator"
11256 [(match_operand 5 "cc_reg_operand" "y")
11258 "REGNO (operands[2]) != REGNO (operands[5])"
11259 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11260 [(set_attr "type" "mfcr")
11261 (set_attr "length" "20")])
11264 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11265 (match_operator:DI 1 "scc_comparison_operator"
11266 [(match_operand 2 "cc_reg_operand" "y")
11268 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11269 (match_operator:DI 4 "scc_comparison_operator"
11270 [(match_operand 5 "cc_reg_operand" "y")
11272 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11273 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11274 [(set_attr "type" "mfcr")
11275 (set_attr "length" "20")])
11277 ;; There are some scc insns that can be done directly, without a compare.
11278 ;; These are faster because they don't involve the communications between
11279 ;; the FXU and branch units. In fact, we will be replacing all of the
11280 ;; integer scc insns here or in the portable methods in emit_store_flag.
11282 ;; Also support (neg (scc ..)) since that construct is used to replace
11283 ;; branches, (plus (scc ..) ..) since that construct is common and
11284 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11285 ;; cases where it is no more expensive than (neg (scc ..)).
11287 ;; Have reload force a constant into a register for the simple insns that
11288 ;; otherwise won't accept constants. We do this because it is faster than
11289 ;; the cmp/mfcr sequence we would otherwise generate.
11292 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11293 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11294 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11295 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11296 "! TARGET_POWERPC64"
11298 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11299 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11300 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11301 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11302 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11303 [(set_attr "length" "12,8,12,12,12")])
11306 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11307 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11308 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11309 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11312 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11313 subfic %3,%1,0\;adde %0,%3,%1
11314 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11315 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11316 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11317 [(set_attr "length" "12,8,12,12,12")])
11320 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11322 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11323 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11325 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11326 (eq:SI (match_dup 1) (match_dup 2)))
11327 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11328 "! TARGET_POWERPC64"
11330 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11331 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11332 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11333 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11334 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11340 [(set_attr "type" "compare")
11341 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11344 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11346 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11347 (match_operand:SI 2 "reg_or_cint_operand" ""))
11349 (set (match_operand:SI 0 "gpc_reg_operand" "")
11350 (eq:SI (match_dup 1) (match_dup 2)))
11351 (clobber (match_scratch:SI 3 ""))]
11352 "! TARGET_POWERPC64 && reload_completed"
11353 [(parallel [(set (match_dup 0)
11354 (eq:SI (match_dup 1) (match_dup 2)))
11355 (clobber (match_dup 3))])
11357 (compare:CC (match_dup 0)
11362 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11364 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11365 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11367 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11368 (eq:DI (match_dup 1) (match_dup 2)))
11369 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11372 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11373 subfic %3,%1,0\;adde. %0,%3,%1
11374 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11375 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11376 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11382 [(set_attr "type" "compare")
11383 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11386 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11388 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11389 (match_operand:DI 2 "reg_or_cint_operand" ""))
11391 (set (match_operand:DI 0 "gpc_reg_operand" "")
11392 (eq:DI (match_dup 1) (match_dup 2)))
11393 (clobber (match_scratch:DI 3 ""))]
11394 "TARGET_POWERPC64 && reload_completed"
11395 [(parallel [(set (match_dup 0)
11396 (eq:DI (match_dup 1) (match_dup 2)))
11397 (clobber (match_dup 3))])
11399 (compare:CC (match_dup 0)
11403 ;; We have insns of the form shown by the first define_insn below. If
11404 ;; there is something inside the comparison operation, we must split it.
11406 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11407 (plus:SI (match_operator 1 "comparison_operator"
11408 [(match_operand:SI 2 "" "")
11409 (match_operand:SI 3
11410 "reg_or_cint_operand" "")])
11411 (match_operand:SI 4 "gpc_reg_operand" "")))
11412 (clobber (match_operand:SI 5 "register_operand" ""))]
11413 "! gpc_reg_operand (operands[2], SImode)"
11414 [(set (match_dup 5) (match_dup 2))
11415 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11419 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11420 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11421 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11422 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11423 "! TARGET_POWERPC64"
11425 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11426 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11427 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11428 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11429 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11430 [(set_attr "length" "12,8,12,12,12")])
11433 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11436 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11437 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11438 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11440 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11441 "! TARGET_POWERPC64"
11443 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11444 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11445 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11446 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11447 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11453 [(set_attr "type" "compare")
11454 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11457 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11460 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11461 (match_operand:SI 2 "reg_or_cint_operand" ""))
11462 (match_operand:SI 3 "gpc_reg_operand" ""))
11464 (clobber (match_scratch:SI 4 ""))]
11465 "! TARGET_POWERPC64 && reload_completed"
11466 [(set (match_dup 4)
11467 (plus:SI (eq:SI (match_dup 1)
11471 (compare:CC (match_dup 4)
11476 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11479 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11480 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11481 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11483 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11484 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11485 "! TARGET_POWERPC64"
11487 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11488 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11489 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11490 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11491 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11497 [(set_attr "type" "compare")
11498 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11501 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11504 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11505 (match_operand:SI 2 "reg_or_cint_operand" ""))
11506 (match_operand:SI 3 "gpc_reg_operand" ""))
11508 (set (match_operand:SI 0 "gpc_reg_operand" "")
11509 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11510 "! TARGET_POWERPC64 && reload_completed"
11511 [(set (match_dup 0)
11512 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11514 (compare:CC (match_dup 0)
11519 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11520 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11521 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11522 "! TARGET_POWERPC64"
11524 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11525 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11526 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11527 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11528 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11529 [(set_attr "length" "12,8,12,12,12")])
11531 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11532 ;; since it nabs/sr is just as fast.
11533 (define_insn "*ne0"
11534 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11535 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11537 (clobber (match_scratch:SI 2 "=&r"))]
11538 "! TARGET_POWER && ! TARGET_POWERPC64 && !TARGET_ISEL"
11539 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11540 [(set_attr "length" "8")])
11543 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11544 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11546 (clobber (match_scratch:DI 2 "=&r"))]
11548 "addic %2,%1,-1\;subfe %0,%2,%1"
11549 [(set_attr "length" "8")])
11551 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11553 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11554 (plus:SI (lshiftrt:SI
11555 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11557 (match_operand:SI 2 "gpc_reg_operand" "r")))
11558 (clobber (match_scratch:SI 3 "=&r"))]
11559 "! TARGET_POWERPC64"
11560 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11561 [(set_attr "length" "8")])
11564 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11565 (plus:DI (lshiftrt:DI
11566 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11568 (match_operand:DI 2 "gpc_reg_operand" "r")))
11569 (clobber (match_scratch:DI 3 "=&r"))]
11571 "addic %3,%1,-1\;addze %0,%2"
11572 [(set_attr "length" "8")])
11575 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11577 (plus:SI (lshiftrt:SI
11578 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11580 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11582 (clobber (match_scratch:SI 3 "=&r,&r"))
11583 (clobber (match_scratch:SI 4 "=X,&r"))]
11584 "! TARGET_POWERPC64"
11586 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11588 [(set_attr "type" "compare")
11589 (set_attr "length" "8,12")])
11592 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11594 (plus:SI (lshiftrt:SI
11595 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11597 (match_operand:SI 2 "gpc_reg_operand" ""))
11599 (clobber (match_scratch:SI 3 ""))
11600 (clobber (match_scratch:SI 4 ""))]
11601 "! TARGET_POWERPC64 && reload_completed"
11602 [(parallel [(set (match_dup 3)
11603 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11606 (clobber (match_dup 4))])
11608 (compare:CC (match_dup 3)
11613 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11615 (plus:DI (lshiftrt:DI
11616 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11618 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11620 (clobber (match_scratch:DI 3 "=&r,&r"))]
11623 addic %3,%1,-1\;addze. %3,%2
11625 [(set_attr "type" "compare")
11626 (set_attr "length" "8,12")])
11629 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11631 (plus:DI (lshiftrt:DI
11632 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11634 (match_operand:DI 2 "gpc_reg_operand" ""))
11636 (clobber (match_scratch:DI 3 ""))]
11637 "TARGET_POWERPC64 && reload_completed"
11638 [(set (match_dup 3)
11639 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11643 (compare:CC (match_dup 3)
11648 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11650 (plus:SI (lshiftrt:SI
11651 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11653 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11655 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11656 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11658 (clobber (match_scratch:SI 3 "=&r,&r"))]
11659 "! TARGET_POWERPC64"
11661 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11663 [(set_attr "type" "compare")
11664 (set_attr "length" "8,12")])
11667 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11669 (plus:SI (lshiftrt:SI
11670 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11672 (match_operand:SI 2 "gpc_reg_operand" ""))
11674 (set (match_operand:SI 0 "gpc_reg_operand" "")
11675 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11677 (clobber (match_scratch:SI 3 ""))]
11678 "! TARGET_POWERPC64 && reload_completed"
11679 [(parallel [(set (match_dup 0)
11680 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11682 (clobber (match_dup 3))])
11684 (compare:CC (match_dup 0)
11689 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11691 (plus:DI (lshiftrt:DI
11692 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11694 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11696 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11697 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11699 (clobber (match_scratch:DI 3 "=&r,&r"))]
11702 addic %3,%1,-1\;addze. %0,%2
11704 [(set_attr "type" "compare")
11705 (set_attr "length" "8,12")])
11708 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11710 (plus:DI (lshiftrt:DI
11711 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11713 (match_operand:DI 2 "gpc_reg_operand" ""))
11715 (set (match_operand:DI 0 "gpc_reg_operand" "")
11716 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11718 (clobber (match_scratch:DI 3 ""))]
11719 "TARGET_POWERPC64 && reload_completed"
11720 [(parallel [(set (match_dup 0)
11721 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11723 (clobber (match_dup 3))])
11725 (compare:CC (match_dup 0)
11730 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11731 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11732 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11733 (clobber (match_scratch:SI 3 "=r,X"))]
11736 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11737 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11738 [(set_attr "length" "12")])
11741 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11743 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11744 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11746 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11747 (le:SI (match_dup 1) (match_dup 2)))
11748 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11751 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11752 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11755 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11756 (set_attr "length" "12,12,16,16")])
11759 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11761 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11762 (match_operand:SI 2 "reg_or_short_operand" ""))
11764 (set (match_operand:SI 0 "gpc_reg_operand" "")
11765 (le:SI (match_dup 1) (match_dup 2)))
11766 (clobber (match_scratch:SI 3 ""))]
11767 "TARGET_POWER && reload_completed"
11768 [(parallel [(set (match_dup 0)
11769 (le:SI (match_dup 1) (match_dup 2)))
11770 (clobber (match_dup 3))])
11772 (compare:CC (match_dup 0)
11777 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11778 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11779 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11780 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11783 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11784 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11785 [(set_attr "length" "12")])
11788 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11790 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11791 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11792 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11794 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11797 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11798 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11801 [(set_attr "type" "compare")
11802 (set_attr "length" "12,12,16,16")])
11805 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11807 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11808 (match_operand:SI 2 "reg_or_short_operand" ""))
11809 (match_operand:SI 3 "gpc_reg_operand" ""))
11811 (clobber (match_scratch:SI 4 ""))]
11812 "TARGET_POWER && reload_completed"
11813 [(set (match_dup 4)
11814 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11817 (compare:CC (match_dup 4)
11822 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11824 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11825 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11826 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11828 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
11829 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11832 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11833 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
11836 [(set_attr "type" "compare")
11837 (set_attr "length" "12,12,16,16")])
11840 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11842 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11843 (match_operand:SI 2 "reg_or_short_operand" ""))
11844 (match_operand:SI 3 "gpc_reg_operand" ""))
11846 (set (match_operand:SI 0 "gpc_reg_operand" "")
11847 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11848 "TARGET_POWER && reload_completed"
11849 [(set (match_dup 0)
11850 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11852 (compare:CC (match_dup 0)
11857 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11858 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11859 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11862 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11863 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11864 [(set_attr "length" "12")])
11867 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11868 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11869 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11870 "! TARGET_POWERPC64"
11871 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11872 [(set_attr "length" "12")])
11875 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11876 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11877 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11879 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11880 [(set_attr "length" "12")])
11883 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11885 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11886 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11888 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11889 (leu:DI (match_dup 1) (match_dup 2)))]
11892 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11894 [(set_attr "type" "compare")
11895 (set_attr "length" "12,16")])
11898 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11900 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11901 (match_operand:DI 2 "reg_or_short_operand" ""))
11903 (set (match_operand:DI 0 "gpc_reg_operand" "")
11904 (leu:DI (match_dup 1) (match_dup 2)))]
11905 "TARGET_POWERPC64 && reload_completed"
11906 [(set (match_dup 0)
11907 (leu:DI (match_dup 1) (match_dup 2)))
11909 (compare:CC (match_dup 0)
11914 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11916 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11917 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11919 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11920 (leu:SI (match_dup 1) (match_dup 2)))]
11921 "! TARGET_POWERPC64"
11923 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11925 [(set_attr "type" "compare")
11926 (set_attr "length" "12,16")])
11929 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11931 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11932 (match_operand:SI 2 "reg_or_short_operand" ""))
11934 (set (match_operand:SI 0 "gpc_reg_operand" "")
11935 (leu:SI (match_dup 1) (match_dup 2)))]
11936 "! TARGET_POWERPC64 && reload_completed"
11937 [(set (match_dup 0)
11938 (leu:SI (match_dup 1) (match_dup 2)))
11940 (compare:CC (match_dup 0)
11945 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11947 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11948 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11950 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11951 (leu:DI (match_dup 1) (match_dup 2)))]
11954 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11956 [(set_attr "type" "compare")
11957 (set_attr "length" "12,16")])
11960 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11961 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11962 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11963 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11964 "! TARGET_POWERPC64"
11965 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11966 [(set_attr "length" "8")])
11969 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11971 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11972 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11973 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11975 (clobber (match_scratch:SI 4 "=&r,&r"))]
11976 "! TARGET_POWERPC64"
11978 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11980 [(set_attr "type" "compare")
11981 (set_attr "length" "8,12")])
11984 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11986 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11987 (match_operand:SI 2 "reg_or_short_operand" ""))
11988 (match_operand:SI 3 "gpc_reg_operand" ""))
11990 (clobber (match_scratch:SI 4 ""))]
11991 "! TARGET_POWERPC64 && reload_completed"
11992 [(set (match_dup 4)
11993 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
11996 (compare:CC (match_dup 4)
12001 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12003 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12004 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12005 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12007 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12008 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12009 "! TARGET_POWERPC64"
12011 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12013 [(set_attr "type" "compare")
12014 (set_attr "length" "8,12")])
12017 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12019 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12020 (match_operand:SI 2 "reg_or_short_operand" ""))
12021 (match_operand:SI 3 "gpc_reg_operand" ""))
12023 (set (match_operand:SI 0 "gpc_reg_operand" "")
12024 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12025 "! TARGET_POWERPC64 && reload_completed"
12026 [(set (match_dup 0)
12027 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12029 (compare:CC (match_dup 0)
12034 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12035 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12036 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12037 "! TARGET_POWERPC64"
12038 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12039 [(set_attr "length" "12")])
12042 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12044 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12045 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12046 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12047 "! TARGET_POWERPC64"
12048 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12049 [(set_attr "length" "12")])
12052 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12055 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12056 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12057 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12059 (clobber (match_scratch:SI 4 "=&r,&r"))]
12060 "! TARGET_POWERPC64"
12062 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12064 [(set_attr "type" "compare")
12065 (set_attr "length" "12,16")])
12068 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12071 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12072 (match_operand:SI 2 "reg_or_short_operand" "")))
12073 (match_operand:SI 3 "gpc_reg_operand" ""))
12075 (clobber (match_scratch:SI 4 ""))]
12076 "! TARGET_POWERPC64 && reload_completed"
12077 [(set (match_dup 4)
12078 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12081 (compare:CC (match_dup 4)
12086 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12089 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12090 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12091 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12093 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12094 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12095 "! TARGET_POWERPC64"
12097 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12099 [(set_attr "type" "compare")
12100 (set_attr "length" "12,16")])
12103 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12106 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12107 (match_operand:SI 2 "reg_or_short_operand" "")))
12108 (match_operand:SI 3 "gpc_reg_operand" ""))
12110 (set (match_operand:SI 0 "gpc_reg_operand" "")
12111 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12112 "! TARGET_POWERPC64 && reload_completed"
12113 [(set (match_dup 0)
12114 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12117 (compare:CC (match_dup 0)
12122 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12123 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12124 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12126 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12127 [(set_attr "length" "12")])
12130 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12132 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12133 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12135 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12136 (lt:SI (match_dup 1) (match_dup 2)))]
12139 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12141 [(set_attr "type" "delayed_compare")
12142 (set_attr "length" "12,16")])
12145 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12147 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12148 (match_operand:SI 2 "reg_or_short_operand" ""))
12150 (set (match_operand:SI 0 "gpc_reg_operand" "")
12151 (lt:SI (match_dup 1) (match_dup 2)))]
12152 "TARGET_POWER && reload_completed"
12153 [(set (match_dup 0)
12154 (lt:SI (match_dup 1) (match_dup 2)))
12156 (compare:CC (match_dup 0)
12161 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12162 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12163 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12164 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12166 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12167 [(set_attr "length" "12")])
12170 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12172 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12173 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12174 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12176 (clobber (match_scratch:SI 4 "=&r,&r"))]
12179 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12181 [(set_attr "type" "compare")
12182 (set_attr "length" "12,16")])
12185 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12187 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12188 (match_operand:SI 2 "reg_or_short_operand" ""))
12189 (match_operand:SI 3 "gpc_reg_operand" ""))
12191 (clobber (match_scratch:SI 4 ""))]
12192 "TARGET_POWER && reload_completed"
12193 [(set (match_dup 4)
12194 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12197 (compare:CC (match_dup 4)
12202 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12204 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12205 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12206 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12208 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12209 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12212 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12214 [(set_attr "type" "compare")
12215 (set_attr "length" "12,16")])
12218 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12220 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12221 (match_operand:SI 2 "reg_or_short_operand" ""))
12222 (match_operand:SI 3 "gpc_reg_operand" ""))
12224 (set (match_operand:SI 0 "gpc_reg_operand" "")
12225 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12226 "TARGET_POWER && reload_completed"
12227 [(set (match_dup 0)
12228 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12230 (compare:CC (match_dup 0)
12235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12236 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12237 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12239 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12240 [(set_attr "length" "12")])
12243 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12244 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12245 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12246 "! TARGET_POWERPC64"
12248 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12249 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12250 [(set_attr "length" "12")])
12253 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12255 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12256 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12258 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12259 (ltu:SI (match_dup 1) (match_dup 2)))]
12260 "! TARGET_POWERPC64"
12262 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12263 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12266 [(set_attr "type" "compare")
12267 (set_attr "length" "12,12,16,16")])
12270 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12272 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12273 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12275 (set (match_operand:SI 0 "gpc_reg_operand" "")
12276 (ltu:SI (match_dup 1) (match_dup 2)))]
12277 "! TARGET_POWERPC64 && reload_completed"
12278 [(set (match_dup 0)
12279 (ltu:SI (match_dup 1) (match_dup 2)))
12281 (compare:CC (match_dup 0)
12286 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12287 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12288 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12289 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12290 "! TARGET_POWERPC64"
12292 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12293 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12294 [(set_attr "length" "12")])
12297 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12299 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12300 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12301 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12303 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12304 "! TARGET_POWERPC64"
12306 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12307 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12310 [(set_attr "type" "compare")
12311 (set_attr "length" "12,12,16,16")])
12314 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12316 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12317 (match_operand:SI 2 "reg_or_neg_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 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12326 (compare:CC (match_dup 4)
12331 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12333 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12334 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12335 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12337 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12338 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12339 "! TARGET_POWERPC64"
12341 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12342 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12345 [(set_attr "type" "compare")
12346 (set_attr "length" "12,12,16,16")])
12349 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12351 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12352 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12353 (match_operand:SI 3 "gpc_reg_operand" ""))
12355 (set (match_operand:SI 0 "gpc_reg_operand" "")
12356 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12357 "! TARGET_POWERPC64 && reload_completed"
12358 [(set (match_dup 0)
12359 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12361 (compare:CC (match_dup 0)
12366 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12367 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12368 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12369 "! TARGET_POWERPC64"
12371 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12372 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12373 [(set_attr "length" "8")])
12376 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12377 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12378 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12379 (clobber (match_scratch:SI 3 "=r"))]
12381 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12382 [(set_attr "length" "12")])
12385 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12387 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12388 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12390 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12391 (ge:SI (match_dup 1) (match_dup 2)))
12392 (clobber (match_scratch:SI 3 "=r,r"))]
12395 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12397 [(set_attr "type" "compare")
12398 (set_attr "length" "12,16")])
12401 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12403 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12404 (match_operand:SI 2 "reg_or_short_operand" ""))
12406 (set (match_operand:SI 0 "gpc_reg_operand" "")
12407 (ge:SI (match_dup 1) (match_dup 2)))
12408 (clobber (match_scratch:SI 3 ""))]
12409 "TARGET_POWER && reload_completed"
12410 [(parallel [(set (match_dup 0)
12411 (ge:SI (match_dup 1) (match_dup 2)))
12412 (clobber (match_dup 3))])
12414 (compare:CC (match_dup 0)
12419 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12420 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12421 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12422 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12424 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12425 [(set_attr "length" "12")])
12428 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12430 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12431 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12432 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12434 (clobber (match_scratch:SI 4 "=&r,&r"))]
12437 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12439 [(set_attr "type" "compare")
12440 (set_attr "length" "12,16")])
12443 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12445 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12446 (match_operand:SI 2 "reg_or_short_operand" ""))
12447 (match_operand:SI 3 "gpc_reg_operand" ""))
12449 (clobber (match_scratch:SI 4 ""))]
12450 "TARGET_POWER && reload_completed"
12451 [(set (match_dup 4)
12452 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12455 (compare:CC (match_dup 4)
12460 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12462 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12463 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12464 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12466 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12467 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12470 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12472 [(set_attr "type" "compare")
12473 (set_attr "length" "12,16")])
12476 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12478 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12479 (match_operand:SI 2 "reg_or_short_operand" ""))
12480 (match_operand:SI 3 "gpc_reg_operand" ""))
12482 (set (match_operand:SI 0 "gpc_reg_operand" "")
12483 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12484 "TARGET_POWER && reload_completed"
12485 [(set (match_dup 0)
12486 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12488 (compare:CC (match_dup 0)
12493 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12494 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12495 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12497 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12498 [(set_attr "length" "12")])
12501 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12502 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12503 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12504 "! TARGET_POWERPC64"
12506 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12507 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12508 [(set_attr "length" "12")])
12511 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12512 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12513 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12516 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12517 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12518 [(set_attr "length" "12")])
12521 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12523 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12524 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12526 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12527 (geu:SI (match_dup 1) (match_dup 2)))]
12528 "! TARGET_POWERPC64"
12530 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12531 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12534 [(set_attr "type" "compare")
12535 (set_attr "length" "12,12,16,16")])
12538 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12540 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12541 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12543 (set (match_operand:SI 0 "gpc_reg_operand" "")
12544 (geu:SI (match_dup 1) (match_dup 2)))]
12545 "! TARGET_POWERPC64 && reload_completed"
12546 [(set (match_dup 0)
12547 (geu:SI (match_dup 1) (match_dup 2)))
12549 (compare:CC (match_dup 0)
12554 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12556 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12557 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12559 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12560 (geu:DI (match_dup 1) (match_dup 2)))]
12563 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12564 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12567 [(set_attr "type" "compare")
12568 (set_attr "length" "12,12,16,16")])
12571 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12573 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12574 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12576 (set (match_operand:DI 0 "gpc_reg_operand" "")
12577 (geu:DI (match_dup 1) (match_dup 2)))]
12578 "TARGET_POWERPC64 && reload_completed"
12579 [(set (match_dup 0)
12580 (geu:DI (match_dup 1) (match_dup 2)))
12582 (compare:CC (match_dup 0)
12587 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12588 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12589 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12590 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12591 "! TARGET_POWERPC64"
12593 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12594 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12595 [(set_attr "length" "8")])
12598 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12600 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12601 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12602 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12604 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12605 "! TARGET_POWERPC64"
12607 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12608 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12611 [(set_attr "type" "compare")
12612 (set_attr "length" "8,8,12,12")])
12615 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12617 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12618 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12619 (match_operand:SI 3 "gpc_reg_operand" ""))
12621 (clobber (match_scratch:SI 4 ""))]
12622 "! TARGET_POWERPC64 && reload_completed"
12623 [(set (match_dup 4)
12624 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12627 (compare:CC (match_dup 4)
12632 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12634 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12635 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12636 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12638 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12639 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12640 "! TARGET_POWERPC64"
12642 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12643 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12646 [(set_attr "type" "compare")
12647 (set_attr "length" "8,8,12,12")])
12650 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12652 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12653 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12654 (match_operand:SI 3 "gpc_reg_operand" ""))
12656 (set (match_operand:SI 0 "gpc_reg_operand" "")
12657 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12658 "! TARGET_POWERPC64 && reload_completed"
12659 [(set (match_dup 0)
12660 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12662 (compare:CC (match_dup 0)
12667 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12668 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12669 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12670 "! TARGET_POWERPC64"
12672 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12673 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12674 [(set_attr "length" "12")])
12677 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12679 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12680 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12681 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12682 "! TARGET_POWERPC64"
12684 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12685 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12686 [(set_attr "length" "12")])
12689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12692 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12693 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12694 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12696 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12697 "! TARGET_POWERPC64"
12699 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12700 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12703 [(set_attr "type" "compare")
12704 (set_attr "length" "12,12,16,16")])
12707 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12710 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12711 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12712 (match_operand:SI 3 "gpc_reg_operand" ""))
12714 (clobber (match_scratch:SI 4 ""))]
12715 "! TARGET_POWERPC64 && reload_completed"
12716 [(set (match_dup 4)
12717 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12720 (compare:CC (match_dup 4)
12725 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12728 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12729 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12730 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12732 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12733 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12734 "! TARGET_POWERPC64"
12736 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12737 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12740 [(set_attr "type" "compare")
12741 (set_attr "length" "12,12,16,16")])
12744 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12747 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12748 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12749 (match_operand:SI 3 "gpc_reg_operand" ""))
12751 (set (match_operand:SI 0 "gpc_reg_operand" "")
12752 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12753 "! TARGET_POWERPC64 && reload_completed"
12754 [(set (match_dup 0)
12755 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12757 (compare:CC (match_dup 0)
12762 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12763 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12765 "! TARGET_POWERPC64"
12766 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12767 [(set_attr "length" "12")])
12770 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12771 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12774 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12775 [(set_attr "length" "12")])
12778 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12780 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12783 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12784 (gt:SI (match_dup 1) (const_int 0)))]
12785 "! TARGET_POWERPC64"
12787 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12789 [(set_attr "type" "delayed_compare")
12790 (set_attr "length" "12,16")])
12793 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12795 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12798 (set (match_operand:SI 0 "gpc_reg_operand" "")
12799 (gt:SI (match_dup 1) (const_int 0)))]
12800 "! TARGET_POWERPC64 && reload_completed"
12801 [(set (match_dup 0)
12802 (gt:SI (match_dup 1) (const_int 0)))
12804 (compare:CC (match_dup 0)
12809 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12811 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12814 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12815 (gt:DI (match_dup 1) (const_int 0)))]
12818 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12820 [(set_attr "type" "delayed_compare")
12821 (set_attr "length" "12,16")])
12824 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12826 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12829 (set (match_operand:DI 0 "gpc_reg_operand" "")
12830 (gt:DI (match_dup 1) (const_int 0)))]
12831 "TARGET_POWERPC64 && reload_completed"
12832 [(set (match_dup 0)
12833 (gt:DI (match_dup 1) (const_int 0)))
12835 (compare:CC (match_dup 0)
12840 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12841 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12842 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12844 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12845 [(set_attr "length" "12")])
12848 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12850 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12851 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12853 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12854 (gt:SI (match_dup 1) (match_dup 2)))]
12857 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12859 [(set_attr "type" "delayed_compare")
12860 (set_attr "length" "12,16")])
12863 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12865 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12866 (match_operand:SI 2 "reg_or_short_operand" ""))
12868 (set (match_operand:SI 0 "gpc_reg_operand" "")
12869 (gt:SI (match_dup 1) (match_dup 2)))]
12870 "TARGET_POWER && reload_completed"
12871 [(set (match_dup 0)
12872 (gt:SI (match_dup 1) (match_dup 2)))
12874 (compare:CC (match_dup 0)
12879 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12880 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12882 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12883 "! TARGET_POWERPC64"
12884 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12885 [(set_attr "length" "12")])
12888 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
12889 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12891 (match_operand:DI 2 "gpc_reg_operand" "r")))]
12893 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12894 [(set_attr "length" "12")])
12897 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12899 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12901 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12903 (clobber (match_scratch:SI 3 "=&r,&r"))]
12904 "! TARGET_POWERPC64"
12906 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12908 [(set_attr "type" "compare")
12909 (set_attr "length" "12,16")])
12912 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12914 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12916 (match_operand:SI 2 "gpc_reg_operand" ""))
12918 (clobber (match_scratch:SI 3 ""))]
12919 "! TARGET_POWERPC64 && reload_completed"
12920 [(set (match_dup 3)
12921 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12924 (compare:CC (match_dup 3)
12929 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12931 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12933 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12935 (clobber (match_scratch:DI 3 "=&r,&r"))]
12938 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12940 [(set_attr "type" "compare")
12941 (set_attr "length" "12,16")])
12944 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12946 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12948 (match_operand:DI 2 "gpc_reg_operand" ""))
12950 (clobber (match_scratch:DI 3 ""))]
12951 "TARGET_POWERPC64 && reload_completed"
12952 [(set (match_dup 3)
12953 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12956 (compare:CC (match_dup 3)
12961 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12963 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12965 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12967 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12968 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12969 "! TARGET_POWERPC64"
12971 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
12973 [(set_attr "type" "compare")
12974 (set_attr "length" "12,16")])
12977 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12979 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12981 (match_operand:SI 2 "gpc_reg_operand" ""))
12983 (set (match_operand:SI 0 "gpc_reg_operand" "")
12984 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12985 "! TARGET_POWERPC64 && reload_completed"
12986 [(set (match_dup 0)
12987 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12989 (compare:CC (match_dup 0)
12994 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12996 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12998 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13000 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13001 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13004 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13006 [(set_attr "type" "compare")
13007 (set_attr "length" "12,16")])
13010 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13012 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13014 (match_operand:DI 2 "gpc_reg_operand" ""))
13016 (set (match_operand:DI 0 "gpc_reg_operand" "")
13017 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13018 "TARGET_POWERPC64 && reload_completed"
13019 [(set (match_dup 0)
13020 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13022 (compare:CC (match_dup 0)
13027 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13028 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13029 (match_operand:SI 2 "reg_or_short_operand" "r"))
13030 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13032 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13033 [(set_attr "length" "12")])
13036 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13038 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13039 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13040 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13042 (clobber (match_scratch:SI 4 "=&r,&r"))]
13045 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13047 [(set_attr "type" "compare")
13048 (set_attr "length" "12,16")])
13051 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13053 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13054 (match_operand:SI 2 "reg_or_short_operand" ""))
13055 (match_operand:SI 3 "gpc_reg_operand" ""))
13057 (clobber (match_scratch:SI 4 ""))]
13058 "TARGET_POWER && reload_completed"
13059 [(set (match_dup 4)
13060 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13062 (compare:CC (match_dup 4)
13067 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13069 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13070 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13071 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13073 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13074 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13077 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13079 [(set_attr "type" "compare")
13080 (set_attr "length" "12,16")])
13083 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13085 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13086 (match_operand:SI 2 "reg_or_short_operand" ""))
13087 (match_operand:SI 3 "gpc_reg_operand" ""))
13089 (set (match_operand:SI 0 "gpc_reg_operand" "")
13090 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13091 "TARGET_POWER && reload_completed"
13092 [(set (match_dup 0)
13093 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13095 (compare:CC (match_dup 0)
13100 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13101 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13103 "! TARGET_POWERPC64"
13104 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13105 [(set_attr "length" "12")])
13108 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13109 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13112 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13113 [(set_attr "length" "12")])
13116 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13117 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13118 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13120 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13121 [(set_attr "length" "12")])
13124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13125 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13126 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13127 "! TARGET_POWERPC64"
13128 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13129 [(set_attr "length" "12")])
13132 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13133 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13134 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13136 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13137 [(set_attr "length" "12")])
13140 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13142 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13143 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13145 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13146 (gtu:SI (match_dup 1) (match_dup 2)))]
13147 "! TARGET_POWERPC64"
13149 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13151 [(set_attr "type" "compare")
13152 (set_attr "length" "12,16")])
13155 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13157 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13158 (match_operand:SI 2 "reg_or_short_operand" ""))
13160 (set (match_operand:SI 0 "gpc_reg_operand" "")
13161 (gtu:SI (match_dup 1) (match_dup 2)))]
13162 "! TARGET_POWERPC64 && reload_completed"
13163 [(set (match_dup 0)
13164 (gtu:SI (match_dup 1) (match_dup 2)))
13166 (compare:CC (match_dup 0)
13171 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13173 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13174 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13176 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13177 (gtu:DI (match_dup 1) (match_dup 2)))]
13180 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13182 [(set_attr "type" "compare")
13183 (set_attr "length" "12,16")])
13186 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13188 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13189 (match_operand:DI 2 "reg_or_short_operand" ""))
13191 (set (match_operand:DI 0 "gpc_reg_operand" "")
13192 (gtu:DI (match_dup 1) (match_dup 2)))]
13193 "TARGET_POWERPC64 && reload_completed"
13194 [(set (match_dup 0)
13195 (gtu:DI (match_dup 1) (match_dup 2)))
13197 (compare:CC (match_dup 0)
13202 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13203 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13204 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13205 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13206 "! TARGET_POWERPC64"
13208 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13209 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13210 [(set_attr "length" "8,12")])
13213 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13214 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13215 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13216 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13219 addic %0,%1,%k2\;addze %0,%3
13220 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13221 [(set_attr "length" "8,12")])
13224 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13226 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13227 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13228 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13230 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13231 "! TARGET_POWERPC64"
13233 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13234 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13237 [(set_attr "type" "compare")
13238 (set_attr "length" "8,12,12,16")])
13241 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13243 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13244 (match_operand:SI 2 "reg_or_short_operand" ""))
13245 (match_operand:SI 3 "gpc_reg_operand" ""))
13247 (clobber (match_scratch:SI 4 ""))]
13248 "! TARGET_POWERPC64 && reload_completed"
13249 [(set (match_dup 4)
13250 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13253 (compare:CC (match_dup 4)
13258 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13260 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13261 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13262 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13264 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13267 addic %4,%1,%k2\;addze. %4,%3
13268 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13271 [(set_attr "type" "compare")
13272 (set_attr "length" "8,12,12,16")])
13275 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13277 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13278 (match_operand:DI 2 "reg_or_short_operand" ""))
13279 (match_operand:DI 3 "gpc_reg_operand" ""))
13281 (clobber (match_scratch:DI 4 ""))]
13282 "TARGET_POWERPC64 && reload_completed"
13283 [(set (match_dup 4)
13284 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13287 (compare:CC (match_dup 4)
13292 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13294 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13295 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13296 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13298 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13299 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13300 "! TARGET_POWERPC64"
13302 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13303 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13306 [(set_attr "type" "compare")
13307 (set_attr "length" "8,12,12,16")])
13310 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13312 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13313 (match_operand:SI 2 "reg_or_short_operand" ""))
13314 (match_operand:SI 3 "gpc_reg_operand" ""))
13316 (set (match_operand:SI 0 "gpc_reg_operand" "")
13317 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13318 "! TARGET_POWERPC64 && reload_completed"
13319 [(set (match_dup 0)
13320 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13322 (compare:CC (match_dup 0)
13327 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13329 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13330 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13331 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13333 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13334 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13337 addic %0,%1,%k2\;addze. %0,%3
13338 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13341 [(set_attr "type" "compare")
13342 (set_attr "length" "8,12,12,16")])
13345 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13347 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13348 (match_operand:DI 2 "reg_or_short_operand" ""))
13349 (match_operand:DI 3 "gpc_reg_operand" ""))
13351 (set (match_operand:DI 0 "gpc_reg_operand" "")
13352 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13353 "TARGET_POWERPC64 && reload_completed"
13354 [(set (match_dup 0)
13355 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13357 (compare:CC (match_dup 0)
13362 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13363 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13364 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13365 "! TARGET_POWERPC64"
13366 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13367 [(set_attr "length" "8")])
13370 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13371 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13372 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13374 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13375 [(set_attr "length" "8")])
13377 ;; Define both directions of branch and return. If we need a reload
13378 ;; register, we'd rather use CR0 since it is much easier to copy a
13379 ;; register CC value to there.
13383 (if_then_else (match_operator 1 "branch_comparison_operator"
13385 "cc_reg_operand" "y")
13387 (label_ref (match_operand 0 "" ""))
13392 return output_cbranch (operands[1], \"%l0\", 0, insn);
13394 [(set_attr "type" "branch")])
13398 (if_then_else (match_operator 0 "branch_comparison_operator"
13400 "cc_reg_operand" "y")
13407 return output_cbranch (operands[0], NULL, 0, insn);
13409 [(set_attr "type" "branch")
13410 (set_attr "length" "4")])
13414 (if_then_else (match_operator 1 "branch_comparison_operator"
13416 "cc_reg_operand" "y")
13419 (label_ref (match_operand 0 "" ""))))]
13423 return output_cbranch (operands[1], \"%l0\", 1, insn);
13425 [(set_attr "type" "branch")])
13429 (if_then_else (match_operator 0 "branch_comparison_operator"
13431 "cc_reg_operand" "y")
13438 return output_cbranch (operands[0], NULL, 1, insn);
13440 [(set_attr "type" "branch")
13441 (set_attr "length" "4")])
13443 ;; Logic on condition register values.
13445 ; This pattern matches things like
13446 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13447 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13449 ; which are generated by the branch logic.
13450 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13453 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13454 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13455 [(match_operator:SI 2
13456 "branch_positive_comparison_operator"
13458 "cc_reg_operand" "y,y")
13460 (match_operator:SI 4
13461 "branch_positive_comparison_operator"
13463 "cc_reg_operand" "0,y")
13467 "cr%q1 %E0,%j2,%j4"
13468 [(set_attr "type" "cr_logical,delayed_cr")])
13470 ; Why is the constant -1 here, but 1 in the previous pattern?
13471 ; Because ~1 has all but the low bit set.
13473 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13474 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13475 [(not:SI (match_operator:SI 2
13476 "branch_positive_comparison_operator"
13478 "cc_reg_operand" "y,y")
13480 (match_operator:SI 4
13481 "branch_positive_comparison_operator"
13483 "cc_reg_operand" "0,y")
13487 "cr%q1 %E0,%j2,%j4"
13488 [(set_attr "type" "cr_logical,delayed_cr")])
13491 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13492 (compare:CCEQ (match_operator:SI 1
13493 "branch_positive_comparison_operator"
13495 "cc_reg_operand" "0,y")
13499 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13500 [(set_attr "type" "cr_logical,delayed_cr")])
13502 ;; If we are comparing the result of two comparisons, this can be done
13503 ;; using creqv or crxor.
13505 (define_insn_and_split ""
13506 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13507 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13508 [(match_operand 2 "cc_reg_operand" "y")
13510 (match_operator 3 "branch_comparison_operator"
13511 [(match_operand 4 "cc_reg_operand" "y")
13516 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13520 int positive_1, positive_2;
13522 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13523 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13526 operands[1] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[2]),
13527 GET_CODE (operands[1])),
13529 operands[2], const0_rtx);
13530 else if (GET_MODE (operands[1]) != SImode)
13531 operands[1] = gen_rtx (GET_CODE (operands[1]),
13533 operands[2], const0_rtx);
13536 operands[3] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[4]),
13537 GET_CODE (operands[3])),
13539 operands[4], const0_rtx);
13540 else if (GET_MODE (operands[3]) != SImode)
13541 operands[3] = gen_rtx (GET_CODE (operands[3]),
13543 operands[4], const0_rtx);
13545 if (positive_1 == positive_2)
13547 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13548 operands[5] = constm1_rtx;
13552 operands[5] = const1_rtx;
13556 ;; Unconditional branch and return.
13558 (define_insn "jump"
13560 (label_ref (match_operand 0 "" "")))]
13563 [(set_attr "type" "branch")])
13565 (define_insn "return"
13569 [(set_attr "type" "jmpreg")])
13571 (define_expand "indirect_jump"
13572 [(set (pc) (match_operand 0 "register_operand" ""))]
13577 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13579 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13583 (define_insn "indirect_jumpsi"
13584 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13589 [(set_attr "type" "jmpreg")])
13591 (define_insn "indirect_jumpdi"
13592 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13597 [(set_attr "type" "jmpreg")])
13599 ;; Table jump for switch statements:
13600 (define_expand "tablejump"
13601 [(use (match_operand 0 "" ""))
13602 (use (label_ref (match_operand 1 "" "")))]
13607 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13609 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13613 (define_expand "tablejumpsi"
13614 [(set (match_dup 3)
13615 (plus:SI (match_operand:SI 0 "" "")
13617 (parallel [(set (pc) (match_dup 3))
13618 (use (label_ref (match_operand 1 "" "")))])]
13621 { operands[0] = force_reg (SImode, operands[0]);
13622 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13623 operands[3] = gen_reg_rtx (SImode);
13626 (define_expand "tablejumpdi"
13627 [(set (match_dup 4)
13628 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13630 (plus:DI (match_dup 4)
13632 (parallel [(set (pc) (match_dup 3))
13633 (use (label_ref (match_operand 1 "" "")))])]
13636 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13637 operands[3] = gen_reg_rtx (DImode);
13638 operands[4] = gen_reg_rtx (DImode);
13643 (match_operand:SI 0 "register_operand" "c,*l"))
13644 (use (label_ref (match_operand 1 "" "")))]
13649 [(set_attr "type" "jmpreg")])
13653 (match_operand:DI 0 "register_operand" "c,*l"))
13654 (use (label_ref (match_operand 1 "" "")))]
13659 [(set_attr "type" "jmpreg")])
13664 "{cror 0,0,0|nop}")
13666 ;; Define the subtract-one-and-jump insns, starting with the template
13667 ;; so loop.c knows what to generate.
13669 (define_expand "doloop_end"
13670 [(use (match_operand 0 "" "")) ; loop pseudo
13671 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13672 (use (match_operand 2 "" "")) ; max iterations
13673 (use (match_operand 3 "" "")) ; loop level
13674 (use (match_operand 4 "" ""))] ; label
13678 /* Only use this on innermost loops. */
13679 if (INTVAL (operands[3]) > 1)
13681 if (TARGET_POWERPC64)
13683 if (GET_MODE (operands[0]) != DImode)
13685 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13689 if (GET_MODE (operands[0]) != SImode)
13691 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13696 (define_expand "ctrsi"
13697 [(parallel [(set (pc)
13698 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13700 (label_ref (match_operand 1 "" ""))
13703 (plus:SI (match_dup 0)
13705 (clobber (match_scratch:CC 2 ""))
13706 (clobber (match_scratch:SI 3 ""))])]
13707 "! TARGET_POWERPC64"
13710 (define_expand "ctrdi"
13711 [(parallel [(set (pc)
13712 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13714 (label_ref (match_operand 1 "" ""))
13717 (plus:DI (match_dup 0)
13719 (clobber (match_scratch:CC 2 ""))
13720 (clobber (match_scratch:DI 3 ""))])]
13724 ;; We need to be able to do this for any operand, including MEM, or we
13725 ;; will cause reload to blow up since we don't allow output reloads on
13727 ;; For the length attribute to be calculated correctly, the
13728 ;; label MUST be operand 0.
13730 (define_insn "*ctrsi_internal1"
13732 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13734 (label_ref (match_operand 0 "" ""))
13736 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13737 (plus:SI (match_dup 1)
13739 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13740 (clobber (match_scratch:SI 4 "=X,X,r"))]
13741 "! TARGET_POWERPC64"
13744 if (which_alternative != 0)
13746 else if (get_attr_length (insn) == 4)
13747 return \"{bdn|bdnz} %l0\";
13749 return \"bdz $+8\;b %l0\";
13751 [(set_attr "type" "branch")
13752 (set_attr "length" "4,12,16")])
13754 (define_insn "*ctrsi_internal2"
13756 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13759 (label_ref (match_operand 0 "" ""))))
13760 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13761 (plus:SI (match_dup 1)
13763 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13764 (clobber (match_scratch:SI 4 "=X,X,r"))]
13765 "! TARGET_POWERPC64"
13768 if (which_alternative != 0)
13770 else if (get_attr_length (insn) == 4)
13771 return \"bdz %l0\";
13773 return \"{bdn|bdnz} $+8\;b %l0\";
13775 [(set_attr "type" "branch")
13776 (set_attr "length" "4,12,16")])
13778 (define_insn "*ctrdi_internal1"
13780 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
13782 (label_ref (match_operand 0 "" ""))
13784 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13785 (plus:DI (match_dup 1)
13787 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13788 (clobber (match_scratch:DI 4 "=X,X,r"))]
13792 if (which_alternative != 0)
13794 else if (get_attr_length (insn) == 4)
13795 return \"{bdn|bdnz} %l0\";
13797 return \"bdz $+8\;b %l0\";
13799 [(set_attr "type" "branch")
13800 (set_attr "length" "4,12,16")])
13802 (define_insn "*ctrdi_internal2"
13804 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
13807 (label_ref (match_operand 0 "" ""))))
13808 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13809 (plus:DI (match_dup 1)
13811 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13812 (clobber (match_scratch:DI 4 "=X,X,r"))]
13816 if (which_alternative != 0)
13818 else if (get_attr_length (insn) == 4)
13819 return \"bdz %l0\";
13821 return \"{bdn|bdnz} $+8\;b %l0\";
13823 [(set_attr "type" "branch")
13824 (set_attr "length" "4,12,16")])
13826 ;; Similar, but we can use GE since we have a REG_NONNEG.
13828 (define_insn "*ctrsi_internal3"
13830 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13832 (label_ref (match_operand 0 "" ""))
13834 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13835 (plus:SI (match_dup 1)
13837 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13838 (clobber (match_scratch:SI 4 "=X,X,r"))]
13839 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13842 if (which_alternative != 0)
13844 else if (get_attr_length (insn) == 4)
13845 return \"{bdn|bdnz} %l0\";
13847 return \"bdz $+8\;b %l0\";
13849 [(set_attr "type" "branch")
13850 (set_attr "length" "4,12,16")])
13852 (define_insn "*ctrsi_internal4"
13854 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13857 (label_ref (match_operand 0 "" ""))))
13858 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13859 (plus:SI (match_dup 1)
13861 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13862 (clobber (match_scratch:SI 4 "=X,X,r"))]
13863 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13866 if (which_alternative != 0)
13868 else if (get_attr_length (insn) == 4)
13869 return \"bdz %l0\";
13871 return \"{bdn|bdnz} $+8\;b %l0\";
13873 [(set_attr "type" "branch")
13874 (set_attr "length" "4,12,16")])
13876 (define_insn "*ctrdi_internal3"
13878 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
13880 (label_ref (match_operand 0 "" ""))
13882 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13883 (plus:DI (match_dup 1)
13885 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13886 (clobber (match_scratch:DI 4 "=X,X,r"))]
13887 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13890 if (which_alternative != 0)
13892 else if (get_attr_length (insn) == 4)
13893 return \"{bdn|bdnz} %l0\";
13895 return \"bdz $+8\;b %l0\";
13897 [(set_attr "type" "branch")
13898 (set_attr "length" "4,12,16")])
13900 (define_insn "*ctrdi_internal4"
13902 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
13905 (label_ref (match_operand 0 "" ""))))
13906 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13907 (plus:DI (match_dup 1)
13909 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13910 (clobber (match_scratch:DI 4 "=X,X,r"))]
13911 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13914 if (which_alternative != 0)
13916 else if (get_attr_length (insn) == 4)
13917 return \"bdz %l0\";
13919 return \"{bdn|bdnz} $+8\;b %l0\";
13921 [(set_attr "type" "branch")
13922 (set_attr "length" "4,12,16")])
13924 ;; Similar but use EQ
13926 (define_insn "*ctrsi_internal5"
13928 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13930 (label_ref (match_operand 0 "" ""))
13932 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13933 (plus:SI (match_dup 1)
13935 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13936 (clobber (match_scratch:SI 4 "=X,X,r"))]
13937 "! TARGET_POWERPC64"
13940 if (which_alternative != 0)
13942 else if (get_attr_length (insn) == 4)
13943 return \"bdz %l0\";
13945 return \"{bdn|bdnz} $+8\;b %l0\";
13947 [(set_attr "type" "branch")
13948 (set_attr "length" "4,12,16")])
13950 (define_insn "*ctrsi_internal6"
13952 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13955 (label_ref (match_operand 0 "" ""))))
13956 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13957 (plus:SI (match_dup 1)
13959 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13960 (clobber (match_scratch:SI 4 "=X,X,r"))]
13961 "! TARGET_POWERPC64"
13964 if (which_alternative != 0)
13966 else if (get_attr_length (insn) == 4)
13967 return \"{bdn|bdnz} %l0\";
13969 return \"bdz $+8\;b %l0\";
13971 [(set_attr "type" "branch")
13972 (set_attr "length" "4,12,16")])
13974 (define_insn "*ctrdi_internal5"
13976 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
13978 (label_ref (match_operand 0 "" ""))
13980 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13981 (plus:DI (match_dup 1)
13983 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13984 (clobber (match_scratch:DI 4 "=X,X,r"))]
13988 if (which_alternative != 0)
13990 else if (get_attr_length (insn) == 4)
13991 return \"bdz %l0\";
13993 return \"{bdn|bdnz} $+8\;b %l0\";
13995 [(set_attr "type" "branch")
13996 (set_attr "length" "4,12,16")])
13998 (define_insn "*ctrdi_internal6"
14000 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
14003 (label_ref (match_operand 0 "" ""))))
14004 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14005 (plus:DI (match_dup 1)
14007 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14008 (clobber (match_scratch:DI 4 "=X,X,r"))]
14012 if (which_alternative != 0)
14014 else if (get_attr_length (insn) == 4)
14015 return \"{bdn|bdnz} %l0\";
14017 return \"bdz $+8\;b %l0\";
14019 [(set_attr "type" "branch")
14020 (set_attr "length" "4,12,16")])
14022 ;; Now the splitters if we could not allocate the CTR register
14026 (if_then_else (match_operator 2 "comparison_operator"
14027 [(match_operand:SI 1 "gpc_reg_operand" "")
14029 (match_operand 5 "" "")
14030 (match_operand 6 "" "")))
14031 (set (match_operand:SI 0 "gpc_reg_operand" "")
14032 (plus:SI (match_dup 1)
14034 (clobber (match_scratch:CC 3 ""))
14035 (clobber (match_scratch:SI 4 ""))]
14036 "! TARGET_POWERPC64 && reload_completed"
14037 [(parallel [(set (match_dup 3)
14038 (compare:CC (plus:SI (match_dup 1)
14042 (plus:SI (match_dup 1)
14044 (set (pc) (if_then_else (match_dup 7)
14048 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14053 (if_then_else (match_operator 2 "comparison_operator"
14054 [(match_operand:SI 1 "gpc_reg_operand" "")
14056 (match_operand 5 "" "")
14057 (match_operand 6 "" "")))
14058 (set (match_operand:SI 0 "nonimmediate_operand" "")
14059 (plus:SI (match_dup 1) (const_int -1)))
14060 (clobber (match_scratch:CC 3 ""))
14061 (clobber (match_scratch:SI 4 ""))]
14062 "! TARGET_POWERPC64 && reload_completed
14063 && ! gpc_reg_operand (operands[0], SImode)"
14064 [(parallel [(set (match_dup 3)
14065 (compare:CC (plus:SI (match_dup 1)
14069 (plus:SI (match_dup 1)
14073 (set (pc) (if_then_else (match_dup 7)
14077 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14081 (if_then_else (match_operator 2 "comparison_operator"
14082 [(match_operand:DI 1 "gpc_reg_operand" "")
14084 (match_operand 5 "" "")
14085 (match_operand 6 "" "")))
14086 (set (match_operand:DI 0 "gpc_reg_operand" "")
14087 (plus:DI (match_dup 1)
14089 (clobber (match_scratch:CC 3 ""))
14090 (clobber (match_scratch:DI 4 ""))]
14091 "TARGET_POWERPC64 && reload_completed"
14092 [(parallel [(set (match_dup 3)
14093 (compare:CC (plus:DI (match_dup 1)
14097 (plus:DI (match_dup 1)
14099 (set (pc) (if_then_else (match_dup 7)
14103 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14108 (if_then_else (match_operator 2 "comparison_operator"
14109 [(match_operand:DI 1 "gpc_reg_operand" "")
14111 (match_operand 5 "" "")
14112 (match_operand 6 "" "")))
14113 (set (match_operand:DI 0 "nonimmediate_operand" "")
14114 (plus:DI (match_dup 1) (const_int -1)))
14115 (clobber (match_scratch:CC 3 ""))
14116 (clobber (match_scratch:DI 4 ""))]
14117 "TARGET_POWERPC64 && reload_completed
14118 && ! gpc_reg_operand (operands[0], DImode)"
14119 [(parallel [(set (match_dup 3)
14120 (compare:CC (plus:DI (match_dup 1)
14124 (plus:DI (match_dup 1)
14128 (set (pc) (if_then_else (match_dup 7)
14132 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14136 (define_insn "trap"
14137 [(trap_if (const_int 1) (const_int 0))]
14141 (define_expand "conditional_trap"
14142 [(trap_if (match_operator 0 "trap_comparison_operator"
14143 [(match_dup 2) (match_dup 3)])
14144 (match_operand 1 "const_int_operand" ""))]
14146 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14147 operands[2] = rs6000_compare_op0;
14148 operands[3] = rs6000_compare_op1;")
14151 [(trap_if (match_operator 0 "trap_comparison_operator"
14152 [(match_operand:SI 1 "register_operand" "r")
14153 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14156 "{t|tw}%V0%I2 %1,%2")
14159 [(trap_if (match_operator 0 "trap_comparison_operator"
14160 [(match_operand:DI 1 "register_operand" "r")
14161 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14166 ;; Insns related to generating the function prologue and epilogue.
14168 (define_expand "prologue"
14169 [(use (const_int 0))]
14170 "TARGET_SCHED_PROLOG"
14173 rs6000_emit_prologue ();
14177 (define_insn "movesi_from_cr"
14178 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14179 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14180 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)] 19))]
14183 [(set_attr "type" "mfcr")])
14185 (define_insn "*stmw"
14186 [(match_parallel 0 "stmw_operation"
14187 [(set (match_operand:SI 1 "memory_operand" "=m")
14188 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14190 "{stm|stmw} %2,%1")
14192 (define_insn "*save_fpregs_si"
14193 [(match_parallel 0 "any_operand"
14194 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14195 (use (match_operand:SI 2 "call_operand" "s"))
14196 (set (match_operand:DF 3 "memory_operand" "=m")
14197 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14201 (define_insn "*save_fpregs_di"
14202 [(match_parallel 0 "any_operand"
14203 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14204 (use (match_operand:DI 2 "call_operand" "s"))
14205 (set (match_operand:DF 3 "memory_operand" "=m")
14206 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14210 ; These are to explain that changes to the stack pointer should
14211 ; not be moved over stores to stack memory.
14212 (define_insn "stack_tie"
14213 [(set (match_operand:BLK 0 "memory_operand" "+m")
14214 (unspec:BLK [(match_dup 0)] 5))]
14217 [(set_attr "length" "0")])
14220 (define_expand "epilogue"
14221 [(use (const_int 0))]
14222 "TARGET_SCHED_PROLOG"
14225 rs6000_emit_epilogue (FALSE);
14229 ; On some processors, doing the mtcrf one CC register at a time is
14230 ; faster (like on the 604e). On others, doing them all at once is
14231 ; faster; for instance, on the 601 and 750.
14233 (define_expand "movsi_to_cr_one"
14234 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14235 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14236 (match_dup 2)] 20))]
14238 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14240 (define_insn "*movsi_to_cr"
14241 [(match_parallel 0 "mtcrf_operation"
14242 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14243 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14244 (match_operand 3 "immediate_operand" "n")]
14251 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14252 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14253 operands[4] = GEN_INT (mask);
14254 return \"mtcrf %4,%2\";
14256 [(set_attr "type" "mtcr")])
14258 (define_insn "*mtcrfsi"
14259 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14260 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14261 (match_operand 2 "immediate_operand" "n")] 20))]
14262 "GET_CODE (operands[0]) == REG
14263 && CR_REGNO_P (REGNO (operands[0]))
14264 && GET_CODE (operands[2]) == CONST_INT
14265 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14267 [(set_attr "type" "mtcr")])
14269 ; The load-multiple instructions have similar properties.
14270 ; Note that "load_multiple" is a name known to the machine-independent
14271 ; code that actually corresponds to the powerpc load-string.
14273 (define_insn "*lmw"
14274 [(match_parallel 0 "lmw_operation"
14275 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14276 (match_operand:SI 2 "memory_operand" "m"))])]
14280 (define_insn "*return_internal_si"
14282 (use (match_operand:SI 0 "register_operand" "lc"))]
14285 [(set_attr "type" "jmpreg")])
14287 (define_insn "*return_internal_di"
14289 (use (match_operand:DI 0 "register_operand" "lc"))]
14292 [(set_attr "type" "jmpreg")])
14294 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14295 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14297 (define_insn "*return_and_restore_fpregs_si"
14298 [(match_parallel 0 "any_operand"
14300 (use (match_operand:SI 1 "register_operand" "l"))
14301 (use (match_operand:SI 2 "call_operand" "s"))
14302 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14303 (match_operand:DF 4 "memory_operand" "m"))])]
14307 (define_insn "*return_and_restore_fpregs_di"
14308 [(match_parallel 0 "any_operand"
14310 (use (match_operand:DI 1 "register_operand" "l"))
14311 (use (match_operand:DI 2 "call_operand" "s"))
14312 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14313 (match_operand:DF 4 "memory_operand" "m"))])]
14317 ; This is used in compiling the unwind routines.
14318 (define_expand "eh_return"
14319 [(use (match_operand 0 "general_operand" ""))
14320 (use (match_operand 1 "general_operand" ""))]
14325 rs6000_emit_eh_toc_restore (operands[0]);
14328 emit_insn (gen_eh_set_lr_si (operands[1]));
14330 emit_insn (gen_eh_set_lr_di (operands[1]));
14331 emit_move_insn (EH_RETURN_STACKADJ_RTX, operands[0]);
14335 ; We can't expand this before we know where the link register is stored.
14336 (define_insn "eh_set_lr_si"
14337 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] 9)
14338 (clobber (match_scratch:SI 1 "=&b"))]
14342 (define_insn "eh_set_lr_di"
14343 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 9)
14344 (clobber (match_scratch:DI 1 "=&b"))]
14349 [(unspec_volatile [(match_operand 0 "register_operand" "")] 9)
14350 (clobber (match_scratch 1 ""))]
14355 rs6000_stack_t *info = rs6000_stack_info ();
14357 if (info->lr_save_p)
14359 rtx frame_rtx = stack_pointer_rtx;
14363 if (frame_pointer_needed
14364 || current_function_calls_alloca
14365 || info->total_size > 32767)
14367 emit_move_insn (operands[1], gen_rtx_MEM (Pmode, frame_rtx));
14368 frame_rtx = operands[1];
14370 else if (info->push_p)
14371 sp_offset = info->total_size;
14373 tmp = plus_constant (frame_rtx, info->lr_save_offset + sp_offset);
14374 tmp = gen_rtx_MEM (Pmode, tmp);
14375 emit_move_insn (tmp, operands[0]);
14378 emit_move_insn (gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM), operands[0]);
14382 (define_insn "prefetch"
14383 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14384 (match_operand:SI 1 "const_int_operand" "n")
14385 (match_operand:SI 2 "const_int_operand" "n"))]
14389 if (GET_CODE (operands[0]) == REG)
14390 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14391 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14393 [(set_attr "type" "load")])
14395 (include "altivec.md")