1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 2, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 ;; MA 02110-1301, USA.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
31 [(UNSPEC_FRSP 0) ; frsp for POWER machines
32 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
33 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
34 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
36 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
42 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
43 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
46 (UNSPEC_MOVESI_FROM_CR 19)
47 (UNSPEC_MOVESI_TO_CR 20)
49 (UNSPEC_TLSDTPRELHA 22)
50 (UNSPEC_TLSDTPRELLO 23)
51 (UNSPEC_TLSGOTDTPREL 24)
53 (UNSPEC_TLSTPRELHA 26)
54 (UNSPEC_TLSTPRELLO 27)
55 (UNSPEC_TLSGOTTPREL 28)
57 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
58 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
74 (UNSPEC_DLMZB_STRLEN 47)
78 ;; UNSPEC_VOLATILE usage
83 (UNSPECV_LL 1) ; load-locked
84 (UNSPECV_SC 2) ; store-conditional
85 (UNSPECV_EH_RR 9) ; eh_reg_restore
88 ;; Define an insn type attribute. This is used in function unit delay
90 (define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr"
91 (const_string "integer"))
94 ; '(pc)' in the following doesn't include the instruction itself; it is
95 ; calculated as if the instruction had zero size.
96 (define_attr "length" ""
97 (if_then_else (eq_attr "type" "branch")
98 (if_then_else (and (ge (minus (match_dup 0) (pc))
100 (lt (minus (match_dup 0) (pc))
106 ;; Processor type -- this attribute must exactly match the processor_type
107 ;; enumeration in rs6000.h.
109 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell"
110 (const (symbol_ref "rs6000_cpu_attr")))
113 ;; If this instruction is microcoded on the CELL processor
114 ; The default for load and stores is conditional
115 ; The default for load extended and the recorded instructions is always microcoded
116 (define_attr "cell_micro" "not,conditional,always"
117 (if_then_else (ior (ior (eq_attr "type" "load")
118 (eq_attr "type" "store"))
119 (ior (eq_attr "type" "fpload")
120 (eq_attr "type" "fpstore")))
121 (const_string "conditional")
122 (if_then_else (ior (eq_attr "type" "load_ext")
123 (ior (eq_attr "type" "compare")
124 (eq_attr "type" "delayed_compare")))
125 (const_string "always")
126 (const_string "not"))))
129 (automata_option "ndfa")
142 (include "power4.md")
143 (include "power5.md")
144 (include "power6.md")
147 (include "predicates.md")
148 (include "constraints.md")
150 (include "darwin.md")
155 ; This mode macro allows :GPR to be used to indicate the allowable size
156 ; of whole values in GPRs.
157 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
159 ; Any supported integer mode.
160 (define_mode_macro INT [QI HI SI DI TI])
162 ; Any supported integer mode that fits in one register.
163 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
165 ; extend modes for DImode
166 (define_mode_macro QHSI [QI HI SI])
168 ; SImode or DImode, even if DImode doesn't fit in GPRs.
169 (define_mode_macro SDI [SI DI])
171 ; The size of a pointer. Also, the size of the value that a record-condition
172 ; (one with a '.') will compare.
173 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
175 ; Any hardware-supported floating-point mode
176 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
177 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
178 (TF "!TARGET_IEEEQUAD
180 && (TARGET_FPRS || TARGET_E500_DOUBLE)
181 && TARGET_LONG_DOUBLE_128")])
183 ; Various instructions that come in SI and DI forms.
184 ; A generic w/d attribute, for things like cmpw/cmpd.
185 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
188 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
191 ;; Start with fixed-point load and store insns. Here we put only the more
192 ;; complex forms. Basic data transfer is done later.
194 (define_expand "zero_extend<mode>di2"
195 [(set (match_operand:DI 0 "gpc_reg_operand" "")
196 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
200 (define_insn "*zero_extend<mode>di2_internal1"
201 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
202 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
206 rldicl %0,%1,0,<dbits>"
207 [(set_attr "type" "load,*")])
209 (define_insn "*zero_extend<mode>di2_internal2"
210 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
211 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
213 (clobber (match_scratch:DI 2 "=r,r"))]
216 rldicl. %2,%1,0,<dbits>
218 [(set_attr "type" "compare")
219 (set_attr "length" "4,8")])
222 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
223 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
225 (clobber (match_scratch:DI 2 ""))]
226 "TARGET_POWERPC64 && reload_completed"
228 (zero_extend:DI (match_dup 1)))
230 (compare:CC (match_dup 2)
234 (define_insn "*zero_extend<mode>di2_internal3"
235 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
236 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
238 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
239 (zero_extend:DI (match_dup 1)))]
242 rldicl. %0,%1,0,<dbits>
244 [(set_attr "type" "compare")
245 (set_attr "length" "4,8")])
248 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
249 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
251 (set (match_operand:DI 0 "gpc_reg_operand" "")
252 (zero_extend:DI (match_dup 1)))]
253 "TARGET_POWERPC64 && reload_completed"
255 (zero_extend:DI (match_dup 1)))
257 (compare:CC (match_dup 0)
261 (define_insn "extendqidi2"
262 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
263 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
266 [(set_attr "type" "exts")])
269 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
270 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
272 (clobber (match_scratch:DI 2 "=r,r"))]
277 [(set_attr "type" "compare")
278 (set_attr "length" "4,8")])
281 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
282 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
284 (clobber (match_scratch:DI 2 ""))]
285 "TARGET_POWERPC64 && reload_completed"
287 (sign_extend:DI (match_dup 1)))
289 (compare:CC (match_dup 2)
294 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
295 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
297 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
298 (sign_extend:DI (match_dup 1)))]
303 [(set_attr "type" "compare")
304 (set_attr "length" "4,8")])
307 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
308 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
310 (set (match_operand:DI 0 "gpc_reg_operand" "")
311 (sign_extend:DI (match_dup 1)))]
312 "TARGET_POWERPC64 && reload_completed"
314 (sign_extend:DI (match_dup 1)))
316 (compare:CC (match_dup 0)
320 (define_expand "extendhidi2"
321 [(set (match_operand:DI 0 "gpc_reg_operand" "")
322 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
327 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
328 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
333 [(set_attr "type" "load_ext,exts")])
336 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
337 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
339 (clobber (match_scratch:DI 2 "=r,r"))]
344 [(set_attr "type" "compare")
345 (set_attr "length" "4,8")])
348 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
349 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
351 (clobber (match_scratch:DI 2 ""))]
352 "TARGET_POWERPC64 && reload_completed"
354 (sign_extend:DI (match_dup 1)))
356 (compare:CC (match_dup 2)
361 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
362 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
364 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
365 (sign_extend:DI (match_dup 1)))]
370 [(set_attr "type" "compare")
371 (set_attr "length" "4,8")])
374 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
375 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
377 (set (match_operand:DI 0 "gpc_reg_operand" "")
378 (sign_extend:DI (match_dup 1)))]
379 "TARGET_POWERPC64 && reload_completed"
381 (sign_extend:DI (match_dup 1)))
383 (compare:CC (match_dup 0)
387 (define_expand "extendsidi2"
388 [(set (match_operand:DI 0 "gpc_reg_operand" "")
389 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
394 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
395 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
400 [(set_attr "type" "load_ext,exts")])
403 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
404 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
406 (clobber (match_scratch:DI 2 "=r,r"))]
411 [(set_attr "type" "compare")
412 (set_attr "length" "4,8")])
415 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
416 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
418 (clobber (match_scratch:DI 2 ""))]
419 "TARGET_POWERPC64 && reload_completed"
421 (sign_extend:DI (match_dup 1)))
423 (compare:CC (match_dup 2)
428 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
429 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
431 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
432 (sign_extend:DI (match_dup 1)))]
437 [(set_attr "type" "compare")
438 (set_attr "length" "4,8")])
441 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
442 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
444 (set (match_operand:DI 0 "gpc_reg_operand" "")
445 (sign_extend:DI (match_dup 1)))]
446 "TARGET_POWERPC64 && reload_completed"
448 (sign_extend:DI (match_dup 1)))
450 (compare:CC (match_dup 0)
454 (define_expand "zero_extendqisi2"
455 [(set (match_operand:SI 0 "gpc_reg_operand" "")
456 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
461 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
462 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
466 {rlinm|rlwinm} %0,%1,0,0xff"
467 [(set_attr "type" "load,*")])
470 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
471 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
473 (clobber (match_scratch:SI 2 "=r,r"))]
476 {andil.|andi.} %2,%1,0xff
478 [(set_attr "type" "compare")
479 (set_attr "length" "4,8")])
482 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
483 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
485 (clobber (match_scratch:SI 2 ""))]
488 (zero_extend:SI (match_dup 1)))
490 (compare:CC (match_dup 2)
495 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
496 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
498 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
499 (zero_extend:SI (match_dup 1)))]
502 {andil.|andi.} %0,%1,0xff
504 [(set_attr "type" "compare")
505 (set_attr "length" "4,8")])
508 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
509 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
511 (set (match_operand:SI 0 "gpc_reg_operand" "")
512 (zero_extend:SI (match_dup 1)))]
515 (zero_extend:SI (match_dup 1)))
517 (compare:CC (match_dup 0)
521 (define_expand "extendqisi2"
522 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
523 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
528 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
529 else if (TARGET_POWER)
530 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
532 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
536 (define_insn "extendqisi2_ppc"
537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
538 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
541 [(set_attr "type" "exts")])
544 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
545 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
547 (clobber (match_scratch:SI 2 "=r,r"))]
552 [(set_attr "type" "compare")
553 (set_attr "length" "4,8")])
556 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
557 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
559 (clobber (match_scratch:SI 2 ""))]
560 "TARGET_POWERPC && reload_completed"
562 (sign_extend:SI (match_dup 1)))
564 (compare:CC (match_dup 2)
569 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
570 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
572 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
573 (sign_extend:SI (match_dup 1)))]
578 [(set_attr "type" "compare")
579 (set_attr "length" "4,8")])
582 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
583 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
585 (set (match_operand:SI 0 "gpc_reg_operand" "")
586 (sign_extend:SI (match_dup 1)))]
587 "TARGET_POWERPC && reload_completed"
589 (sign_extend:SI (match_dup 1)))
591 (compare:CC (match_dup 0)
595 (define_expand "extendqisi2_power"
596 [(parallel [(set (match_dup 2)
597 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
599 (clobber (scratch:SI))])
600 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
601 (ashiftrt:SI (match_dup 2)
603 (clobber (scratch:SI))])]
606 { operands[1] = gen_lowpart (SImode, operands[1]);
607 operands[2] = gen_reg_rtx (SImode); }")
609 (define_expand "extendqisi2_no_power"
611 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
613 (set (match_operand:SI 0 "gpc_reg_operand" "")
614 (ashiftrt:SI (match_dup 2)
616 "! TARGET_POWER && ! TARGET_POWERPC"
618 { operands[1] = gen_lowpart (SImode, operands[1]);
619 operands[2] = gen_reg_rtx (SImode); }")
621 (define_expand "zero_extendqihi2"
622 [(set (match_operand:HI 0 "gpc_reg_operand" "")
623 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
628 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
629 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
633 {rlinm|rlwinm} %0,%1,0,0xff"
634 [(set_attr "type" "load,*")])
637 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
638 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
640 (clobber (match_scratch:HI 2 "=r,r"))]
643 {andil.|andi.} %2,%1,0xff
645 [(set_attr "type" "compare")
646 (set_attr "length" "4,8")])
649 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
650 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
652 (clobber (match_scratch:HI 2 ""))]
655 (zero_extend:HI (match_dup 1)))
657 (compare:CC (match_dup 2)
662 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
663 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
665 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
666 (zero_extend:HI (match_dup 1)))]
669 {andil.|andi.} %0,%1,0xff
671 [(set_attr "type" "compare")
672 (set_attr "length" "4,8")])
675 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
676 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
678 (set (match_operand:HI 0 "gpc_reg_operand" "")
679 (zero_extend:HI (match_dup 1)))]
682 (zero_extend:HI (match_dup 1)))
684 (compare:CC (match_dup 0)
688 (define_expand "extendqihi2"
689 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
690 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
695 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
696 else if (TARGET_POWER)
697 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
699 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
703 (define_insn "extendqihi2_ppc"
704 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
705 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
708 [(set_attr "type" "exts")])
711 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
712 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
714 (clobber (match_scratch:HI 2 "=r,r"))]
719 [(set_attr "type" "compare")
720 (set_attr "length" "4,8")])
723 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
724 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
726 (clobber (match_scratch:HI 2 ""))]
727 "TARGET_POWERPC && reload_completed"
729 (sign_extend:HI (match_dup 1)))
731 (compare:CC (match_dup 2)
736 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
737 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
739 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
740 (sign_extend:HI (match_dup 1)))]
745 [(set_attr "type" "compare")
746 (set_attr "length" "4,8")])
749 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
750 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
752 (set (match_operand:HI 0 "gpc_reg_operand" "")
753 (sign_extend:HI (match_dup 1)))]
754 "TARGET_POWERPC && reload_completed"
756 (sign_extend:HI (match_dup 1)))
758 (compare:CC (match_dup 0)
762 (define_expand "extendqihi2_power"
763 [(parallel [(set (match_dup 2)
764 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
766 (clobber (scratch:SI))])
767 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
768 (ashiftrt:SI (match_dup 2)
770 (clobber (scratch:SI))])]
773 { operands[0] = gen_lowpart (SImode, operands[0]);
774 operands[1] = gen_lowpart (SImode, operands[1]);
775 operands[2] = gen_reg_rtx (SImode); }")
777 (define_expand "extendqihi2_no_power"
779 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
781 (set (match_operand:HI 0 "gpc_reg_operand" "")
782 (ashiftrt:SI (match_dup 2)
784 "! TARGET_POWER && ! TARGET_POWERPC"
786 { operands[0] = gen_lowpart (SImode, operands[0]);
787 operands[1] = gen_lowpart (SImode, operands[1]);
788 operands[2] = gen_reg_rtx (SImode); }")
790 (define_expand "zero_extendhisi2"
791 [(set (match_operand:SI 0 "gpc_reg_operand" "")
792 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
797 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
798 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
802 {rlinm|rlwinm} %0,%1,0,0xffff"
803 [(set_attr "type" "load,*")])
806 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
807 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
809 (clobber (match_scratch:SI 2 "=r,r"))]
812 {andil.|andi.} %2,%1,0xffff
814 [(set_attr "type" "compare")
815 (set_attr "length" "4,8")])
818 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
819 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
821 (clobber (match_scratch:SI 2 ""))]
824 (zero_extend:SI (match_dup 1)))
826 (compare:CC (match_dup 2)
831 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
832 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
834 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
835 (zero_extend:SI (match_dup 1)))]
838 {andil.|andi.} %0,%1,0xffff
840 [(set_attr "type" "compare")
841 (set_attr "length" "4,8")])
844 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
845 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
847 (set (match_operand:SI 0 "gpc_reg_operand" "")
848 (zero_extend:SI (match_dup 1)))]
851 (zero_extend:SI (match_dup 1)))
853 (compare:CC (match_dup 0)
857 (define_expand "extendhisi2"
858 [(set (match_operand:SI 0 "gpc_reg_operand" "")
859 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
864 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
865 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
870 [(set_attr "type" "load_ext,exts")])
873 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
874 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
876 (clobber (match_scratch:SI 2 "=r,r"))]
881 [(set_attr "type" "compare")
882 (set_attr "length" "4,8")])
885 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
886 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
888 (clobber (match_scratch:SI 2 ""))]
891 (sign_extend:SI (match_dup 1)))
893 (compare:CC (match_dup 2)
898 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
899 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
901 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
902 (sign_extend:SI (match_dup 1)))]
907 [(set_attr "type" "compare")
908 (set_attr "length" "4,8")])
910 ;; IBM 405 and 440 half-word multiplication operations.
912 (define_insn "*macchwc"
913 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
914 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
915 (match_operand:SI 2 "gpc_reg_operand" "r")
918 (match_operand:HI 1 "gpc_reg_operand" "r")))
919 (match_operand:SI 4 "gpc_reg_operand" "0"))
921 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
922 (plus:SI (mult:SI (ashiftrt:SI
930 [(set_attr "type" "imul3")])
932 (define_insn "*macchw"
933 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
934 (plus:SI (mult:SI (ashiftrt:SI
935 (match_operand:SI 2 "gpc_reg_operand" "r")
938 (match_operand:HI 1 "gpc_reg_operand" "r")))
939 (match_operand:SI 3 "gpc_reg_operand" "0")))]
942 [(set_attr "type" "imul3")])
944 (define_insn "*macchwuc"
945 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
946 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
947 (match_operand:SI 2 "gpc_reg_operand" "r")
950 (match_operand:HI 1 "gpc_reg_operand" "r")))
951 (match_operand:SI 4 "gpc_reg_operand" "0"))
953 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
954 (plus:SI (mult:SI (lshiftrt:SI
961 "macchwu. %0, %1, %2"
962 [(set_attr "type" "imul3")])
964 (define_insn "*macchwu"
965 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
966 (plus:SI (mult:SI (lshiftrt:SI
967 (match_operand:SI 2 "gpc_reg_operand" "r")
970 (match_operand:HI 1 "gpc_reg_operand" "r")))
971 (match_operand:SI 3 "gpc_reg_operand" "0")))]
974 [(set_attr "type" "imul3")])
976 (define_insn "*machhwc"
977 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
978 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
979 (match_operand:SI 1 "gpc_reg_operand" "%r")
982 (match_operand:SI 2 "gpc_reg_operand" "r")
984 (match_operand:SI 4 "gpc_reg_operand" "0"))
986 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
987 (plus:SI (mult:SI (ashiftrt:SI
996 [(set_attr "type" "imul3")])
998 (define_insn "*machhw"
999 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1000 (plus:SI (mult:SI (ashiftrt:SI
1001 (match_operand:SI 1 "gpc_reg_operand" "%r")
1004 (match_operand:SI 2 "gpc_reg_operand" "r")
1006 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1009 [(set_attr "type" "imul3")])
1011 (define_insn "*machhwuc"
1012 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1013 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1014 (match_operand:SI 1 "gpc_reg_operand" "%r")
1017 (match_operand:SI 2 "gpc_reg_operand" "r")
1019 (match_operand:SI 4 "gpc_reg_operand" "0"))
1021 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1022 (plus:SI (mult:SI (lshiftrt:SI
1030 "machhwu. %0, %1, %2"
1031 [(set_attr "type" "imul3")])
1033 (define_insn "*machhwu"
1034 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1035 (plus:SI (mult:SI (lshiftrt:SI
1036 (match_operand:SI 1 "gpc_reg_operand" "%r")
1039 (match_operand:SI 2 "gpc_reg_operand" "r")
1041 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1043 "machhwu %0, %1, %2"
1044 [(set_attr "type" "imul3")])
1046 (define_insn "*maclhwc"
1047 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1048 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1049 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1051 (match_operand:HI 2 "gpc_reg_operand" "r")))
1052 (match_operand:SI 4 "gpc_reg_operand" "0"))
1054 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1055 (plus:SI (mult:SI (sign_extend:SI
1061 "maclhw. %0, %1, %2"
1062 [(set_attr "type" "imul3")])
1064 (define_insn "*maclhw"
1065 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1066 (plus:SI (mult:SI (sign_extend:SI
1067 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1069 (match_operand:HI 2 "gpc_reg_operand" "r")))
1070 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1073 [(set_attr "type" "imul3")])
1075 (define_insn "*maclhwuc"
1076 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1077 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1078 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1080 (match_operand:HI 2 "gpc_reg_operand" "r")))
1081 (match_operand:SI 4 "gpc_reg_operand" "0"))
1083 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1084 (plus:SI (mult:SI (zero_extend:SI
1090 "maclhwu. %0, %1, %2"
1091 [(set_attr "type" "imul3")])
1093 (define_insn "*maclhwu"
1094 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1095 (plus:SI (mult:SI (zero_extend:SI
1096 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1098 (match_operand:HI 2 "gpc_reg_operand" "r")))
1099 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1101 "maclhwu %0, %1, %2"
1102 [(set_attr "type" "imul3")])
1104 (define_insn "*nmacchwc"
1105 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1106 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1107 (mult:SI (ashiftrt:SI
1108 (match_operand:SI 2 "gpc_reg_operand" "r")
1111 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1113 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1114 (minus:SI (match_dup 4)
1115 (mult:SI (ashiftrt:SI
1121 "nmacchw. %0, %1, %2"
1122 [(set_attr "type" "imul3")])
1124 (define_insn "*nmacchw"
1125 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1126 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1127 (mult:SI (ashiftrt:SI
1128 (match_operand:SI 2 "gpc_reg_operand" "r")
1131 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1133 "nmacchw %0, %1, %2"
1134 [(set_attr "type" "imul3")])
1136 (define_insn "*nmachhwc"
1137 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1138 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1139 (mult:SI (ashiftrt:SI
1140 (match_operand:SI 1 "gpc_reg_operand" "%r")
1143 (match_operand:SI 2 "gpc_reg_operand" "r")
1146 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1147 (minus:SI (match_dup 4)
1148 (mult:SI (ashiftrt:SI
1155 "nmachhw. %0, %1, %2"
1156 [(set_attr "type" "imul3")])
1158 (define_insn "*nmachhw"
1159 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1160 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1161 (mult:SI (ashiftrt:SI
1162 (match_operand:SI 1 "gpc_reg_operand" "%r")
1165 (match_operand:SI 2 "gpc_reg_operand" "r")
1168 "nmachhw %0, %1, %2"
1169 [(set_attr "type" "imul3")])
1171 (define_insn "*nmaclhwc"
1172 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1173 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1174 (mult:SI (sign_extend:SI
1175 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1177 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1179 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1180 (minus:SI (match_dup 4)
1181 (mult:SI (sign_extend:SI
1186 "nmaclhw. %0, %1, %2"
1187 [(set_attr "type" "imul3")])
1189 (define_insn "*nmaclhw"
1190 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1191 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1192 (mult:SI (sign_extend:SI
1193 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1195 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1197 "nmaclhw %0, %1, %2"
1198 [(set_attr "type" "imul3")])
1200 (define_insn "*mulchwc"
1201 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1202 (compare:CC (mult:SI (ashiftrt:SI
1203 (match_operand:SI 2 "gpc_reg_operand" "r")
1206 (match_operand:HI 1 "gpc_reg_operand" "r")))
1208 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1209 (mult:SI (ashiftrt:SI
1215 "mulchw. %0, %1, %2"
1216 [(set_attr "type" "imul3")])
1218 (define_insn "*mulchw"
1219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1220 (mult:SI (ashiftrt:SI
1221 (match_operand:SI 2 "gpc_reg_operand" "r")
1224 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1227 [(set_attr "type" "imul3")])
1229 (define_insn "*mulchwuc"
1230 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1231 (compare:CC (mult:SI (lshiftrt:SI
1232 (match_operand:SI 2 "gpc_reg_operand" "r")
1235 (match_operand:HI 1 "gpc_reg_operand" "r")))
1237 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1238 (mult:SI (lshiftrt:SI
1244 "mulchwu. %0, %1, %2"
1245 [(set_attr "type" "imul3")])
1247 (define_insn "*mulchwu"
1248 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1249 (mult:SI (lshiftrt:SI
1250 (match_operand:SI 2 "gpc_reg_operand" "r")
1253 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1255 "mulchwu %0, %1, %2"
1256 [(set_attr "type" "imul3")])
1258 (define_insn "*mulhhwc"
1259 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1260 (compare:CC (mult:SI (ashiftrt:SI
1261 (match_operand:SI 1 "gpc_reg_operand" "%r")
1264 (match_operand:SI 2 "gpc_reg_operand" "r")
1267 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1268 (mult:SI (ashiftrt:SI
1275 "mulhhw. %0, %1, %2"
1276 [(set_attr "type" "imul3")])
1278 (define_insn "*mulhhw"
1279 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1280 (mult:SI (ashiftrt:SI
1281 (match_operand:SI 1 "gpc_reg_operand" "%r")
1284 (match_operand:SI 2 "gpc_reg_operand" "r")
1288 [(set_attr "type" "imul3")])
1290 (define_insn "*mulhhwuc"
1291 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1292 (compare:CC (mult:SI (lshiftrt:SI
1293 (match_operand:SI 1 "gpc_reg_operand" "%r")
1296 (match_operand:SI 2 "gpc_reg_operand" "r")
1299 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1300 (mult:SI (lshiftrt:SI
1307 "mulhhwu. %0, %1, %2"
1308 [(set_attr "type" "imul3")])
1310 (define_insn "*mulhhwu"
1311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1312 (mult:SI (lshiftrt:SI
1313 (match_operand:SI 1 "gpc_reg_operand" "%r")
1316 (match_operand:SI 2 "gpc_reg_operand" "r")
1319 "mulhhwu %0, %1, %2"
1320 [(set_attr "type" "imul3")])
1322 (define_insn "*mullhwc"
1323 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1324 (compare:CC (mult:SI (sign_extend:SI
1325 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1327 (match_operand:HI 2 "gpc_reg_operand" "r")))
1329 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1330 (mult:SI (sign_extend:SI
1335 "mullhw. %0, %1, %2"
1336 [(set_attr "type" "imul3")])
1338 (define_insn "*mullhw"
1339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1340 (mult:SI (sign_extend:SI
1341 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1343 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1346 [(set_attr "type" "imul3")])
1348 (define_insn "*mullhwuc"
1349 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1350 (compare:CC (mult:SI (zero_extend:SI
1351 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1353 (match_operand:HI 2 "gpc_reg_operand" "r")))
1355 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1356 (mult:SI (zero_extend:SI
1361 "mullhwu. %0, %1, %2"
1362 [(set_attr "type" "imul3")])
1364 (define_insn "*mullhwu"
1365 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1366 (mult:SI (zero_extend:SI
1367 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1369 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1371 "mullhwu %0, %1, %2"
1372 [(set_attr "type" "imul3")])
1374 ;; IBM 405 and 440 string-search dlmzb instruction support.
1375 (define_insn "dlmzb"
1376 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1377 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1378 (match_operand:SI 2 "gpc_reg_operand" "r")]
1380 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1381 (unspec:SI [(match_dup 1)
1385 "dlmzb. %0, %1, %2")
1387 (define_expand "strlensi"
1388 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1389 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1390 (match_operand:QI 2 "const_int_operand" "")
1391 (match_operand 3 "const_int_operand" "")]
1392 UNSPEC_DLMZB_STRLEN))
1393 (clobber (match_scratch:CC 4 "=x"))]
1394 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1396 rtx result = operands[0];
1397 rtx src = operands[1];
1398 rtx search_char = operands[2];
1399 rtx align = operands[3];
1400 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1401 rtx loop_label, end_label, mem, cr0, cond;
1402 if (search_char != const0_rtx
1403 || GET_CODE (align) != CONST_INT
1404 || INTVAL (align) < 8)
1406 word1 = gen_reg_rtx (SImode);
1407 word2 = gen_reg_rtx (SImode);
1408 scratch_dlmzb = gen_reg_rtx (SImode);
1409 scratch_string = gen_reg_rtx (Pmode);
1410 loop_label = gen_label_rtx ();
1411 end_label = gen_label_rtx ();
1412 addr = force_reg (Pmode, XEXP (src, 0));
1413 emit_move_insn (scratch_string, addr);
1414 emit_label (loop_label);
1415 mem = change_address (src, SImode, scratch_string);
1416 emit_move_insn (word1, mem);
1417 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1418 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1419 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1420 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1421 emit_jump_insn (gen_rtx_SET (VOIDmode,
1423 gen_rtx_IF_THEN_ELSE (VOIDmode,
1429 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1430 emit_jump_insn (gen_rtx_SET (VOIDmode,
1432 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1434 emit_label (end_label);
1435 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1436 emit_insn (gen_subsi3 (result, scratch_string, addr));
1437 emit_insn (gen_subsi3 (result, result, const1_rtx));
1442 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1443 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1445 (set (match_operand:SI 0 "gpc_reg_operand" "")
1446 (sign_extend:SI (match_dup 1)))]
1449 (sign_extend:SI (match_dup 1)))
1451 (compare:CC (match_dup 0)
1455 ;; Fixed-point arithmetic insns.
1457 (define_expand "add<mode>3"
1458 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1459 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1460 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1463 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1465 if (non_short_cint_operand (operands[2], DImode))
1468 else if (GET_CODE (operands[2]) == CONST_INT
1469 && ! add_operand (operands[2], <MODE>mode))
1471 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1472 ? operands[0] : gen_reg_rtx (<MODE>mode));
1474 HOST_WIDE_INT val = INTVAL (operands[2]);
1475 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1476 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1478 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1481 /* The ordering here is important for the prolog expander.
1482 When space is allocated from the stack, adding 'low' first may
1483 produce a temporary deallocation (which would be bad). */
1484 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1485 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1490 ;; Discourage ai/addic because of carry but provide it in an alternative
1491 ;; allowing register zero as source.
1492 (define_insn "*add<mode>3_internal1"
1493 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1494 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1495 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1499 {cal %0,%2(%1)|addi %0,%1,%2}
1501 {cau|addis} %0,%1,%v2"
1502 [(set_attr "length" "4,4,4,4")])
1504 (define_insn "addsi3_high"
1505 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1506 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1507 (high:SI (match_operand 2 "" ""))))]
1508 "TARGET_MACHO && !TARGET_64BIT"
1509 "{cau|addis} %0,%1,ha16(%2)"
1510 [(set_attr "length" "4")])
1512 (define_insn "*add<mode>3_internal2"
1513 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1514 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1515 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1517 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1520 {cax.|add.} %3,%1,%2
1521 {ai.|addic.} %3,%1,%2
1524 [(set_attr "type" "fast_compare,compare,compare,compare")
1525 (set_attr "length" "4,4,8,8")])
1528 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1529 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1530 (match_operand:GPR 2 "reg_or_short_operand" ""))
1532 (clobber (match_scratch:GPR 3 ""))]
1535 (plus:GPR (match_dup 1)
1538 (compare:CC (match_dup 3)
1542 (define_insn "*add<mode>3_internal3"
1543 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1544 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1545 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1547 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1548 (plus:P (match_dup 1)
1552 {cax.|add.} %0,%1,%2
1553 {ai.|addic.} %0,%1,%2
1556 [(set_attr "type" "fast_compare,compare,compare,compare")
1557 (set_attr "length" "4,4,8,8")])
1560 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1561 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1562 (match_operand:P 2 "reg_or_short_operand" ""))
1564 (set (match_operand:P 0 "gpc_reg_operand" "")
1565 (plus:P (match_dup 1) (match_dup 2)))]
1568 (plus:P (match_dup 1)
1571 (compare:CC (match_dup 0)
1575 ;; Split an add that we can't do in one insn into two insns, each of which
1576 ;; does one 16-bit part. This is used by combine. Note that the low-order
1577 ;; add should be last in case the result gets used in an address.
1580 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1581 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1582 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1584 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1585 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1587 HOST_WIDE_INT val = INTVAL (operands[2]);
1588 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1589 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1591 operands[4] = GEN_INT (low);
1592 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1593 operands[3] = GEN_INT (rest);
1594 else if (! no_new_pseudos)
1596 operands[3] = gen_reg_rtx (DImode);
1597 emit_move_insn (operands[3], operands[2]);
1598 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1605 (define_insn "one_cmpl<mode>2"
1606 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1607 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1612 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1613 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1615 (clobber (match_scratch:P 2 "=r,r"))]
1620 [(set_attr "type" "compare")
1621 (set_attr "length" "4,8")])
1624 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1625 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1627 (clobber (match_scratch:P 2 ""))]
1630 (not:P (match_dup 1)))
1632 (compare:CC (match_dup 2)
1637 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1638 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1640 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1641 (not:P (match_dup 1)))]
1646 [(set_attr "type" "compare")
1647 (set_attr "length" "4,8")])
1650 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1651 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1653 (set (match_operand:P 0 "gpc_reg_operand" "")
1654 (not:P (match_dup 1)))]
1657 (not:P (match_dup 1)))
1659 (compare:CC (match_dup 0)
1664 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1665 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1666 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1668 "{sf%I1|subf%I1c} %0,%2,%1")
1671 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1672 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1673 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1680 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1681 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1682 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1684 (clobber (match_scratch:SI 3 "=r,r"))]
1687 {sf.|subfc.} %3,%2,%1
1689 [(set_attr "type" "compare")
1690 (set_attr "length" "4,8")])
1693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1694 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1695 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1697 (clobber (match_scratch:P 3 "=r,r"))]
1702 [(set_attr "type" "fast_compare")
1703 (set_attr "length" "4,8")])
1706 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1707 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1708 (match_operand:P 2 "gpc_reg_operand" ""))
1710 (clobber (match_scratch:P 3 ""))]
1713 (minus:P (match_dup 1)
1716 (compare:CC (match_dup 3)
1721 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1722 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1723 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1725 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1726 (minus:SI (match_dup 1) (match_dup 2)))]
1729 {sf.|subfc.} %0,%2,%1
1731 [(set_attr "type" "compare")
1732 (set_attr "length" "4,8")])
1735 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1736 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1737 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1739 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1740 (minus:P (match_dup 1)
1746 [(set_attr "type" "fast_compare")
1747 (set_attr "length" "4,8")])
1750 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1751 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1752 (match_operand:P 2 "gpc_reg_operand" ""))
1754 (set (match_operand:P 0 "gpc_reg_operand" "")
1755 (minus:P (match_dup 1)
1759 (minus:P (match_dup 1)
1762 (compare:CC (match_dup 0)
1766 (define_expand "sub<mode>3"
1767 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1768 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1769 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1773 if (GET_CODE (operands[2]) == CONST_INT)
1775 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1776 negate_rtx (<MODE>mode, operands[2])));
1781 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1782 ;; instruction and some auxiliary computations. Then we just have a single
1783 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1786 (define_expand "sminsi3"
1788 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1789 (match_operand:SI 2 "reg_or_short_operand" ""))
1791 (minus:SI (match_dup 2) (match_dup 1))))
1792 (set (match_operand:SI 0 "gpc_reg_operand" "")
1793 (minus:SI (match_dup 2) (match_dup 3)))]
1794 "TARGET_POWER || TARGET_ISEL"
1799 operands[2] = force_reg (SImode, operands[2]);
1800 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1804 operands[3] = gen_reg_rtx (SImode);
1808 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1809 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1810 (match_operand:SI 2 "reg_or_short_operand" "")))
1811 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1814 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1816 (minus:SI (match_dup 2) (match_dup 1))))
1817 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1820 (define_expand "smaxsi3"
1822 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1823 (match_operand:SI 2 "reg_or_short_operand" ""))
1825 (minus:SI (match_dup 2) (match_dup 1))))
1826 (set (match_operand:SI 0 "gpc_reg_operand" "")
1827 (plus:SI (match_dup 3) (match_dup 1)))]
1828 "TARGET_POWER || TARGET_ISEL"
1833 operands[2] = force_reg (SImode, operands[2]);
1834 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1837 operands[3] = gen_reg_rtx (SImode);
1841 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1842 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1843 (match_operand:SI 2 "reg_or_short_operand" "")))
1844 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1847 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1849 (minus:SI (match_dup 2) (match_dup 1))))
1850 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1853 (define_expand "uminsi3"
1854 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1856 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1858 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1860 (minus:SI (match_dup 4) (match_dup 3))))
1861 (set (match_operand:SI 0 "gpc_reg_operand" "")
1862 (minus:SI (match_dup 2) (match_dup 3)))]
1863 "TARGET_POWER || TARGET_ISEL"
1868 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1871 operands[3] = gen_reg_rtx (SImode);
1872 operands[4] = gen_reg_rtx (SImode);
1873 operands[5] = GEN_INT (-2147483647 - 1);
1876 (define_expand "umaxsi3"
1877 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1879 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1881 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1883 (minus:SI (match_dup 4) (match_dup 3))))
1884 (set (match_operand:SI 0 "gpc_reg_operand" "")
1885 (plus:SI (match_dup 3) (match_dup 1)))]
1886 "TARGET_POWER || TARGET_ISEL"
1891 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1894 operands[3] = gen_reg_rtx (SImode);
1895 operands[4] = gen_reg_rtx (SImode);
1896 operands[5] = GEN_INT (-2147483647 - 1);
1900 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1901 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1902 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1904 (minus:SI (match_dup 2) (match_dup 1))))]
1909 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1911 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1912 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1914 (minus:SI (match_dup 2) (match_dup 1)))
1916 (clobber (match_scratch:SI 3 "=r,r"))]
1921 [(set_attr "type" "delayed_compare")
1922 (set_attr "length" "4,8")])
1925 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1927 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1928 (match_operand:SI 2 "reg_or_short_operand" ""))
1930 (minus:SI (match_dup 2) (match_dup 1)))
1932 (clobber (match_scratch:SI 3 ""))]
1933 "TARGET_POWER && reload_completed"
1935 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1937 (minus:SI (match_dup 2) (match_dup 1))))
1939 (compare:CC (match_dup 3)
1944 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1946 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1947 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1949 (minus:SI (match_dup 2) (match_dup 1)))
1951 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1952 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1954 (minus:SI (match_dup 2) (match_dup 1))))]
1959 [(set_attr "type" "delayed_compare")
1960 (set_attr "length" "4,8")])
1963 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1965 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1966 (match_operand:SI 2 "reg_or_short_operand" ""))
1968 (minus:SI (match_dup 2) (match_dup 1)))
1970 (set (match_operand:SI 0 "gpc_reg_operand" "")
1971 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1973 (minus:SI (match_dup 2) (match_dup 1))))]
1974 "TARGET_POWER && reload_completed"
1976 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1978 (minus:SI (match_dup 2) (match_dup 1))))
1980 (compare:CC (match_dup 0)
1984 ;; We don't need abs with condition code because such comparisons should
1986 (define_expand "abssi2"
1987 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1988 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1994 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1997 else if (! TARGET_POWER)
1999 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2004 (define_insn "*abssi2_power"
2005 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2006 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2010 (define_insn_and_split "abssi2_isel"
2011 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2012 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2013 (clobber (match_scratch:SI 2 "=&b"))
2014 (clobber (match_scratch:CC 3 "=y"))]
2017 "&& reload_completed"
2018 [(set (match_dup 2) (neg:SI (match_dup 1)))
2020 (compare:CC (match_dup 1)
2023 (if_then_else:SI (ge (match_dup 3)
2029 (define_insn_and_split "abssi2_nopower"
2030 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2031 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2032 (clobber (match_scratch:SI 2 "=&r,&r"))]
2033 "! TARGET_POWER && ! TARGET_ISEL"
2035 "&& reload_completed"
2036 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2037 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2038 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2041 (define_insn "*nabs_power"
2042 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2043 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2047 (define_insn_and_split "*nabs_nopower"
2048 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2049 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2050 (clobber (match_scratch:SI 2 "=&r,&r"))]
2053 "&& reload_completed"
2054 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2055 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2056 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2059 (define_expand "neg<mode>2"
2060 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2061 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2065 (define_insn "*neg<mode>2_internal"
2066 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2067 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2072 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2073 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2075 (clobber (match_scratch:P 2 "=r,r"))]
2080 [(set_attr "type" "fast_compare")
2081 (set_attr "length" "4,8")])
2084 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2085 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2087 (clobber (match_scratch:P 2 ""))]
2090 (neg:P (match_dup 1)))
2092 (compare:CC (match_dup 2)
2097 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2098 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2100 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2101 (neg:P (match_dup 1)))]
2106 [(set_attr "type" "fast_compare")
2107 (set_attr "length" "4,8")])
2110 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2111 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2113 (set (match_operand:P 0 "gpc_reg_operand" "")
2114 (neg:P (match_dup 1)))]
2117 (neg:P (match_dup 1)))
2119 (compare:CC (match_dup 0)
2123 (define_insn "clz<mode>2"
2124 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2125 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2127 "{cntlz|cntlz<wd>} %0,%1"
2128 [(set_attr "type" "cntlz")])
2130 (define_expand "ctz<mode>2"
2132 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2133 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2135 (clobber (scratch:CC))])
2136 (set (match_dup 4) (clz:GPR (match_dup 3)))
2137 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2138 (minus:GPR (match_dup 5) (match_dup 4)))]
2141 operands[2] = gen_reg_rtx (<MODE>mode);
2142 operands[3] = gen_reg_rtx (<MODE>mode);
2143 operands[4] = gen_reg_rtx (<MODE>mode);
2144 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2147 (define_expand "ffs<mode>2"
2149 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
2150 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2152 (clobber (scratch:CC))])
2153 (set (match_dup 4) (clz:GPR (match_dup 3)))
2154 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2155 (minus:GPR (match_dup 5) (match_dup 4)))]
2158 operands[2] = gen_reg_rtx (<MODE>mode);
2159 operands[3] = gen_reg_rtx (<MODE>mode);
2160 operands[4] = gen_reg_rtx (<MODE>mode);
2161 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2164 (define_insn "popcntb<mode>2"
2165 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2166 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2171 (define_expand "popcount<mode>2"
2172 [(use (match_operand:GPR 0 "gpc_reg_operand" "=r"))
2173 (use (match_operand:GPR 1 "gpc_reg_operand" "r"))]
2176 rs6000_emit_popcount (operands[0], operands[1]);
2180 (define_expand "parity<mode>2"
2181 [(use (match_operand:GPR 0 "gpc_reg_operand" "=r"))
2182 (use (match_operand:GPR 1 "gpc_reg_operand" "r"))]
2185 rs6000_emit_parity (operands[0], operands[1]);
2189 (define_expand "mulsi3"
2190 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2191 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2192 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2197 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2199 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2203 (define_insn "mulsi3_mq"
2204 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2205 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2206 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2207 (clobber (match_scratch:SI 3 "=q,q"))]
2210 {muls|mullw} %0,%1,%2
2211 {muli|mulli} %0,%1,%2"
2213 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2214 (const_string "imul3")
2215 (match_operand:SI 2 "short_cint_operand" "")
2216 (const_string "imul2")]
2217 (const_string "imul")))])
2219 (define_insn "mulsi3_no_mq"
2220 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2221 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2222 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2225 {muls|mullw} %0,%1,%2
2226 {muli|mulli} %0,%1,%2"
2228 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2229 (const_string "imul3")
2230 (match_operand:SI 2 "short_cint_operand" "")
2231 (const_string "imul2")]
2232 (const_string "imul")))])
2234 (define_insn "*mulsi3_mq_internal1"
2235 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2236 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2237 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2239 (clobber (match_scratch:SI 3 "=r,r"))
2240 (clobber (match_scratch:SI 4 "=q,q"))]
2243 {muls.|mullw.} %3,%1,%2
2245 [(set_attr "type" "imul_compare")
2246 (set_attr "length" "4,8")])
2249 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2250 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2251 (match_operand:SI 2 "gpc_reg_operand" ""))
2253 (clobber (match_scratch:SI 3 ""))
2254 (clobber (match_scratch:SI 4 ""))]
2255 "TARGET_POWER && reload_completed"
2256 [(parallel [(set (match_dup 3)
2257 (mult:SI (match_dup 1) (match_dup 2)))
2258 (clobber (match_dup 4))])
2260 (compare:CC (match_dup 3)
2264 (define_insn "*mulsi3_no_mq_internal1"
2265 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2266 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2267 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2269 (clobber (match_scratch:SI 3 "=r,r"))]
2272 {muls.|mullw.} %3,%1,%2
2274 [(set_attr "type" "imul_compare")
2275 (set_attr "length" "4,8")])
2278 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2279 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2280 (match_operand:SI 2 "gpc_reg_operand" ""))
2282 (clobber (match_scratch:SI 3 ""))]
2283 "! TARGET_POWER && reload_completed"
2285 (mult:SI (match_dup 1) (match_dup 2)))
2287 (compare:CC (match_dup 3)
2291 (define_insn "*mulsi3_mq_internal2"
2292 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2293 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2294 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2296 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2297 (mult:SI (match_dup 1) (match_dup 2)))
2298 (clobber (match_scratch:SI 4 "=q,q"))]
2301 {muls.|mullw.} %0,%1,%2
2303 [(set_attr "type" "imul_compare")
2304 (set_attr "length" "4,8")])
2307 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2308 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2309 (match_operand:SI 2 "gpc_reg_operand" ""))
2311 (set (match_operand:SI 0 "gpc_reg_operand" "")
2312 (mult:SI (match_dup 1) (match_dup 2)))
2313 (clobber (match_scratch:SI 4 ""))]
2314 "TARGET_POWER && reload_completed"
2315 [(parallel [(set (match_dup 0)
2316 (mult:SI (match_dup 1) (match_dup 2)))
2317 (clobber (match_dup 4))])
2319 (compare:CC (match_dup 0)
2323 (define_insn "*mulsi3_no_mq_internal2"
2324 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2325 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2326 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2328 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2329 (mult:SI (match_dup 1) (match_dup 2)))]
2332 {muls.|mullw.} %0,%1,%2
2334 [(set_attr "type" "imul_compare")
2335 (set_attr "length" "4,8")])
2338 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2339 (compare:CC (mult: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 (mult:SI (match_dup 1) (match_dup 2)))]
2344 "! TARGET_POWER && reload_completed"
2346 (mult:SI (match_dup 1) (match_dup 2)))
2348 (compare:CC (match_dup 0)
2352 ;; Operand 1 is divided by operand 2; quotient goes to operand
2353 ;; 0 and remainder to operand 3.
2354 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2356 (define_expand "divmodsi4"
2357 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2358 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2359 (match_operand:SI 2 "gpc_reg_operand" "")))
2360 (set (match_operand:SI 3 "register_operand" "")
2361 (mod:SI (match_dup 1) (match_dup 2)))])]
2362 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2365 if (! TARGET_POWER && ! TARGET_POWERPC)
2367 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2368 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2369 emit_insn (gen_divss_call ());
2370 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2371 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2376 (define_insn "*divmodsi4_internal"
2377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2378 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2379 (match_operand:SI 2 "gpc_reg_operand" "r")))
2380 (set (match_operand:SI 3 "register_operand" "=q")
2381 (mod:SI (match_dup 1) (match_dup 2)))]
2384 [(set_attr "type" "idiv")])
2386 (define_expand "udiv<mode>3"
2387 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2388 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2389 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2390 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2393 if (! TARGET_POWER && ! TARGET_POWERPC)
2395 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2396 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2397 emit_insn (gen_quous_call ());
2398 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2401 else if (TARGET_POWER)
2403 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2408 (define_insn "udivsi3_mq"
2409 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2410 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2411 (match_operand:SI 2 "gpc_reg_operand" "r")))
2412 (clobber (match_scratch:SI 3 "=q"))]
2413 "TARGET_POWERPC && TARGET_POWER"
2415 [(set_attr "type" "idiv")])
2417 (define_insn "*udivsi3_no_mq"
2418 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2419 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2420 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2421 "TARGET_POWERPC && ! TARGET_POWER"
2424 (cond [(match_operand:SI 0 "" "")
2425 (const_string "idiv")]
2426 (const_string "ldiv")))])
2429 ;; For powers of two we can do srai/aze for divide and then adjust for
2430 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2431 ;; used; for PowerPC, force operands into register and do a normal divide;
2432 ;; for AIX common-mode, use quoss call on register operands.
2433 (define_expand "div<mode>3"
2434 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2435 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2436 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2440 if (GET_CODE (operands[2]) == CONST_INT
2441 && INTVAL (operands[2]) > 0
2442 && exact_log2 (INTVAL (operands[2])) >= 0)
2444 else if (TARGET_POWERPC)
2446 operands[2] = force_reg (<MODE>mode, operands[2]);
2449 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2453 else if (TARGET_POWER)
2457 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2458 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2459 emit_insn (gen_quoss_call ());
2460 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2465 (define_insn "divsi3_mq"
2466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2467 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2468 (match_operand:SI 2 "gpc_reg_operand" "r")))
2469 (clobber (match_scratch:SI 3 "=q"))]
2470 "TARGET_POWERPC && TARGET_POWER"
2472 [(set_attr "type" "idiv")])
2474 (define_insn "*div<mode>3_no_mq"
2475 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2476 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2477 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2478 "TARGET_POWERPC && ! TARGET_POWER"
2481 (cond [(match_operand:SI 0 "" "")
2482 (const_string "idiv")]
2483 (const_string "ldiv")))])
2485 (define_expand "mod<mode>3"
2486 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2487 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2488 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2496 if (GET_CODE (operands[2]) != CONST_INT
2497 || INTVAL (operands[2]) <= 0
2498 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2501 temp1 = gen_reg_rtx (<MODE>mode);
2502 temp2 = gen_reg_rtx (<MODE>mode);
2504 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2505 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2506 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2511 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2512 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2513 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2515 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2516 [(set_attr "type" "two")
2517 (set_attr "length" "8")])
2520 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2521 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2522 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2524 (clobber (match_scratch:P 3 "=r,r"))]
2527 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2529 [(set_attr "type" "compare")
2530 (set_attr "length" "8,12")])
2533 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2534 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2535 (match_operand:GPR 2 "exact_log2_cint_operand"
2538 (clobber (match_scratch:GPR 3 ""))]
2541 (div:<MODE> (match_dup 1) (match_dup 2)))
2543 (compare:CC (match_dup 3)
2548 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2549 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2550 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2552 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2553 (div:P (match_dup 1) (match_dup 2)))]
2556 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2558 [(set_attr "type" "compare")
2559 (set_attr "length" "8,12")])
2562 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2563 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2564 (match_operand:GPR 2 "exact_log2_cint_operand"
2567 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2568 (div:GPR (match_dup 1) (match_dup 2)))]
2571 (div:<MODE> (match_dup 1) (match_dup 2)))
2573 (compare:CC (match_dup 0)
2578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2581 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2583 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2584 (match_operand:SI 3 "gpc_reg_operand" "r")))
2585 (set (match_operand:SI 2 "register_operand" "=*q")
2588 (zero_extend:DI (match_dup 1)) (const_int 32))
2589 (zero_extend:DI (match_dup 4)))
2593 [(set_attr "type" "idiv")])
2595 ;; To do unsigned divide we handle the cases of the divisor looking like a
2596 ;; negative number. If it is a constant that is less than 2**31, we don't
2597 ;; have to worry about the branches. So make a few subroutines here.
2599 ;; First comes the normal case.
2600 (define_expand "udivmodsi4_normal"
2601 [(set (match_dup 4) (const_int 0))
2602 (parallel [(set (match_operand:SI 0 "" "")
2603 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2605 (zero_extend:DI (match_operand:SI 1 "" "")))
2606 (match_operand:SI 2 "" "")))
2607 (set (match_operand:SI 3 "" "")
2608 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2610 (zero_extend:DI (match_dup 1)))
2614 { operands[4] = gen_reg_rtx (SImode); }")
2616 ;; This handles the branches.
2617 (define_expand "udivmodsi4_tests"
2618 [(set (match_operand:SI 0 "" "") (const_int 0))
2619 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2620 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2621 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2622 (label_ref (match_operand:SI 4 "" "")) (pc)))
2623 (set (match_dup 0) (const_int 1))
2624 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2625 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2626 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2627 (label_ref (match_dup 4)) (pc)))]
2630 { operands[5] = gen_reg_rtx (CCUNSmode);
2631 operands[6] = gen_reg_rtx (CCmode);
2634 (define_expand "udivmodsi4"
2635 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2636 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2637 (match_operand:SI 2 "reg_or_cint_operand" "")))
2638 (set (match_operand:SI 3 "gpc_reg_operand" "")
2639 (umod:SI (match_dup 1) (match_dup 2)))])]
2647 if (! TARGET_POWERPC)
2649 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2650 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2651 emit_insn (gen_divus_call ());
2652 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2653 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2660 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2662 operands[2] = force_reg (SImode, operands[2]);
2663 label = gen_label_rtx ();
2664 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2665 operands[3], label));
2668 operands[2] = force_reg (SImode, operands[2]);
2670 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2678 ;; AIX architecture-independent common-mode multiply (DImode),
2679 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2680 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2681 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2682 ;; assumed unused if generating common-mode, so ignore.
2683 (define_insn "mulh_call"
2686 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2687 (sign_extend:DI (reg:SI 4)))
2689 (clobber (match_scratch:SI 0 "=l"))]
2690 "! TARGET_POWER && ! TARGET_POWERPC"
2692 [(set_attr "type" "imul")])
2694 (define_insn "mull_call"
2696 (mult:DI (sign_extend:DI (reg:SI 3))
2697 (sign_extend:DI (reg:SI 4))))
2698 (clobber (match_scratch:SI 0 "=l"))
2699 (clobber (reg:SI 0))]
2700 "! TARGET_POWER && ! TARGET_POWERPC"
2702 [(set_attr "type" "imul")])
2704 (define_insn "divss_call"
2706 (div:SI (reg:SI 3) (reg:SI 4)))
2708 (mod:SI (reg:SI 3) (reg:SI 4)))
2709 (clobber (match_scratch:SI 0 "=l"))
2710 (clobber (reg:SI 0))]
2711 "! TARGET_POWER && ! TARGET_POWERPC"
2713 [(set_attr "type" "idiv")])
2715 (define_insn "divus_call"
2717 (udiv:SI (reg:SI 3) (reg:SI 4)))
2719 (umod:SI (reg:SI 3) (reg:SI 4)))
2720 (clobber (match_scratch:SI 0 "=l"))
2721 (clobber (reg:SI 0))
2722 (clobber (match_scratch:CC 1 "=x"))
2723 (clobber (reg:CC 69))]
2724 "! TARGET_POWER && ! TARGET_POWERPC"
2726 [(set_attr "type" "idiv")])
2728 (define_insn "quoss_call"
2730 (div:SI (reg:SI 3) (reg:SI 4)))
2731 (clobber (match_scratch:SI 0 "=l"))]
2732 "! TARGET_POWER && ! TARGET_POWERPC"
2734 [(set_attr "type" "idiv")])
2736 (define_insn "quous_call"
2738 (udiv:SI (reg:SI 3) (reg:SI 4)))
2739 (clobber (match_scratch:SI 0 "=l"))
2740 (clobber (reg:SI 0))
2741 (clobber (match_scratch:CC 1 "=x"))
2742 (clobber (reg:CC 69))]
2743 "! TARGET_POWER && ! TARGET_POWERPC"
2745 [(set_attr "type" "idiv")])
2747 ;; Logical instructions
2748 ;; The logical instructions are mostly combined by using match_operator,
2749 ;; but the plain AND insns are somewhat different because there is no
2750 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2751 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2753 (define_insn "andsi3"
2754 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2755 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2756 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2757 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2761 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2762 {andil.|andi.} %0,%1,%b2
2763 {andiu.|andis.} %0,%1,%u2"
2764 [(set_attr "type" "*,*,compare,compare")])
2766 ;; Note to set cr's other than cr0 we do the and immediate and then
2767 ;; the test again -- this avoids a mfcr which on the higher end
2768 ;; machines causes an execution serialization
2770 (define_insn "*andsi3_internal2"
2771 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2772 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2773 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2775 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2776 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2780 {andil.|andi.} %3,%1,%b2
2781 {andiu.|andis.} %3,%1,%u2
2782 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2787 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2788 (set_attr "length" "4,4,4,4,8,8,8,8")])
2790 (define_insn "*andsi3_internal3"
2791 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2792 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2793 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2795 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2796 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2800 {andil.|andi.} %3,%1,%b2
2801 {andiu.|andis.} %3,%1,%u2
2802 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2807 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2808 (set_attr "length" "8,4,4,4,8,8,8,8")])
2811 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2812 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2813 (match_operand:GPR 2 "and_operand" ""))
2815 (clobber (match_scratch:GPR 3 ""))
2816 (clobber (match_scratch:CC 4 ""))]
2818 [(parallel [(set (match_dup 3)
2819 (and:<MODE> (match_dup 1)
2821 (clobber (match_dup 4))])
2823 (compare:CC (match_dup 3)
2827 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2828 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2831 [(set (match_operand:CC 0 "cc_reg_operand" "")
2832 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2833 (match_operand:SI 2 "gpc_reg_operand" ""))
2835 (clobber (match_scratch:SI 3 ""))
2836 (clobber (match_scratch:CC 4 ""))]
2837 "TARGET_POWERPC64 && reload_completed"
2838 [(parallel [(set (match_dup 3)
2839 (and:SI (match_dup 1)
2841 (clobber (match_dup 4))])
2843 (compare:CC (match_dup 3)
2847 (define_insn "*andsi3_internal4"
2848 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2849 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2850 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2852 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2853 (and:SI (match_dup 1)
2855 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2859 {andil.|andi.} %0,%1,%b2
2860 {andiu.|andis.} %0,%1,%u2
2861 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2866 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2867 (set_attr "length" "4,4,4,4,8,8,8,8")])
2869 (define_insn "*andsi3_internal5"
2870 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2871 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2872 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2874 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2875 (and:SI (match_dup 1)
2877 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2881 {andil.|andi.} %0,%1,%b2
2882 {andiu.|andis.} %0,%1,%u2
2883 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2888 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2889 (set_attr "length" "8,4,4,4,8,8,8,8")])
2892 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2893 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2894 (match_operand:SI 2 "and_operand" ""))
2896 (set (match_operand:SI 0 "gpc_reg_operand" "")
2897 (and:SI (match_dup 1)
2899 (clobber (match_scratch:CC 4 ""))]
2901 [(parallel [(set (match_dup 0)
2902 (and:SI (match_dup 1)
2904 (clobber (match_dup 4))])
2906 (compare:CC (match_dup 0)
2911 [(set (match_operand:CC 3 "cc_reg_operand" "")
2912 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2913 (match_operand:SI 2 "gpc_reg_operand" ""))
2915 (set (match_operand:SI 0 "gpc_reg_operand" "")
2916 (and:SI (match_dup 1)
2918 (clobber (match_scratch:CC 4 ""))]
2919 "TARGET_POWERPC64 && reload_completed"
2920 [(parallel [(set (match_dup 0)
2921 (and:SI (match_dup 1)
2923 (clobber (match_dup 4))])
2925 (compare:CC (match_dup 0)
2929 ;; Handle the PowerPC64 rlwinm corner case
2931 (define_insn_and_split "*andsi3_internal6"
2932 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2933 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2934 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2939 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2942 (rotate:SI (match_dup 0) (match_dup 5)))]
2945 int mb = extract_MB (operands[2]);
2946 int me = extract_ME (operands[2]);
2947 operands[3] = GEN_INT (me + 1);
2948 operands[5] = GEN_INT (32 - (me + 1));
2949 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2951 [(set_attr "length" "8")])
2953 (define_expand "iorsi3"
2954 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2955 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2956 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2960 if (GET_CODE (operands[2]) == CONST_INT
2961 && ! logical_operand (operands[2], SImode))
2963 HOST_WIDE_INT value = INTVAL (operands[2]);
2964 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2965 ? operands[0] : gen_reg_rtx (SImode));
2967 emit_insn (gen_iorsi3 (tmp, operands[1],
2968 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2969 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2974 (define_expand "xorsi3"
2975 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2976 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2977 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2981 if (GET_CODE (operands[2]) == CONST_INT
2982 && ! logical_operand (operands[2], SImode))
2984 HOST_WIDE_INT value = INTVAL (operands[2]);
2985 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2986 ? operands[0] : gen_reg_rtx (SImode));
2988 emit_insn (gen_xorsi3 (tmp, operands[1],
2989 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2990 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2995 (define_insn "*boolsi3_internal1"
2996 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2997 (match_operator:SI 3 "boolean_or_operator"
2998 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2999 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3003 {%q3il|%q3i} %0,%1,%b2
3004 {%q3iu|%q3is} %0,%1,%u2")
3006 (define_insn "*boolsi3_internal2"
3007 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3008 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3009 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3010 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3012 (clobber (match_scratch:SI 3 "=r,r"))]
3017 [(set_attr "type" "compare")
3018 (set_attr "length" "4,8")])
3021 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3022 (compare:CC (match_operator:SI 4 "boolean_operator"
3023 [(match_operand:SI 1 "gpc_reg_operand" "")
3024 (match_operand:SI 2 "gpc_reg_operand" "")])
3026 (clobber (match_scratch:SI 3 ""))]
3027 "TARGET_32BIT && reload_completed"
3028 [(set (match_dup 3) (match_dup 4))
3030 (compare:CC (match_dup 3)
3034 (define_insn "*boolsi3_internal3"
3035 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3036 (compare:CC (match_operator:SI 4 "boolean_operator"
3037 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3038 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3040 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3046 [(set_attr "type" "compare")
3047 (set_attr "length" "4,8")])
3050 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3051 (compare:CC (match_operator:SI 4 "boolean_operator"
3052 [(match_operand:SI 1 "gpc_reg_operand" "")
3053 (match_operand:SI 2 "gpc_reg_operand" "")])
3055 (set (match_operand:SI 0 "gpc_reg_operand" "")
3057 "TARGET_32BIT && reload_completed"
3058 [(set (match_dup 0) (match_dup 4))
3060 (compare:CC (match_dup 0)
3064 ;; Split a logical operation that we can't do in one insn into two insns,
3065 ;; each of which does one 16-bit part. This is used by combine.
3068 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3069 (match_operator:SI 3 "boolean_or_operator"
3070 [(match_operand:SI 1 "gpc_reg_operand" "")
3071 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3073 [(set (match_dup 0) (match_dup 4))
3074 (set (match_dup 0) (match_dup 5))]
3078 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3079 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3081 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3082 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3086 (define_insn "*boolcsi3_internal1"
3087 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3088 (match_operator:SI 3 "boolean_operator"
3089 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3090 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3094 (define_insn "*boolcsi3_internal2"
3095 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3096 (compare:CC (match_operator:SI 4 "boolean_operator"
3097 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3098 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3100 (clobber (match_scratch:SI 3 "=r,r"))]
3105 [(set_attr "type" "compare")
3106 (set_attr "length" "4,8")])
3109 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3110 (compare:CC (match_operator:SI 4 "boolean_operator"
3111 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3112 (match_operand:SI 2 "gpc_reg_operand" "")])
3114 (clobber (match_scratch:SI 3 ""))]
3115 "TARGET_32BIT && reload_completed"
3116 [(set (match_dup 3) (match_dup 4))
3118 (compare:CC (match_dup 3)
3122 (define_insn "*boolcsi3_internal3"
3123 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3124 (compare:CC (match_operator:SI 4 "boolean_operator"
3125 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3126 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3128 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3134 [(set_attr "type" "compare")
3135 (set_attr "length" "4,8")])
3138 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3139 (compare:CC (match_operator:SI 4 "boolean_operator"
3140 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3141 (match_operand:SI 2 "gpc_reg_operand" "")])
3143 (set (match_operand:SI 0 "gpc_reg_operand" "")
3145 "TARGET_32BIT && reload_completed"
3146 [(set (match_dup 0) (match_dup 4))
3148 (compare:CC (match_dup 0)
3152 (define_insn "*boolccsi3_internal1"
3153 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3154 (match_operator:SI 3 "boolean_operator"
3155 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3156 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3160 (define_insn "*boolccsi3_internal2"
3161 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3162 (compare:CC (match_operator:SI 4 "boolean_operator"
3163 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3164 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3166 (clobber (match_scratch:SI 3 "=r,r"))]
3171 [(set_attr "type" "compare")
3172 (set_attr "length" "4,8")])
3175 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3176 (compare:CC (match_operator:SI 4 "boolean_operator"
3177 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3178 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3180 (clobber (match_scratch:SI 3 ""))]
3181 "TARGET_32BIT && reload_completed"
3182 [(set (match_dup 3) (match_dup 4))
3184 (compare:CC (match_dup 3)
3188 (define_insn "*boolccsi3_internal3"
3189 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3190 (compare:CC (match_operator:SI 4 "boolean_operator"
3191 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3192 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3194 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3200 [(set_attr "type" "compare")
3201 (set_attr "length" "4,8")])
3204 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3205 (compare:CC (match_operator:SI 4 "boolean_operator"
3206 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3207 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3209 (set (match_operand:SI 0 "gpc_reg_operand" "")
3211 "TARGET_32BIT && reload_completed"
3212 [(set (match_dup 0) (match_dup 4))
3214 (compare:CC (match_dup 0)
3218 ;; maskir insn. We need four forms because things might be in arbitrary
3219 ;; orders. Don't define forms that only set CR fields because these
3220 ;; would modify an input register.
3222 (define_insn "*maskir_internal1"
3223 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3224 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3225 (match_operand:SI 1 "gpc_reg_operand" "0"))
3226 (and:SI (match_dup 2)
3227 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3231 (define_insn "*maskir_internal2"
3232 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3233 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3234 (match_operand:SI 1 "gpc_reg_operand" "0"))
3235 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3240 (define_insn "*maskir_internal3"
3241 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3242 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3243 (match_operand:SI 3 "gpc_reg_operand" "r"))
3244 (and:SI (not:SI (match_dup 2))
3245 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3249 (define_insn "*maskir_internal4"
3250 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3251 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3252 (match_operand:SI 2 "gpc_reg_operand" "r"))
3253 (and:SI (not:SI (match_dup 2))
3254 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3258 (define_insn "*maskir_internal5"
3259 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3261 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3262 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3263 (and:SI (match_dup 2)
3264 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3266 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3267 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3268 (and:SI (match_dup 2) (match_dup 3))))]
3273 [(set_attr "type" "compare")
3274 (set_attr "length" "4,8")])
3277 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3279 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3280 (match_operand:SI 1 "gpc_reg_operand" ""))
3281 (and:SI (match_dup 2)
3282 (match_operand:SI 3 "gpc_reg_operand" "")))
3284 (set (match_operand:SI 0 "gpc_reg_operand" "")
3285 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3286 (and:SI (match_dup 2) (match_dup 3))))]
3287 "TARGET_POWER && reload_completed"
3289 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3290 (and:SI (match_dup 2) (match_dup 3))))
3292 (compare:CC (match_dup 0)
3296 (define_insn "*maskir_internal6"
3297 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3299 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3300 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3301 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3304 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3305 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3306 (and:SI (match_dup 3) (match_dup 2))))]
3311 [(set_attr "type" "compare")
3312 (set_attr "length" "4,8")])
3315 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3317 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3318 (match_operand:SI 1 "gpc_reg_operand" ""))
3319 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3322 (set (match_operand:SI 0 "gpc_reg_operand" "")
3323 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3324 (and:SI (match_dup 3) (match_dup 2))))]
3325 "TARGET_POWER && reload_completed"
3327 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3328 (and:SI (match_dup 3) (match_dup 2))))
3330 (compare:CC (match_dup 0)
3334 (define_insn "*maskir_internal7"
3335 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3337 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3338 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3339 (and:SI (not:SI (match_dup 2))
3340 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3342 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3343 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3344 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3349 [(set_attr "type" "compare")
3350 (set_attr "length" "4,8")])
3353 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3355 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3356 (match_operand:SI 3 "gpc_reg_operand" ""))
3357 (and:SI (not:SI (match_dup 2))
3358 (match_operand:SI 1 "gpc_reg_operand" "")))
3360 (set (match_operand:SI 0 "gpc_reg_operand" "")
3361 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3362 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3363 "TARGET_POWER && reload_completed"
3365 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3366 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3368 (compare:CC (match_dup 0)
3372 (define_insn "*maskir_internal8"
3373 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3375 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3376 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3377 (and:SI (not:SI (match_dup 2))
3378 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3380 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3381 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3382 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3387 [(set_attr "type" "compare")
3388 (set_attr "length" "4,8")])
3391 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3393 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3394 (match_operand:SI 2 "gpc_reg_operand" ""))
3395 (and:SI (not:SI (match_dup 2))
3396 (match_operand:SI 1 "gpc_reg_operand" "")))
3398 (set (match_operand:SI 0 "gpc_reg_operand" "")
3399 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3400 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3401 "TARGET_POWER && reload_completed"
3403 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3404 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3406 (compare:CC (match_dup 0)
3410 ;; Rotate and shift insns, in all their variants. These support shifts,
3411 ;; field inserts and extracts, and various combinations thereof.
3412 (define_expand "insv"
3413 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3414 (match_operand:SI 1 "const_int_operand" "")
3415 (match_operand:SI 2 "const_int_operand" ""))
3416 (match_operand 3 "gpc_reg_operand" ""))]
3420 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3421 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3422 compiler if the address of the structure is taken later. Likewise, do
3423 not handle invalid E500 subregs. */
3424 if (GET_CODE (operands[0]) == SUBREG
3425 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3426 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3427 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3430 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3431 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3433 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3437 (define_insn "insvsi"
3438 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3439 (match_operand:SI 1 "const_int_operand" "i")
3440 (match_operand:SI 2 "const_int_operand" "i"))
3441 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3445 int start = INTVAL (operands[2]) & 31;
3446 int size = INTVAL (operands[1]) & 31;
3448 operands[4] = GEN_INT (32 - start - size);
3449 operands[1] = GEN_INT (start + size - 1);
3450 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3452 [(set_attr "type" "insert_word")])
3454 (define_insn "*insvsi_internal1"
3455 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3456 (match_operand:SI 1 "const_int_operand" "i")
3457 (match_operand:SI 2 "const_int_operand" "i"))
3458 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3459 (match_operand:SI 4 "const_int_operand" "i")))]
3460 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3463 int shift = INTVAL (operands[4]) & 31;
3464 int start = INTVAL (operands[2]) & 31;
3465 int size = INTVAL (operands[1]) & 31;
3467 operands[4] = GEN_INT (shift - start - size);
3468 operands[1] = GEN_INT (start + size - 1);
3469 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3471 [(set_attr "type" "insert_word")])
3473 (define_insn "*insvsi_internal2"
3474 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3475 (match_operand:SI 1 "const_int_operand" "i")
3476 (match_operand:SI 2 "const_int_operand" "i"))
3477 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3478 (match_operand:SI 4 "const_int_operand" "i")))]
3479 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3482 int shift = INTVAL (operands[4]) & 31;
3483 int start = INTVAL (operands[2]) & 31;
3484 int size = INTVAL (operands[1]) & 31;
3486 operands[4] = GEN_INT (32 - shift - start - size);
3487 operands[1] = GEN_INT (start + size - 1);
3488 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3490 [(set_attr "type" "insert_word")])
3492 (define_insn "*insvsi_internal3"
3493 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3494 (match_operand:SI 1 "const_int_operand" "i")
3495 (match_operand:SI 2 "const_int_operand" "i"))
3496 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3497 (match_operand:SI 4 "const_int_operand" "i")))]
3498 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3501 int shift = INTVAL (operands[4]) & 31;
3502 int start = INTVAL (operands[2]) & 31;
3503 int size = INTVAL (operands[1]) & 31;
3505 operands[4] = GEN_INT (32 - shift - start - size);
3506 operands[1] = GEN_INT (start + size - 1);
3507 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3509 [(set_attr "type" "insert_word")])
3511 (define_insn "*insvsi_internal4"
3512 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3513 (match_operand:SI 1 "const_int_operand" "i")
3514 (match_operand:SI 2 "const_int_operand" "i"))
3515 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3516 (match_operand:SI 4 "const_int_operand" "i")
3517 (match_operand:SI 5 "const_int_operand" "i")))]
3518 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3521 int extract_start = INTVAL (operands[5]) & 31;
3522 int extract_size = INTVAL (operands[4]) & 31;
3523 int insert_start = INTVAL (operands[2]) & 31;
3524 int insert_size = INTVAL (operands[1]) & 31;
3526 /* Align extract field with insert field */
3527 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3528 operands[1] = GEN_INT (insert_start + insert_size - 1);
3529 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3531 [(set_attr "type" "insert_word")])
3533 ;; combine patterns for rlwimi
3534 (define_insn "*insvsi_internal5"
3535 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3536 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3537 (match_operand:SI 1 "mask_operand" "i"))
3538 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3539 (match_operand:SI 2 "const_int_operand" "i"))
3540 (match_operand:SI 5 "mask_operand" "i"))))]
3541 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3544 int me = extract_ME(operands[5]);
3545 int mb = extract_MB(operands[5]);
3546 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3547 operands[2] = GEN_INT(mb);
3548 operands[1] = GEN_INT(me);
3549 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3551 [(set_attr "type" "insert_word")])
3553 (define_insn "*insvsi_internal6"
3554 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3555 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3556 (match_operand:SI 2 "const_int_operand" "i"))
3557 (match_operand:SI 5 "mask_operand" "i"))
3558 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3559 (match_operand:SI 1 "mask_operand" "i"))))]
3560 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3563 int me = extract_ME(operands[5]);
3564 int mb = extract_MB(operands[5]);
3565 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3566 operands[2] = GEN_INT(mb);
3567 operands[1] = GEN_INT(me);
3568 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3570 [(set_attr "type" "insert_word")])
3572 (define_insn "insvdi"
3573 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3574 (match_operand:SI 1 "const_int_operand" "i")
3575 (match_operand:SI 2 "const_int_operand" "i"))
3576 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3580 int start = INTVAL (operands[2]) & 63;
3581 int size = INTVAL (operands[1]) & 63;
3583 operands[1] = GEN_INT (64 - start - size);
3584 return \"rldimi %0,%3,%H1,%H2\";
3586 [(set_attr "type" "insert_dword")])
3588 (define_insn "*insvdi_internal2"
3589 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3590 (match_operand:SI 1 "const_int_operand" "i")
3591 (match_operand:SI 2 "const_int_operand" "i"))
3592 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3593 (match_operand:SI 4 "const_int_operand" "i")))]
3595 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3598 int shift = INTVAL (operands[4]) & 63;
3599 int start = (INTVAL (operands[2]) & 63) - 32;
3600 int size = INTVAL (operands[1]) & 63;
3602 operands[4] = GEN_INT (64 - shift - start - size);
3603 operands[2] = GEN_INT (start);
3604 operands[1] = GEN_INT (start + size - 1);
3605 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3608 (define_insn "*insvdi_internal3"
3609 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3610 (match_operand:SI 1 "const_int_operand" "i")
3611 (match_operand:SI 2 "const_int_operand" "i"))
3612 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3613 (match_operand:SI 4 "const_int_operand" "i")))]
3615 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3618 int shift = INTVAL (operands[4]) & 63;
3619 int start = (INTVAL (operands[2]) & 63) - 32;
3620 int size = INTVAL (operands[1]) & 63;
3622 operands[4] = GEN_INT (64 - shift - start - size);
3623 operands[2] = GEN_INT (start);
3624 operands[1] = GEN_INT (start + size - 1);
3625 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3628 (define_expand "extzv"
3629 [(set (match_operand 0 "gpc_reg_operand" "")
3630 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3631 (match_operand:SI 2 "const_int_operand" "")
3632 (match_operand:SI 3 "const_int_operand" "")))]
3636 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3637 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3638 compiler if the address of the structure is taken later. */
3639 if (GET_CODE (operands[0]) == SUBREG
3640 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3643 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3644 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3646 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3650 (define_insn "extzvsi"
3651 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3652 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3653 (match_operand:SI 2 "const_int_operand" "i")
3654 (match_operand:SI 3 "const_int_operand" "i")))]
3658 int start = INTVAL (operands[3]) & 31;
3659 int size = INTVAL (operands[2]) & 31;
3661 if (start + size >= 32)
3662 operands[3] = const0_rtx;
3664 operands[3] = GEN_INT (start + size);
3665 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3668 (define_insn "*extzvsi_internal1"
3669 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3670 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3671 (match_operand:SI 2 "const_int_operand" "i,i")
3672 (match_operand:SI 3 "const_int_operand" "i,i"))
3674 (clobber (match_scratch:SI 4 "=r,r"))]
3678 int start = INTVAL (operands[3]) & 31;
3679 int size = INTVAL (operands[2]) & 31;
3681 /* Force split for non-cc0 compare. */
3682 if (which_alternative == 1)
3685 /* If the bit-field being tested fits in the upper or lower half of a
3686 word, it is possible to use andiu. or andil. to test it. This is
3687 useful because the condition register set-use delay is smaller for
3688 andi[ul]. than for rlinm. This doesn't work when the starting bit
3689 position is 0 because the LT and GT bits may be set wrong. */
3691 if ((start > 0 && start + size <= 16) || start >= 16)
3693 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3694 - (1 << (16 - (start & 15) - size))));
3696 return \"{andiu.|andis.} %4,%1,%3\";
3698 return \"{andil.|andi.} %4,%1,%3\";
3701 if (start + size >= 32)
3702 operands[3] = const0_rtx;
3704 operands[3] = GEN_INT (start + size);
3705 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3707 [(set_attr "type" "delayed_compare")
3708 (set_attr "length" "4,8")])
3711 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3712 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3713 (match_operand:SI 2 "const_int_operand" "")
3714 (match_operand:SI 3 "const_int_operand" ""))
3716 (clobber (match_scratch:SI 4 ""))]
3719 (zero_extract:SI (match_dup 1) (match_dup 2)
3722 (compare:CC (match_dup 4)
3726 (define_insn "*extzvsi_internal2"
3727 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3728 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3729 (match_operand:SI 2 "const_int_operand" "i,i")
3730 (match_operand:SI 3 "const_int_operand" "i,i"))
3732 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3733 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3737 int start = INTVAL (operands[3]) & 31;
3738 int size = INTVAL (operands[2]) & 31;
3740 /* Force split for non-cc0 compare. */
3741 if (which_alternative == 1)
3744 /* Since we are using the output value, we can't ignore any need for
3745 a shift. The bit-field must end at the LSB. */
3746 if (start >= 16 && start + size == 32)
3748 operands[3] = GEN_INT ((1 << size) - 1);
3749 return \"{andil.|andi.} %0,%1,%3\";
3752 if (start + size >= 32)
3753 operands[3] = const0_rtx;
3755 operands[3] = GEN_INT (start + size);
3756 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3758 [(set_attr "type" "delayed_compare")
3759 (set_attr "length" "4,8")])
3762 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3763 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3764 (match_operand:SI 2 "const_int_operand" "")
3765 (match_operand:SI 3 "const_int_operand" ""))
3767 (set (match_operand:SI 0 "gpc_reg_operand" "")
3768 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3771 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3773 (compare:CC (match_dup 0)
3777 (define_insn "extzvdi"
3778 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3779 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3780 (match_operand:SI 2 "const_int_operand" "i")
3781 (match_operand:SI 3 "const_int_operand" "i")))]
3785 int start = INTVAL (operands[3]) & 63;
3786 int size = INTVAL (operands[2]) & 63;
3788 if (start + size >= 64)
3789 operands[3] = const0_rtx;
3791 operands[3] = GEN_INT (start + size);
3792 operands[2] = GEN_INT (64 - size);
3793 return \"rldicl %0,%1,%3,%2\";
3796 (define_insn "*extzvdi_internal1"
3797 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3798 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3799 (match_operand:SI 2 "const_int_operand" "i")
3800 (match_operand:SI 3 "const_int_operand" "i"))
3802 (clobber (match_scratch:DI 4 "=r"))]
3806 int start = INTVAL (operands[3]) & 63;
3807 int size = INTVAL (operands[2]) & 63;
3809 if (start + size >= 64)
3810 operands[3] = const0_rtx;
3812 operands[3] = GEN_INT (start + size);
3813 operands[2] = GEN_INT (64 - size);
3814 return \"rldicl. %4,%1,%3,%2\";
3816 [(set_attr "type" "compare")])
3818 (define_insn "*extzvdi_internal2"
3819 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3820 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3821 (match_operand:SI 2 "const_int_operand" "i")
3822 (match_operand:SI 3 "const_int_operand" "i"))
3824 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3825 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3829 int start = INTVAL (operands[3]) & 63;
3830 int size = INTVAL (operands[2]) & 63;
3832 if (start + size >= 64)
3833 operands[3] = const0_rtx;
3835 operands[3] = GEN_INT (start + size);
3836 operands[2] = GEN_INT (64 - size);
3837 return \"rldicl. %0,%1,%3,%2\";
3839 [(set_attr "type" "compare")])
3841 (define_insn "rotlsi3"
3842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3843 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3844 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3847 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3848 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3849 [(set_attr "type" "var_shift_rotate,integer")])
3851 (define_insn "*rotlsi3_internal2"
3852 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3853 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3854 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3856 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3859 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3860 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
3863 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3864 (set_attr "length" "4,4,8,8")])
3867 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3868 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3869 (match_operand:SI 2 "reg_or_cint_operand" ""))
3871 (clobber (match_scratch:SI 3 ""))]
3874 (rotate:SI (match_dup 1) (match_dup 2)))
3876 (compare:CC (match_dup 3)
3880 (define_insn "*rotlsi3_internal3"
3881 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3882 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3883 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3885 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3886 (rotate:SI (match_dup 1) (match_dup 2)))]
3889 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
3890 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
3893 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3894 (set_attr "length" "4,4,8,8")])
3897 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3898 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3899 (match_operand:SI 2 "reg_or_cint_operand" ""))
3901 (set (match_operand:SI 0 "gpc_reg_operand" "")
3902 (rotate:SI (match_dup 1) (match_dup 2)))]
3905 (rotate:SI (match_dup 1) (match_dup 2)))
3907 (compare:CC (match_dup 0)
3911 (define_insn "*rotlsi3_internal4"
3912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3913 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3914 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3915 (match_operand:SI 3 "mask_operand" "n,n")))]
3918 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
3919 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
3920 [(set_attr "type" "var_shift_rotate,integer")])
3922 (define_insn "*rotlsi3_internal5"
3923 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3925 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3926 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3927 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3929 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3932 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
3933 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3936 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3937 (set_attr "length" "4,4,8,8")])
3940 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3942 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3943 (match_operand:SI 2 "reg_or_cint_operand" ""))
3944 (match_operand:SI 3 "mask_operand" ""))
3946 (clobber (match_scratch:SI 4 ""))]
3949 (and:SI (rotate:SI (match_dup 1)
3953 (compare:CC (match_dup 4)
3957 (define_insn "*rotlsi3_internal6"
3958 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3960 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3961 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3962 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3964 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3965 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3968 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
3969 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3972 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3973 (set_attr "length" "4,4,8,8")])
3976 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3978 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3979 (match_operand:SI 2 "reg_or_cint_operand" ""))
3980 (match_operand:SI 3 "mask_operand" ""))
3982 (set (match_operand:SI 0 "gpc_reg_operand" "")
3983 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3986 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3988 (compare:CC (match_dup 0)
3992 (define_insn "*rotlsi3_internal7"
3993 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3996 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3997 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3999 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4001 (define_insn "*rotlsi3_internal8"
4002 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4003 (compare:CC (zero_extend:SI
4005 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4006 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4008 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4011 {rlnm.|rlwnm.} %3,%1,%2,0xff
4012 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4015 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4016 (set_attr "length" "4,4,8,8")])
4019 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4020 (compare:CC (zero_extend:SI
4022 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4023 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4025 (clobber (match_scratch:SI 3 ""))]
4028 (zero_extend:SI (subreg:QI
4029 (rotate:SI (match_dup 1)
4032 (compare:CC (match_dup 3)
4036 (define_insn "*rotlsi3_internal9"
4037 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4038 (compare:CC (zero_extend:SI
4040 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4041 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4043 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4044 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4047 {rlnm.|rlwnm.} %0,%1,%2,0xff
4048 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4051 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4052 (set_attr "length" "4,4,8,8")])
4055 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4056 (compare:CC (zero_extend:SI
4058 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4059 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4061 (set (match_operand:SI 0 "gpc_reg_operand" "")
4062 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4065 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4067 (compare:CC (match_dup 0)
4071 (define_insn "*rotlsi3_internal10"
4072 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4075 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4076 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4079 {rlnm|rlwnm} %0,%1,%2,0xffff
4080 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4081 [(set_attr "type" "var_shift_rotate,integer")])
4084 (define_insn "*rotlsi3_internal11"
4085 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4086 (compare:CC (zero_extend:SI
4088 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4089 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4091 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4094 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4095 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4098 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4099 (set_attr "length" "4,4,8,8")])
4102 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4103 (compare:CC (zero_extend:SI
4105 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4106 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4108 (clobber (match_scratch:SI 3 ""))]
4111 (zero_extend:SI (subreg:HI
4112 (rotate:SI (match_dup 1)
4115 (compare:CC (match_dup 3)
4119 (define_insn "*rotlsi3_internal12"
4120 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4121 (compare:CC (zero_extend:SI
4123 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4124 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4126 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4127 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4130 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4131 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4134 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4135 (set_attr "length" "4,4,8,8")])
4138 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4139 (compare:CC (zero_extend:SI
4141 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4142 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4144 (set (match_operand:SI 0 "gpc_reg_operand" "")
4145 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4148 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4150 (compare:CC (match_dup 0)
4154 ;; Note that we use "sle." instead of "sl." so that we can set
4155 ;; SHIFT_COUNT_TRUNCATED.
4157 (define_expand "ashlsi3"
4158 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4159 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4160 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4165 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4167 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4171 (define_insn "ashlsi3_power"
4172 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4173 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4174 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4175 (clobber (match_scratch:SI 3 "=q,X"))]
4179 {sli|slwi} %0,%1,%h2")
4181 (define_insn "ashlsi3_no_power"
4182 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4183 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4184 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4188 {sli|slwi} %0,%1,%h2"
4189 [(set_attr "type" "var_shift_rotate,shift")])
4192 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4193 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4194 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4196 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4197 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4201 {sli.|slwi.} %3,%1,%h2
4204 [(set_attr "type" "delayed_compare")
4205 (set_attr "length" "4,4,8,8")])
4208 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4209 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4210 (match_operand:SI 2 "reg_or_cint_operand" ""))
4212 (clobber (match_scratch:SI 3 ""))
4213 (clobber (match_scratch:SI 4 ""))]
4214 "TARGET_POWER && reload_completed"
4215 [(parallel [(set (match_dup 3)
4216 (ashift:SI (match_dup 1) (match_dup 2)))
4217 (clobber (match_dup 4))])
4219 (compare:CC (match_dup 3)
4224 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4225 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4226 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4228 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4229 "! TARGET_POWER && TARGET_32BIT"
4232 {sli.|slwi.} %3,%1,%h2
4235 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4236 (set_attr "length" "4,4,8,8")])
4239 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4240 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4241 (match_operand:SI 2 "reg_or_cint_operand" ""))
4243 (clobber (match_scratch:SI 3 ""))]
4244 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4246 (ashift:SI (match_dup 1) (match_dup 2)))
4248 (compare:CC (match_dup 3)
4253 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4254 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4255 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4257 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4258 (ashift:SI (match_dup 1) (match_dup 2)))
4259 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4263 {sli.|slwi.} %0,%1,%h2
4266 [(set_attr "type" "delayed_compare")
4267 (set_attr "length" "4,4,8,8")])
4270 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4271 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4272 (match_operand:SI 2 "reg_or_cint_operand" ""))
4274 (set (match_operand:SI 0 "gpc_reg_operand" "")
4275 (ashift:SI (match_dup 1) (match_dup 2)))
4276 (clobber (match_scratch:SI 4 ""))]
4277 "TARGET_POWER && reload_completed"
4278 [(parallel [(set (match_dup 0)
4279 (ashift:SI (match_dup 1) (match_dup 2)))
4280 (clobber (match_dup 4))])
4282 (compare:CC (match_dup 0)
4287 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4288 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4289 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4291 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4292 (ashift:SI (match_dup 1) (match_dup 2)))]
4293 "! TARGET_POWER && TARGET_32BIT"
4296 {sli.|slwi.} %0,%1,%h2
4299 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4300 (set_attr "length" "4,4,8,8")])
4303 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4304 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4305 (match_operand:SI 2 "reg_or_cint_operand" ""))
4307 (set (match_operand:SI 0 "gpc_reg_operand" "")
4308 (ashift:SI (match_dup 1) (match_dup 2)))]
4309 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4311 (ashift:SI (match_dup 1) (match_dup 2)))
4313 (compare:CC (match_dup 0)
4317 (define_insn "rlwinm"
4318 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4319 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4320 (match_operand:SI 2 "const_int_operand" "i"))
4321 (match_operand:SI 3 "mask_operand" "n")))]
4322 "includes_lshift_p (operands[2], operands[3])"
4323 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4326 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4328 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4329 (match_operand:SI 2 "const_int_operand" "i,i"))
4330 (match_operand:SI 3 "mask_operand" "n,n"))
4332 (clobber (match_scratch:SI 4 "=r,r"))]
4333 "includes_lshift_p (operands[2], operands[3])"
4335 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4337 [(set_attr "type" "delayed_compare")
4338 (set_attr "length" "4,8")])
4341 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4343 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4344 (match_operand:SI 2 "const_int_operand" ""))
4345 (match_operand:SI 3 "mask_operand" ""))
4347 (clobber (match_scratch:SI 4 ""))]
4348 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4350 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4353 (compare:CC (match_dup 4)
4358 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4360 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4361 (match_operand:SI 2 "const_int_operand" "i,i"))
4362 (match_operand:SI 3 "mask_operand" "n,n"))
4364 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4365 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4366 "includes_lshift_p (operands[2], operands[3])"
4368 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4370 [(set_attr "type" "delayed_compare")
4371 (set_attr "length" "4,8")])
4374 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4376 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4377 (match_operand:SI 2 "const_int_operand" ""))
4378 (match_operand:SI 3 "mask_operand" ""))
4380 (set (match_operand:SI 0 "gpc_reg_operand" "")
4381 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4382 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4384 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4386 (compare:CC (match_dup 0)
4390 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4392 (define_expand "lshrsi3"
4393 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4394 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4395 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4400 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4402 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4406 (define_insn "lshrsi3_power"
4407 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4408 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4409 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4410 (clobber (match_scratch:SI 3 "=q,X,X"))]
4415 {s%A2i|s%A2wi} %0,%1,%h2")
4417 (define_insn "lshrsi3_no_power"
4418 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4419 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4420 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4425 {sri|srwi} %0,%1,%h2"
4426 [(set_attr "type" "integer,var_shift_rotate,shift")])
4429 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4430 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4431 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4433 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4434 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4439 {s%A2i.|s%A2wi.} %3,%1,%h2
4443 [(set_attr "type" "delayed_compare")
4444 (set_attr "length" "4,4,4,8,8,8")])
4447 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4448 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4449 (match_operand:SI 2 "reg_or_cint_operand" ""))
4451 (clobber (match_scratch:SI 3 ""))
4452 (clobber (match_scratch:SI 4 ""))]
4453 "TARGET_POWER && reload_completed"
4454 [(parallel [(set (match_dup 3)
4455 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4456 (clobber (match_dup 4))])
4458 (compare:CC (match_dup 3)
4463 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4464 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4465 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4467 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4468 "! TARGET_POWER && TARGET_32BIT"
4472 {sri.|srwi.} %3,%1,%h2
4476 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4477 (set_attr "length" "4,4,4,8,8,8")])
4480 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4481 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4482 (match_operand:SI 2 "reg_or_cint_operand" ""))
4484 (clobber (match_scratch:SI 3 ""))]
4485 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4487 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4489 (compare:CC (match_dup 3)
4494 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4495 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4496 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4498 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4499 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4500 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4505 {s%A2i.|s%A2wi.} %0,%1,%h2
4509 [(set_attr "type" "delayed_compare")
4510 (set_attr "length" "4,4,4,8,8,8")])
4513 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4514 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4515 (match_operand:SI 2 "reg_or_cint_operand" ""))
4517 (set (match_operand:SI 0 "gpc_reg_operand" "")
4518 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4519 (clobber (match_scratch:SI 4 ""))]
4520 "TARGET_POWER && reload_completed"
4521 [(parallel [(set (match_dup 0)
4522 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4523 (clobber (match_dup 4))])
4525 (compare:CC (match_dup 0)
4530 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4531 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4532 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4534 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4535 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4536 "! TARGET_POWER && TARGET_32BIT"
4540 {sri.|srwi.} %0,%1,%h2
4544 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4545 (set_attr "length" "4,4,4,8,8,8")])
4548 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4549 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4550 (match_operand:SI 2 "reg_or_cint_operand" ""))
4552 (set (match_operand:SI 0 "gpc_reg_operand" "")
4553 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4554 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4556 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4558 (compare:CC (match_dup 0)
4563 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4564 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4565 (match_operand:SI 2 "const_int_operand" "i"))
4566 (match_operand:SI 3 "mask_operand" "n")))]
4567 "includes_rshift_p (operands[2], operands[3])"
4568 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4571 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4573 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4574 (match_operand:SI 2 "const_int_operand" "i,i"))
4575 (match_operand:SI 3 "mask_operand" "n,n"))
4577 (clobber (match_scratch:SI 4 "=r,r"))]
4578 "includes_rshift_p (operands[2], operands[3])"
4580 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4582 [(set_attr "type" "delayed_compare")
4583 (set_attr "length" "4,8")])
4586 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4588 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4589 (match_operand:SI 2 "const_int_operand" ""))
4590 (match_operand:SI 3 "mask_operand" ""))
4592 (clobber (match_scratch:SI 4 ""))]
4593 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4595 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4598 (compare:CC (match_dup 4)
4603 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4605 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4606 (match_operand:SI 2 "const_int_operand" "i,i"))
4607 (match_operand:SI 3 "mask_operand" "n,n"))
4609 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4610 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4611 "includes_rshift_p (operands[2], operands[3])"
4613 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4615 [(set_attr "type" "delayed_compare")
4616 (set_attr "length" "4,8")])
4619 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4621 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4622 (match_operand:SI 2 "const_int_operand" ""))
4623 (match_operand:SI 3 "mask_operand" ""))
4625 (set (match_operand:SI 0 "gpc_reg_operand" "")
4626 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4627 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4629 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4631 (compare:CC (match_dup 0)
4636 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4639 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4640 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4641 "includes_rshift_p (operands[2], GEN_INT (255))"
4642 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4645 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4649 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4650 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4652 (clobber (match_scratch:SI 3 "=r,r"))]
4653 "includes_rshift_p (operands[2], GEN_INT (255))"
4655 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4657 [(set_attr "type" "delayed_compare")
4658 (set_attr "length" "4,8")])
4661 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4665 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4666 (match_operand:SI 2 "const_int_operand" "")) 0))
4668 (clobber (match_scratch:SI 3 ""))]
4669 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4671 (zero_extend:SI (subreg:QI
4672 (lshiftrt:SI (match_dup 1)
4675 (compare:CC (match_dup 3)
4680 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4684 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4685 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4687 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4688 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4689 "includes_rshift_p (operands[2], GEN_INT (255))"
4691 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4693 [(set_attr "type" "delayed_compare")
4694 (set_attr "length" "4,8")])
4697 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4701 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4702 (match_operand:SI 2 "const_int_operand" "")) 0))
4704 (set (match_operand:SI 0 "gpc_reg_operand" "")
4705 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4706 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4708 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4710 (compare:CC (match_dup 0)
4715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4718 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4719 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4720 "includes_rshift_p (operands[2], GEN_INT (65535))"
4721 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4724 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4728 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4729 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4731 (clobber (match_scratch:SI 3 "=r,r"))]
4732 "includes_rshift_p (operands[2], GEN_INT (65535))"
4734 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4736 [(set_attr "type" "delayed_compare")
4737 (set_attr "length" "4,8")])
4740 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4744 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4745 (match_operand:SI 2 "const_int_operand" "")) 0))
4747 (clobber (match_scratch:SI 3 ""))]
4748 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4750 (zero_extend:SI (subreg:HI
4751 (lshiftrt:SI (match_dup 1)
4754 (compare:CC (match_dup 3)
4759 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4763 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4764 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4766 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4767 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4768 "includes_rshift_p (operands[2], GEN_INT (65535))"
4770 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4772 [(set_attr "type" "delayed_compare")
4773 (set_attr "length" "4,8")])
4776 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4780 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4781 (match_operand:SI 2 "const_int_operand" "")) 0))
4783 (set (match_operand:SI 0 "gpc_reg_operand" "")
4784 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4785 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4787 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4789 (compare:CC (match_dup 0)
4794 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4796 (match_operand:SI 1 "gpc_reg_operand" "r"))
4797 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4803 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4805 (match_operand:SI 1 "gpc_reg_operand" "r"))
4806 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4812 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4814 (match_operand:SI 1 "gpc_reg_operand" "r"))
4815 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4821 (define_expand "ashrsi3"
4822 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4823 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4824 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4829 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4831 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4835 (define_insn "ashrsi3_power"
4836 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4837 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4838 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4839 (clobber (match_scratch:SI 3 "=q,X"))]
4843 {srai|srawi} %0,%1,%h2"
4844 [(set_attr "type" "shift")])
4846 (define_insn "ashrsi3_no_power"
4847 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4848 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4849 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4853 {srai|srawi} %0,%1,%h2"
4854 [(set_attr "type" "var_shift_rotate,shift")])
4857 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4858 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4859 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4861 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4862 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4866 {srai.|srawi.} %3,%1,%h2
4869 [(set_attr "type" "delayed_compare")
4870 (set_attr "length" "4,4,8,8")])
4873 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4874 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4875 (match_operand:SI 2 "reg_or_cint_operand" ""))
4877 (clobber (match_scratch:SI 3 ""))
4878 (clobber (match_scratch:SI 4 ""))]
4879 "TARGET_POWER && reload_completed"
4880 [(parallel [(set (match_dup 3)
4881 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4882 (clobber (match_dup 4))])
4884 (compare:CC (match_dup 3)
4889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4890 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4891 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4893 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4896 {sra.|sraw.} %3,%1,%2
4897 {srai.|srawi.} %3,%1,%h2
4900 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4901 (set_attr "length" "4,4,8,8")])
4904 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4905 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4906 (match_operand:SI 2 "reg_or_cint_operand" ""))
4908 (clobber (match_scratch:SI 3 ""))]
4909 "! TARGET_POWER && reload_completed"
4911 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4913 (compare:CC (match_dup 3)
4918 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4919 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4920 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4922 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4923 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4924 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4928 {srai.|srawi.} %0,%1,%h2
4931 [(set_attr "type" "delayed_compare")
4932 (set_attr "length" "4,4,8,8")])
4935 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4936 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4937 (match_operand:SI 2 "reg_or_cint_operand" ""))
4939 (set (match_operand:SI 0 "gpc_reg_operand" "")
4940 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4941 (clobber (match_scratch:SI 4 ""))]
4942 "TARGET_POWER && reload_completed"
4943 [(parallel [(set (match_dup 0)
4944 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4945 (clobber (match_dup 4))])
4947 (compare:CC (match_dup 0)
4952 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4953 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4954 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4956 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4957 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4960 {sra.|sraw.} %0,%1,%2
4961 {srai.|srawi.} %0,%1,%h2
4964 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4965 (set_attr "length" "4,4,8,8")])
4968 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4969 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4970 (match_operand:SI 2 "reg_or_cint_operand" ""))
4972 (set (match_operand:SI 0 "gpc_reg_operand" "")
4973 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4974 "! TARGET_POWER && reload_completed"
4976 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4978 (compare:CC (match_dup 0)
4982 ;; Floating-point insns, excluding normal data motion.
4984 ;; PowerPC has a full set of single-precision floating point instructions.
4986 ;; For the POWER architecture, we pretend that we have both SFmode and
4987 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4988 ;; The only conversions we will do will be when storing to memory. In that
4989 ;; case, we will use the "frsp" instruction before storing.
4991 ;; Note that when we store into a single-precision memory location, we need to
4992 ;; use the frsp insn first. If the register being stored isn't dead, we
4993 ;; need a scratch register for the frsp. But this is difficult when the store
4994 ;; is done by reload. It is not incorrect to do the frsp on the register in
4995 ;; this case, we just lose precision that we would have otherwise gotten but
4996 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4998 (define_expand "extendsfdf2"
4999 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5000 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5001 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5004 (define_insn_and_split "*extendsfdf2_fpr"
5005 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
5006 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5007 "TARGET_HARD_FLOAT && TARGET_FPRS"
5012 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5015 emit_note (NOTE_INSN_DELETED);
5018 [(set_attr "type" "fp,fp,fpload")])
5020 (define_expand "truncdfsf2"
5021 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5022 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5023 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5026 (define_insn "*truncdfsf2_fpr"
5027 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5028 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5029 "TARGET_HARD_FLOAT && TARGET_FPRS"
5031 [(set_attr "type" "fp")])
5033 (define_insn "aux_truncdfsf2"
5034 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5035 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5036 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5038 [(set_attr "type" "fp")])
5040 (define_expand "negsf2"
5041 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5042 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5046 (define_insn "*negsf2"
5047 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5048 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5049 "TARGET_HARD_FLOAT && TARGET_FPRS"
5051 [(set_attr "type" "fp")])
5053 (define_expand "abssf2"
5054 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5055 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5059 (define_insn "*abssf2"
5060 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5061 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5062 "TARGET_HARD_FLOAT && TARGET_FPRS"
5064 [(set_attr "type" "fp")])
5067 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5068 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5069 "TARGET_HARD_FLOAT && TARGET_FPRS"
5071 [(set_attr "type" "fp")])
5073 (define_expand "addsf3"
5074 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5075 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5076 (match_operand:SF 2 "gpc_reg_operand" "")))]
5081 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5082 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5083 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5084 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5086 [(set_attr "type" "fp")])
5089 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5090 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5091 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5092 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5093 "{fa|fadd} %0,%1,%2"
5094 [(set_attr "type" "fp")])
5096 (define_expand "subsf3"
5097 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5098 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5099 (match_operand:SF 2 "gpc_reg_operand" "")))]
5104 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5105 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5106 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5107 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5109 [(set_attr "type" "fp")])
5112 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5113 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5114 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5115 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5116 "{fs|fsub} %0,%1,%2"
5117 [(set_attr "type" "fp")])
5119 (define_expand "mulsf3"
5120 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5121 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5122 (match_operand:SF 2 "gpc_reg_operand" "")))]
5127 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5128 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5129 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5130 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5132 [(set_attr "type" "fp")])
5135 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5136 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5137 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5138 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5139 "{fm|fmul} %0,%1,%2"
5140 [(set_attr "type" "dmul")])
5143 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5144 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5145 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5147 [(set_attr "type" "fp")])
5149 (define_expand "divsf3"
5150 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5151 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5152 (match_operand:SF 2 "gpc_reg_operand" "")))]
5155 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
5156 && flag_finite_math_only && !flag_trapping_math)
5158 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5164 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5165 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5166 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5167 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5169 [(set_attr "type" "sdiv")])
5172 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5173 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5174 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5175 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5176 "{fd|fdiv} %0,%1,%2"
5177 [(set_attr "type" "ddiv")])
5180 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5181 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5182 (match_operand:SF 2 "gpc_reg_operand" "f"))
5183 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5184 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5185 "fmadds %0,%1,%2,%3"
5186 [(set_attr "type" "fp")])
5189 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5190 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5191 (match_operand:SF 2 "gpc_reg_operand" "f"))
5192 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5193 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5194 "{fma|fmadd} %0,%1,%2,%3"
5195 [(set_attr "type" "dmul")])
5198 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5199 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5200 (match_operand:SF 2 "gpc_reg_operand" "f"))
5201 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5202 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5203 "fmsubs %0,%1,%2,%3"
5204 [(set_attr "type" "fp")])
5207 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5208 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5209 (match_operand:SF 2 "gpc_reg_operand" "f"))
5210 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5211 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5212 "{fms|fmsub} %0,%1,%2,%3"
5213 [(set_attr "type" "dmul")])
5216 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5217 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5218 (match_operand:SF 2 "gpc_reg_operand" "f"))
5219 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5220 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5221 && HONOR_SIGNED_ZEROS (SFmode)"
5222 "fnmadds %0,%1,%2,%3"
5223 [(set_attr "type" "fp")])
5226 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5227 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5228 (match_operand:SF 2 "gpc_reg_operand" "f"))
5229 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5230 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5231 && ! HONOR_SIGNED_ZEROS (SFmode)"
5232 "fnmadds %0,%1,%2,%3"
5233 [(set_attr "type" "fp")])
5236 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5237 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5238 (match_operand:SF 2 "gpc_reg_operand" "f"))
5239 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5240 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5241 "{fnma|fnmadd} %0,%1,%2,%3"
5242 [(set_attr "type" "dmul")])
5245 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5246 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5247 (match_operand:SF 2 "gpc_reg_operand" "f"))
5248 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5249 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5250 && ! HONOR_SIGNED_ZEROS (SFmode)"
5251 "{fnma|fnmadd} %0,%1,%2,%3"
5252 [(set_attr "type" "dmul")])
5255 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5256 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5257 (match_operand:SF 2 "gpc_reg_operand" "f"))
5258 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5259 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5260 && HONOR_SIGNED_ZEROS (SFmode)"
5261 "fnmsubs %0,%1,%2,%3"
5262 [(set_attr "type" "fp")])
5265 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5266 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5267 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5268 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5269 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5270 && ! HONOR_SIGNED_ZEROS (SFmode)"
5271 "fnmsubs %0,%1,%2,%3"
5272 [(set_attr "type" "fp")])
5275 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5276 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5277 (match_operand:SF 2 "gpc_reg_operand" "f"))
5278 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5279 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5280 "{fnms|fnmsub} %0,%1,%2,%3"
5281 [(set_attr "type" "dmul")])
5284 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5285 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5286 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5287 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5288 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5289 && ! HONOR_SIGNED_ZEROS (SFmode)"
5290 "{fnms|fnmsub} %0,%1,%2,%3"
5291 [(set_attr "type" "dmul")])
5293 (define_expand "sqrtsf2"
5294 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5295 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5296 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5300 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5301 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5302 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5304 [(set_attr "type" "ssqrt")])
5307 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5308 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5309 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5311 [(set_attr "type" "dsqrt")])
5313 (define_expand "copysignsf3"
5315 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5317 (neg:SF (abs:SF (match_dup 1))))
5318 (set (match_operand:SF 0 "gpc_reg_operand" "")
5319 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5323 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5324 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5326 operands[3] = gen_reg_rtx (SFmode);
5327 operands[4] = gen_reg_rtx (SFmode);
5328 operands[5] = CONST0_RTX (SFmode);
5331 (define_expand "copysigndf3"
5333 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5335 (neg:DF (abs:DF (match_dup 1))))
5336 (set (match_operand:DF 0 "gpc_reg_operand" "")
5337 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5341 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5342 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5344 operands[3] = gen_reg_rtx (DFmode);
5345 operands[4] = gen_reg_rtx (DFmode);
5346 operands[5] = CONST0_RTX (DFmode);
5349 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5350 ;; fsel instruction and some auxiliary computations. Then we just have a
5351 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5353 (define_expand "smaxsf3"
5354 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5355 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5356 (match_operand:SF 2 "gpc_reg_operand" ""))
5359 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5360 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5362 (define_expand "sminsf3"
5363 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5364 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5365 (match_operand:SF 2 "gpc_reg_operand" ""))
5368 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5369 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5372 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5373 (match_operator:SF 3 "min_max_operator"
5374 [(match_operand:SF 1 "gpc_reg_operand" "")
5375 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5376 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5379 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5380 operands[1], operands[2]);
5384 (define_expand "movsicc"
5385 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5386 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5387 (match_operand:SI 2 "gpc_reg_operand" "")
5388 (match_operand:SI 3 "gpc_reg_operand" "")))]
5392 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5398 ;; We use the BASE_REGS for the isel input operands because, if rA is
5399 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5400 ;; because we may switch the operands and rB may end up being rA.
5402 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5403 ;; leave out the mode in operand 4 and use one pattern, but reload can
5404 ;; change the mode underneath our feet and then gets confused trying
5405 ;; to reload the value.
5406 (define_insn "isel_signed"
5407 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5409 (match_operator 1 "comparison_operator"
5410 [(match_operand:CC 4 "cc_reg_operand" "y")
5412 (match_operand:SI 2 "gpc_reg_operand" "b")
5413 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5416 { return output_isel (operands); }"
5417 [(set_attr "length" "4")])
5419 (define_insn "isel_unsigned"
5420 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5422 (match_operator 1 "comparison_operator"
5423 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5425 (match_operand:SI 2 "gpc_reg_operand" "b")
5426 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5429 { return output_isel (operands); }"
5430 [(set_attr "length" "4")])
5432 (define_expand "movsfcc"
5433 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5434 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5435 (match_operand:SF 2 "gpc_reg_operand" "")
5436 (match_operand:SF 3 "gpc_reg_operand" "")))]
5437 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5440 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5446 (define_insn "*fselsfsf4"
5447 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5448 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5449 (match_operand:SF 4 "zero_fp_constant" "F"))
5450 (match_operand:SF 2 "gpc_reg_operand" "f")
5451 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5452 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5454 [(set_attr "type" "fp")])
5456 (define_insn "*fseldfsf4"
5457 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5458 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5459 (match_operand:DF 4 "zero_fp_constant" "F"))
5460 (match_operand:SF 2 "gpc_reg_operand" "f")
5461 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5462 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5464 [(set_attr "type" "fp")])
5466 (define_expand "negdf2"
5467 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5468 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5469 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5472 (define_insn "*negdf2_fpr"
5473 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5474 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5475 "TARGET_HARD_FLOAT && TARGET_FPRS"
5477 [(set_attr "type" "fp")])
5479 (define_expand "absdf2"
5480 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5481 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5482 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5485 (define_insn "*absdf2_fpr"
5486 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5487 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5488 "TARGET_HARD_FLOAT && TARGET_FPRS"
5490 [(set_attr "type" "fp")])
5492 (define_insn "*nabsdf2_fpr"
5493 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5494 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5495 "TARGET_HARD_FLOAT && TARGET_FPRS"
5497 [(set_attr "type" "fp")])
5499 (define_expand "adddf3"
5500 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5501 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5502 (match_operand:DF 2 "gpc_reg_operand" "")))]
5503 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5506 (define_insn "*adddf3_fpr"
5507 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5508 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5509 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5510 "TARGET_HARD_FLOAT && TARGET_FPRS"
5511 "{fa|fadd} %0,%1,%2"
5512 [(set_attr "type" "fp")])
5514 (define_expand "subdf3"
5515 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5516 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5517 (match_operand:DF 2 "gpc_reg_operand" "")))]
5518 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5521 (define_insn "*subdf3_fpr"
5522 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5523 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5524 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5525 "TARGET_HARD_FLOAT && TARGET_FPRS"
5526 "{fs|fsub} %0,%1,%2"
5527 [(set_attr "type" "fp")])
5529 (define_expand "muldf3"
5530 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5531 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5532 (match_operand:DF 2 "gpc_reg_operand" "")))]
5533 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5536 (define_insn "*muldf3_fpr"
5537 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5538 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5539 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5540 "TARGET_HARD_FLOAT && TARGET_FPRS"
5541 "{fm|fmul} %0,%1,%2"
5542 [(set_attr "type" "dmul")])
5545 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5546 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5547 "TARGET_POPCNTB && flag_finite_math_only"
5549 [(set_attr "type" "fp")])
5551 (define_expand "divdf3"
5552 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5553 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5554 (match_operand:DF 2 "gpc_reg_operand" "")))]
5555 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5557 if (swdiv && !optimize_size && TARGET_POPCNTB
5558 && flag_finite_math_only && !flag_trapping_math)
5560 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5565 (define_insn "*divdf3_fpr"
5566 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5567 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5568 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5569 "TARGET_HARD_FLOAT && TARGET_FPRS"
5570 "{fd|fdiv} %0,%1,%2"
5571 [(set_attr "type" "ddiv")])
5574 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5575 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5576 (match_operand:DF 2 "gpc_reg_operand" "f"))
5577 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5578 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5579 "{fma|fmadd} %0,%1,%2,%3"
5580 [(set_attr "type" "dmul")])
5583 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5584 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5585 (match_operand:DF 2 "gpc_reg_operand" "f"))
5586 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5587 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5588 "{fms|fmsub} %0,%1,%2,%3"
5589 [(set_attr "type" "dmul")])
5592 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5593 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5594 (match_operand:DF 2 "gpc_reg_operand" "f"))
5595 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5596 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5597 && HONOR_SIGNED_ZEROS (DFmode)"
5598 "{fnma|fnmadd} %0,%1,%2,%3"
5599 [(set_attr "type" "dmul")])
5602 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5603 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5604 (match_operand:DF 2 "gpc_reg_operand" "f"))
5605 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5606 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5607 && ! HONOR_SIGNED_ZEROS (DFmode)"
5608 "{fnma|fnmadd} %0,%1,%2,%3"
5609 [(set_attr "type" "dmul")])
5612 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5613 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5614 (match_operand:DF 2 "gpc_reg_operand" "f"))
5615 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5616 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5617 && HONOR_SIGNED_ZEROS (DFmode)"
5618 "{fnms|fnmsub} %0,%1,%2,%3"
5619 [(set_attr "type" "dmul")])
5622 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5623 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5624 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5625 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5626 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5627 && ! HONOR_SIGNED_ZEROS (DFmode)"
5628 "{fnms|fnmsub} %0,%1,%2,%3"
5629 [(set_attr "type" "dmul")])
5631 (define_insn "sqrtdf2"
5632 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5633 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5634 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5636 [(set_attr "type" "dsqrt")])
5638 ;; The conditional move instructions allow us to perform max and min
5639 ;; operations even when
5641 (define_expand "smaxdf3"
5642 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5643 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5644 (match_operand:DF 2 "gpc_reg_operand" ""))
5647 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5648 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5650 (define_expand "smindf3"
5651 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5652 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5653 (match_operand:DF 2 "gpc_reg_operand" ""))
5656 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5657 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5660 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5661 (match_operator:DF 3 "min_max_operator"
5662 [(match_operand:DF 1 "gpc_reg_operand" "")
5663 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5664 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5667 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5668 operands[1], operands[2]);
5672 (define_expand "movdfcc"
5673 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5674 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5675 (match_operand:DF 2 "gpc_reg_operand" "")
5676 (match_operand:DF 3 "gpc_reg_operand" "")))]
5677 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5680 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5686 (define_insn "*fseldfdf4"
5687 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5688 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5689 (match_operand:DF 4 "zero_fp_constant" "F"))
5690 (match_operand:DF 2 "gpc_reg_operand" "f")
5691 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5692 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5694 [(set_attr "type" "fp")])
5696 (define_insn "*fselsfdf4"
5697 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5698 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5699 (match_operand:SF 4 "zero_fp_constant" "F"))
5700 (match_operand:DF 2 "gpc_reg_operand" "f")
5701 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5704 [(set_attr "type" "fp")])
5706 ;; Conversions to and from floating-point.
5708 (define_expand "fixuns_truncsfsi2"
5709 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5710 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5711 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5714 (define_expand "fix_truncsfsi2"
5715 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5716 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5717 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5720 ; For each of these conversions, there is a define_expand, a define_insn
5721 ; with a '#' template, and a define_split (with C code). The idea is
5722 ; to allow constant folding with the template of the define_insn,
5723 ; then to have the insns split later (between sched1 and final).
5725 (define_expand "floatsidf2"
5726 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5727 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5730 (clobber (match_dup 4))
5731 (clobber (match_dup 5))
5732 (clobber (match_dup 6))])]
5733 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5736 if (TARGET_E500_DOUBLE)
5738 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5741 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS)
5743 rtx t1 = gen_reg_rtx (DImode);
5744 emit_insn (gen_floatsidf_ppc64_mfpgpr (operands[0], operands[1], t1));
5747 if (TARGET_POWERPC64)
5749 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5750 rtx t1 = gen_reg_rtx (DImode);
5751 rtx t2 = gen_reg_rtx (DImode);
5752 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5756 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5757 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5758 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5759 operands[5] = gen_reg_rtx (DFmode);
5760 operands[6] = gen_reg_rtx (SImode);
5763 (define_insn_and_split "*floatsidf2_internal"
5764 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5765 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5766 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5767 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5768 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5769 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5770 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5771 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5773 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5777 rtx lowword, highword;
5778 gcc_assert (MEM_P (operands[4]));
5779 highword = adjust_address (operands[4], SImode, 0);
5780 lowword = adjust_address (operands[4], SImode, 4);
5781 if (! WORDS_BIG_ENDIAN)
5784 tmp = highword; highword = lowword; lowword = tmp;
5787 emit_insn (gen_xorsi3 (operands[6], operands[1],
5788 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5789 emit_move_insn (lowword, operands[6]);
5790 emit_move_insn (highword, operands[2]);
5791 emit_move_insn (operands[5], operands[4]);
5792 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5795 [(set_attr "length" "24")])
5797 (define_expand "floatunssisf2"
5798 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5799 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5800 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5803 (define_expand "floatunssidf2"
5804 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5805 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5808 (clobber (match_dup 4))
5809 (clobber (match_dup 5))])]
5810 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5813 if (TARGET_E500_DOUBLE)
5815 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5818 if (TARGET_POWERPC64)
5820 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5821 rtx t1 = gen_reg_rtx (DImode);
5822 rtx t2 = gen_reg_rtx (DImode);
5823 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5828 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5829 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5830 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5831 operands[5] = gen_reg_rtx (DFmode);
5834 (define_insn_and_split "*floatunssidf2_internal"
5835 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5836 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5837 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5838 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5839 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5840 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5841 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5843 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5847 rtx lowword, highword;
5848 gcc_assert (MEM_P (operands[4]));
5849 highword = adjust_address (operands[4], SImode, 0);
5850 lowword = adjust_address (operands[4], SImode, 4);
5851 if (! WORDS_BIG_ENDIAN)
5854 tmp = highword; highword = lowword; lowword = tmp;
5857 emit_move_insn (lowword, operands[1]);
5858 emit_move_insn (highword, operands[2]);
5859 emit_move_insn (operands[5], operands[4]);
5860 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5863 [(set_attr "length" "20")])
5865 (define_expand "fix_truncdfsi2"
5866 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5867 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5868 (clobber (match_dup 2))
5869 (clobber (match_dup 3))])]
5870 "(TARGET_POWER2 || TARGET_POWERPC)
5871 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5874 if (TARGET_E500_DOUBLE)
5876 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5879 operands[2] = gen_reg_rtx (DImode);
5880 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
5881 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
5883 operands[3] = gen_reg_rtx (DImode);
5884 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
5885 operands[2], operands[3]));
5888 if (TARGET_PPC_GFXOPT)
5890 rtx orig_dest = operands[0];
5891 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5892 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5893 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5895 if (operands[0] != orig_dest)
5896 emit_move_insn (orig_dest, operands[0]);
5899 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5902 (define_insn_and_split "*fix_truncdfsi2_internal"
5903 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5904 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5905 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5906 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5907 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5909 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5914 gcc_assert (MEM_P (operands[3]));
5915 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5917 emit_insn (gen_fctiwz (operands[2], operands[1]));
5918 emit_move_insn (operands[3], operands[2]);
5919 emit_move_insn (operands[0], lowword);
5922 [(set_attr "length" "16")])
5924 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5925 [(set (match_operand:SI 0 "memory_operand" "=Z")
5926 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5927 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5928 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5929 && TARGET_PPC_GFXOPT"
5935 emit_insn (gen_fctiwz (operands[2], operands[1]));
5936 emit_insn (gen_stfiwx (operands[0], operands[2]));
5939 [(set_attr "length" "16")])
5941 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
5942 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5943 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5944 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5945 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
5946 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
5949 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
5950 (set (match_dup 3) (match_dup 2))
5951 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
5953 [(set_attr "length" "12")])
5955 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5956 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5957 ; because the first makes it clear that operand 0 is not live
5958 ; before the instruction.
5959 (define_insn "fctiwz"
5960 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5961 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5963 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5964 "{fcirz|fctiwz} %0,%1"
5965 [(set_attr "type" "fp")])
5967 (define_insn "btruncdf2"
5968 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5969 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5970 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5972 [(set_attr "type" "fp")])
5974 (define_insn "btruncsf2"
5975 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5976 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
5977 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5979 [(set_attr "type" "fp")])
5981 (define_insn "ceildf2"
5982 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5983 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5984 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5986 [(set_attr "type" "fp")])
5988 (define_insn "ceilsf2"
5989 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5990 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
5991 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
5993 [(set_attr "type" "fp")])
5995 (define_insn "floordf2"
5996 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5997 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
5998 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6000 [(set_attr "type" "fp")])
6002 (define_insn "floorsf2"
6003 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6004 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6005 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6007 [(set_attr "type" "fp")])
6009 (define_insn "rounddf2"
6010 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6011 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6012 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6014 [(set_attr "type" "fp")])
6016 (define_insn "roundsf2"
6017 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6018 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6019 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6021 [(set_attr "type" "fp")])
6023 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6024 (define_insn "stfiwx"
6025 [(set (match_operand:SI 0 "memory_operand" "=Z")
6026 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6030 [(set_attr "type" "fpstore")])
6032 (define_expand "floatsisf2"
6033 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6034 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6035 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6038 (define_insn "floatdidf2"
6039 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6040 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
6041 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6043 [(set_attr "type" "fp")])
6045 (define_insn_and_split "floatsidf_ppc64_mfpgpr"
6046 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6047 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6048 (clobber (match_operand:DI 2 "gpc_reg_operand" "=r"))]
6049 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6052 [(set (match_dup 2) (sign_extend:DI (match_dup 1)))
6053 (set (match_dup 0) (float:DF (match_dup 2)))]
6056 (define_insn_and_split "floatsidf_ppc64"
6057 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6058 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6059 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6060 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6061 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6062 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6065 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
6066 (set (match_dup 2) (match_dup 3))
6067 (set (match_dup 4) (match_dup 2))
6068 (set (match_dup 0) (float:DF (match_dup 4)))]
6071 (define_insn_and_split "floatunssidf_ppc64"
6072 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6073 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6074 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6075 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6076 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6077 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6080 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
6081 (set (match_dup 2) (match_dup 3))
6082 (set (match_dup 4) (match_dup 2))
6083 (set (match_dup 0) (float:DF (match_dup 4)))]
6086 (define_insn "fix_truncdfdi2"
6087 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
6088 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6089 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6091 [(set_attr "type" "fp")])
6093 (define_expand "floatdisf2"
6094 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6095 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6096 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6099 rtx val = operands[1];
6100 if (!flag_unsafe_math_optimizations)
6102 rtx label = gen_label_rtx ();
6103 val = gen_reg_rtx (DImode);
6104 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6107 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6111 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6112 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6113 ;; from double rounding.
6114 (define_insn_and_split "floatdisf2_internal1"
6115 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6116 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
6117 (clobber (match_scratch:DF 2 "=f"))]
6118 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6120 "&& reload_completed"
6122 (float:DF (match_dup 1)))
6124 (float_truncate:SF (match_dup 2)))]
6127 ;; Twiddles bits to avoid double rounding.
6128 ;; Bits that might be truncated when converting to DFmode are replaced
6129 ;; by a bit that won't be lost at that stage, but is below the SFmode
6130 ;; rounding position.
6131 (define_expand "floatdisf2_internal2"
6132 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6134 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6136 (clobber (scratch:CC))])
6137 (set (match_dup 3) (plus:DI (match_dup 3)
6139 (set (match_dup 0) (plus:DI (match_dup 0)
6141 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6143 (set (match_dup 0) (ior:DI (match_dup 0)
6145 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6147 (clobber (scratch:CC))])
6148 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6149 (label_ref (match_operand:DI 2 "" ""))
6151 (set (match_dup 0) (match_dup 1))]
6152 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6155 operands[3] = gen_reg_rtx (DImode);
6156 operands[4] = gen_reg_rtx (CCUNSmode);
6159 ;; Define the DImode operations that can be done in a small number
6160 ;; of instructions. The & constraints are to prevent the register
6161 ;; allocator from allocating registers that overlap with the inputs
6162 ;; (for example, having an input in 7,8 and an output in 6,7). We
6163 ;; also allow for the output being the same as one of the inputs.
6165 (define_insn "*adddi3_noppc64"
6166 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6167 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6168 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6169 "! TARGET_POWERPC64"
6172 if (WORDS_BIG_ENDIAN)
6173 return (GET_CODE (operands[2])) != CONST_INT
6174 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6175 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6177 return (GET_CODE (operands[2])) != CONST_INT
6178 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6179 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6181 [(set_attr "type" "two")
6182 (set_attr "length" "8")])
6184 (define_insn "*subdi3_noppc64"
6185 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6186 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6187 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6188 "! TARGET_POWERPC64"
6191 if (WORDS_BIG_ENDIAN)
6192 return (GET_CODE (operands[1]) != CONST_INT)
6193 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6194 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6196 return (GET_CODE (operands[1]) != CONST_INT)
6197 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6198 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6200 [(set_attr "type" "two")
6201 (set_attr "length" "8")])
6203 (define_insn "*negdi2_noppc64"
6204 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6205 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6206 "! TARGET_POWERPC64"
6209 return (WORDS_BIG_ENDIAN)
6210 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6211 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6213 [(set_attr "type" "two")
6214 (set_attr "length" "8")])
6216 (define_expand "mulsidi3"
6217 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6218 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6219 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6220 "! TARGET_POWERPC64"
6223 if (! TARGET_POWER && ! TARGET_POWERPC)
6225 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6226 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6227 emit_insn (gen_mull_call ());
6228 if (WORDS_BIG_ENDIAN)
6229 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6232 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6233 gen_rtx_REG (SImode, 3));
6234 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6235 gen_rtx_REG (SImode, 4));
6239 else if (TARGET_POWER)
6241 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6246 (define_insn "mulsidi3_mq"
6247 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6248 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6249 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6250 (clobber (match_scratch:SI 3 "=q"))]
6252 "mul %0,%1,%2\;mfmq %L0"
6253 [(set_attr "type" "imul")
6254 (set_attr "length" "8")])
6256 (define_insn "*mulsidi3_no_mq"
6257 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6258 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6259 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6260 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6263 return (WORDS_BIG_ENDIAN)
6264 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6265 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6267 [(set_attr "type" "imul")
6268 (set_attr "length" "8")])
6271 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6272 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6273 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6274 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6277 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6278 (sign_extend:DI (match_dup 2)))
6281 (mult:SI (match_dup 1)
6285 int endian = (WORDS_BIG_ENDIAN == 0);
6286 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6287 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6290 (define_expand "umulsidi3"
6291 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6292 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6293 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6294 "TARGET_POWERPC && ! TARGET_POWERPC64"
6299 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6304 (define_insn "umulsidi3_mq"
6305 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6306 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6307 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6308 (clobber (match_scratch:SI 3 "=q"))]
6309 "TARGET_POWERPC && TARGET_POWER"
6312 return (WORDS_BIG_ENDIAN)
6313 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6314 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6316 [(set_attr "type" "imul")
6317 (set_attr "length" "8")])
6319 (define_insn "*umulsidi3_no_mq"
6320 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6321 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6322 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6323 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6326 return (WORDS_BIG_ENDIAN)
6327 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6328 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6330 [(set_attr "type" "imul")
6331 (set_attr "length" "8")])
6334 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6335 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6336 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6337 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6340 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6341 (zero_extend:DI (match_dup 2)))
6344 (mult:SI (match_dup 1)
6348 int endian = (WORDS_BIG_ENDIAN == 0);
6349 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6350 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6353 (define_expand "smulsi3_highpart"
6354 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6356 (lshiftrt:DI (mult:DI (sign_extend:DI
6357 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6359 (match_operand:SI 2 "gpc_reg_operand" "r")))
6364 if (! TARGET_POWER && ! TARGET_POWERPC)
6366 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6367 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6368 emit_insn (gen_mulh_call ());
6369 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6372 else if (TARGET_POWER)
6374 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6379 (define_insn "smulsi3_highpart_mq"
6380 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6382 (lshiftrt:DI (mult:DI (sign_extend:DI
6383 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6385 (match_operand:SI 2 "gpc_reg_operand" "r")))
6387 (clobber (match_scratch:SI 3 "=q"))]
6390 [(set_attr "type" "imul")])
6392 (define_insn "*smulsi3_highpart_no_mq"
6393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6395 (lshiftrt:DI (mult:DI (sign_extend:DI
6396 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6398 (match_operand:SI 2 "gpc_reg_operand" "r")))
6400 "TARGET_POWERPC && ! TARGET_POWER"
6402 [(set_attr "type" "imul")])
6404 (define_expand "umulsi3_highpart"
6405 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6407 (lshiftrt:DI (mult:DI (zero_extend:DI
6408 (match_operand:SI 1 "gpc_reg_operand" ""))
6410 (match_operand:SI 2 "gpc_reg_operand" "")))
6417 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6422 (define_insn "umulsi3_highpart_mq"
6423 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6425 (lshiftrt:DI (mult:DI (zero_extend:DI
6426 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6428 (match_operand:SI 2 "gpc_reg_operand" "r")))
6430 (clobber (match_scratch:SI 3 "=q"))]
6431 "TARGET_POWERPC && TARGET_POWER"
6433 [(set_attr "type" "imul")])
6435 (define_insn "*umulsi3_highpart_no_mq"
6436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6438 (lshiftrt:DI (mult:DI (zero_extend:DI
6439 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6441 (match_operand:SI 2 "gpc_reg_operand" "r")))
6443 "TARGET_POWERPC && ! TARGET_POWER"
6445 [(set_attr "type" "imul")])
6447 ;; If operands 0 and 2 are in the same register, we have a problem. But
6448 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6449 ;; why we have the strange constraints below.
6450 (define_insn "ashldi3_power"
6451 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6452 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6453 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6454 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6457 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6458 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6459 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6460 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6461 [(set_attr "length" "8")])
6463 (define_insn "lshrdi3_power"
6464 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6465 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6466 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6467 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6470 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6471 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6472 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6473 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6474 [(set_attr "length" "8")])
6476 ;; Shift by a variable amount is too complex to be worth open-coding. We
6477 ;; just handle shifts by constants.
6478 (define_insn "ashrdi3_power"
6479 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6480 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6481 (match_operand:SI 2 "const_int_operand" "M,i")))
6482 (clobber (match_scratch:SI 3 "=X,q"))]
6485 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6486 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6487 [(set_attr "type" "shift")
6488 (set_attr "length" "8")])
6490 (define_insn "ashrdi3_no_power"
6491 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6492 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6493 (match_operand:SI 2 "const_int_operand" "M,i")))]
6494 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6496 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6497 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6498 [(set_attr "type" "two,three")
6499 (set_attr "length" "8,12")])
6501 (define_insn "*ashrdisi3_noppc64"
6502 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6503 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6504 (const_int 32)) 4))]
6505 "TARGET_32BIT && !TARGET_POWERPC64"
6508 if (REGNO (operands[0]) == REGNO (operands[1]))
6511 return \"mr %0,%1\";
6513 [(set_attr "length" "4")])
6516 ;; PowerPC64 DImode operations.
6518 (define_insn_and_split "absdi2"
6519 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6520 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6521 (clobber (match_scratch:DI 2 "=&r,&r"))]
6524 "&& reload_completed"
6525 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6526 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6527 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6530 (define_insn_and_split "*nabsdi2"
6531 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6532 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6533 (clobber (match_scratch:DI 2 "=&r,&r"))]
6536 "&& reload_completed"
6537 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6538 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6539 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6542 (define_insn "muldi3"
6543 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6544 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6545 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6551 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6552 (const_string "imul3")
6553 (match_operand:SI 2 "short_cint_operand" "")
6554 (const_string "imul2")]
6555 (const_string "lmul")))])
6557 (define_insn "*muldi3_internal1"
6558 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6559 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6560 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6562 (clobber (match_scratch:DI 3 "=r,r"))]
6567 [(set_attr "type" "lmul_compare")
6568 (set_attr "length" "4,8")])
6571 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6572 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6573 (match_operand:DI 2 "gpc_reg_operand" ""))
6575 (clobber (match_scratch:DI 3 ""))]
6576 "TARGET_POWERPC64 && reload_completed"
6578 (mult:DI (match_dup 1) (match_dup 2)))
6580 (compare:CC (match_dup 3)
6584 (define_insn "*muldi3_internal2"
6585 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6586 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6587 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6589 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6590 (mult:DI (match_dup 1) (match_dup 2)))]
6595 [(set_attr "type" "lmul_compare")
6596 (set_attr "length" "4,8")])
6599 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6600 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6601 (match_operand:DI 2 "gpc_reg_operand" ""))
6603 (set (match_operand:DI 0 "gpc_reg_operand" "")
6604 (mult:DI (match_dup 1) (match_dup 2)))]
6605 "TARGET_POWERPC64 && reload_completed"
6607 (mult:DI (match_dup 1) (match_dup 2)))
6609 (compare:CC (match_dup 0)
6613 (define_insn "smuldi3_highpart"
6614 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6616 (lshiftrt:TI (mult:TI (sign_extend:TI
6617 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6619 (match_operand:DI 2 "gpc_reg_operand" "r")))
6623 [(set_attr "type" "lmul")])
6625 (define_insn "umuldi3_highpart"
6626 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6628 (lshiftrt:TI (mult:TI (zero_extend:TI
6629 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6631 (match_operand:DI 2 "gpc_reg_operand" "r")))
6635 [(set_attr "type" "lmul")])
6637 (define_insn "rotldi3"
6638 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6639 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6640 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6645 [(set_attr "type" "var_shift_rotate,integer")])
6647 (define_insn "*rotldi3_internal2"
6648 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6649 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6650 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6652 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6659 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6660 (set_attr "length" "4,4,8,8")])
6663 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6664 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6665 (match_operand:DI 2 "reg_or_cint_operand" ""))
6667 (clobber (match_scratch:DI 3 ""))]
6668 "TARGET_POWERPC64 && reload_completed"
6670 (rotate:DI (match_dup 1) (match_dup 2)))
6672 (compare:CC (match_dup 3)
6676 (define_insn "*rotldi3_internal3"
6677 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6678 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6679 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6681 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6682 (rotate:DI (match_dup 1) (match_dup 2)))]
6689 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6690 (set_attr "length" "4,4,8,8")])
6693 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6694 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6695 (match_operand:DI 2 "reg_or_cint_operand" ""))
6697 (set (match_operand:DI 0 "gpc_reg_operand" "")
6698 (rotate:DI (match_dup 1) (match_dup 2)))]
6699 "TARGET_POWERPC64 && reload_completed"
6701 (rotate:DI (match_dup 1) (match_dup 2)))
6703 (compare:CC (match_dup 0)
6707 (define_insn "*rotldi3_internal4"
6708 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6709 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6710 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6711 (match_operand:DI 3 "mask64_operand" "n,n")))]
6714 rldc%B3 %0,%1,%2,%S3
6715 rldic%B3 %0,%1,%H2,%S3"
6716 [(set_attr "type" "var_shift_rotate,integer")])
6718 (define_insn "*rotldi3_internal5"
6719 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6721 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6722 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6723 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6725 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6728 rldc%B3. %4,%1,%2,%S3
6729 rldic%B3. %4,%1,%H2,%S3
6732 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6733 (set_attr "length" "4,4,8,8")])
6736 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6738 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6739 (match_operand:DI 2 "reg_or_cint_operand" ""))
6740 (match_operand:DI 3 "mask64_operand" ""))
6742 (clobber (match_scratch:DI 4 ""))]
6743 "TARGET_POWERPC64 && reload_completed"
6745 (and:DI (rotate:DI (match_dup 1)
6749 (compare:CC (match_dup 4)
6753 (define_insn "*rotldi3_internal6"
6754 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6756 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6757 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6758 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6760 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6761 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6764 rldc%B3. %0,%1,%2,%S3
6765 rldic%B3. %0,%1,%H2,%S3
6768 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6769 (set_attr "length" "4,4,8,8")])
6772 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6774 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6775 (match_operand:DI 2 "reg_or_cint_operand" ""))
6776 (match_operand:DI 3 "mask64_operand" ""))
6778 (set (match_operand:DI 0 "gpc_reg_operand" "")
6779 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6780 "TARGET_POWERPC64 && reload_completed"
6782 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6784 (compare:CC (match_dup 0)
6788 (define_insn "*rotldi3_internal7"
6789 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6792 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6793 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6797 rldicl %0,%1,%H2,56"
6798 [(set_attr "type" "var_shift_rotate,integer")])
6800 (define_insn "*rotldi3_internal8"
6801 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6802 (compare:CC (zero_extend:DI
6804 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6805 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6807 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6811 rldicl. %3,%1,%H2,56
6814 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6815 (set_attr "length" "4,4,8,8")])
6818 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6819 (compare:CC (zero_extend:DI
6821 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6822 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6824 (clobber (match_scratch:DI 3 ""))]
6825 "TARGET_POWERPC64 && reload_completed"
6827 (zero_extend:DI (subreg:QI
6828 (rotate:DI (match_dup 1)
6831 (compare:CC (match_dup 3)
6835 (define_insn "*rotldi3_internal9"
6836 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6837 (compare:CC (zero_extend:DI
6839 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6840 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6842 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6843 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6847 rldicl. %0,%1,%H2,56
6850 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6851 (set_attr "length" "4,4,8,8")])
6854 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6855 (compare:CC (zero_extend:DI
6857 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6858 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6860 (set (match_operand:DI 0 "gpc_reg_operand" "")
6861 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6862 "TARGET_POWERPC64 && reload_completed"
6864 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6866 (compare:CC (match_dup 0)
6870 (define_insn "*rotldi3_internal10"
6871 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6874 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6875 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6879 rldicl %0,%1,%H2,48"
6880 [(set_attr "type" "var_shift_rotate,integer")])
6882 (define_insn "*rotldi3_internal11"
6883 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6884 (compare:CC (zero_extend:DI
6886 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6887 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6889 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6893 rldicl. %3,%1,%H2,48
6896 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6897 (set_attr "length" "4,4,8,8")])
6900 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6901 (compare:CC (zero_extend:DI
6903 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6904 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6906 (clobber (match_scratch:DI 3 ""))]
6907 "TARGET_POWERPC64 && reload_completed"
6909 (zero_extend:DI (subreg:HI
6910 (rotate:DI (match_dup 1)
6913 (compare:CC (match_dup 3)
6917 (define_insn "*rotldi3_internal12"
6918 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6919 (compare:CC (zero_extend:DI
6921 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6922 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6924 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6925 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6929 rldicl. %0,%1,%H2,48
6932 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6933 (set_attr "length" "4,4,8,8")])
6936 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6937 (compare:CC (zero_extend:DI
6939 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6940 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6942 (set (match_operand:DI 0 "gpc_reg_operand" "")
6943 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6944 "TARGET_POWERPC64 && reload_completed"
6946 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6948 (compare:CC (match_dup 0)
6952 (define_insn "*rotldi3_internal13"
6953 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6956 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6957 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6961 rldicl %0,%1,%H2,32"
6962 [(set_attr "type" "var_shift_rotate,integer")])
6964 (define_insn "*rotldi3_internal14"
6965 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6966 (compare:CC (zero_extend:DI
6968 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6969 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6971 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6975 rldicl. %3,%1,%H2,32
6978 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6979 (set_attr "length" "4,4,8,8")])
6982 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6983 (compare:CC (zero_extend:DI
6985 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6986 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6988 (clobber (match_scratch:DI 3 ""))]
6989 "TARGET_POWERPC64 && reload_completed"
6991 (zero_extend:DI (subreg:SI
6992 (rotate:DI (match_dup 1)
6995 (compare:CC (match_dup 3)
6999 (define_insn "*rotldi3_internal15"
7000 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7001 (compare:CC (zero_extend:DI
7003 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7004 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7006 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7007 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7011 rldicl. %0,%1,%H2,32
7014 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7015 (set_attr "length" "4,4,8,8")])
7018 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7019 (compare:CC (zero_extend:DI
7021 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7022 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7024 (set (match_operand:DI 0 "gpc_reg_operand" "")
7025 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7026 "TARGET_POWERPC64 && reload_completed"
7028 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7030 (compare:CC (match_dup 0)
7034 (define_expand "ashldi3"
7035 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7036 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7037 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7038 "TARGET_POWERPC64 || TARGET_POWER"
7041 if (TARGET_POWERPC64)
7043 else if (TARGET_POWER)
7045 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7052 (define_insn "*ashldi3_internal1"
7053 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7054 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7055 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7060 [(set_attr "type" "var_shift_rotate,shift")])
7062 (define_insn "*ashldi3_internal2"
7063 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7064 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7065 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7067 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7074 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7075 (set_attr "length" "4,4,8,8")])
7078 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7079 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7080 (match_operand:SI 2 "reg_or_cint_operand" ""))
7082 (clobber (match_scratch:DI 3 ""))]
7083 "TARGET_POWERPC64 && reload_completed"
7085 (ashift:DI (match_dup 1) (match_dup 2)))
7087 (compare:CC (match_dup 3)
7091 (define_insn "*ashldi3_internal3"
7092 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7093 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7094 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7096 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7097 (ashift:DI (match_dup 1) (match_dup 2)))]
7104 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7105 (set_attr "length" "4,4,8,8")])
7108 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7109 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7110 (match_operand:SI 2 "reg_or_cint_operand" ""))
7112 (set (match_operand:DI 0 "gpc_reg_operand" "")
7113 (ashift:DI (match_dup 1) (match_dup 2)))]
7114 "TARGET_POWERPC64 && reload_completed"
7116 (ashift:DI (match_dup 1) (match_dup 2)))
7118 (compare:CC (match_dup 0)
7122 (define_insn "*ashldi3_internal4"
7123 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7124 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7125 (match_operand:SI 2 "const_int_operand" "i"))
7126 (match_operand:DI 3 "const_int_operand" "n")))]
7127 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7128 "rldic %0,%1,%H2,%W3")
7130 (define_insn "ashldi3_internal5"
7131 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7133 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7134 (match_operand:SI 2 "const_int_operand" "i,i"))
7135 (match_operand:DI 3 "const_int_operand" "n,n"))
7137 (clobber (match_scratch:DI 4 "=r,r"))]
7138 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7140 rldic. %4,%1,%H2,%W3
7142 [(set_attr "type" "compare")
7143 (set_attr "length" "4,8")])
7146 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7148 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7149 (match_operand:SI 2 "const_int_operand" ""))
7150 (match_operand:DI 3 "const_int_operand" ""))
7152 (clobber (match_scratch:DI 4 ""))]
7153 "TARGET_POWERPC64 && reload_completed
7154 && includes_rldic_lshift_p (operands[2], operands[3])"
7156 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7159 (compare:CC (match_dup 4)
7163 (define_insn "*ashldi3_internal6"
7164 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7166 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7167 (match_operand:SI 2 "const_int_operand" "i,i"))
7168 (match_operand:DI 3 "const_int_operand" "n,n"))
7170 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7171 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7172 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7174 rldic. %0,%1,%H2,%W3
7176 [(set_attr "type" "compare")
7177 (set_attr "length" "4,8")])
7180 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7182 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7183 (match_operand:SI 2 "const_int_operand" ""))
7184 (match_operand:DI 3 "const_int_operand" ""))
7186 (set (match_operand:DI 0 "gpc_reg_operand" "")
7187 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7188 "TARGET_POWERPC64 && reload_completed
7189 && includes_rldic_lshift_p (operands[2], operands[3])"
7191 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7194 (compare:CC (match_dup 0)
7198 (define_insn "*ashldi3_internal7"
7199 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7200 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7201 (match_operand:SI 2 "const_int_operand" "i"))
7202 (match_operand:DI 3 "mask64_operand" "n")))]
7203 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7204 "rldicr %0,%1,%H2,%S3")
7206 (define_insn "ashldi3_internal8"
7207 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7209 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7210 (match_operand:SI 2 "const_int_operand" "i,i"))
7211 (match_operand:DI 3 "mask64_operand" "n,n"))
7213 (clobber (match_scratch:DI 4 "=r,r"))]
7214 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7216 rldicr. %4,%1,%H2,%S3
7218 [(set_attr "type" "compare")
7219 (set_attr "length" "4,8")])
7222 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7224 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7225 (match_operand:SI 2 "const_int_operand" ""))
7226 (match_operand:DI 3 "mask64_operand" ""))
7228 (clobber (match_scratch:DI 4 ""))]
7229 "TARGET_POWERPC64 && reload_completed
7230 && includes_rldicr_lshift_p (operands[2], operands[3])"
7232 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7235 (compare:CC (match_dup 4)
7239 (define_insn "*ashldi3_internal9"
7240 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7242 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7243 (match_operand:SI 2 "const_int_operand" "i,i"))
7244 (match_operand:DI 3 "mask64_operand" "n,n"))
7246 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7247 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7248 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7250 rldicr. %0,%1,%H2,%S3
7252 [(set_attr "type" "compare")
7253 (set_attr "length" "4,8")])
7256 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7258 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7259 (match_operand:SI 2 "const_int_operand" ""))
7260 (match_operand:DI 3 "mask64_operand" ""))
7262 (set (match_operand:DI 0 "gpc_reg_operand" "")
7263 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7264 "TARGET_POWERPC64 && reload_completed
7265 && includes_rldicr_lshift_p (operands[2], operands[3])"
7267 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7270 (compare:CC (match_dup 0)
7274 (define_expand "lshrdi3"
7275 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7276 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7277 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7278 "TARGET_POWERPC64 || TARGET_POWER"
7281 if (TARGET_POWERPC64)
7283 else if (TARGET_POWER)
7285 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7292 (define_insn "*lshrdi3_internal1"
7293 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7294 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7295 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7300 [(set_attr "type" "var_shift_rotate,shift")])
7302 (define_insn "*lshrdi3_internal2"
7303 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7304 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7305 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7307 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7314 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7315 (set_attr "length" "4,4,8,8")])
7318 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7319 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7320 (match_operand:SI 2 "reg_or_cint_operand" ""))
7322 (clobber (match_scratch:DI 3 ""))]
7323 "TARGET_POWERPC64 && reload_completed"
7325 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7327 (compare:CC (match_dup 3)
7331 (define_insn "*lshrdi3_internal3"
7332 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7333 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7334 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7336 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7337 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7344 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7345 (set_attr "length" "4,4,8,8")])
7348 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7349 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7350 (match_operand:SI 2 "reg_or_cint_operand" ""))
7352 (set (match_operand:DI 0 "gpc_reg_operand" "")
7353 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7354 "TARGET_POWERPC64 && reload_completed"
7356 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7358 (compare:CC (match_dup 0)
7362 (define_expand "ashrdi3"
7363 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7364 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7365 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7369 if (TARGET_POWERPC64)
7371 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7373 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7376 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7377 && WORDS_BIG_ENDIAN)
7379 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7386 (define_insn "*ashrdi3_internal1"
7387 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7388 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7389 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7394 [(set_attr "type" "var_shift_rotate,shift")])
7396 (define_insn "*ashrdi3_internal2"
7397 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7398 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7399 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7401 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7408 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7409 (set_attr "length" "4,4,8,8")])
7412 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7413 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7414 (match_operand:SI 2 "reg_or_cint_operand" ""))
7416 (clobber (match_scratch:DI 3 ""))]
7417 "TARGET_POWERPC64 && reload_completed"
7419 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7421 (compare:CC (match_dup 3)
7425 (define_insn "*ashrdi3_internal3"
7426 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7427 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7428 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7430 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7431 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7438 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7439 (set_attr "length" "4,4,8,8")])
7442 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7443 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7444 (match_operand:SI 2 "reg_or_cint_operand" ""))
7446 (set (match_operand:DI 0 "gpc_reg_operand" "")
7447 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7448 "TARGET_POWERPC64 && reload_completed"
7450 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7452 (compare:CC (match_dup 0)
7456 (define_insn "anddi3"
7457 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7458 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7459 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7460 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7464 rldic%B2 %0,%1,0,%S2
7465 rlwinm %0,%1,0,%m2,%M2
7469 [(set_attr "type" "*,*,*,compare,compare,*")
7470 (set_attr "length" "4,4,4,4,4,8")])
7473 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7474 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7475 (match_operand:DI 2 "mask64_2_operand" "")))
7476 (clobber (match_scratch:CC 3 ""))]
7478 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7479 && !mask_operand (operands[2], DImode)
7480 && !mask64_operand (operands[2], DImode)"
7482 (and:DI (rotate:DI (match_dup 1)
7486 (and:DI (rotate:DI (match_dup 0)
7490 build_mask64_2_operands (operands[2], &operands[4]);
7493 (define_insn "*anddi3_internal2"
7494 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7495 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7496 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7498 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7499 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7503 rldic%B2. %3,%1,0,%S2
7504 rlwinm. %3,%1,0,%m2,%M2
7514 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7515 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7518 [(set (match_operand:CC 0 "cc_reg_operand" "")
7519 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7520 (match_operand:DI 2 "mask64_2_operand" ""))
7522 (clobber (match_scratch:DI 3 ""))
7523 (clobber (match_scratch:CC 4 ""))]
7524 "TARGET_64BIT && reload_completed
7525 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7526 && !mask_operand (operands[2], DImode)
7527 && !mask64_operand (operands[2], DImode)"
7529 (and:DI (rotate:DI (match_dup 1)
7532 (parallel [(set (match_dup 0)
7533 (compare:CC (and:DI (rotate:DI (match_dup 3)
7537 (clobber (match_dup 3))])]
7540 build_mask64_2_operands (operands[2], &operands[5]);
7543 (define_insn "*anddi3_internal3"
7544 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7545 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7546 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7548 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7549 (and:DI (match_dup 1) (match_dup 2)))
7550 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7554 rldic%B2. %0,%1,0,%S2
7555 rlwinm. %0,%1,0,%m2,%M2
7565 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7566 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7569 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7570 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7571 (match_operand:DI 2 "and64_2_operand" ""))
7573 (set (match_operand:DI 0 "gpc_reg_operand" "")
7574 (and:DI (match_dup 1) (match_dup 2)))
7575 (clobber (match_scratch:CC 4 ""))]
7576 "TARGET_64BIT && reload_completed"
7577 [(parallel [(set (match_dup 0)
7578 (and:DI (match_dup 1) (match_dup 2)))
7579 (clobber (match_dup 4))])
7581 (compare:CC (match_dup 0)
7586 [(set (match_operand:CC 3 "cc_reg_operand" "")
7587 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7588 (match_operand:DI 2 "mask64_2_operand" ""))
7590 (set (match_operand:DI 0 "gpc_reg_operand" "")
7591 (and:DI (match_dup 1) (match_dup 2)))
7592 (clobber (match_scratch:CC 4 ""))]
7593 "TARGET_64BIT && reload_completed
7594 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7595 && !mask_operand (operands[2], DImode)
7596 && !mask64_operand (operands[2], DImode)"
7598 (and:DI (rotate:DI (match_dup 1)
7601 (parallel [(set (match_dup 3)
7602 (compare:CC (and:DI (rotate:DI (match_dup 0)
7607 (and:DI (rotate:DI (match_dup 0)
7612 build_mask64_2_operands (operands[2], &operands[5]);
7615 (define_expand "iordi3"
7616 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7617 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7618 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7622 if (non_logical_cint_operand (operands[2], DImode))
7624 HOST_WIDE_INT value;
7625 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7626 ? operands[0] : gen_reg_rtx (DImode));
7628 if (GET_CODE (operands[2]) == CONST_INT)
7630 value = INTVAL (operands[2]);
7631 emit_insn (gen_iordi3 (tmp, operands[1],
7632 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7636 value = CONST_DOUBLE_LOW (operands[2]);
7637 emit_insn (gen_iordi3 (tmp, operands[1],
7638 immed_double_const (value
7639 & (~ (HOST_WIDE_INT) 0xffff),
7643 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7648 (define_expand "xordi3"
7649 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7650 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7651 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7655 if (non_logical_cint_operand (operands[2], DImode))
7657 HOST_WIDE_INT value;
7658 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7659 ? operands[0] : gen_reg_rtx (DImode));
7661 if (GET_CODE (operands[2]) == CONST_INT)
7663 value = INTVAL (operands[2]);
7664 emit_insn (gen_xordi3 (tmp, operands[1],
7665 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7669 value = CONST_DOUBLE_LOW (operands[2]);
7670 emit_insn (gen_xordi3 (tmp, operands[1],
7671 immed_double_const (value
7672 & (~ (HOST_WIDE_INT) 0xffff),
7676 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7681 (define_insn "*booldi3_internal1"
7682 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7683 (match_operator:DI 3 "boolean_or_operator"
7684 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7685 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7692 (define_insn "*booldi3_internal2"
7693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7694 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7695 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7696 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7698 (clobber (match_scratch:DI 3 "=r,r"))]
7703 [(set_attr "type" "compare")
7704 (set_attr "length" "4,8")])
7707 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7708 (compare:CC (match_operator:DI 4 "boolean_operator"
7709 [(match_operand:DI 1 "gpc_reg_operand" "")
7710 (match_operand:DI 2 "gpc_reg_operand" "")])
7712 (clobber (match_scratch:DI 3 ""))]
7713 "TARGET_POWERPC64 && reload_completed"
7714 [(set (match_dup 3) (match_dup 4))
7716 (compare:CC (match_dup 3)
7720 (define_insn "*booldi3_internal3"
7721 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7722 (compare:CC (match_operator:DI 4 "boolean_operator"
7723 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7724 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7726 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7732 [(set_attr "type" "compare")
7733 (set_attr "length" "4,8")])
7736 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7737 (compare:CC (match_operator:DI 4 "boolean_operator"
7738 [(match_operand:DI 1 "gpc_reg_operand" "")
7739 (match_operand:DI 2 "gpc_reg_operand" "")])
7741 (set (match_operand:DI 0 "gpc_reg_operand" "")
7743 "TARGET_POWERPC64 && reload_completed"
7744 [(set (match_dup 0) (match_dup 4))
7746 (compare:CC (match_dup 0)
7750 ;; Split a logical operation that we can't do in one insn into two insns,
7751 ;; each of which does one 16-bit part. This is used by combine.
7754 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7755 (match_operator:DI 3 "boolean_or_operator"
7756 [(match_operand:DI 1 "gpc_reg_operand" "")
7757 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7759 [(set (match_dup 0) (match_dup 4))
7760 (set (match_dup 0) (match_dup 5))]
7765 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7767 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7768 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7770 i4 = GEN_INT (value & 0xffff);
7774 i3 = GEN_INT (INTVAL (operands[2])
7775 & (~ (HOST_WIDE_INT) 0xffff));
7776 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7778 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7780 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7784 (define_insn "*boolcdi3_internal1"
7785 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7786 (match_operator:DI 3 "boolean_operator"
7787 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7788 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7792 (define_insn "*boolcdi3_internal2"
7793 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7794 (compare:CC (match_operator:DI 4 "boolean_operator"
7795 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7796 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7798 (clobber (match_scratch:DI 3 "=r,r"))]
7803 [(set_attr "type" "compare")
7804 (set_attr "length" "4,8")])
7807 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7808 (compare:CC (match_operator:DI 4 "boolean_operator"
7809 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7810 (match_operand:DI 2 "gpc_reg_operand" "")])
7812 (clobber (match_scratch:DI 3 ""))]
7813 "TARGET_POWERPC64 && reload_completed"
7814 [(set (match_dup 3) (match_dup 4))
7816 (compare:CC (match_dup 3)
7820 (define_insn "*boolcdi3_internal3"
7821 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7822 (compare:CC (match_operator:DI 4 "boolean_operator"
7823 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7824 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7826 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7832 [(set_attr "type" "compare")
7833 (set_attr "length" "4,8")])
7836 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7837 (compare:CC (match_operator:DI 4 "boolean_operator"
7838 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7839 (match_operand:DI 2 "gpc_reg_operand" "")])
7841 (set (match_operand:DI 0 "gpc_reg_operand" "")
7843 "TARGET_POWERPC64 && reload_completed"
7844 [(set (match_dup 0) (match_dup 4))
7846 (compare:CC (match_dup 0)
7850 (define_insn "*boolccdi3_internal1"
7851 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7852 (match_operator:DI 3 "boolean_operator"
7853 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7854 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7858 (define_insn "*boolccdi3_internal2"
7859 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7860 (compare:CC (match_operator:DI 4 "boolean_operator"
7861 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7862 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7864 (clobber (match_scratch:DI 3 "=r,r"))]
7869 [(set_attr "type" "compare")
7870 (set_attr "length" "4,8")])
7873 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7874 (compare:CC (match_operator:DI 4 "boolean_operator"
7875 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7876 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7878 (clobber (match_scratch:DI 3 ""))]
7879 "TARGET_POWERPC64 && reload_completed"
7880 [(set (match_dup 3) (match_dup 4))
7882 (compare:CC (match_dup 3)
7886 (define_insn "*boolccdi3_internal3"
7887 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7888 (compare:CC (match_operator:DI 4 "boolean_operator"
7889 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7890 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7892 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7898 [(set_attr "type" "compare")
7899 (set_attr "length" "4,8")])
7902 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7903 (compare:CC (match_operator:DI 4 "boolean_operator"
7904 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7905 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7907 (set (match_operand:DI 0 "gpc_reg_operand" "")
7909 "TARGET_POWERPC64 && reload_completed"
7910 [(set (match_dup 0) (match_dup 4))
7912 (compare:CC (match_dup 0)
7916 ;; Now define ways of moving data around.
7918 ;; Set up a register with a value from the GOT table
7920 (define_expand "movsi_got"
7921 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7922 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7923 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7924 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7927 if (GET_CODE (operands[1]) == CONST)
7929 rtx offset = const0_rtx;
7930 HOST_WIDE_INT value;
7932 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7933 value = INTVAL (offset);
7936 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7937 emit_insn (gen_movsi_got (tmp, operands[1]));
7938 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7943 operands[2] = rs6000_got_register (operands[1]);
7946 (define_insn "*movsi_got_internal"
7947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7948 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7949 (match_operand:SI 2 "gpc_reg_operand" "b")]
7951 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7952 "{l|lwz} %0,%a1@got(%2)"
7953 [(set_attr "type" "load")])
7955 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7956 ;; didn't get allocated to a hard register.
7958 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7959 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7960 (match_operand:SI 2 "memory_operand" "")]
7962 "DEFAULT_ABI == ABI_V4
7964 && (reload_in_progress || reload_completed)"
7965 [(set (match_dup 0) (match_dup 2))
7966 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7970 ;; For SI, we special-case integers that can't be loaded in one insn. We
7971 ;; do the load 16-bits at a time. We could do this by loading from memory,
7972 ;; and this is even supposed to be faster, but it is simpler not to get
7973 ;; integers in the TOC.
7974 (define_insn "movsi_low"
7975 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7976 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7977 (match_operand 2 "" ""))))]
7978 "TARGET_MACHO && ! TARGET_64BIT"
7979 "{l|lwz} %0,lo16(%2)(%1)"
7980 [(set_attr "type" "load")
7981 (set_attr "length" "4")])
7983 (define_insn "*movsi_internal1"
7984 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7985 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7986 "gpc_reg_operand (operands[0], SImode)
7987 || gpc_reg_operand (operands[1], SImode)"
7991 {l%U1%X1|lwz%U1%X1} %0,%1
7992 {st%U0%X0|stw%U0%X0} %1,%0
8002 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8003 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8005 ;; Split a load of a large constant into the appropriate two-insn
8009 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8010 (match_operand:SI 1 "const_int_operand" ""))]
8011 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8012 && (INTVAL (operands[1]) & 0xffff) != 0"
8016 (ior:SI (match_dup 0)
8019 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8021 if (tem == operands[0])
8027 (define_insn "*mov<mode>_internal2"
8028 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8029 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8031 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8034 {cmpi|cmp<wd>i} %2,%0,0
8037 [(set_attr "type" "cmp,compare,cmp")
8038 (set_attr "length" "4,4,8")])
8041 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8042 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8044 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8046 [(set (match_dup 0) (match_dup 1))
8048 (compare:CC (match_dup 0)
8052 (define_insn "*movhi_internal"
8053 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8054 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8055 "gpc_reg_operand (operands[0], HImode)
8056 || gpc_reg_operand (operands[1], HImode)"
8066 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8068 (define_expand "mov<mode>"
8069 [(set (match_operand:INT 0 "general_operand" "")
8070 (match_operand:INT 1 "any_operand" ""))]
8072 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8074 (define_insn "*movqi_internal"
8075 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8076 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8077 "gpc_reg_operand (operands[0], QImode)
8078 || gpc_reg_operand (operands[1], QImode)"
8088 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8090 ;; Here is how to move condition codes around. When we store CC data in
8091 ;; an integer register or memory, we store just the high-order 4 bits.
8092 ;; This lets us not shift in the most common case of CR0.
8093 (define_expand "movcc"
8094 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8095 (match_operand:CC 1 "nonimmediate_operand" ""))]
8099 (define_insn "*movcc_internal1"
8100 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8101 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8102 "register_operand (operands[0], CCmode)
8103 || register_operand (operands[1], CCmode)"
8107 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8110 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8116 {l%U1%X1|lwz%U1%X1} %0,%1
8117 {st%U0%U1|stw%U0%U1} %1,%0"
8119 (cond [(eq_attr "alternative" "0,3")
8120 (const_string "cr_logical")
8121 (eq_attr "alternative" "1,2")
8122 (const_string "mtcr")
8123 (eq_attr "alternative" "6,7,9")
8124 (const_string "integer")
8125 (eq_attr "alternative" "8")
8126 (const_string "mfjmpr")
8127 (eq_attr "alternative" "10")
8128 (const_string "mtjmpr")
8129 (eq_attr "alternative" "11")
8130 (const_string "load")
8131 (eq_attr "alternative" "12")
8132 (const_string "store")
8133 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8134 (const_string "mfcrf")
8136 (const_string "mfcr")))
8137 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8139 ;; For floating-point, we normally deal with the floating-point registers
8140 ;; unless -msoft-float is used. The sole exception is that parameter passing
8141 ;; can produce floating-point values in fixed-point registers. Unless the
8142 ;; value is a simple constant or already in memory, we deal with this by
8143 ;; allocating memory and copying the value explicitly via that memory location.
8144 (define_expand "movsf"
8145 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8146 (match_operand:SF 1 "any_operand" ""))]
8148 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8151 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8152 (match_operand:SF 1 "const_double_operand" ""))]
8154 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8155 || (GET_CODE (operands[0]) == SUBREG
8156 && GET_CODE (SUBREG_REG (operands[0])) == REG
8157 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8158 [(set (match_dup 2) (match_dup 3))]
8164 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8165 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8167 if (! TARGET_POWERPC64)
8168 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8170 operands[2] = gen_lowpart (SImode, operands[0]);
8172 operands[3] = gen_int_mode (l, SImode);
8175 (define_insn "*movsf_hardfloat"
8176 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8177 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8178 "(gpc_reg_operand (operands[0], SFmode)
8179 || gpc_reg_operand (operands[1], SFmode))
8180 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8183 {l%U1%X1|lwz%U1%X1} %0,%1
8184 {st%U0%X0|stw%U0%X0} %1,%0
8194 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8195 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8197 (define_insn "*movsf_softfloat"
8198 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8199 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8200 "(gpc_reg_operand (operands[0], SFmode)
8201 || gpc_reg_operand (operands[1], SFmode))
8202 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8208 {l%U1%X1|lwz%U1%X1} %0,%1
8209 {st%U0%X0|stw%U0%X0} %1,%0
8216 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8217 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8220 (define_expand "movdf"
8221 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8222 (match_operand:DF 1 "any_operand" ""))]
8224 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8227 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8228 (match_operand:DF 1 "const_int_operand" ""))]
8229 "! TARGET_POWERPC64 && reload_completed
8230 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8231 || (GET_CODE (operands[0]) == SUBREG
8232 && GET_CODE (SUBREG_REG (operands[0])) == REG
8233 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8234 [(set (match_dup 2) (match_dup 4))
8235 (set (match_dup 3) (match_dup 1))]
8238 int endian = (WORDS_BIG_ENDIAN == 0);
8239 HOST_WIDE_INT value = INTVAL (operands[1]);
8241 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8242 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8243 #if HOST_BITS_PER_WIDE_INT == 32
8244 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8246 operands[4] = GEN_INT (value >> 32);
8247 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8252 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8253 (match_operand:DF 1 "const_double_operand" ""))]
8254 "! TARGET_POWERPC64 && reload_completed
8255 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8256 || (GET_CODE (operands[0]) == SUBREG
8257 && GET_CODE (SUBREG_REG (operands[0])) == REG
8258 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8259 [(set (match_dup 2) (match_dup 4))
8260 (set (match_dup 3) (match_dup 5))]
8263 int endian = (WORDS_BIG_ENDIAN == 0);
8267 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8268 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8270 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8271 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8272 operands[4] = gen_int_mode (l[endian], SImode);
8273 operands[5] = gen_int_mode (l[1 - endian], SImode);
8277 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8278 (match_operand:DF 1 "const_double_operand" ""))]
8279 "TARGET_POWERPC64 && reload_completed
8280 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8281 || (GET_CODE (operands[0]) == SUBREG
8282 && GET_CODE (SUBREG_REG (operands[0])) == REG
8283 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8284 [(set (match_dup 2) (match_dup 3))]
8287 int endian = (WORDS_BIG_ENDIAN == 0);
8290 #if HOST_BITS_PER_WIDE_INT >= 64
8294 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8295 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8297 operands[2] = gen_lowpart (DImode, operands[0]);
8298 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8299 #if HOST_BITS_PER_WIDE_INT >= 64
8300 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8301 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8303 operands[3] = gen_int_mode (val, DImode);
8305 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8309 ;; Don't have reload use general registers to load a constant. First,
8310 ;; it might not work if the output operand is the equivalent of
8311 ;; a non-offsettable memref, but also it is less efficient than loading
8312 ;; the constant into an FP register, since it will probably be used there.
8313 ;; The "??" is a kludge until we can figure out a more reasonable way
8314 ;; of handling these non-offsettable values.
8315 (define_insn "*movdf_hardfloat32"
8316 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8317 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8318 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8319 && (gpc_reg_operand (operands[0], DFmode)
8320 || gpc_reg_operand (operands[1], DFmode))"
8323 switch (which_alternative)
8328 /* We normally copy the low-numbered register first. However, if
8329 the first register operand 0 is the same as the second register
8330 of operand 1, we must copy in the opposite order. */
8331 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8332 return \"mr %L0,%L1\;mr %0,%1\";
8334 return \"mr %0,%1\;mr %L0,%L1\";
8336 if (rs6000_offsettable_memref_p (operands[1])
8337 || (GET_CODE (operands[1]) == MEM
8338 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8339 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8340 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8342 /* If the low-address word is used in the address, we must load
8343 it last. Otherwise, load it first. Note that we cannot have
8344 auto-increment in that case since the address register is
8345 known to be dead. */
8346 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8348 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8350 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8356 addreg = find_addr_reg (XEXP (operands[1], 0));
8357 if (refers_to_regno_p (REGNO (operands[0]),
8358 REGNO (operands[0]) + 1,
8361 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8362 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8363 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8364 return \"{l%X1|lwz%X1} %0,%1\";
8368 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
8369 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8370 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8371 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8376 if (rs6000_offsettable_memref_p (operands[0])
8377 || (GET_CODE (operands[0]) == MEM
8378 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8379 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8380 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8381 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8386 addreg = find_addr_reg (XEXP (operands[0], 0));
8387 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
8388 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8389 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
8390 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8394 return \"fmr %0,%1\";
8396 return \"lfd%U1%X1 %0,%1\";
8398 return \"stfd%U0%X0 %1,%0\";
8405 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8406 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8408 (define_insn "*movdf_softfloat32"
8409 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8410 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8411 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8412 && (gpc_reg_operand (operands[0], DFmode)
8413 || gpc_reg_operand (operands[1], DFmode))"
8416 switch (which_alternative)
8421 /* We normally copy the low-numbered register first. However, if
8422 the first register operand 0 is the same as the second register of
8423 operand 1, we must copy in the opposite order. */
8424 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8425 return \"mr %L0,%L1\;mr %0,%1\";
8427 return \"mr %0,%1\;mr %L0,%L1\";
8429 /* If the low-address word is used in the address, we must load
8430 it last. Otherwise, load it first. Note that we cannot have
8431 auto-increment in that case since the address register is
8432 known to be dead. */
8433 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8435 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8437 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8439 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8446 [(set_attr "type" "two,load,store,*,*,*")
8447 (set_attr "length" "8,8,8,8,12,16")])
8449 ; ld/std require word-aligned displacements -> 'Y' constraint.
8450 ; List Y->r and r->Y before r->r for reload.
8451 (define_insn "*movdf_hardfloat64_mfpgpr"
8452 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8453 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8454 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8455 && (gpc_reg_operand (operands[0], DFmode)
8456 || gpc_reg_operand (operands[1], DFmode))"
8472 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8473 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8475 ; ld/std require word-aligned displacements -> 'Y' constraint.
8476 ; List Y->r and r->Y before r->r for reload.
8477 (define_insn "*movdf_hardfloat64"
8478 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8479 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8480 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8481 && (gpc_reg_operand (operands[0], DFmode)
8482 || gpc_reg_operand (operands[1], DFmode))"
8496 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8497 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8499 (define_insn "*movdf_softfloat64"
8500 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8501 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8502 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8503 && (gpc_reg_operand (operands[0], DFmode)
8504 || gpc_reg_operand (operands[1], DFmode))"
8515 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8516 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8518 (define_expand "movtf"
8519 [(set (match_operand:TF 0 "general_operand" "")
8520 (match_operand:TF 1 "any_operand" ""))]
8521 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8522 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8524 ; It's important to list the o->f and f->o moves before f->f because
8525 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8526 ; which doesn't make progress. Likewise r->Y must be before r->r.
8527 (define_insn_and_split "*movtf_internal"
8528 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8529 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8531 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8532 && (gpc_reg_operand (operands[0], TFmode)
8533 || gpc_reg_operand (operands[1], TFmode))"
8535 "&& reload_completed"
8537 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8538 [(set_attr "length" "8,8,8,20,20,16")])
8540 (define_insn_and_split "*movtf_softfloat"
8541 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
8542 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
8544 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8545 && (gpc_reg_operand (operands[0], TFmode)
8546 || gpc_reg_operand (operands[1], TFmode))"
8548 "&& reload_completed"
8550 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8551 [(set_attr "length" "20,20,16")])
8553 (define_expand "extenddftf2"
8554 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8555 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8557 && TARGET_HARD_FLOAT
8558 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8559 && TARGET_LONG_DOUBLE_128"
8561 if (TARGET_E500_DOUBLE)
8562 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8564 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8568 (define_expand "extenddftf2_fprs"
8569 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8570 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8571 (use (match_dup 2))])]
8573 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8575 operands[2] = CONST0_RTX (DFmode);
8576 /* Generate GOT reference early for SVR4 PIC. */
8577 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8578 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8581 (define_insn_and_split "*extenddftf2_internal"
8582 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8583 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8584 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8586 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8588 "&& reload_completed"
8591 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8592 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8593 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8595 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8600 (define_expand "extendsftf2"
8601 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8602 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8604 && TARGET_HARD_FLOAT
8605 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8606 && TARGET_LONG_DOUBLE_128"
8608 rtx tmp = gen_reg_rtx (DFmode);
8609 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8610 emit_insn (gen_extenddftf2 (operands[0], tmp));
8614 (define_expand "trunctfdf2"
8615 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8616 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8618 && TARGET_HARD_FLOAT
8619 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8620 && TARGET_LONG_DOUBLE_128"
8623 (define_insn_and_split "trunctfdf2_internal1"
8624 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8625 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8626 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8627 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8631 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8634 emit_note (NOTE_INSN_DELETED);
8637 [(set_attr "type" "fp")])
8639 (define_insn "trunctfdf2_internal2"
8640 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8641 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8642 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8643 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8645 [(set_attr "type" "fp")])
8647 (define_expand "trunctfsf2"
8648 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8649 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8651 && TARGET_HARD_FLOAT
8652 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8653 && TARGET_LONG_DOUBLE_128"
8655 if (TARGET_E500_DOUBLE)
8656 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8658 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8662 (define_insn_and_split "trunctfsf2_fprs"
8663 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8664 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8665 (clobber (match_scratch:DF 2 "=f"))]
8667 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8669 "&& reload_completed"
8671 (float_truncate:DF (match_dup 1)))
8673 (float_truncate:SF (match_dup 2)))]
8676 (define_expand "floatsitf2"
8677 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8678 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8680 && TARGET_HARD_FLOAT
8681 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8682 && TARGET_LONG_DOUBLE_128"
8684 rtx tmp = gen_reg_rtx (DFmode);
8685 expand_float (tmp, operands[1], false);
8686 emit_insn (gen_extenddftf2 (operands[0], tmp));
8690 ; fadd, but rounding towards zero.
8691 ; This is probably not the optimal code sequence.
8692 (define_insn "fix_trunc_helper"
8693 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8694 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8695 UNSPEC_FIX_TRUNC_TF))
8696 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8697 "TARGET_HARD_FLOAT && TARGET_FPRS"
8698 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8699 [(set_attr "type" "fp")
8700 (set_attr "length" "20")])
8702 (define_expand "fix_trunctfsi2"
8703 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8704 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8706 && (TARGET_POWER2 || TARGET_POWERPC)
8707 && TARGET_HARD_FLOAT
8708 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8709 && TARGET_LONG_DOUBLE_128"
8711 if (TARGET_E500_DOUBLE)
8712 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8714 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8718 (define_expand "fix_trunctfsi2_fprs"
8719 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8720 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8721 (clobber (match_dup 2))
8722 (clobber (match_dup 3))
8723 (clobber (match_dup 4))
8724 (clobber (match_dup 5))])]
8726 && (TARGET_POWER2 || TARGET_POWERPC)
8727 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8729 operands[2] = gen_reg_rtx (DFmode);
8730 operands[3] = gen_reg_rtx (DFmode);
8731 operands[4] = gen_reg_rtx (DImode);
8732 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8735 (define_insn_and_split "*fix_trunctfsi2_internal"
8736 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8737 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8738 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8739 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8740 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8741 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8743 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8745 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
8749 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8751 gcc_assert (MEM_P (operands[5]));
8752 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8754 emit_insn (gen_fctiwz (operands[4], operands[2]));
8755 emit_move_insn (operands[5], operands[4]);
8756 emit_move_insn (operands[0], lowword);
8760 (define_expand "negtf2"
8761 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8762 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8764 && TARGET_HARD_FLOAT
8765 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8766 && TARGET_LONG_DOUBLE_128"
8769 (define_insn "negtf2_internal"
8770 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8771 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8773 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8776 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8777 return \"fneg %L0,%L1\;fneg %0,%1\";
8779 return \"fneg %0,%1\;fneg %L0,%L1\";
8781 [(set_attr "type" "fp")
8782 (set_attr "length" "8")])
8784 (define_expand "abstf2"
8785 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8786 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8788 && TARGET_HARD_FLOAT
8789 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8790 && TARGET_LONG_DOUBLE_128"
8793 rtx label = gen_label_rtx ();
8794 if (TARGET_E500_DOUBLE)
8796 if (flag_unsafe_math_optimizations)
8797 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8799 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8802 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8807 (define_expand "abstf2_internal"
8808 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8809 (match_operand:TF 1 "gpc_reg_operand" "f"))
8810 (set (match_dup 3) (match_dup 5))
8811 (set (match_dup 5) (abs:DF (match_dup 5)))
8812 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8813 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8814 (label_ref (match_operand 2 "" ""))
8816 (set (match_dup 6) (neg:DF (match_dup 6)))]
8818 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8821 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8822 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8823 operands[3] = gen_reg_rtx (DFmode);
8824 operands[4] = gen_reg_rtx (CCFPmode);
8825 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8826 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8829 ;; Next come the multi-word integer load and store and the load and store
8832 ; List r->r after r->"o<>", otherwise reload will try to reload a
8833 ; non-offsettable address by using r->r which won't make progress.
8834 (define_insn "*movdi_internal32"
8835 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8836 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8838 && (gpc_reg_operand (operands[0], DImode)
8839 || gpc_reg_operand (operands[1], DImode))"
8848 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8851 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8852 (match_operand:DI 1 "const_int_operand" ""))]
8853 "! TARGET_POWERPC64 && reload_completed"
8854 [(set (match_dup 2) (match_dup 4))
8855 (set (match_dup 3) (match_dup 1))]
8858 HOST_WIDE_INT value = INTVAL (operands[1]);
8859 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8861 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8863 #if HOST_BITS_PER_WIDE_INT == 32
8864 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8866 operands[4] = GEN_INT (value >> 32);
8867 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8872 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
8873 (match_operand:DI 1 "input_operand" ""))]
8874 "reload_completed && !TARGET_POWERPC64
8875 && gpr_or_gpr_p (operands[0], operands[1])"
8877 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8879 (define_insn "*movdi_mfpgpr"
8880 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
8881 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
8882 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8883 && (gpc_reg_operand (operands[0], DImode)
8884 || gpc_reg_operand (operands[1], DImode))"
8901 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8902 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
8904 (define_insn "*movdi_internal64"
8905 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8906 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8907 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8908 && (gpc_reg_operand (operands[0], DImode)
8909 || gpc_reg_operand (operands[1], DImode))"
8924 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8925 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8927 ;; immediate value valid for a single instruction hiding in a const_double
8929 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8930 (match_operand:DI 1 "const_double_operand" "F"))]
8931 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8932 && GET_CODE (operands[1]) == CONST_DOUBLE
8933 && num_insns_constant (operands[1], DImode) == 1"
8936 return ((unsigned HOST_WIDE_INT)
8937 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8938 ? \"li %0,%1\" : \"lis %0,%v1\";
8941 ;; Generate all one-bits and clear left or right.
8942 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8944 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8945 (match_operand:DI 1 "mask64_operand" ""))]
8946 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8947 [(set (match_dup 0) (const_int -1))
8949 (and:DI (rotate:DI (match_dup 0)
8954 ;; Split a load of a large constant into the appropriate five-instruction
8955 ;; sequence. Handle anything in a constant number of insns.
8956 ;; When non-easy constants can go in the TOC, this should use
8957 ;; easy_fp_constant predicate.
8959 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8960 (match_operand:DI 1 "const_int_operand" ""))]
8961 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8962 [(set (match_dup 0) (match_dup 2))
8963 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8965 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8967 if (tem == operands[0])
8974 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8975 (match_operand:DI 1 "const_double_operand" ""))]
8976 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8977 [(set (match_dup 0) (match_dup 2))
8978 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8980 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8982 if (tem == operands[0])
8988 ;; TImode is similar, except that we usually want to compute the address into
8989 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8990 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8992 ;; We say that MQ is clobbered in the last alternative because the first
8993 ;; alternative would never get used otherwise since it would need a reload
8994 ;; while the 2nd alternative would not. We put memory cases first so they
8995 ;; are preferred. Otherwise, we'd try to reload the output instead of
8996 ;; giving the SCRATCH mq.
8998 (define_insn "*movti_power"
8999 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9000 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9001 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9002 "TARGET_POWER && ! TARGET_POWERPC64
9003 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9006 switch (which_alternative)
9013 return \"{stsi|stswi} %1,%P0,16\";
9018 /* If the address is not used in the output, we can use lsi. Otherwise,
9019 fall through to generating four loads. */
9021 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9022 return \"{lsi|lswi} %0,%P1,16\";
9023 /* ... fall through ... */
9029 [(set_attr "type" "store,store,*,load,load,*")])
9031 (define_insn "*movti_string"
9032 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9033 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9034 "! TARGET_POWER && ! TARGET_POWERPC64
9035 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9038 switch (which_alternative)
9044 return \"{stsi|stswi} %1,%P0,16\";
9049 /* If the address is not used in the output, we can use lsi. Otherwise,
9050 fall through to generating four loads. */
9052 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9053 return \"{lsi|lswi} %0,%P1,16\";
9054 /* ... fall through ... */
9060 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
9062 (define_insn "*movti_ppc64"
9063 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9064 (match_operand:TI 1 "input_operand" "r,r,m"))]
9065 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9066 || gpc_reg_operand (operands[1], TImode))"
9068 [(set_attr "type" "*,load,store")])
9071 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9072 (match_operand:TI 1 "const_double_operand" ""))]
9074 [(set (match_dup 2) (match_dup 4))
9075 (set (match_dup 3) (match_dup 5))]
9078 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9080 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9082 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9084 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9085 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9087 else if (GET_CODE (operands[1]) == CONST_INT)
9089 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9090 operands[5] = operands[1];
9097 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9098 (match_operand:TI 1 "input_operand" ""))]
9100 && gpr_or_gpr_p (operands[0], operands[1])"
9102 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9104 (define_expand "load_multiple"
9105 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9106 (match_operand:SI 1 "" ""))
9107 (use (match_operand:SI 2 "" ""))])]
9108 "TARGET_STRING && !TARGET_POWERPC64"
9116 /* Support only loading a constant number of fixed-point registers from
9117 memory and only bother with this if more than two; the machine
9118 doesn't support more than eight. */
9119 if (GET_CODE (operands[2]) != CONST_INT
9120 || INTVAL (operands[2]) <= 2
9121 || INTVAL (operands[2]) > 8
9122 || GET_CODE (operands[1]) != MEM
9123 || GET_CODE (operands[0]) != REG
9124 || REGNO (operands[0]) >= 32)
9127 count = INTVAL (operands[2]);
9128 regno = REGNO (operands[0]);
9130 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9131 op1 = replace_equiv_address (operands[1],
9132 force_reg (SImode, XEXP (operands[1], 0)));
9134 for (i = 0; i < count; i++)
9135 XVECEXP (operands[3], 0, i)
9136 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9137 adjust_address_nv (op1, SImode, i * 4));
9140 (define_insn "*ldmsi8"
9141 [(match_parallel 0 "load_multiple_operation"
9142 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9143 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9144 (set (match_operand:SI 3 "gpc_reg_operand" "")
9145 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9146 (set (match_operand:SI 4 "gpc_reg_operand" "")
9147 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9148 (set (match_operand:SI 5 "gpc_reg_operand" "")
9149 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9150 (set (match_operand:SI 6 "gpc_reg_operand" "")
9151 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9152 (set (match_operand:SI 7 "gpc_reg_operand" "")
9153 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9154 (set (match_operand:SI 8 "gpc_reg_operand" "")
9155 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9156 (set (match_operand:SI 9 "gpc_reg_operand" "")
9157 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9158 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9160 { return rs6000_output_load_multiple (operands); }"
9161 [(set_attr "type" "load_ux")
9162 (set_attr "length" "32")])
9164 (define_insn "*ldmsi7"
9165 [(match_parallel 0 "load_multiple_operation"
9166 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9167 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9168 (set (match_operand:SI 3 "gpc_reg_operand" "")
9169 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9170 (set (match_operand:SI 4 "gpc_reg_operand" "")
9171 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9172 (set (match_operand:SI 5 "gpc_reg_operand" "")
9173 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9174 (set (match_operand:SI 6 "gpc_reg_operand" "")
9175 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9176 (set (match_operand:SI 7 "gpc_reg_operand" "")
9177 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9178 (set (match_operand:SI 8 "gpc_reg_operand" "")
9179 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9180 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9182 { return rs6000_output_load_multiple (operands); }"
9183 [(set_attr "type" "load_ux")
9184 (set_attr "length" "32")])
9186 (define_insn "*ldmsi6"
9187 [(match_parallel 0 "load_multiple_operation"
9188 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9189 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9190 (set (match_operand:SI 3 "gpc_reg_operand" "")
9191 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9192 (set (match_operand:SI 4 "gpc_reg_operand" "")
9193 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9194 (set (match_operand:SI 5 "gpc_reg_operand" "")
9195 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9196 (set (match_operand:SI 6 "gpc_reg_operand" "")
9197 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9198 (set (match_operand:SI 7 "gpc_reg_operand" "")
9199 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9200 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9202 { return rs6000_output_load_multiple (operands); }"
9203 [(set_attr "type" "load_ux")
9204 (set_attr "length" "32")])
9206 (define_insn "*ldmsi5"
9207 [(match_parallel 0 "load_multiple_operation"
9208 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9209 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9210 (set (match_operand:SI 3 "gpc_reg_operand" "")
9211 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9212 (set (match_operand:SI 4 "gpc_reg_operand" "")
9213 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9214 (set (match_operand:SI 5 "gpc_reg_operand" "")
9215 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9216 (set (match_operand:SI 6 "gpc_reg_operand" "")
9217 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9218 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9220 { return rs6000_output_load_multiple (operands); }"
9221 [(set_attr "type" "load_ux")
9222 (set_attr "length" "32")])
9224 (define_insn "*ldmsi4"
9225 [(match_parallel 0 "load_multiple_operation"
9226 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9227 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9228 (set (match_operand:SI 3 "gpc_reg_operand" "")
9229 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9230 (set (match_operand:SI 4 "gpc_reg_operand" "")
9231 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9232 (set (match_operand:SI 5 "gpc_reg_operand" "")
9233 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9234 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9236 { return rs6000_output_load_multiple (operands); }"
9237 [(set_attr "type" "load_ux")
9238 (set_attr "length" "32")])
9240 (define_insn "*ldmsi3"
9241 [(match_parallel 0 "load_multiple_operation"
9242 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9243 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9244 (set (match_operand:SI 3 "gpc_reg_operand" "")
9245 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9246 (set (match_operand:SI 4 "gpc_reg_operand" "")
9247 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9248 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9250 { return rs6000_output_load_multiple (operands); }"
9251 [(set_attr "type" "load_ux")
9252 (set_attr "length" "32")])
9254 (define_expand "store_multiple"
9255 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9256 (match_operand:SI 1 "" ""))
9257 (clobber (scratch:SI))
9258 (use (match_operand:SI 2 "" ""))])]
9259 "TARGET_STRING && !TARGET_POWERPC64"
9268 /* Support only storing a constant number of fixed-point registers to
9269 memory and only bother with this if more than two; the machine
9270 doesn't support more than eight. */
9271 if (GET_CODE (operands[2]) != CONST_INT
9272 || INTVAL (operands[2]) <= 2
9273 || INTVAL (operands[2]) > 8
9274 || GET_CODE (operands[0]) != MEM
9275 || GET_CODE (operands[1]) != REG
9276 || REGNO (operands[1]) >= 32)
9279 count = INTVAL (operands[2]);
9280 regno = REGNO (operands[1]);
9282 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9283 to = force_reg (SImode, XEXP (operands[0], 0));
9284 op0 = replace_equiv_address (operands[0], to);
9286 XVECEXP (operands[3], 0, 0)
9287 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9288 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9289 gen_rtx_SCRATCH (SImode));
9291 for (i = 1; i < count; i++)
9292 XVECEXP (operands[3], 0, i + 1)
9293 = gen_rtx_SET (VOIDmode,
9294 adjust_address_nv (op0, SImode, i * 4),
9295 gen_rtx_REG (SImode, regno + i));
9298 (define_insn "*stmsi8"
9299 [(match_parallel 0 "store_multiple_operation"
9300 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9301 (match_operand:SI 2 "gpc_reg_operand" "r"))
9302 (clobber (match_scratch:SI 3 "=X"))
9303 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9304 (match_operand:SI 4 "gpc_reg_operand" "r"))
9305 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9306 (match_operand:SI 5 "gpc_reg_operand" "r"))
9307 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9308 (match_operand:SI 6 "gpc_reg_operand" "r"))
9309 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9310 (match_operand:SI 7 "gpc_reg_operand" "r"))
9311 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9312 (match_operand:SI 8 "gpc_reg_operand" "r"))
9313 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9314 (match_operand:SI 9 "gpc_reg_operand" "r"))
9315 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9316 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9317 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9318 "{stsi|stswi} %2,%1,%O0"
9319 [(set_attr "type" "store_ux")])
9321 (define_insn "*stmsi7"
9322 [(match_parallel 0 "store_multiple_operation"
9323 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9324 (match_operand:SI 2 "gpc_reg_operand" "r"))
9325 (clobber (match_scratch:SI 3 "=X"))
9326 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9327 (match_operand:SI 4 "gpc_reg_operand" "r"))
9328 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9329 (match_operand:SI 5 "gpc_reg_operand" "r"))
9330 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9331 (match_operand:SI 6 "gpc_reg_operand" "r"))
9332 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9333 (match_operand:SI 7 "gpc_reg_operand" "r"))
9334 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9335 (match_operand:SI 8 "gpc_reg_operand" "r"))
9336 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9337 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9338 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9339 "{stsi|stswi} %2,%1,%O0"
9340 [(set_attr "type" "store_ux")])
9342 (define_insn "*stmsi6"
9343 [(match_parallel 0 "store_multiple_operation"
9344 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9345 (match_operand:SI 2 "gpc_reg_operand" "r"))
9346 (clobber (match_scratch:SI 3 "=X"))
9347 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9348 (match_operand:SI 4 "gpc_reg_operand" "r"))
9349 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9350 (match_operand:SI 5 "gpc_reg_operand" "r"))
9351 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9352 (match_operand:SI 6 "gpc_reg_operand" "r"))
9353 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9354 (match_operand:SI 7 "gpc_reg_operand" "r"))
9355 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9356 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9357 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9358 "{stsi|stswi} %2,%1,%O0"
9359 [(set_attr "type" "store_ux")])
9361 (define_insn "*stmsi5"
9362 [(match_parallel 0 "store_multiple_operation"
9363 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9364 (match_operand:SI 2 "gpc_reg_operand" "r"))
9365 (clobber (match_scratch:SI 3 "=X"))
9366 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9367 (match_operand:SI 4 "gpc_reg_operand" "r"))
9368 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9369 (match_operand:SI 5 "gpc_reg_operand" "r"))
9370 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9371 (match_operand:SI 6 "gpc_reg_operand" "r"))
9372 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9373 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9374 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9375 "{stsi|stswi} %2,%1,%O0"
9376 [(set_attr "type" "store_ux")])
9378 (define_insn "*stmsi4"
9379 [(match_parallel 0 "store_multiple_operation"
9380 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9381 (match_operand:SI 2 "gpc_reg_operand" "r"))
9382 (clobber (match_scratch:SI 3 "=X"))
9383 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9384 (match_operand:SI 4 "gpc_reg_operand" "r"))
9385 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9386 (match_operand:SI 5 "gpc_reg_operand" "r"))
9387 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9388 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9389 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9390 "{stsi|stswi} %2,%1,%O0"
9391 [(set_attr "type" "store_ux")])
9393 (define_insn "*stmsi3"
9394 [(match_parallel 0 "store_multiple_operation"
9395 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9396 (match_operand:SI 2 "gpc_reg_operand" "r"))
9397 (clobber (match_scratch:SI 3 "=X"))
9398 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9399 (match_operand:SI 4 "gpc_reg_operand" "r"))
9400 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9401 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9402 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9403 "{stsi|stswi} %2,%1,%O0"
9404 [(set_attr "type" "store_ux")])
9406 (define_insn "*stmsi8_power"
9407 [(match_parallel 0 "store_multiple_operation"
9408 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9409 (match_operand:SI 2 "gpc_reg_operand" "r"))
9410 (clobber (match_scratch:SI 3 "=q"))
9411 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9412 (match_operand:SI 4 "gpc_reg_operand" "r"))
9413 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9414 (match_operand:SI 5 "gpc_reg_operand" "r"))
9415 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9416 (match_operand:SI 6 "gpc_reg_operand" "r"))
9417 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9418 (match_operand:SI 7 "gpc_reg_operand" "r"))
9419 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9420 (match_operand:SI 8 "gpc_reg_operand" "r"))
9421 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9422 (match_operand:SI 9 "gpc_reg_operand" "r"))
9423 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9424 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9425 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9426 "{stsi|stswi} %2,%1,%O0"
9427 [(set_attr "type" "store_ux")])
9429 (define_insn "*stmsi7_power"
9430 [(match_parallel 0 "store_multiple_operation"
9431 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9432 (match_operand:SI 2 "gpc_reg_operand" "r"))
9433 (clobber (match_scratch:SI 3 "=q"))
9434 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9435 (match_operand:SI 4 "gpc_reg_operand" "r"))
9436 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9437 (match_operand:SI 5 "gpc_reg_operand" "r"))
9438 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9439 (match_operand:SI 6 "gpc_reg_operand" "r"))
9440 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9441 (match_operand:SI 7 "gpc_reg_operand" "r"))
9442 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9443 (match_operand:SI 8 "gpc_reg_operand" "r"))
9444 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9445 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9446 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9447 "{stsi|stswi} %2,%1,%O0"
9448 [(set_attr "type" "store_ux")])
9450 (define_insn "*stmsi6_power"
9451 [(match_parallel 0 "store_multiple_operation"
9452 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9453 (match_operand:SI 2 "gpc_reg_operand" "r"))
9454 (clobber (match_scratch:SI 3 "=q"))
9455 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9456 (match_operand:SI 4 "gpc_reg_operand" "r"))
9457 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9458 (match_operand:SI 5 "gpc_reg_operand" "r"))
9459 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9460 (match_operand:SI 6 "gpc_reg_operand" "r"))
9461 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9462 (match_operand:SI 7 "gpc_reg_operand" "r"))
9463 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9464 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9465 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9466 "{stsi|stswi} %2,%1,%O0"
9467 [(set_attr "type" "store_ux")])
9469 (define_insn "*stmsi5_power"
9470 [(match_parallel 0 "store_multiple_operation"
9471 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9472 (match_operand:SI 2 "gpc_reg_operand" "r"))
9473 (clobber (match_scratch:SI 3 "=q"))
9474 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9475 (match_operand:SI 4 "gpc_reg_operand" "r"))
9476 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9477 (match_operand:SI 5 "gpc_reg_operand" "r"))
9478 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9479 (match_operand:SI 6 "gpc_reg_operand" "r"))
9480 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9481 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9482 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9483 "{stsi|stswi} %2,%1,%O0"
9484 [(set_attr "type" "store_ux")])
9486 (define_insn "*stmsi4_power"
9487 [(match_parallel 0 "store_multiple_operation"
9488 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9489 (match_operand:SI 2 "gpc_reg_operand" "r"))
9490 (clobber (match_scratch:SI 3 "=q"))
9491 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9492 (match_operand:SI 4 "gpc_reg_operand" "r"))
9493 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9494 (match_operand:SI 5 "gpc_reg_operand" "r"))
9495 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9496 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9497 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9498 "{stsi|stswi} %2,%1,%O0"
9499 [(set_attr "type" "store_ux")])
9501 (define_insn "*stmsi3_power"
9502 [(match_parallel 0 "store_multiple_operation"
9503 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9504 (match_operand:SI 2 "gpc_reg_operand" "r"))
9505 (clobber (match_scratch:SI 3 "=q"))
9506 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9507 (match_operand:SI 4 "gpc_reg_operand" "r"))
9508 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9509 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9510 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9511 "{stsi|stswi} %2,%1,%O0"
9512 [(set_attr "type" "store_ux")])
9514 (define_expand "setmemsi"
9515 [(parallel [(set (match_operand:BLK 0 "" "")
9516 (match_operand 2 "const_int_operand" ""))
9517 (use (match_operand:SI 1 "" ""))
9518 (use (match_operand:SI 3 "" ""))])]
9522 /* If value to set is not zero, use the library routine. */
9523 if (operands[2] != const0_rtx)
9526 if (expand_block_clear (operands))
9532 ;; String/block move insn.
9533 ;; Argument 0 is the destination
9534 ;; Argument 1 is the source
9535 ;; Argument 2 is the length
9536 ;; Argument 3 is the alignment
9538 (define_expand "movmemsi"
9539 [(parallel [(set (match_operand:BLK 0 "" "")
9540 (match_operand:BLK 1 "" ""))
9541 (use (match_operand:SI 2 "" ""))
9542 (use (match_operand:SI 3 "" ""))])]
9546 if (expand_block_move (operands))
9552 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9553 ;; register allocator doesn't have a clue about allocating 8 word registers.
9554 ;; rD/rS = r5 is preferred, efficient form.
9555 (define_expand "movmemsi_8reg"
9556 [(parallel [(set (match_operand 0 "" "")
9557 (match_operand 1 "" ""))
9558 (use (match_operand 2 "" ""))
9559 (use (match_operand 3 "" ""))
9560 (clobber (reg:SI 5))
9561 (clobber (reg:SI 6))
9562 (clobber (reg:SI 7))
9563 (clobber (reg:SI 8))
9564 (clobber (reg:SI 9))
9565 (clobber (reg:SI 10))
9566 (clobber (reg:SI 11))
9567 (clobber (reg:SI 12))
9568 (clobber (match_scratch:SI 4 ""))])]
9573 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9574 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9575 (use (match_operand:SI 2 "immediate_operand" "i"))
9576 (use (match_operand:SI 3 "immediate_operand" "i"))
9577 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9578 (clobber (reg:SI 6))
9579 (clobber (reg:SI 7))
9580 (clobber (reg:SI 8))
9581 (clobber (reg:SI 9))
9582 (clobber (reg:SI 10))
9583 (clobber (reg:SI 11))
9584 (clobber (reg:SI 12))
9585 (clobber (match_scratch:SI 5 "=q"))]
9586 "TARGET_STRING && TARGET_POWER
9587 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9588 || INTVAL (operands[2]) == 0)
9589 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9590 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9591 && REGNO (operands[4]) == 5"
9592 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9593 [(set_attr "type" "store_ux")
9594 (set_attr "length" "8")])
9597 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9598 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9599 (use (match_operand:SI 2 "immediate_operand" "i"))
9600 (use (match_operand:SI 3 "immediate_operand" "i"))
9601 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9602 (clobber (reg:SI 6))
9603 (clobber (reg:SI 7))
9604 (clobber (reg:SI 8))
9605 (clobber (reg:SI 9))
9606 (clobber (reg:SI 10))
9607 (clobber (reg:SI 11))
9608 (clobber (reg:SI 12))
9609 (clobber (match_scratch:SI 5 "=X"))]
9610 "TARGET_STRING && ! TARGET_POWER
9611 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9612 || INTVAL (operands[2]) == 0)
9613 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9614 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9615 && REGNO (operands[4]) == 5"
9616 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9617 [(set_attr "type" "store_ux")
9618 (set_attr "length" "8")])
9620 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9621 ;; register allocator doesn't have a clue about allocating 6 word registers.
9622 ;; rD/rS = r5 is preferred, efficient form.
9623 (define_expand "movmemsi_6reg"
9624 [(parallel [(set (match_operand 0 "" "")
9625 (match_operand 1 "" ""))
9626 (use (match_operand 2 "" ""))
9627 (use (match_operand 3 "" ""))
9628 (clobber (reg:SI 5))
9629 (clobber (reg:SI 6))
9630 (clobber (reg:SI 7))
9631 (clobber (reg:SI 8))
9632 (clobber (reg:SI 9))
9633 (clobber (reg:SI 10))
9634 (clobber (match_scratch:SI 4 ""))])]
9639 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9640 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9641 (use (match_operand:SI 2 "immediate_operand" "i"))
9642 (use (match_operand:SI 3 "immediate_operand" "i"))
9643 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9644 (clobber (reg:SI 6))
9645 (clobber (reg:SI 7))
9646 (clobber (reg:SI 8))
9647 (clobber (reg:SI 9))
9648 (clobber (reg:SI 10))
9649 (clobber (match_scratch:SI 5 "=q"))]
9650 "TARGET_STRING && TARGET_POWER
9651 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9652 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9653 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9654 && REGNO (operands[4]) == 5"
9655 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9656 [(set_attr "type" "store_ux")
9657 (set_attr "length" "8")])
9660 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9661 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9662 (use (match_operand:SI 2 "immediate_operand" "i"))
9663 (use (match_operand:SI 3 "immediate_operand" "i"))
9664 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9665 (clobber (reg:SI 6))
9666 (clobber (reg:SI 7))
9667 (clobber (reg:SI 8))
9668 (clobber (reg:SI 9))
9669 (clobber (reg:SI 10))
9670 (clobber (match_scratch:SI 5 "=X"))]
9671 "TARGET_STRING && ! TARGET_POWER
9672 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9673 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9674 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9675 && REGNO (operands[4]) == 5"
9676 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9677 [(set_attr "type" "store_ux")
9678 (set_attr "length" "8")])
9680 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9681 ;; problems with TImode.
9682 ;; rD/rS = r5 is preferred, efficient form.
9683 (define_expand "movmemsi_4reg"
9684 [(parallel [(set (match_operand 0 "" "")
9685 (match_operand 1 "" ""))
9686 (use (match_operand 2 "" ""))
9687 (use (match_operand 3 "" ""))
9688 (clobber (reg:SI 5))
9689 (clobber (reg:SI 6))
9690 (clobber (reg:SI 7))
9691 (clobber (reg:SI 8))
9692 (clobber (match_scratch:SI 4 ""))])]
9697 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9698 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9699 (use (match_operand:SI 2 "immediate_operand" "i"))
9700 (use (match_operand:SI 3 "immediate_operand" "i"))
9701 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9702 (clobber (reg:SI 6))
9703 (clobber (reg:SI 7))
9704 (clobber (reg:SI 8))
9705 (clobber (match_scratch:SI 5 "=q"))]
9706 "TARGET_STRING && TARGET_POWER
9707 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9708 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9709 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9710 && REGNO (operands[4]) == 5"
9711 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9712 [(set_attr "type" "store_ux")
9713 (set_attr "length" "8")])
9716 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9717 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9718 (use (match_operand:SI 2 "immediate_operand" "i"))
9719 (use (match_operand:SI 3 "immediate_operand" "i"))
9720 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9721 (clobber (reg:SI 6))
9722 (clobber (reg:SI 7))
9723 (clobber (reg:SI 8))
9724 (clobber (match_scratch:SI 5 "=X"))]
9725 "TARGET_STRING && ! TARGET_POWER
9726 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9727 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9728 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9729 && REGNO (operands[4]) == 5"
9730 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9731 [(set_attr "type" "store_ux")
9732 (set_attr "length" "8")])
9734 ;; Move up to 8 bytes at a time.
9735 (define_expand "movmemsi_2reg"
9736 [(parallel [(set (match_operand 0 "" "")
9737 (match_operand 1 "" ""))
9738 (use (match_operand 2 "" ""))
9739 (use (match_operand 3 "" ""))
9740 (clobber (match_scratch:DI 4 ""))
9741 (clobber (match_scratch:SI 5 ""))])]
9742 "TARGET_STRING && ! TARGET_POWERPC64"
9746 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9747 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9748 (use (match_operand:SI 2 "immediate_operand" "i"))
9749 (use (match_operand:SI 3 "immediate_operand" "i"))
9750 (clobber (match_scratch:DI 4 "=&r"))
9751 (clobber (match_scratch:SI 5 "=q"))]
9752 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9753 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9754 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9755 [(set_attr "type" "store_ux")
9756 (set_attr "length" "8")])
9759 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9760 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9761 (use (match_operand:SI 2 "immediate_operand" "i"))
9762 (use (match_operand:SI 3 "immediate_operand" "i"))
9763 (clobber (match_scratch:DI 4 "=&r"))
9764 (clobber (match_scratch:SI 5 "=X"))]
9765 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9766 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9767 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9768 [(set_attr "type" "store_ux")
9769 (set_attr "length" "8")])
9771 ;; Move up to 4 bytes at a time.
9772 (define_expand "movmemsi_1reg"
9773 [(parallel [(set (match_operand 0 "" "")
9774 (match_operand 1 "" ""))
9775 (use (match_operand 2 "" ""))
9776 (use (match_operand 3 "" ""))
9777 (clobber (match_scratch:SI 4 ""))
9778 (clobber (match_scratch:SI 5 ""))])]
9783 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9784 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9785 (use (match_operand:SI 2 "immediate_operand" "i"))
9786 (use (match_operand:SI 3 "immediate_operand" "i"))
9787 (clobber (match_scratch:SI 4 "=&r"))
9788 (clobber (match_scratch:SI 5 "=q"))]
9789 "TARGET_STRING && TARGET_POWER
9790 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9791 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9792 [(set_attr "type" "store_ux")
9793 (set_attr "length" "8")])
9796 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9797 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9798 (use (match_operand:SI 2 "immediate_operand" "i"))
9799 (use (match_operand:SI 3 "immediate_operand" "i"))
9800 (clobber (match_scratch:SI 4 "=&r"))
9801 (clobber (match_scratch:SI 5 "=X"))]
9802 "TARGET_STRING && ! TARGET_POWER
9803 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9804 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9805 [(set_attr "type" "store_ux")
9806 (set_attr "length" "8")])
9808 ;; Define insns that do load or store with update. Some of these we can
9809 ;; get by using pre-decrement or pre-increment, but the hardware can also
9810 ;; do cases where the increment is not the size of the object.
9812 ;; In all these cases, we use operands 0 and 1 for the register being
9813 ;; incremented because those are the operands that local-alloc will
9814 ;; tie and these are the pair most likely to be tieable (and the ones
9815 ;; that will benefit the most).
9817 (define_insn "*movdi_update1"
9818 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9819 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9820 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9821 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9822 (plus:DI (match_dup 1) (match_dup 2)))]
9823 "TARGET_POWERPC64 && TARGET_UPDATE"
9827 [(set_attr "type" "load_ux,load_u")])
9829 (define_insn "movdi_<mode>_update"
9830 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9831 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9832 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9833 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9834 (plus:P (match_dup 1) (match_dup 2)))]
9835 "TARGET_POWERPC64 && TARGET_UPDATE"
9839 [(set_attr "type" "store_ux,store_u")])
9841 (define_insn "*movsi_update1"
9842 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9843 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9844 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9845 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9846 (plus:SI (match_dup 1) (match_dup 2)))]
9849 {lux|lwzux} %3,%0,%2
9850 {lu|lwzu} %3,%2(%0)"
9851 [(set_attr "type" "load_ux,load_u")])
9853 (define_insn "*movsi_update2"
9854 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9856 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9857 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9858 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9859 (plus:DI (match_dup 1) (match_dup 2)))]
9862 [(set_attr "type" "load_ext_ux")])
9864 (define_insn "movsi_update"
9865 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9866 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9867 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9868 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9869 (plus:SI (match_dup 1) (match_dup 2)))]
9872 {stux|stwux} %3,%0,%2
9873 {stu|stwu} %3,%2(%0)"
9874 [(set_attr "type" "store_ux,store_u")])
9876 (define_insn "*movhi_update1"
9877 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9878 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9879 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9880 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9881 (plus:SI (match_dup 1) (match_dup 2)))]
9886 [(set_attr "type" "load_ux,load_u")])
9888 (define_insn "*movhi_update2"
9889 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9891 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9892 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9893 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9894 (plus:SI (match_dup 1) (match_dup 2)))]
9899 [(set_attr "type" "load_ux,load_u")])
9901 (define_insn "*movhi_update3"
9902 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9904 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9905 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9906 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9907 (plus:SI (match_dup 1) (match_dup 2)))]
9912 [(set_attr "type" "load_ext_ux,load_ext_u")])
9914 (define_insn "*movhi_update4"
9915 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9916 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9917 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9918 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9919 (plus:SI (match_dup 1) (match_dup 2)))]
9924 [(set_attr "type" "store_ux,store_u")])
9926 (define_insn "*movqi_update1"
9927 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9928 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9929 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9930 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9931 (plus:SI (match_dup 1) (match_dup 2)))]
9936 [(set_attr "type" "load_ux,load_u")])
9938 (define_insn "*movqi_update2"
9939 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9941 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9942 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9943 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9944 (plus:SI (match_dup 1) (match_dup 2)))]
9949 [(set_attr "type" "load_ux,load_u")])
9951 (define_insn "*movqi_update3"
9952 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9953 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9954 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9955 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9956 (plus:SI (match_dup 1) (match_dup 2)))]
9961 [(set_attr "type" "store_ux,store_u")])
9963 (define_insn "*movsf_update1"
9964 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9965 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9966 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9967 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9968 (plus:SI (match_dup 1) (match_dup 2)))]
9969 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9973 [(set_attr "type" "fpload_ux,fpload_u")])
9975 (define_insn "*movsf_update2"
9976 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9977 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9978 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9979 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9980 (plus:SI (match_dup 1) (match_dup 2)))]
9981 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9985 [(set_attr "type" "fpstore_ux,fpstore_u")])
9987 (define_insn "*movsf_update3"
9988 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9989 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9990 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9991 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9992 (plus:SI (match_dup 1) (match_dup 2)))]
9993 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9995 {lux|lwzux} %3,%0,%2
9996 {lu|lwzu} %3,%2(%0)"
9997 [(set_attr "type" "load_ux,load_u")])
9999 (define_insn "*movsf_update4"
10000 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10001 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10002 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10003 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10004 (plus:SI (match_dup 1) (match_dup 2)))]
10005 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10007 {stux|stwux} %3,%0,%2
10008 {stu|stwu} %3,%2(%0)"
10009 [(set_attr "type" "store_ux,store_u")])
10011 (define_insn "*movdf_update1"
10012 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10013 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10014 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10015 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10016 (plus:SI (match_dup 1) (match_dup 2)))]
10017 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10021 [(set_attr "type" "fpload_ux,fpload_u")])
10023 (define_insn "*movdf_update2"
10024 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10025 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10026 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10027 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10028 (plus:SI (match_dup 1) (match_dup 2)))]
10029 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10033 [(set_attr "type" "fpstore_ux,fpstore_u")])
10035 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10037 (define_insn "*lfq_power2"
10038 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10039 (match_operand:V2DF 1 "memory_operand" ""))]
10041 && TARGET_HARD_FLOAT && TARGET_FPRS"
10045 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10046 (match_operand:DF 1 "memory_operand" ""))
10047 (set (match_operand:DF 2 "gpc_reg_operand" "")
10048 (match_operand:DF 3 "memory_operand" ""))]
10050 && TARGET_HARD_FLOAT && TARGET_FPRS
10051 && registers_ok_for_quad_peep (operands[0], operands[2])
10052 && mems_ok_for_quad_peep (operands[1], operands[3])"
10053 [(set (match_dup 0)
10055 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10056 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10058 (define_insn "*stfq_power2"
10059 [(set (match_operand:V2DF 0 "memory_operand" "")
10060 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10062 && TARGET_HARD_FLOAT && TARGET_FPRS"
10063 "stfq%U0%X0 %1,%0")
10067 [(set (match_operand:DF 0 "memory_operand" "")
10068 (match_operand:DF 1 "gpc_reg_operand" ""))
10069 (set (match_operand:DF 2 "memory_operand" "")
10070 (match_operand:DF 3 "gpc_reg_operand" ""))]
10072 && TARGET_HARD_FLOAT && TARGET_FPRS
10073 && registers_ok_for_quad_peep (operands[1], operands[3])
10074 && mems_ok_for_quad_peep (operands[0], operands[2])"
10075 [(set (match_dup 0)
10077 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10078 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10080 ;; After inserting conditional returns we can sometimes have
10081 ;; unnecessary register moves. Unfortunately we cannot have a
10082 ;; modeless peephole here, because some single SImode sets have early
10083 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10084 ;; sequences, using get_attr_length here will smash the operands
10085 ;; array. Neither is there an early_cobbler_p predicate.
10086 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10088 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10089 (match_operand:DF 1 "any_operand" ""))
10090 (set (match_operand:DF 2 "gpc_reg_operand" "")
10092 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10093 && peep2_reg_dead_p (2, operands[0])"
10094 [(set (match_dup 2) (match_dup 1))])
10097 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10098 (match_operand:SF 1 "any_operand" ""))
10099 (set (match_operand:SF 2 "gpc_reg_operand" "")
10101 "peep2_reg_dead_p (2, operands[0])"
10102 [(set (match_dup 2) (match_dup 1))])
10107 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
10108 (define_insn "tls_gd_32"
10109 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10110 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10111 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10113 "HAVE_AS_TLS && !TARGET_64BIT"
10114 "addi %0,%1,%2@got@tlsgd")
10116 (define_insn "tls_gd_64"
10117 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10118 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10119 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10121 "HAVE_AS_TLS && TARGET_64BIT"
10122 "addi %0,%1,%2@got@tlsgd")
10124 (define_insn "tls_ld_32"
10125 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10126 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
10128 "HAVE_AS_TLS && !TARGET_64BIT"
10129 "addi %0,%1,%&@got@tlsld")
10131 (define_insn "tls_ld_64"
10132 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10133 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
10135 "HAVE_AS_TLS && TARGET_64BIT"
10136 "addi %0,%1,%&@got@tlsld")
10138 (define_insn "tls_dtprel_32"
10139 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10140 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10141 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10142 UNSPEC_TLSDTPREL))]
10143 "HAVE_AS_TLS && !TARGET_64BIT"
10144 "addi %0,%1,%2@dtprel")
10146 (define_insn "tls_dtprel_64"
10147 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10148 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10149 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10150 UNSPEC_TLSDTPREL))]
10151 "HAVE_AS_TLS && TARGET_64BIT"
10152 "addi %0,%1,%2@dtprel")
10154 (define_insn "tls_dtprel_ha_32"
10155 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10156 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10157 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10158 UNSPEC_TLSDTPRELHA))]
10159 "HAVE_AS_TLS && !TARGET_64BIT"
10160 "addis %0,%1,%2@dtprel@ha")
10162 (define_insn "tls_dtprel_ha_64"
10163 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10164 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10165 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10166 UNSPEC_TLSDTPRELHA))]
10167 "HAVE_AS_TLS && TARGET_64BIT"
10168 "addis %0,%1,%2@dtprel@ha")
10170 (define_insn "tls_dtprel_lo_32"
10171 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10172 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10173 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10174 UNSPEC_TLSDTPRELLO))]
10175 "HAVE_AS_TLS && !TARGET_64BIT"
10176 "addi %0,%1,%2@dtprel@l")
10178 (define_insn "tls_dtprel_lo_64"
10179 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10180 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10181 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10182 UNSPEC_TLSDTPRELLO))]
10183 "HAVE_AS_TLS && TARGET_64BIT"
10184 "addi %0,%1,%2@dtprel@l")
10186 (define_insn "tls_got_dtprel_32"
10187 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10188 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10189 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10190 UNSPEC_TLSGOTDTPREL))]
10191 "HAVE_AS_TLS && !TARGET_64BIT"
10192 "lwz %0,%2@got@dtprel(%1)")
10194 (define_insn "tls_got_dtprel_64"
10195 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10196 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10197 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10198 UNSPEC_TLSGOTDTPREL))]
10199 "HAVE_AS_TLS && TARGET_64BIT"
10200 "ld %0,%2@got@dtprel(%1)")
10202 (define_insn "tls_tprel_32"
10203 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10204 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10205 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10207 "HAVE_AS_TLS && !TARGET_64BIT"
10208 "addi %0,%1,%2@tprel")
10210 (define_insn "tls_tprel_64"
10211 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10212 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10213 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10215 "HAVE_AS_TLS && TARGET_64BIT"
10216 "addi %0,%1,%2@tprel")
10218 (define_insn "tls_tprel_ha_32"
10219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10220 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10221 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10222 UNSPEC_TLSTPRELHA))]
10223 "HAVE_AS_TLS && !TARGET_64BIT"
10224 "addis %0,%1,%2@tprel@ha")
10226 (define_insn "tls_tprel_ha_64"
10227 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10228 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10229 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10230 UNSPEC_TLSTPRELHA))]
10231 "HAVE_AS_TLS && TARGET_64BIT"
10232 "addis %0,%1,%2@tprel@ha")
10234 (define_insn "tls_tprel_lo_32"
10235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10236 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10237 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10238 UNSPEC_TLSTPRELLO))]
10239 "HAVE_AS_TLS && !TARGET_64BIT"
10240 "addi %0,%1,%2@tprel@l")
10242 (define_insn "tls_tprel_lo_64"
10243 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10244 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10245 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10246 UNSPEC_TLSTPRELLO))]
10247 "HAVE_AS_TLS && TARGET_64BIT"
10248 "addi %0,%1,%2@tprel@l")
10250 ;; "b" output constraint here and on tls_tls input to support linker tls
10251 ;; optimization. The linker may edit the instructions emitted by a
10252 ;; tls_got_tprel/tls_tls pair to addis,addi.
10253 (define_insn "tls_got_tprel_32"
10254 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10255 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10256 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10257 UNSPEC_TLSGOTTPREL))]
10258 "HAVE_AS_TLS && !TARGET_64BIT"
10259 "lwz %0,%2@got@tprel(%1)")
10261 (define_insn "tls_got_tprel_64"
10262 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10263 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10264 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10265 UNSPEC_TLSGOTTPREL))]
10266 "HAVE_AS_TLS && TARGET_64BIT"
10267 "ld %0,%2@got@tprel(%1)")
10269 (define_insn "tls_tls_32"
10270 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10271 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10272 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10274 "HAVE_AS_TLS && !TARGET_64BIT"
10275 "add %0,%1,%2@tls")
10277 (define_insn "tls_tls_64"
10278 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10279 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10280 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10282 "HAVE_AS_TLS && TARGET_64BIT"
10283 "add %0,%1,%2@tls")
10285 ;; Next come insns related to the calling sequence.
10287 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10288 ;; We move the back-chain and decrement the stack pointer.
10290 (define_expand "allocate_stack"
10291 [(set (match_operand 0 "gpc_reg_operand" "=r")
10292 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10294 (minus (reg 1) (match_dup 1)))]
10297 { rtx chain = gen_reg_rtx (Pmode);
10298 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10301 emit_move_insn (chain, stack_bot);
10303 /* Check stack bounds if necessary. */
10304 if (current_function_limit_stack)
10307 available = expand_binop (Pmode, sub_optab,
10308 stack_pointer_rtx, stack_limit_rtx,
10309 NULL_RTX, 1, OPTAB_WIDEN);
10310 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10313 if (GET_CODE (operands[1]) != CONST_INT
10314 || INTVAL (operands[1]) < -32767
10315 || INTVAL (operands[1]) > 32768)
10317 neg_op0 = gen_reg_rtx (Pmode);
10319 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10321 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10324 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10327 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10328 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10332 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10333 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10334 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10337 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10341 ;; These patterns say how to save and restore the stack pointer. We need not
10342 ;; save the stack pointer at function level since we are careful to
10343 ;; preserve the backchain. At block level, we have to restore the backchain
10344 ;; when we restore the stack pointer.
10346 ;; For nonlocal gotos, we must save both the stack pointer and its
10347 ;; backchain and restore both. Note that in the nonlocal case, the
10348 ;; save area is a memory location.
10350 (define_expand "save_stack_function"
10351 [(match_operand 0 "any_operand" "")
10352 (match_operand 1 "any_operand" "")]
10356 (define_expand "restore_stack_function"
10357 [(match_operand 0 "any_operand" "")
10358 (match_operand 1 "any_operand" "")]
10362 ;; Adjust stack pointer (op0) to a new value (op1).
10363 ;; First copy old stack backchain to new location, and ensure that the
10364 ;; scheduler won't reorder the sp assignment before the backchain write.
10365 (define_expand "restore_stack_block"
10366 [(set (match_dup 2) (match_dup 3))
10367 (set (match_dup 4) (match_dup 2))
10368 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10369 (set (match_operand 0 "register_operand" "")
10370 (match_operand 1 "register_operand" ""))]
10374 operands[2] = gen_reg_rtx (Pmode);
10375 operands[3] = gen_frame_mem (Pmode, operands[0]);
10376 operands[4] = gen_frame_mem (Pmode, operands[1]);
10377 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10380 (define_expand "save_stack_nonlocal"
10381 [(set (match_dup 3) (match_dup 4))
10382 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10383 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10387 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10389 /* Copy the backchain to the first word, sp to the second. */
10390 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10391 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10392 operands[3] = gen_reg_rtx (Pmode);
10393 operands[4] = gen_frame_mem (Pmode, operands[1]);
10396 (define_expand "restore_stack_nonlocal"
10397 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10398 (set (match_dup 3) (match_dup 4))
10399 (set (match_dup 5) (match_dup 2))
10400 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10401 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10405 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10407 /* Restore the backchain from the first word, sp from the second. */
10408 operands[2] = gen_reg_rtx (Pmode);
10409 operands[3] = gen_reg_rtx (Pmode);
10410 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10411 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10412 operands[5] = gen_frame_mem (Pmode, operands[3]);
10413 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10416 ;; TOC register handling.
10418 ;; Code to initialize the TOC register...
10420 (define_insn "load_toc_aix_si"
10421 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10422 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10423 (use (reg:SI 2))])]
10424 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10428 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10429 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10430 operands[2] = gen_rtx_REG (Pmode, 2);
10431 return \"{l|lwz} %0,%1(%2)\";
10433 [(set_attr "type" "load")])
10435 (define_insn "load_toc_aix_di"
10436 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10437 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10438 (use (reg:DI 2))])]
10439 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10443 #ifdef TARGET_RELOCATABLE
10444 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10445 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10447 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10450 strcat (buf, \"@toc\");
10451 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10452 operands[2] = gen_rtx_REG (Pmode, 2);
10453 return \"ld %0,%1(%2)\";
10455 [(set_attr "type" "load")])
10457 (define_insn "load_toc_v4_pic_si"
10458 [(set (match_operand:SI 0 "register_operand" "=l")
10459 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10460 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10461 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10462 [(set_attr "type" "branch")
10463 (set_attr "length" "4")])
10465 (define_insn "load_toc_v4_PIC_1"
10466 [(set (match_operand:SI 0 "register_operand" "=l")
10467 (match_operand:SI 1 "immediate_operand" "s"))
10468 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
10469 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10470 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10471 "bcl 20,31,%1\\n%1:"
10472 [(set_attr "type" "branch")
10473 (set_attr "length" "4")])
10475 (define_insn "load_toc_v4_PIC_1b"
10476 [(set (match_operand:SI 0 "register_operand" "=l")
10477 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
10479 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10480 "bcl 20,31,$+8\\n\\t.long %1-$"
10481 [(set_attr "type" "branch")
10482 (set_attr "length" "8")])
10484 (define_insn "load_toc_v4_PIC_2"
10485 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10486 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10487 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10488 (match_operand:SI 3 "immediate_operand" "s")))))]
10489 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10490 "{l|lwz} %0,%2-%3(%1)"
10491 [(set_attr "type" "load")])
10493 (define_insn "load_toc_v4_PIC_3b"
10494 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10495 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10497 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10498 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10499 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10500 "{cau|addis} %0,%1,%2-%3@ha")
10502 (define_insn "load_toc_v4_PIC_3c"
10503 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10504 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10505 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10506 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10507 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10508 "{cal|addi} %0,%1,%2-%3@l")
10510 ;; If the TOC is shared over a translation unit, as happens with all
10511 ;; the kinds of PIC that we support, we need to restore the TOC
10512 ;; pointer only when jumping over units of translation.
10513 ;; On Darwin, we need to reload the picbase.
10515 (define_expand "builtin_setjmp_receiver"
10516 [(use (label_ref (match_operand 0 "" "")))]
10517 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10518 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10519 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10523 if (DEFAULT_ABI == ABI_DARWIN)
10525 const char *picbase = machopic_function_base_name ();
10526 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10527 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10531 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10532 CODE_LABEL_NUMBER (operands[0]));
10533 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10535 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10536 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10540 rs6000_emit_load_toc_table (FALSE);
10544 ;; Elf specific ways of loading addresses for non-PIC code.
10545 ;; The output of this could be r0, but we make a very strong
10546 ;; preference for a base register because it will usually
10547 ;; be needed there.
10548 (define_insn "elf_high"
10549 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10550 (high:SI (match_operand 1 "" "")))]
10551 "TARGET_ELF && ! TARGET_64BIT"
10552 "{liu|lis} %0,%1@ha")
10554 (define_insn "elf_low"
10555 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10556 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10557 (match_operand 2 "" "")))]
10558 "TARGET_ELF && ! TARGET_64BIT"
10560 {cal|la} %0,%2@l(%1)
10561 {ai|addic} %0,%1,%K2")
10563 ;; A function pointer under AIX is a pointer to a data area whose first word
10564 ;; contains the actual address of the function, whose second word contains a
10565 ;; pointer to its TOC, and whose third word contains a value to place in the
10566 ;; static chain register (r11). Note that if we load the static chain, our
10567 ;; "trampoline" need not have any executable code.
10569 (define_expand "call_indirect_aix32"
10570 [(set (match_dup 2)
10571 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10572 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10575 (mem:SI (plus:SI (match_dup 0)
10578 (mem:SI (plus:SI (match_dup 0)
10580 (parallel [(call (mem:SI (match_dup 2))
10581 (match_operand 1 "" ""))
10585 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10586 (clobber (scratch:SI))])]
10589 { operands[2] = gen_reg_rtx (SImode); }")
10591 (define_expand "call_indirect_aix64"
10592 [(set (match_dup 2)
10593 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10594 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10597 (mem:DI (plus:DI (match_dup 0)
10600 (mem:DI (plus:DI (match_dup 0)
10602 (parallel [(call (mem:SI (match_dup 2))
10603 (match_operand 1 "" ""))
10607 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10608 (clobber (scratch:SI))])]
10611 { operands[2] = gen_reg_rtx (DImode); }")
10613 (define_expand "call_value_indirect_aix32"
10614 [(set (match_dup 3)
10615 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10616 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10619 (mem:SI (plus:SI (match_dup 1)
10622 (mem:SI (plus:SI (match_dup 1)
10624 (parallel [(set (match_operand 0 "" "")
10625 (call (mem:SI (match_dup 3))
10626 (match_operand 2 "" "")))
10630 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10631 (clobber (scratch:SI))])]
10634 { operands[3] = gen_reg_rtx (SImode); }")
10636 (define_expand "call_value_indirect_aix64"
10637 [(set (match_dup 3)
10638 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10639 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10642 (mem:DI (plus:DI (match_dup 1)
10645 (mem:DI (plus:DI (match_dup 1)
10647 (parallel [(set (match_operand 0 "" "")
10648 (call (mem:SI (match_dup 3))
10649 (match_operand 2 "" "")))
10653 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10654 (clobber (scratch:SI))])]
10657 { operands[3] = gen_reg_rtx (DImode); }")
10659 ;; Now the definitions for the call and call_value insns
10660 (define_expand "call"
10661 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10662 (match_operand 1 "" ""))
10663 (use (match_operand 2 "" ""))
10664 (clobber (scratch:SI))])]
10669 if (MACHOPIC_INDIRECT)
10670 operands[0] = machopic_indirect_call_target (operands[0]);
10673 gcc_assert (GET_CODE (operands[0]) == MEM);
10674 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10676 operands[0] = XEXP (operands[0], 0);
10678 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10680 && GET_CODE (operands[0]) == SYMBOL_REF
10681 && !SYMBOL_REF_LOCAL_P (operands[0]))
10686 tmp = gen_rtvec (3,
10687 gen_rtx_CALL (VOIDmode,
10688 gen_rtx_MEM (SImode, operands[0]),
10690 gen_rtx_USE (VOIDmode, operands[2]),
10691 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10692 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10693 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10697 if (GET_CODE (operands[0]) != SYMBOL_REF
10698 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10699 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10701 if (INTVAL (operands[2]) & CALL_LONG)
10702 operands[0] = rs6000_longcall_ref (operands[0]);
10704 switch (DEFAULT_ABI)
10708 operands[0] = force_reg (Pmode, operands[0]);
10712 /* AIX function pointers are really pointers to a three word
10714 emit_call_insn (TARGET_32BIT
10715 ? gen_call_indirect_aix32 (force_reg (SImode,
10718 : gen_call_indirect_aix64 (force_reg (DImode,
10724 gcc_unreachable ();
10729 (define_expand "call_value"
10730 [(parallel [(set (match_operand 0 "" "")
10731 (call (mem:SI (match_operand 1 "address_operand" ""))
10732 (match_operand 2 "" "")))
10733 (use (match_operand 3 "" ""))
10734 (clobber (scratch:SI))])]
10739 if (MACHOPIC_INDIRECT)
10740 operands[1] = machopic_indirect_call_target (operands[1]);
10743 gcc_assert (GET_CODE (operands[1]) == MEM);
10744 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10746 operands[1] = XEXP (operands[1], 0);
10748 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10750 && GET_CODE (operands[1]) == SYMBOL_REF
10751 && !SYMBOL_REF_LOCAL_P (operands[1]))
10756 tmp = gen_rtvec (3,
10757 gen_rtx_SET (VOIDmode,
10759 gen_rtx_CALL (VOIDmode,
10760 gen_rtx_MEM (SImode,
10763 gen_rtx_USE (VOIDmode, operands[3]),
10764 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
10765 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10766 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10770 if (GET_CODE (operands[1]) != SYMBOL_REF
10771 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10772 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10774 if (INTVAL (operands[3]) & CALL_LONG)
10775 operands[1] = rs6000_longcall_ref (operands[1]);
10777 switch (DEFAULT_ABI)
10781 operands[1] = force_reg (Pmode, operands[1]);
10785 /* AIX function pointers are really pointers to a three word
10787 emit_call_insn (TARGET_32BIT
10788 ? gen_call_value_indirect_aix32 (operands[0],
10792 : gen_call_value_indirect_aix64 (operands[0],
10799 gcc_unreachable ();
10804 ;; Call to function in current module. No TOC pointer reload needed.
10805 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10806 ;; either the function was not prototyped, or it was prototyped as a
10807 ;; variable argument function. It is > 0 if FP registers were passed
10808 ;; and < 0 if they were not.
10810 (define_insn "*call_local32"
10811 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10812 (match_operand 1 "" "g,g"))
10813 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10814 (clobber (match_scratch:SI 3 "=l,l"))]
10815 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10818 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10819 output_asm_insn (\"crxor 6,6,6\", operands);
10821 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10822 output_asm_insn (\"creqv 6,6,6\", operands);
10824 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10826 [(set_attr "type" "branch")
10827 (set_attr "length" "4,8")])
10829 (define_insn "*call_local64"
10830 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10831 (match_operand 1 "" "g,g"))
10832 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10833 (clobber (match_scratch:SI 3 "=l,l"))]
10834 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10837 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10838 output_asm_insn (\"crxor 6,6,6\", operands);
10840 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10841 output_asm_insn (\"creqv 6,6,6\", operands);
10843 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10845 [(set_attr "type" "branch")
10846 (set_attr "length" "4,8")])
10848 (define_insn "*call_value_local32"
10849 [(set (match_operand 0 "" "")
10850 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10851 (match_operand 2 "" "g,g")))
10852 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10853 (clobber (match_scratch:SI 4 "=l,l"))]
10854 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10857 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10858 output_asm_insn (\"crxor 6,6,6\", operands);
10860 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10861 output_asm_insn (\"creqv 6,6,6\", operands);
10863 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10865 [(set_attr "type" "branch")
10866 (set_attr "length" "4,8")])
10869 (define_insn "*call_value_local64"
10870 [(set (match_operand 0 "" "")
10871 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10872 (match_operand 2 "" "g,g")))
10873 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10874 (clobber (match_scratch:SI 4 "=l,l"))]
10875 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10878 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10879 output_asm_insn (\"crxor 6,6,6\", operands);
10881 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10882 output_asm_insn (\"creqv 6,6,6\", operands);
10884 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10886 [(set_attr "type" "branch")
10887 (set_attr "length" "4,8")])
10889 ;; Call to function which may be in another module. Restore the TOC
10890 ;; pointer (r2) after the call unless this is System V.
10891 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10892 ;; either the function was not prototyped, or it was prototyped as a
10893 ;; variable argument function. It is > 0 if FP registers were passed
10894 ;; and < 0 if they were not.
10896 (define_insn "*call_indirect_nonlocal_aix32"
10897 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10898 (match_operand 1 "" "g,g"))
10902 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10903 (clobber (match_scratch:SI 2 "=l,l"))]
10904 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10905 "b%T0l\;{l|lwz} 2,20(1)"
10906 [(set_attr "type" "jmpreg")
10907 (set_attr "length" "8")])
10909 (define_insn "*call_nonlocal_aix32"
10910 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10911 (match_operand 1 "" "g"))
10912 (use (match_operand:SI 2 "immediate_operand" "O"))
10913 (clobber (match_scratch:SI 3 "=l"))]
10915 && DEFAULT_ABI == ABI_AIX
10916 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10918 [(set_attr "type" "branch")
10919 (set_attr "length" "8")])
10921 (define_insn "*call_indirect_nonlocal_aix64"
10922 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10923 (match_operand 1 "" "g,g"))
10927 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10928 (clobber (match_scratch:SI 2 "=l,l"))]
10929 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10930 "b%T0l\;ld 2,40(1)"
10931 [(set_attr "type" "jmpreg")
10932 (set_attr "length" "8")])
10934 (define_insn "*call_nonlocal_aix64"
10935 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10936 (match_operand 1 "" "g"))
10937 (use (match_operand:SI 2 "immediate_operand" "O"))
10938 (clobber (match_scratch:SI 3 "=l"))]
10940 && DEFAULT_ABI == ABI_AIX
10941 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10943 [(set_attr "type" "branch")
10944 (set_attr "length" "8")])
10946 (define_insn "*call_value_indirect_nonlocal_aix32"
10947 [(set (match_operand 0 "" "")
10948 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10949 (match_operand 2 "" "g,g")))
10953 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10954 (clobber (match_scratch:SI 3 "=l,l"))]
10955 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10956 "b%T1l\;{l|lwz} 2,20(1)"
10957 [(set_attr "type" "jmpreg")
10958 (set_attr "length" "8")])
10960 (define_insn "*call_value_nonlocal_aix32"
10961 [(set (match_operand 0 "" "")
10962 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10963 (match_operand 2 "" "g")))
10964 (use (match_operand:SI 3 "immediate_operand" "O"))
10965 (clobber (match_scratch:SI 4 "=l"))]
10967 && DEFAULT_ABI == ABI_AIX
10968 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10970 [(set_attr "type" "branch")
10971 (set_attr "length" "8")])
10973 (define_insn "*call_value_indirect_nonlocal_aix64"
10974 [(set (match_operand 0 "" "")
10975 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10976 (match_operand 2 "" "g,g")))
10980 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10981 (clobber (match_scratch:SI 3 "=l,l"))]
10982 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10983 "b%T1l\;ld 2,40(1)"
10984 [(set_attr "type" "jmpreg")
10985 (set_attr "length" "8")])
10987 (define_insn "*call_value_nonlocal_aix64"
10988 [(set (match_operand 0 "" "")
10989 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10990 (match_operand 2 "" "g")))
10991 (use (match_operand:SI 3 "immediate_operand" "O"))
10992 (clobber (match_scratch:SI 4 "=l"))]
10994 && DEFAULT_ABI == ABI_AIX
10995 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10997 [(set_attr "type" "branch")
10998 (set_attr "length" "8")])
11000 ;; A function pointer under System V is just a normal pointer
11001 ;; operands[0] is the function pointer
11002 ;; operands[1] is the stack size to clean up
11003 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11004 ;; which indicates how to set cr1
11006 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11007 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11008 (match_operand 1 "" "g,g,g,g"))
11009 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11010 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
11011 "DEFAULT_ABI == ABI_V4
11012 || DEFAULT_ABI == ABI_DARWIN"
11014 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11015 output_asm_insn ("crxor 6,6,6", operands);
11017 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11018 output_asm_insn ("creqv 6,6,6", operands);
11022 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11023 (set_attr "length" "4,4,8,8")])
11025 (define_insn "*call_nonlocal_sysv<mode>"
11026 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11027 (match_operand 1 "" "g,g"))
11028 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11029 (clobber (match_scratch:SI 3 "=l,l"))]
11030 "(DEFAULT_ABI == ABI_DARWIN
11031 || (DEFAULT_ABI == ABI_V4
11032 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11034 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11035 output_asm_insn ("crxor 6,6,6", operands);
11037 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11038 output_asm_insn ("creqv 6,6,6", operands);
11041 return output_call(insn, operands, 0, 2);
11043 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11045 if (TARGET_SECURE_PLT && flag_pic == 2)
11046 /* The magic 32768 offset here and in the other sysv call insns
11047 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11048 See sysv4.h:toc_section. */
11049 return "bl %z0+32768@plt";
11051 return "bl %z0@plt";
11057 [(set_attr "type" "branch,branch")
11058 (set_attr "length" "4,8")])
11060 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11061 [(set (match_operand 0 "" "")
11062 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11063 (match_operand 2 "" "g,g,g,g")))
11064 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11065 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
11066 "DEFAULT_ABI == ABI_V4
11067 || DEFAULT_ABI == ABI_DARWIN"
11069 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11070 output_asm_insn ("crxor 6,6,6", operands);
11072 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11073 output_asm_insn ("creqv 6,6,6", operands);
11077 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11078 (set_attr "length" "4,4,8,8")])
11080 (define_insn "*call_value_nonlocal_sysv<mode>"
11081 [(set (match_operand 0 "" "")
11082 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11083 (match_operand 2 "" "g,g")))
11084 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11085 (clobber (match_scratch:SI 4 "=l,l"))]
11086 "(DEFAULT_ABI == ABI_DARWIN
11087 || (DEFAULT_ABI == ABI_V4
11088 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11090 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11091 output_asm_insn ("crxor 6,6,6", operands);
11093 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11094 output_asm_insn ("creqv 6,6,6", operands);
11097 return output_call(insn, operands, 1, 3);
11099 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11101 if (TARGET_SECURE_PLT && flag_pic == 2)
11102 return "bl %z1+32768@plt";
11104 return "bl %z1@plt";
11110 [(set_attr "type" "branch,branch")
11111 (set_attr "length" "4,8")])
11113 ;; Call subroutine returning any type.
11114 (define_expand "untyped_call"
11115 [(parallel [(call (match_operand 0 "" "")
11117 (match_operand 1 "" "")
11118 (match_operand 2 "" "")])]
11124 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11126 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11128 rtx set = XVECEXP (operands[2], 0, i);
11129 emit_move_insn (SET_DEST (set), SET_SRC (set));
11132 /* The optimizer does not know that the call sets the function value
11133 registers we stored in the result block. We avoid problems by
11134 claiming that all hard registers are used and clobbered at this
11136 emit_insn (gen_blockage ());
11141 ;; sibling call patterns
11142 (define_expand "sibcall"
11143 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11144 (match_operand 1 "" ""))
11145 (use (match_operand 2 "" ""))
11146 (use (match_operand 3 "" ""))
11152 if (MACHOPIC_INDIRECT)
11153 operands[0] = machopic_indirect_call_target (operands[0]);
11156 gcc_assert (GET_CODE (operands[0]) == MEM);
11157 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11159 operands[0] = XEXP (operands[0], 0);
11160 operands[3] = gen_reg_rtx (SImode);
11164 ;; this and similar patterns must be marked as using LR, otherwise
11165 ;; dataflow will try to delete the store into it. This is true
11166 ;; even when the actual reg to jump to is in CTR, when LR was
11167 ;; saved and restored around the PIC-setting BCL.
11168 (define_insn "*sibcall_local32"
11169 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11170 (match_operand 1 "" "g,g"))
11171 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11172 (use (match_operand:SI 3 "register_operand" "l,l"))
11174 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11177 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11178 output_asm_insn (\"crxor 6,6,6\", operands);
11180 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11181 output_asm_insn (\"creqv 6,6,6\", operands);
11183 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11185 [(set_attr "type" "branch")
11186 (set_attr "length" "4,8")])
11188 (define_insn "*sibcall_local64"
11189 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11190 (match_operand 1 "" "g,g"))
11191 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11192 (use (match_operand:SI 3 "register_operand" "l,l"))
11194 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11197 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11198 output_asm_insn (\"crxor 6,6,6\", operands);
11200 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11201 output_asm_insn (\"creqv 6,6,6\", operands);
11203 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11205 [(set_attr "type" "branch")
11206 (set_attr "length" "4,8")])
11208 (define_insn "*sibcall_value_local32"
11209 [(set (match_operand 0 "" "")
11210 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11211 (match_operand 2 "" "g,g")))
11212 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11213 (use (match_operand:SI 4 "register_operand" "l,l"))
11215 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11218 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11219 output_asm_insn (\"crxor 6,6,6\", operands);
11221 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11222 output_asm_insn (\"creqv 6,6,6\", operands);
11224 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11226 [(set_attr "type" "branch")
11227 (set_attr "length" "4,8")])
11230 (define_insn "*sibcall_value_local64"
11231 [(set (match_operand 0 "" "")
11232 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11233 (match_operand 2 "" "g,g")))
11234 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11235 (use (match_operand:SI 4 "register_operand" "l,l"))
11237 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11240 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11241 output_asm_insn (\"crxor 6,6,6\", operands);
11243 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11244 output_asm_insn (\"creqv 6,6,6\", operands);
11246 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11248 [(set_attr "type" "branch")
11249 (set_attr "length" "4,8")])
11251 (define_insn "*sibcall_nonlocal_aix32"
11252 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11253 (match_operand 1 "" "g"))
11254 (use (match_operand:SI 2 "immediate_operand" "O"))
11255 (use (match_operand:SI 3 "register_operand" "l"))
11258 && DEFAULT_ABI == ABI_AIX
11259 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11261 [(set_attr "type" "branch")
11262 (set_attr "length" "4")])
11264 (define_insn "*sibcall_nonlocal_aix64"
11265 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11266 (match_operand 1 "" "g"))
11267 (use (match_operand:SI 2 "immediate_operand" "O"))
11268 (use (match_operand:SI 3 "register_operand" "l"))
11271 && DEFAULT_ABI == ABI_AIX
11272 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11274 [(set_attr "type" "branch")
11275 (set_attr "length" "4")])
11277 (define_insn "*sibcall_value_nonlocal_aix32"
11278 [(set (match_operand 0 "" "")
11279 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11280 (match_operand 2 "" "g")))
11281 (use (match_operand:SI 3 "immediate_operand" "O"))
11282 (use (match_operand:SI 4 "register_operand" "l"))
11285 && DEFAULT_ABI == ABI_AIX
11286 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11288 [(set_attr "type" "branch")
11289 (set_attr "length" "4")])
11291 (define_insn "*sibcall_value_nonlocal_aix64"
11292 [(set (match_operand 0 "" "")
11293 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11294 (match_operand 2 "" "g")))
11295 (use (match_operand:SI 3 "immediate_operand" "O"))
11296 (use (match_operand:SI 4 "register_operand" "l"))
11299 && DEFAULT_ABI == ABI_AIX
11300 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11302 [(set_attr "type" "branch")
11303 (set_attr "length" "4")])
11305 (define_insn "*sibcall_nonlocal_sysv<mode>"
11306 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11307 (match_operand 1 "" ""))
11308 (use (match_operand 2 "immediate_operand" "O,n"))
11309 (use (match_operand:SI 3 "register_operand" "l,l"))
11311 "(DEFAULT_ABI == ABI_DARWIN
11312 || DEFAULT_ABI == ABI_V4)
11313 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11316 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11317 output_asm_insn (\"crxor 6,6,6\", operands);
11319 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11320 output_asm_insn (\"creqv 6,6,6\", operands);
11322 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11324 if (TARGET_SECURE_PLT && flag_pic == 2)
11325 return \"b %z0+32768@plt\";
11327 return \"b %z0@plt\";
11332 [(set_attr "type" "branch,branch")
11333 (set_attr "length" "4,8")])
11335 (define_expand "sibcall_value"
11336 [(parallel [(set (match_operand 0 "register_operand" "")
11337 (call (mem:SI (match_operand 1 "address_operand" ""))
11338 (match_operand 2 "" "")))
11339 (use (match_operand 3 "" ""))
11340 (use (match_operand 4 "" ""))
11346 if (MACHOPIC_INDIRECT)
11347 operands[1] = machopic_indirect_call_target (operands[1]);
11350 gcc_assert (GET_CODE (operands[1]) == MEM);
11351 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11353 operands[1] = XEXP (operands[1], 0);
11354 operands[4] = gen_reg_rtx (SImode);
11358 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11359 [(set (match_operand 0 "" "")
11360 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11361 (match_operand 2 "" "")))
11362 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11363 (use (match_operand:SI 4 "register_operand" "l,l"))
11365 "(DEFAULT_ABI == ABI_DARWIN
11366 || DEFAULT_ABI == ABI_V4)
11367 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11370 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11371 output_asm_insn (\"crxor 6,6,6\", operands);
11373 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11374 output_asm_insn (\"creqv 6,6,6\", operands);
11376 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11378 if (TARGET_SECURE_PLT && flag_pic == 2)
11379 return \"b %z1+32768@plt\";
11381 return \"b %z1@plt\";
11386 [(set_attr "type" "branch,branch")
11387 (set_attr "length" "4,8")])
11389 (define_expand "sibcall_epilogue"
11390 [(use (const_int 0))]
11391 "TARGET_SCHED_PROLOG"
11394 rs6000_emit_epilogue (TRUE);
11398 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11399 ;; all of memory. This blocks insns from being moved across this point.
11401 (define_insn "blockage"
11402 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11406 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11407 ;; signed & unsigned, and one type of branch.
11409 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11410 ;; insns, and branches. We store the operands of compares until we see
11412 (define_expand "cmp<mode>"
11414 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11415 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11419 /* Take care of the possibility that operands[1] might be negative but
11420 this might be a logical operation. That insn doesn't exist. */
11421 if (GET_CODE (operands[1]) == CONST_INT
11422 && INTVAL (operands[1]) < 0)
11423 operands[1] = force_reg (<MODE>mode, operands[1]);
11425 rs6000_compare_op0 = operands[0];
11426 rs6000_compare_op1 = operands[1];
11427 rs6000_compare_fp_p = 0;
11431 (define_expand "cmp<mode>"
11432 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11433 (match_operand:FP 1 "gpc_reg_operand" "")))]
11437 rs6000_compare_op0 = operands[0];
11438 rs6000_compare_op1 = operands[1];
11439 rs6000_compare_fp_p = 1;
11443 (define_expand "beq"
11444 [(use (match_operand 0 "" ""))]
11446 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11448 (define_expand "bne"
11449 [(use (match_operand 0 "" ""))]
11451 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11453 (define_expand "bge"
11454 [(use (match_operand 0 "" ""))]
11456 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11458 (define_expand "bgt"
11459 [(use (match_operand 0 "" ""))]
11461 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11463 (define_expand "ble"
11464 [(use (match_operand 0 "" ""))]
11466 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11468 (define_expand "blt"
11469 [(use (match_operand 0 "" ""))]
11471 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11473 (define_expand "bgeu"
11474 [(use (match_operand 0 "" ""))]
11476 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11478 (define_expand "bgtu"
11479 [(use (match_operand 0 "" ""))]
11481 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11483 (define_expand "bleu"
11484 [(use (match_operand 0 "" ""))]
11486 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11488 (define_expand "bltu"
11489 [(use (match_operand 0 "" ""))]
11491 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11493 (define_expand "bunordered"
11494 [(use (match_operand 0 "" ""))]
11495 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11496 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11498 (define_expand "bordered"
11499 [(use (match_operand 0 "" ""))]
11500 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11501 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11503 (define_expand "buneq"
11504 [(use (match_operand 0 "" ""))]
11506 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11508 (define_expand "bunge"
11509 [(use (match_operand 0 "" ""))]
11511 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11513 (define_expand "bungt"
11514 [(use (match_operand 0 "" ""))]
11516 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11518 (define_expand "bunle"
11519 [(use (match_operand 0 "" ""))]
11521 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11523 (define_expand "bunlt"
11524 [(use (match_operand 0 "" ""))]
11526 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11528 (define_expand "bltgt"
11529 [(use (match_operand 0 "" ""))]
11531 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11533 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11534 ;; For SEQ, likewise, except that comparisons with zero should be done
11535 ;; with an scc insns. However, due to the order that combine see the
11536 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11537 ;; the cases we don't want to handle.
11538 (define_expand "seq"
11539 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11541 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11543 (define_expand "sne"
11544 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11548 if (! rs6000_compare_fp_p)
11551 rs6000_emit_sCOND (NE, operands[0]);
11555 ;; A >= 0 is best done the portable way for A an integer.
11556 (define_expand "sge"
11557 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11561 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11564 rs6000_emit_sCOND (GE, operands[0]);
11568 ;; A > 0 is best done using the portable sequence, so fail in that case.
11569 (define_expand "sgt"
11570 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11574 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11577 rs6000_emit_sCOND (GT, operands[0]);
11581 ;; A <= 0 is best done the portable way for A an integer.
11582 (define_expand "sle"
11583 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11587 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11590 rs6000_emit_sCOND (LE, operands[0]);
11594 ;; A < 0 is best done in the portable way for A an integer.
11595 (define_expand "slt"
11596 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11600 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11603 rs6000_emit_sCOND (LT, operands[0]);
11607 (define_expand "sgeu"
11608 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11610 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11612 (define_expand "sgtu"
11613 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11615 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11617 (define_expand "sleu"
11618 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11620 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11622 (define_expand "sltu"
11623 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11625 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11627 (define_expand "sunordered"
11628 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11629 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11630 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11632 (define_expand "sordered"
11633 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11634 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11635 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11637 (define_expand "suneq"
11638 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11640 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11642 (define_expand "sunge"
11643 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11645 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11647 (define_expand "sungt"
11648 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11650 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11652 (define_expand "sunle"
11653 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11655 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11657 (define_expand "sunlt"
11658 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11660 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11662 (define_expand "sltgt"
11663 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11665 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11667 (define_expand "stack_protect_set"
11668 [(match_operand 0 "memory_operand" "")
11669 (match_operand 1 "memory_operand" "")]
11672 #ifdef TARGET_THREAD_SSP_OFFSET
11673 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11674 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11675 operands[1] = gen_rtx_MEM (Pmode, addr);
11678 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11680 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11684 (define_insn "stack_protect_setsi"
11685 [(set (match_operand:SI 0 "memory_operand" "=m")
11686 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11687 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11689 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11690 [(set_attr "type" "three")
11691 (set_attr "length" "12")])
11693 (define_insn "stack_protect_setdi"
11694 [(set (match_operand:DI 0 "memory_operand" "=m")
11695 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11696 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11698 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11699 [(set_attr "type" "three")
11700 (set_attr "length" "12")])
11702 (define_expand "stack_protect_test"
11703 [(match_operand 0 "memory_operand" "")
11704 (match_operand 1 "memory_operand" "")
11705 (match_operand 2 "" "")]
11708 #ifdef TARGET_THREAD_SSP_OFFSET
11709 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11710 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11711 operands[1] = gen_rtx_MEM (Pmode, addr);
11713 rs6000_compare_op0 = operands[0];
11714 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11716 rs6000_compare_fp_p = 0;
11717 emit_jump_insn (gen_beq (operands[2]));
11721 (define_insn "stack_protect_testsi"
11722 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11723 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11724 (match_operand:SI 2 "memory_operand" "m,m")]
11726 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11727 (clobber (match_scratch:SI 3 "=&r,&r"))]
11730 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11731 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;{cmpl|cmplw} %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11732 [(set_attr "length" "16,20")])
11734 (define_insn "stack_protect_testdi"
11735 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11736 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11737 (match_operand:DI 2 "memory_operand" "m,m")]
11739 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11740 (clobber (match_scratch:DI 3 "=&r,&r"))]
11743 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11744 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11745 [(set_attr "length" "16,20")])
11748 ;; Here are the actual compare insns.
11749 (define_insn "*cmp<mode>_internal1"
11750 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11751 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11752 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11754 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11755 [(set_attr "type" "cmp")])
11757 ;; If we are comparing a register for equality with a large constant,
11758 ;; we can do this with an XOR followed by a compare. But this is profitable
11759 ;; only if the large constant is only used for the comparison (and in this
11760 ;; case we already have a register to reuse as scratch).
11762 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11763 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11766 [(set (match_operand:SI 0 "register_operand")
11767 (match_operand:SI 1 "logical_const_operand" ""))
11768 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11770 (match_operand:SI 2 "logical_const_operand" "")]))
11771 (set (match_operand:CC 4 "cc_reg_operand" "")
11772 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11775 (if_then_else (match_operator 6 "equality_operator"
11776 [(match_dup 4) (const_int 0)])
11777 (match_operand 7 "" "")
11778 (match_operand 8 "" "")))]
11779 "peep2_reg_dead_p (3, operands[0])
11780 && peep2_reg_dead_p (4, operands[4])"
11781 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11782 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11783 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11786 /* Get the constant we are comparing against, and see what it looks like
11787 when sign-extended from 16 to 32 bits. Then see what constant we could
11788 XOR with SEXTC to get the sign-extended value. */
11789 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11791 operands[1], operands[2]);
11792 HOST_WIDE_INT c = INTVAL (cnst);
11793 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11794 HOST_WIDE_INT xorv = c ^ sextc;
11796 operands[9] = GEN_INT (xorv);
11797 operands[10] = GEN_INT (sextc);
11800 (define_insn "*cmpsi_internal2"
11801 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11802 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11803 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11805 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11806 [(set_attr "type" "cmp")])
11808 (define_insn "*cmpdi_internal2"
11809 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11810 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11811 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11813 "cmpld%I2 %0,%1,%b2"
11814 [(set_attr "type" "cmp")])
11816 ;; The following two insns don't exist as single insns, but if we provide
11817 ;; them, we can swap an add and compare, which will enable us to overlap more
11818 ;; of the required delay between a compare and branch. We generate code for
11819 ;; them by splitting.
11822 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11823 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11824 (match_operand:SI 2 "short_cint_operand" "i")))
11825 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11826 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11829 [(set_attr "length" "8")])
11832 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11833 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11834 (match_operand:SI 2 "u_short_cint_operand" "i")))
11835 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11836 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11839 [(set_attr "length" "8")])
11842 [(set (match_operand:CC 3 "cc_reg_operand" "")
11843 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11844 (match_operand:SI 2 "short_cint_operand" "")))
11845 (set (match_operand:SI 0 "gpc_reg_operand" "")
11846 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11848 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11849 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11852 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11853 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11854 (match_operand:SI 2 "u_short_cint_operand" "")))
11855 (set (match_operand:SI 0 "gpc_reg_operand" "")
11856 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11858 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11859 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11861 (define_insn "*cmpsf_internal1"
11862 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11863 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11864 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11865 "TARGET_HARD_FLOAT && TARGET_FPRS"
11867 [(set_attr "type" "fpcompare")])
11869 (define_insn "*cmpdf_internal1"
11870 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11871 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11872 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11873 "TARGET_HARD_FLOAT && TARGET_FPRS"
11875 [(set_attr "type" "fpcompare")])
11877 ;; Only need to compare second words if first words equal
11878 (define_insn "*cmptf_internal1"
11879 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11880 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11881 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11882 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11883 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11884 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11885 [(set_attr "type" "fpcompare")
11886 (set_attr "length" "12")])
11888 (define_insn_and_split "*cmptf_internal2"
11889 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11890 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11891 (match_operand:TF 2 "gpc_reg_operand" "f")))
11892 (clobber (match_scratch:DF 3 "=f"))
11893 (clobber (match_scratch:DF 4 "=f"))
11894 (clobber (match_scratch:DF 5 "=f"))
11895 (clobber (match_scratch:DF 6 "=f"))
11896 (clobber (match_scratch:DF 7 "=f"))
11897 (clobber (match_scratch:DF 8 "=f"))
11898 (clobber (match_scratch:DF 9 "=f"))
11899 (clobber (match_scratch:DF 10 "=f"))]
11900 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11901 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11903 "&& reload_completed"
11904 [(set (match_dup 3) (match_dup 13))
11905 (set (match_dup 4) (match_dup 14))
11906 (set (match_dup 9) (abs:DF (match_dup 5)))
11907 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11908 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11909 (label_ref (match_dup 11))
11911 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11912 (set (pc) (label_ref (match_dup 12)))
11914 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11915 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11916 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11917 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11920 REAL_VALUE_TYPE rv;
11921 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11922 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11924 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11925 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11926 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11927 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11928 operands[11] = gen_label_rtx ();
11929 operands[12] = gen_label_rtx ();
11931 operands[13] = force_const_mem (DFmode,
11932 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11933 operands[14] = force_const_mem (DFmode,
11934 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11938 operands[13] = gen_const_mem (DFmode,
11939 create_TOC_reference (XEXP (operands[13], 0)));
11940 operands[14] = gen_const_mem (DFmode,
11941 create_TOC_reference (XEXP (operands[14], 0)));
11942 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11943 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11947 ;; Now we have the scc insns. We can do some combinations because of the
11948 ;; way the machine works.
11950 ;; Note that this is probably faster if we can put an insn between the
11951 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11952 ;; cases the insns below which don't use an intermediate CR field will
11953 ;; be used instead.
11955 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11956 (match_operator:SI 1 "scc_comparison_operator"
11957 [(match_operand 2 "cc_reg_operand" "y")
11960 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11961 [(set (attr "type")
11962 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11963 (const_string "mfcrf")
11965 (const_string "mfcr")))
11966 (set_attr "length" "8")])
11968 ;; Same as above, but get the GT bit.
11969 (define_insn "move_from_CR_gt_bit"
11970 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11971 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11973 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11974 [(set_attr "type" "mfcr")
11975 (set_attr "length" "8")])
11977 ;; Same as above, but get the OV/ORDERED bit.
11978 (define_insn "move_from_CR_ov_bit"
11979 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11980 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11982 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11983 [(set_attr "type" "mfcr")
11984 (set_attr "length" "8")])
11987 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11988 (match_operator:DI 1 "scc_comparison_operator"
11989 [(match_operand 2 "cc_reg_operand" "y")
11992 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11993 [(set (attr "type")
11994 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11995 (const_string "mfcrf")
11997 (const_string "mfcr")))
11998 (set_attr "length" "8")])
12001 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12002 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12003 [(match_operand 2 "cc_reg_operand" "y,y")
12006 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12007 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12010 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12012 [(set_attr "type" "delayed_compare")
12013 (set_attr "length" "8,16")])
12016 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12017 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12018 [(match_operand 2 "cc_reg_operand" "")
12021 (set (match_operand:SI 3 "gpc_reg_operand" "")
12022 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12023 "TARGET_32BIT && reload_completed"
12024 [(set (match_dup 3)
12025 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12027 (compare:CC (match_dup 3)
12032 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12033 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12034 [(match_operand 2 "cc_reg_operand" "y")
12036 (match_operand:SI 3 "const_int_operand" "n")))]
12040 int is_bit = ccr_bit (operands[1], 1);
12041 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12044 if (is_bit >= put_bit)
12045 count = is_bit - put_bit;
12047 count = 32 - (put_bit - is_bit);
12049 operands[4] = GEN_INT (count);
12050 operands[5] = GEN_INT (put_bit);
12052 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12054 [(set (attr "type")
12055 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12056 (const_string "mfcrf")
12058 (const_string "mfcr")))
12059 (set_attr "length" "8")])
12062 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12064 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12065 [(match_operand 2 "cc_reg_operand" "y,y")
12067 (match_operand:SI 3 "const_int_operand" "n,n"))
12069 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12070 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12075 int is_bit = ccr_bit (operands[1], 1);
12076 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12079 /* Force split for non-cc0 compare. */
12080 if (which_alternative == 1)
12083 if (is_bit >= put_bit)
12084 count = is_bit - put_bit;
12086 count = 32 - (put_bit - is_bit);
12088 operands[5] = GEN_INT (count);
12089 operands[6] = GEN_INT (put_bit);
12091 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12093 [(set_attr "type" "delayed_compare")
12094 (set_attr "length" "8,16")])
12097 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12099 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12100 [(match_operand 2 "cc_reg_operand" "")
12102 (match_operand:SI 3 "const_int_operand" ""))
12104 (set (match_operand:SI 4 "gpc_reg_operand" "")
12105 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12108 [(set (match_dup 4)
12109 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12112 (compare:CC (match_dup 4)
12116 ;; There is a 3 cycle delay between consecutive mfcr instructions
12117 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12120 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12121 (match_operator:SI 1 "scc_comparison_operator"
12122 [(match_operand 2 "cc_reg_operand" "y")
12124 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12125 (match_operator:SI 4 "scc_comparison_operator"
12126 [(match_operand 5 "cc_reg_operand" "y")
12128 "REGNO (operands[2]) != REGNO (operands[5])"
12129 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12130 [(set_attr "type" "mfcr")
12131 (set_attr "length" "12")])
12134 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12135 (match_operator:DI 1 "scc_comparison_operator"
12136 [(match_operand 2 "cc_reg_operand" "y")
12138 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12139 (match_operator:DI 4 "scc_comparison_operator"
12140 [(match_operand 5 "cc_reg_operand" "y")
12142 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12143 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12144 [(set_attr "type" "mfcr")
12145 (set_attr "length" "12")])
12147 ;; There are some scc insns that can be done directly, without a compare.
12148 ;; These are faster because they don't involve the communications between
12149 ;; the FXU and branch units. In fact, we will be replacing all of the
12150 ;; integer scc insns here or in the portable methods in emit_store_flag.
12152 ;; Also support (neg (scc ..)) since that construct is used to replace
12153 ;; branches, (plus (scc ..) ..) since that construct is common and
12154 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12155 ;; cases where it is no more expensive than (neg (scc ..)).
12157 ;; Have reload force a constant into a register for the simple insns that
12158 ;; otherwise won't accept constants. We do this because it is faster than
12159 ;; the cmp/mfcr sequence we would otherwise generate.
12161 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12164 (define_insn_and_split "*eq<mode>"
12165 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12166 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12167 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12171 [(set (match_dup 0)
12172 (clz:GPR (match_dup 3)))
12174 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12176 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12178 /* Use output operand as intermediate. */
12179 operands[3] = operands[0];
12181 if (logical_operand (operands[2], <MODE>mode))
12182 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12183 gen_rtx_XOR (<MODE>mode,
12184 operands[1], operands[2])));
12186 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12187 gen_rtx_PLUS (<MODE>mode, operands[1],
12188 negate_rtx (<MODE>mode,
12192 operands[3] = operands[1];
12194 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12197 (define_insn_and_split "*eq<mode>_compare"
12198 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12200 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12201 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12203 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12204 (eq:P (match_dup 1) (match_dup 2)))]
12205 "!TARGET_POWER && optimize_size"
12207 "!TARGET_POWER && optimize_size"
12208 [(set (match_dup 0)
12209 (clz:P (match_dup 4)))
12210 (parallel [(set (match_dup 3)
12211 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12214 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12216 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12218 /* Use output operand as intermediate. */
12219 operands[4] = operands[0];
12221 if (logical_operand (operands[2], <MODE>mode))
12222 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12223 gen_rtx_XOR (<MODE>mode,
12224 operands[1], operands[2])));
12226 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12227 gen_rtx_PLUS (<MODE>mode, operands[1],
12228 negate_rtx (<MODE>mode,
12232 operands[4] = operands[1];
12234 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12237 (define_insn "*eqsi_power"
12238 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12239 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12240 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12241 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12244 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12245 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12246 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12247 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12248 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12249 [(set_attr "type" "three,two,three,three,three")
12250 (set_attr "length" "12,8,12,12,12")])
12252 ;; We have insns of the form shown by the first define_insn below. If
12253 ;; there is something inside the comparison operation, we must split it.
12255 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12256 (plus:SI (match_operator 1 "comparison_operator"
12257 [(match_operand:SI 2 "" "")
12258 (match_operand:SI 3
12259 "reg_or_cint_operand" "")])
12260 (match_operand:SI 4 "gpc_reg_operand" "")))
12261 (clobber (match_operand:SI 5 "register_operand" ""))]
12262 "! gpc_reg_operand (operands[2], SImode)"
12263 [(set (match_dup 5) (match_dup 2))
12264 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12267 (define_insn "*plus_eqsi"
12268 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12269 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12270 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12271 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12274 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12275 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12276 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12277 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12278 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12279 [(set_attr "type" "three,two,three,three,three")
12280 (set_attr "length" "12,8,12,12,12")])
12282 (define_insn "*compare_plus_eqsi"
12283 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12286 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12287 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12288 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12290 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12291 "TARGET_32BIT && optimize_size"
12293 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12294 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12295 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12296 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12297 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12303 [(set_attr "type" "compare")
12304 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12307 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12310 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12311 (match_operand:SI 2 "scc_eq_operand" ""))
12312 (match_operand:SI 3 "gpc_reg_operand" ""))
12314 (clobber (match_scratch:SI 4 ""))]
12315 "TARGET_32BIT && optimize_size && reload_completed"
12316 [(set (match_dup 4)
12317 (plus:SI (eq:SI (match_dup 1)
12321 (compare:CC (match_dup 4)
12325 (define_insn "*plus_eqsi_compare"
12326 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12329 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12330 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12331 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12333 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12334 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12335 "TARGET_32BIT && optimize_size"
12337 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12338 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12339 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12340 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12341 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12347 [(set_attr "type" "compare")
12348 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12351 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12354 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12355 (match_operand:SI 2 "scc_eq_operand" ""))
12356 (match_operand:SI 3 "gpc_reg_operand" ""))
12358 (set (match_operand:SI 0 "gpc_reg_operand" "")
12359 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12360 "TARGET_32BIT && optimize_size && reload_completed"
12361 [(set (match_dup 0)
12362 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12364 (compare:CC (match_dup 0)
12368 (define_insn "*neg_eq0<mode>"
12369 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12370 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12373 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12374 [(set_attr "type" "two")
12375 (set_attr "length" "8")])
12377 (define_insn_and_split "*neg_eq<mode>"
12378 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12379 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12380 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12384 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12386 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12388 /* Use output operand as intermediate. */
12389 operands[3] = operands[0];
12391 if (logical_operand (operands[2], <MODE>mode))
12392 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12393 gen_rtx_XOR (<MODE>mode,
12394 operands[1], operands[2])));
12396 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12397 gen_rtx_PLUS (<MODE>mode, operands[1],
12398 negate_rtx (<MODE>mode,
12402 operands[3] = operands[1];
12405 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12406 ;; since it nabs/sr is just as fast.
12407 (define_insn "*ne0si"
12408 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12409 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12411 (clobber (match_scratch:SI 2 "=&r"))]
12412 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12413 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12414 [(set_attr "type" "two")
12415 (set_attr "length" "8")])
12417 (define_insn "*ne0di"
12418 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12419 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12421 (clobber (match_scratch:DI 2 "=&r"))]
12423 "addic %2,%1,-1\;subfe %0,%2,%1"
12424 [(set_attr "type" "two")
12425 (set_attr "length" "8")])
12427 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12428 (define_insn "*plus_ne0si"
12429 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12430 (plus:SI (lshiftrt:SI
12431 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12433 (match_operand:SI 2 "gpc_reg_operand" "r")))
12434 (clobber (match_scratch:SI 3 "=&r"))]
12436 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12437 [(set_attr "type" "two")
12438 (set_attr "length" "8")])
12440 (define_insn "*plus_ne0di"
12441 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12442 (plus:DI (lshiftrt:DI
12443 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12445 (match_operand:DI 2 "gpc_reg_operand" "r")))
12446 (clobber (match_scratch:DI 3 "=&r"))]
12448 "addic %3,%1,-1\;addze %0,%2"
12449 [(set_attr "type" "two")
12450 (set_attr "length" "8")])
12452 (define_insn "*compare_plus_ne0si"
12453 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12455 (plus:SI (lshiftrt:SI
12456 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12458 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12460 (clobber (match_scratch:SI 3 "=&r,&r"))
12461 (clobber (match_scratch:SI 4 "=X,&r"))]
12464 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12466 [(set_attr "type" "compare")
12467 (set_attr "length" "8,12")])
12470 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12472 (plus:SI (lshiftrt:SI
12473 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12475 (match_operand:SI 2 "gpc_reg_operand" ""))
12477 (clobber (match_scratch:SI 3 ""))
12478 (clobber (match_scratch:SI 4 ""))]
12479 "TARGET_32BIT && reload_completed"
12480 [(parallel [(set (match_dup 3)
12481 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12484 (clobber (match_dup 4))])
12486 (compare:CC (match_dup 3)
12490 (define_insn "*compare_plus_ne0di"
12491 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12493 (plus:DI (lshiftrt:DI
12494 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12496 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12498 (clobber (match_scratch:DI 3 "=&r,&r"))]
12501 addic %3,%1,-1\;addze. %3,%2
12503 [(set_attr "type" "compare")
12504 (set_attr "length" "8,12")])
12507 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12509 (plus:DI (lshiftrt:DI
12510 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12512 (match_operand:DI 2 "gpc_reg_operand" ""))
12514 (clobber (match_scratch:DI 3 ""))]
12515 "TARGET_64BIT && reload_completed"
12516 [(set (match_dup 3)
12517 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12521 (compare:CC (match_dup 3)
12525 (define_insn "*plus_ne0si_compare"
12526 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12528 (plus:SI (lshiftrt:SI
12529 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12531 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12533 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12534 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12536 (clobber (match_scratch:SI 3 "=&r,&r"))]
12539 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12541 [(set_attr "type" "compare")
12542 (set_attr "length" "8,12")])
12545 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12547 (plus:SI (lshiftrt:SI
12548 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12550 (match_operand:SI 2 "gpc_reg_operand" ""))
12552 (set (match_operand:SI 0 "gpc_reg_operand" "")
12553 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12555 (clobber (match_scratch:SI 3 ""))]
12556 "TARGET_32BIT && reload_completed"
12557 [(parallel [(set (match_dup 0)
12558 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12560 (clobber (match_dup 3))])
12562 (compare:CC (match_dup 0)
12566 (define_insn "*plus_ne0di_compare"
12567 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12569 (plus:DI (lshiftrt:DI
12570 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12572 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12574 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12575 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12577 (clobber (match_scratch:DI 3 "=&r,&r"))]
12580 addic %3,%1,-1\;addze. %0,%2
12582 [(set_attr "type" "compare")
12583 (set_attr "length" "8,12")])
12586 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12588 (plus:DI (lshiftrt:DI
12589 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12591 (match_operand:DI 2 "gpc_reg_operand" ""))
12593 (set (match_operand:DI 0 "gpc_reg_operand" "")
12594 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12596 (clobber (match_scratch:DI 3 ""))]
12597 "TARGET_64BIT && reload_completed"
12598 [(parallel [(set (match_dup 0)
12599 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12601 (clobber (match_dup 3))])
12603 (compare:CC (match_dup 0)
12608 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12609 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12610 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12611 (clobber (match_scratch:SI 3 "=r,X"))]
12614 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12615 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12616 [(set_attr "length" "12")])
12619 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12621 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12622 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12624 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12625 (le:SI (match_dup 1) (match_dup 2)))
12626 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12629 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12630 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12633 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12634 (set_attr "length" "12,12,16,16")])
12637 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12639 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12640 (match_operand:SI 2 "reg_or_short_operand" ""))
12642 (set (match_operand:SI 0 "gpc_reg_operand" "")
12643 (le:SI (match_dup 1) (match_dup 2)))
12644 (clobber (match_scratch:SI 3 ""))]
12645 "TARGET_POWER && reload_completed"
12646 [(parallel [(set (match_dup 0)
12647 (le:SI (match_dup 1) (match_dup 2)))
12648 (clobber (match_dup 3))])
12650 (compare:CC (match_dup 0)
12655 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12656 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12657 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12658 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12661 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12662 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12663 [(set_attr "length" "12")])
12666 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12668 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12669 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12670 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12672 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12675 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12676 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12679 [(set_attr "type" "compare")
12680 (set_attr "length" "12,12,16,16")])
12683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12685 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12686 (match_operand:SI 2 "reg_or_short_operand" ""))
12687 (match_operand:SI 3 "gpc_reg_operand" ""))
12689 (clobber (match_scratch:SI 4 ""))]
12690 "TARGET_POWER && reload_completed"
12691 [(set (match_dup 4)
12692 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12695 (compare:CC (match_dup 4)
12700 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12702 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12703 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12704 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12706 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12707 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12710 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12711 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12714 [(set_attr "type" "compare")
12715 (set_attr "length" "12,12,16,16")])
12718 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12720 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12721 (match_operand:SI 2 "reg_or_short_operand" ""))
12722 (match_operand:SI 3 "gpc_reg_operand" ""))
12724 (set (match_operand:SI 0 "gpc_reg_operand" "")
12725 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12726 "TARGET_POWER && reload_completed"
12727 [(set (match_dup 0)
12728 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12730 (compare:CC (match_dup 0)
12735 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12736 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12737 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12740 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12741 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12742 [(set_attr "length" "12")])
12744 (define_insn "*leu<mode>"
12745 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12746 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12747 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12749 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12750 [(set_attr "type" "three")
12751 (set_attr "length" "12")])
12753 (define_insn "*leu<mode>_compare"
12754 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12756 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12757 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12759 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12760 (leu:P (match_dup 1) (match_dup 2)))]
12763 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12765 [(set_attr "type" "compare")
12766 (set_attr "length" "12,16")])
12769 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12771 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12772 (match_operand:P 2 "reg_or_short_operand" ""))
12774 (set (match_operand:P 0 "gpc_reg_operand" "")
12775 (leu:P (match_dup 1) (match_dup 2)))]
12777 [(set (match_dup 0)
12778 (leu:P (match_dup 1) (match_dup 2)))
12780 (compare:CC (match_dup 0)
12784 (define_insn "*plus_leu<mode>"
12785 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12786 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12787 (match_operand:P 2 "reg_or_short_operand" "rI"))
12788 (match_operand:P 3 "gpc_reg_operand" "r")))]
12790 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12791 [(set_attr "type" "two")
12792 (set_attr "length" "8")])
12795 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12797 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12798 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12799 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12801 (clobber (match_scratch:SI 4 "=&r,&r"))]
12804 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12806 [(set_attr "type" "compare")
12807 (set_attr "length" "8,12")])
12810 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12812 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12813 (match_operand:SI 2 "reg_or_short_operand" ""))
12814 (match_operand:SI 3 "gpc_reg_operand" ""))
12816 (clobber (match_scratch:SI 4 ""))]
12817 "TARGET_32BIT && reload_completed"
12818 [(set (match_dup 4)
12819 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12822 (compare:CC (match_dup 4)
12827 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12829 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12830 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12831 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12833 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12834 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12837 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12839 [(set_attr "type" "compare")
12840 (set_attr "length" "8,12")])
12843 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12845 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12846 (match_operand:SI 2 "reg_or_short_operand" ""))
12847 (match_operand:SI 3 "gpc_reg_operand" ""))
12849 (set (match_operand:SI 0 "gpc_reg_operand" "")
12850 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12851 "TARGET_32BIT && reload_completed"
12852 [(set (match_dup 0)
12853 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12855 (compare:CC (match_dup 0)
12859 (define_insn "*neg_leu<mode>"
12860 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12861 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12862 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12864 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12865 [(set_attr "type" "three")
12866 (set_attr "length" "12")])
12868 (define_insn "*and_neg_leu<mode>"
12869 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12871 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12872 (match_operand:P 2 "reg_or_short_operand" "rI")))
12873 (match_operand:P 3 "gpc_reg_operand" "r")))]
12875 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12876 [(set_attr "type" "three")
12877 (set_attr "length" "12")])
12880 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12883 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12884 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12885 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12887 (clobber (match_scratch:SI 4 "=&r,&r"))]
12890 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12892 [(set_attr "type" "compare")
12893 (set_attr "length" "12,16")])
12896 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12899 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12900 (match_operand:SI 2 "reg_or_short_operand" "")))
12901 (match_operand:SI 3 "gpc_reg_operand" ""))
12903 (clobber (match_scratch:SI 4 ""))]
12904 "TARGET_32BIT && reload_completed"
12905 [(set (match_dup 4)
12906 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12909 (compare:CC (match_dup 4)
12914 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12917 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12918 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12919 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12921 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12922 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12925 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12927 [(set_attr "type" "compare")
12928 (set_attr "length" "12,16")])
12931 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12934 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12935 (match_operand:SI 2 "reg_or_short_operand" "")))
12936 (match_operand:SI 3 "gpc_reg_operand" ""))
12938 (set (match_operand:SI 0 "gpc_reg_operand" "")
12939 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12940 "TARGET_32BIT && reload_completed"
12941 [(set (match_dup 0)
12942 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12945 (compare:CC (match_dup 0)
12950 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12951 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12952 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12954 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12955 [(set_attr "length" "12")])
12958 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12960 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12961 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12963 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12964 (lt:SI (match_dup 1) (match_dup 2)))]
12967 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12969 [(set_attr "type" "delayed_compare")
12970 (set_attr "length" "12,16")])
12973 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12975 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12976 (match_operand:SI 2 "reg_or_short_operand" ""))
12978 (set (match_operand:SI 0 "gpc_reg_operand" "")
12979 (lt:SI (match_dup 1) (match_dup 2)))]
12980 "TARGET_POWER && reload_completed"
12981 [(set (match_dup 0)
12982 (lt:SI (match_dup 1) (match_dup 2)))
12984 (compare:CC (match_dup 0)
12989 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12990 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12991 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12992 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12994 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12995 [(set_attr "length" "12")])
12998 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13000 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13001 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13002 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13004 (clobber (match_scratch:SI 4 "=&r,&r"))]
13007 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13009 [(set_attr "type" "compare")
13010 (set_attr "length" "12,16")])
13013 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13015 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13016 (match_operand:SI 2 "reg_or_short_operand" ""))
13017 (match_operand:SI 3 "gpc_reg_operand" ""))
13019 (clobber (match_scratch:SI 4 ""))]
13020 "TARGET_POWER && reload_completed"
13021 [(set (match_dup 4)
13022 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13025 (compare:CC (match_dup 4)
13030 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13032 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13033 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13034 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13036 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13037 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13040 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13042 [(set_attr "type" "compare")
13043 (set_attr "length" "12,16")])
13046 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13048 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13049 (match_operand:SI 2 "reg_or_short_operand" ""))
13050 (match_operand:SI 3 "gpc_reg_operand" ""))
13052 (set (match_operand:SI 0 "gpc_reg_operand" "")
13053 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13054 "TARGET_POWER && reload_completed"
13055 [(set (match_dup 0)
13056 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13058 (compare:CC (match_dup 0)
13063 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13064 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13065 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13067 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13068 [(set_attr "length" "12")])
13070 (define_insn_and_split "*ltu<mode>"
13071 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13072 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13073 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13077 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13078 (set (match_dup 0) (neg:P (match_dup 0)))]
13081 (define_insn_and_split "*ltu<mode>_compare"
13082 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13084 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13085 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13087 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13088 (ltu:P (match_dup 1) (match_dup 2)))]
13092 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13093 (parallel [(set (match_dup 3)
13094 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13095 (set (match_dup 0) (neg:P (match_dup 0)))])]
13098 (define_insn_and_split "*plus_ltu<mode>"
13099 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13100 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13101 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13102 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13105 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13106 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13107 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13110 (define_insn_and_split "*plus_ltu<mode>_compare"
13111 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13113 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13114 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13115 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13117 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13118 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13121 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13122 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13123 (parallel [(set (match_dup 4)
13124 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13126 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13129 (define_insn "*neg_ltu<mode>"
13130 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13131 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13132 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13135 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13136 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13137 [(set_attr "type" "two")
13138 (set_attr "length" "8")])
13141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13142 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13143 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13144 (clobber (match_scratch:SI 3 "=r"))]
13146 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13147 [(set_attr "length" "12")])
13150 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13152 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13153 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13155 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13156 (ge:SI (match_dup 1) (match_dup 2)))
13157 (clobber (match_scratch:SI 3 "=r,r"))]
13160 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13162 [(set_attr "type" "compare")
13163 (set_attr "length" "12,16")])
13166 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13168 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13169 (match_operand:SI 2 "reg_or_short_operand" ""))
13171 (set (match_operand:SI 0 "gpc_reg_operand" "")
13172 (ge:SI (match_dup 1) (match_dup 2)))
13173 (clobber (match_scratch:SI 3 ""))]
13174 "TARGET_POWER && reload_completed"
13175 [(parallel [(set (match_dup 0)
13176 (ge:SI (match_dup 1) (match_dup 2)))
13177 (clobber (match_dup 3))])
13179 (compare:CC (match_dup 0)
13184 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13185 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13186 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13187 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13189 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13190 [(set_attr "length" "12")])
13193 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13195 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13196 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13197 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13199 (clobber (match_scratch:SI 4 "=&r,&r"))]
13202 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13204 [(set_attr "type" "compare")
13205 (set_attr "length" "12,16")])
13208 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13210 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13211 (match_operand:SI 2 "reg_or_short_operand" ""))
13212 (match_operand:SI 3 "gpc_reg_operand" ""))
13214 (clobber (match_scratch:SI 4 ""))]
13215 "TARGET_POWER && reload_completed"
13216 [(set (match_dup 4)
13217 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13220 (compare:CC (match_dup 4)
13225 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13227 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13228 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13229 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13231 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13232 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13235 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13237 [(set_attr "type" "compare")
13238 (set_attr "length" "12,16")])
13241 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13243 (plus:SI (ge: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 (set (match_operand:SI 0 "gpc_reg_operand" "")
13248 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13249 "TARGET_POWER && reload_completed"
13250 [(set (match_dup 0)
13251 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13253 (compare:CC (match_dup 0)
13258 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13259 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13260 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13262 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13263 [(set_attr "length" "12")])
13265 (define_insn "*geu<mode>"
13266 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13267 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13268 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13271 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13272 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13273 [(set_attr "type" "three")
13274 (set_attr "length" "12")])
13276 (define_insn "*geu<mode>_compare"
13277 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13279 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13280 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13282 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13283 (geu:P (match_dup 1) (match_dup 2)))]
13286 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13287 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13290 [(set_attr "type" "compare")
13291 (set_attr "length" "12,12,16,16")])
13294 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13296 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13297 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13299 (set (match_operand:P 0 "gpc_reg_operand" "")
13300 (geu:P (match_dup 1) (match_dup 2)))]
13302 [(set (match_dup 0)
13303 (geu:P (match_dup 1) (match_dup 2)))
13305 (compare:CC (match_dup 0)
13309 (define_insn "*plus_geu<mode>"
13310 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13311 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13312 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13313 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13316 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13317 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13318 [(set_attr "type" "two")
13319 (set_attr "length" "8")])
13322 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13324 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13325 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13326 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13328 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13331 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13332 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13335 [(set_attr "type" "compare")
13336 (set_attr "length" "8,8,12,12")])
13339 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13341 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13342 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13343 (match_operand:SI 3 "gpc_reg_operand" ""))
13345 (clobber (match_scratch:SI 4 ""))]
13346 "TARGET_32BIT && reload_completed"
13347 [(set (match_dup 4)
13348 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13351 (compare:CC (match_dup 4)
13356 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13358 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13359 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13360 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13362 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13363 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13366 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13367 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13370 [(set_attr "type" "compare")
13371 (set_attr "length" "8,8,12,12")])
13374 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13376 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13377 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13378 (match_operand:SI 3 "gpc_reg_operand" ""))
13380 (set (match_operand:SI 0 "gpc_reg_operand" "")
13381 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13382 "TARGET_32BIT && reload_completed"
13383 [(set (match_dup 0)
13384 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13386 (compare:CC (match_dup 0)
13390 (define_insn "*neg_geu<mode>"
13391 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13392 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13393 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13396 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13397 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13398 [(set_attr "type" "three")
13399 (set_attr "length" "12")])
13401 (define_insn "*and_neg_geu<mode>"
13402 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13404 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13405 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13406 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13409 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13410 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13411 [(set_attr "type" "three")
13412 (set_attr "length" "12")])
13415 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13418 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13419 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13420 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13422 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13425 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13426 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13429 [(set_attr "type" "compare")
13430 (set_attr "length" "12,12,16,16")])
13433 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13436 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13437 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13438 (match_operand:SI 3 "gpc_reg_operand" ""))
13440 (clobber (match_scratch:SI 4 ""))]
13441 "TARGET_32BIT && reload_completed"
13442 [(set (match_dup 4)
13443 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13446 (compare:CC (match_dup 4)
13451 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13454 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13455 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13456 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13458 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13459 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13462 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13463 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13466 [(set_attr "type" "compare")
13467 (set_attr "length" "12,12,16,16")])
13470 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13473 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13474 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13475 (match_operand:SI 3 "gpc_reg_operand" ""))
13477 (set (match_operand:SI 0 "gpc_reg_operand" "")
13478 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13479 "TARGET_32BIT && reload_completed"
13480 [(set (match_dup 0)
13481 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13483 (compare:CC (match_dup 0)
13488 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13489 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13490 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13492 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13493 [(set_attr "length" "12")])
13496 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13498 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13499 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13501 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13502 (gt:SI (match_dup 1) (match_dup 2)))]
13505 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13507 [(set_attr "type" "delayed_compare")
13508 (set_attr "length" "12,16")])
13511 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13513 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13514 (match_operand:SI 2 "reg_or_short_operand" ""))
13516 (set (match_operand:SI 0 "gpc_reg_operand" "")
13517 (gt:SI (match_dup 1) (match_dup 2)))]
13518 "TARGET_POWER && reload_completed"
13519 [(set (match_dup 0)
13520 (gt:SI (match_dup 1) (match_dup 2)))
13522 (compare:CC (match_dup 0)
13526 (define_insn "*plus_gt0<mode>"
13527 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13528 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13530 (match_operand:P 2 "gpc_reg_operand" "r")))]
13532 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13533 [(set_attr "type" "three")
13534 (set_attr "length" "12")])
13537 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13539 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13541 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13543 (clobber (match_scratch:SI 3 "=&r,&r"))]
13546 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13548 [(set_attr "type" "compare")
13549 (set_attr "length" "12,16")])
13552 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13554 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13556 (match_operand:SI 2 "gpc_reg_operand" ""))
13558 (clobber (match_scratch:SI 3 ""))]
13559 "TARGET_32BIT && reload_completed"
13560 [(set (match_dup 3)
13561 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13564 (compare:CC (match_dup 3)
13569 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13571 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13573 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13575 (clobber (match_scratch:DI 3 "=&r,&r"))]
13578 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13580 [(set_attr "type" "compare")
13581 (set_attr "length" "12,16")])
13584 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13586 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13588 (match_operand:DI 2 "gpc_reg_operand" ""))
13590 (clobber (match_scratch:DI 3 ""))]
13591 "TARGET_64BIT && reload_completed"
13592 [(set (match_dup 3)
13593 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13596 (compare:CC (match_dup 3)
13601 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13603 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13605 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13607 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13608 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13611 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13613 [(set_attr "type" "compare")
13614 (set_attr "length" "12,16")])
13617 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13619 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13621 (match_operand:SI 2 "gpc_reg_operand" ""))
13623 (set (match_operand:SI 0 "gpc_reg_operand" "")
13624 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13625 "TARGET_32BIT && reload_completed"
13626 [(set (match_dup 0)
13627 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13629 (compare:CC (match_dup 0)
13634 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13636 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13638 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13640 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13641 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13644 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13646 [(set_attr "type" "compare")
13647 (set_attr "length" "12,16")])
13650 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13652 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13654 (match_operand:DI 2 "gpc_reg_operand" ""))
13656 (set (match_operand:DI 0 "gpc_reg_operand" "")
13657 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13658 "TARGET_64BIT && reload_completed"
13659 [(set (match_dup 0)
13660 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13662 (compare:CC (match_dup 0)
13667 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13668 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13669 (match_operand:SI 2 "reg_or_short_operand" "r"))
13670 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13672 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13673 [(set_attr "length" "12")])
13676 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13678 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13679 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13680 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13682 (clobber (match_scratch:SI 4 "=&r,&r"))]
13685 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13687 [(set_attr "type" "compare")
13688 (set_attr "length" "12,16")])
13691 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13693 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13694 (match_operand:SI 2 "reg_or_short_operand" ""))
13695 (match_operand:SI 3 "gpc_reg_operand" ""))
13697 (clobber (match_scratch:SI 4 ""))]
13698 "TARGET_POWER && reload_completed"
13699 [(set (match_dup 4)
13700 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13702 (compare:CC (match_dup 4)
13707 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13709 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13710 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13711 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13713 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13714 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13717 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13719 [(set_attr "type" "compare")
13720 (set_attr "length" "12,16")])
13723 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13725 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13726 (match_operand:SI 2 "reg_or_short_operand" ""))
13727 (match_operand:SI 3 "gpc_reg_operand" ""))
13729 (set (match_operand:SI 0 "gpc_reg_operand" "")
13730 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13731 "TARGET_POWER && reload_completed"
13732 [(set (match_dup 0)
13733 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13735 (compare:CC (match_dup 0)
13740 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13741 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13742 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13744 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13745 [(set_attr "length" "12")])
13747 (define_insn_and_split "*gtu<mode>"
13748 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13749 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13750 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13754 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13755 (set (match_dup 0) (neg:P (match_dup 0)))]
13758 (define_insn_and_split "*gtu<mode>_compare"
13759 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13761 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13762 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13764 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13765 (gtu:P (match_dup 1) (match_dup 2)))]
13769 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13770 (parallel [(set (match_dup 3)
13771 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13772 (set (match_dup 0) (neg:P (match_dup 0)))])]
13775 (define_insn_and_split "*plus_gtu<mode>"
13776 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13777 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13778 (match_operand:P 2 "reg_or_short_operand" "rI"))
13779 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13782 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13783 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13784 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13787 (define_insn_and_split "*plus_gtu<mode>_compare"
13788 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13790 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13791 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13792 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13794 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13795 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13798 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13799 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13800 (parallel [(set (match_dup 4)
13801 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13803 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13806 (define_insn "*neg_gtu<mode>"
13807 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13808 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13809 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13811 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13812 [(set_attr "type" "two")
13813 (set_attr "length" "8")])
13816 ;; Define both directions of branch and return. If we need a reload
13817 ;; register, we'd rather use CR0 since it is much easier to copy a
13818 ;; register CC value to there.
13822 (if_then_else (match_operator 1 "branch_comparison_operator"
13824 "cc_reg_operand" "y")
13826 (label_ref (match_operand 0 "" ""))
13831 return output_cbranch (operands[1], \"%l0\", 0, insn);
13833 [(set_attr "type" "branch")])
13837 (if_then_else (match_operator 0 "branch_comparison_operator"
13839 "cc_reg_operand" "y")
13846 return output_cbranch (operands[0], NULL, 0, insn);
13848 [(set_attr "type" "jmpreg")
13849 (set_attr "length" "4")])
13853 (if_then_else (match_operator 1 "branch_comparison_operator"
13855 "cc_reg_operand" "y")
13858 (label_ref (match_operand 0 "" ""))))]
13862 return output_cbranch (operands[1], \"%l0\", 1, insn);
13864 [(set_attr "type" "branch")])
13868 (if_then_else (match_operator 0 "branch_comparison_operator"
13870 "cc_reg_operand" "y")
13877 return output_cbranch (operands[0], NULL, 1, insn);
13879 [(set_attr "type" "jmpreg")
13880 (set_attr "length" "4")])
13882 ;; Logic on condition register values.
13884 ; This pattern matches things like
13885 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13886 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13888 ; which are generated by the branch logic.
13889 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13891 (define_insn "*cceq_ior_compare"
13892 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13893 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13894 [(match_operator:SI 2
13895 "branch_positive_comparison_operator"
13897 "cc_reg_operand" "y,y")
13899 (match_operator:SI 4
13900 "branch_positive_comparison_operator"
13902 "cc_reg_operand" "0,y")
13906 "cr%q1 %E0,%j2,%j4"
13907 [(set_attr "type" "cr_logical,delayed_cr")])
13909 ; Why is the constant -1 here, but 1 in the previous pattern?
13910 ; Because ~1 has all but the low bit set.
13912 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13913 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13914 [(not:SI (match_operator:SI 2
13915 "branch_positive_comparison_operator"
13917 "cc_reg_operand" "y,y")
13919 (match_operator:SI 4
13920 "branch_positive_comparison_operator"
13922 "cc_reg_operand" "0,y")
13926 "cr%q1 %E0,%j2,%j4"
13927 [(set_attr "type" "cr_logical,delayed_cr")])
13929 (define_insn "*cceq_rev_compare"
13930 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13931 (compare:CCEQ (match_operator:SI 1
13932 "branch_positive_comparison_operator"
13934 "cc_reg_operand" "0,y")
13938 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13939 [(set_attr "type" "cr_logical,delayed_cr")])
13941 ;; If we are comparing the result of two comparisons, this can be done
13942 ;; using creqv or crxor.
13944 (define_insn_and_split ""
13945 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13946 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13947 [(match_operand 2 "cc_reg_operand" "y")
13949 (match_operator 3 "branch_comparison_operator"
13950 [(match_operand 4 "cc_reg_operand" "y")
13955 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13959 int positive_1, positive_2;
13961 positive_1 = branch_positive_comparison_operator (operands[1],
13962 GET_MODE (operands[1]));
13963 positive_2 = branch_positive_comparison_operator (operands[3],
13964 GET_MODE (operands[3]));
13967 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13968 GET_CODE (operands[1])),
13970 operands[2], const0_rtx);
13971 else if (GET_MODE (operands[1]) != SImode)
13972 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13973 operands[2], const0_rtx);
13976 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13977 GET_CODE (operands[3])),
13979 operands[4], const0_rtx);
13980 else if (GET_MODE (operands[3]) != SImode)
13981 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13982 operands[4], const0_rtx);
13984 if (positive_1 == positive_2)
13986 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13987 operands[5] = constm1_rtx;
13991 operands[5] = const1_rtx;
13995 ;; Unconditional branch and return.
13997 (define_insn "jump"
13999 (label_ref (match_operand 0 "" "")))]
14002 [(set_attr "type" "branch")])
14004 (define_insn "return"
14008 [(set_attr "type" "jmpreg")])
14010 (define_expand "indirect_jump"
14011 [(set (pc) (match_operand 0 "register_operand" ""))])
14013 (define_insn "*indirect_jump<mode>"
14014 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14019 [(set_attr "type" "jmpreg")])
14021 ;; Table jump for switch statements:
14022 (define_expand "tablejump"
14023 [(use (match_operand 0 "" ""))
14024 (use (label_ref (match_operand 1 "" "")))]
14029 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14031 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14035 (define_expand "tablejumpsi"
14036 [(set (match_dup 3)
14037 (plus:SI (match_operand:SI 0 "" "")
14039 (parallel [(set (pc) (match_dup 3))
14040 (use (label_ref (match_operand 1 "" "")))])]
14043 { operands[0] = force_reg (SImode, operands[0]);
14044 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14045 operands[3] = gen_reg_rtx (SImode);
14048 (define_expand "tablejumpdi"
14049 [(set (match_dup 4)
14050 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
14052 (plus:DI (match_dup 4)
14054 (parallel [(set (pc) (match_dup 3))
14055 (use (label_ref (match_operand 1 "" "")))])]
14058 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14059 operands[3] = gen_reg_rtx (DImode);
14060 operands[4] = gen_reg_rtx (DImode);
14063 (define_insn "*tablejump<mode>_internal1"
14065 (match_operand:P 0 "register_operand" "c,*l"))
14066 (use (label_ref (match_operand 1 "" "")))]
14071 [(set_attr "type" "jmpreg")])
14076 "{cror 0,0,0|nop}")
14078 ;; Define the subtract-one-and-jump insns, starting with the template
14079 ;; so loop.c knows what to generate.
14081 (define_expand "doloop_end"
14082 [(use (match_operand 0 "" "")) ; loop pseudo
14083 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14084 (use (match_operand 2 "" "")) ; max iterations
14085 (use (match_operand 3 "" "")) ; loop level
14086 (use (match_operand 4 "" ""))] ; label
14090 /* Only use this on innermost loops. */
14091 if (INTVAL (operands[3]) > 1)
14095 if (GET_MODE (operands[0]) != DImode)
14097 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14101 if (GET_MODE (operands[0]) != SImode)
14103 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14108 (define_expand "ctr<mode>"
14109 [(parallel [(set (pc)
14110 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14112 (label_ref (match_operand 1 "" ""))
14115 (plus:P (match_dup 0)
14117 (clobber (match_scratch:CC 2 ""))
14118 (clobber (match_scratch:P 3 ""))])]
14122 ;; We need to be able to do this for any operand, including MEM, or we
14123 ;; will cause reload to blow up since we don't allow output reloads on
14125 ;; For the length attribute to be calculated correctly, the
14126 ;; label MUST be operand 0.
14128 (define_insn "*ctr<mode>_internal1"
14130 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14132 (label_ref (match_operand 0 "" ""))
14134 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14135 (plus:P (match_dup 1)
14137 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14138 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14142 if (which_alternative != 0)
14144 else if (get_attr_length (insn) == 4)
14145 return \"{bdn|bdnz} %l0\";
14147 return \"bdz $+8\;b %l0\";
14149 [(set_attr "type" "branch")
14150 (set_attr "length" "*,12,16,16")])
14152 (define_insn "*ctr<mode>_internal2"
14154 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14157 (label_ref (match_operand 0 "" ""))))
14158 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14159 (plus:P (match_dup 1)
14161 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14162 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14166 if (which_alternative != 0)
14168 else if (get_attr_length (insn) == 4)
14169 return \"bdz %l0\";
14171 return \"{bdn|bdnz} $+8\;b %l0\";
14173 [(set_attr "type" "branch")
14174 (set_attr "length" "*,12,16,16")])
14176 ;; Similar but use EQ
14178 (define_insn "*ctr<mode>_internal5"
14180 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14182 (label_ref (match_operand 0 "" ""))
14184 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14185 (plus:P (match_dup 1)
14187 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14188 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14192 if (which_alternative != 0)
14194 else if (get_attr_length (insn) == 4)
14195 return \"bdz %l0\";
14197 return \"{bdn|bdnz} $+8\;b %l0\";
14199 [(set_attr "type" "branch")
14200 (set_attr "length" "*,12,16,16")])
14202 (define_insn "*ctr<mode>_internal6"
14204 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14207 (label_ref (match_operand 0 "" ""))))
14208 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14209 (plus:P (match_dup 1)
14211 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14212 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14216 if (which_alternative != 0)
14218 else if (get_attr_length (insn) == 4)
14219 return \"{bdn|bdnz} %l0\";
14221 return \"bdz $+8\;b %l0\";
14223 [(set_attr "type" "branch")
14224 (set_attr "length" "*,12,16,16")])
14226 ;; Now the splitters if we could not allocate the CTR register
14230 (if_then_else (match_operator 2 "comparison_operator"
14231 [(match_operand:P 1 "gpc_reg_operand" "")
14233 (match_operand 5 "" "")
14234 (match_operand 6 "" "")))
14235 (set (match_operand:P 0 "gpc_reg_operand" "")
14236 (plus:P (match_dup 1) (const_int -1)))
14237 (clobber (match_scratch:CC 3 ""))
14238 (clobber (match_scratch:P 4 ""))]
14240 [(parallel [(set (match_dup 3)
14241 (compare:CC (plus:P (match_dup 1)
14245 (plus:P (match_dup 1)
14247 (set (pc) (if_then_else (match_dup 7)
14251 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14252 operands[3], const0_rtx); }")
14256 (if_then_else (match_operator 2 "comparison_operator"
14257 [(match_operand:P 1 "gpc_reg_operand" "")
14259 (match_operand 5 "" "")
14260 (match_operand 6 "" "")))
14261 (set (match_operand:P 0 "nonimmediate_operand" "")
14262 (plus:P (match_dup 1) (const_int -1)))
14263 (clobber (match_scratch:CC 3 ""))
14264 (clobber (match_scratch:P 4 ""))]
14265 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14266 [(parallel [(set (match_dup 3)
14267 (compare:CC (plus:P (match_dup 1)
14271 (plus:P (match_dup 1)
14275 (set (pc) (if_then_else (match_dup 7)
14279 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14280 operands[3], const0_rtx); }")
14282 (define_insn "trap"
14283 [(trap_if (const_int 1) (const_int 0))]
14286 [(set_attr "type" "trap")])
14288 (define_expand "conditional_trap"
14289 [(trap_if (match_operator 0 "trap_comparison_operator"
14290 [(match_dup 2) (match_dup 3)])
14291 (match_operand 1 "const_int_operand" ""))]
14293 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14294 operands[2] = rs6000_compare_op0;
14295 operands[3] = rs6000_compare_op1;")
14298 [(trap_if (match_operator 0 "trap_comparison_operator"
14299 [(match_operand:GPR 1 "register_operand" "r")
14300 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14303 "{t|t<wd>}%V0%I2 %1,%2"
14304 [(set_attr "type" "trap")])
14306 ;; Insns related to generating the function prologue and epilogue.
14308 (define_expand "prologue"
14309 [(use (const_int 0))]
14310 "TARGET_SCHED_PROLOG"
14313 rs6000_emit_prologue ();
14317 (define_insn "*movesi_from_cr_one"
14318 [(match_parallel 0 "mfcr_operation"
14319 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14320 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14321 (match_operand 3 "immediate_operand" "n")]
14322 UNSPEC_MOVESI_FROM_CR))])]
14328 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14330 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14331 operands[4] = GEN_INT (mask);
14332 output_asm_insn (\"mfcr %1,%4\", operands);
14336 [(set_attr "type" "mfcrf")])
14338 (define_insn "movesi_from_cr"
14339 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14340 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14341 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14342 UNSPEC_MOVESI_FROM_CR))]
14345 [(set_attr "type" "mfcr")])
14347 (define_insn "*stmw"
14348 [(match_parallel 0 "stmw_operation"
14349 [(set (match_operand:SI 1 "memory_operand" "=m")
14350 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14353 [(set_attr "type" "store_ux")])
14355 (define_insn "*save_fpregs_<mode>"
14356 [(match_parallel 0 "any_parallel_operand"
14357 [(clobber (match_operand:P 1 "register_operand" "=l"))
14358 (use (match_operand:P 2 "call_operand" "s"))
14359 (set (match_operand:DF 3 "memory_operand" "=m")
14360 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14363 [(set_attr "type" "branch")
14364 (set_attr "length" "4")])
14366 ; These are to explain that changes to the stack pointer should
14367 ; not be moved over stores to stack memory.
14368 (define_insn "stack_tie"
14369 [(set (match_operand:BLK 0 "memory_operand" "+m")
14370 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14373 [(set_attr "length" "0")])
14376 (define_expand "epilogue"
14377 [(use (const_int 0))]
14378 "TARGET_SCHED_PROLOG"
14381 rs6000_emit_epilogue (FALSE);
14385 ; On some processors, doing the mtcrf one CC register at a time is
14386 ; faster (like on the 604e). On others, doing them all at once is
14387 ; faster; for instance, on the 601 and 750.
14389 (define_expand "movsi_to_cr_one"
14390 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14391 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14392 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14394 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14396 (define_insn "*movsi_to_cr"
14397 [(match_parallel 0 "mtcrf_operation"
14398 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14399 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14400 (match_operand 3 "immediate_operand" "n")]
14401 UNSPEC_MOVESI_TO_CR))])]
14407 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14408 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14409 operands[4] = GEN_INT (mask);
14410 return \"mtcrf %4,%2\";
14412 [(set_attr "type" "mtcr")])
14414 (define_insn "*mtcrfsi"
14415 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14416 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14417 (match_operand 2 "immediate_operand" "n")]
14418 UNSPEC_MOVESI_TO_CR))]
14419 "GET_CODE (operands[0]) == REG
14420 && CR_REGNO_P (REGNO (operands[0]))
14421 && GET_CODE (operands[2]) == CONST_INT
14422 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14424 [(set_attr "type" "mtcr")])
14426 ; The load-multiple instructions have similar properties.
14427 ; Note that "load_multiple" is a name known to the machine-independent
14428 ; code that actually corresponds to the PowerPC load-string.
14430 (define_insn "*lmw"
14431 [(match_parallel 0 "lmw_operation"
14432 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14433 (match_operand:SI 2 "memory_operand" "m"))])]
14436 [(set_attr "type" "load_ux")])
14438 (define_insn "*return_internal_<mode>"
14440 (use (match_operand:P 0 "register_operand" "lc"))]
14443 [(set_attr "type" "jmpreg")])
14445 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14446 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14448 (define_insn "*return_and_restore_fpregs_<mode>"
14449 [(match_parallel 0 "any_parallel_operand"
14451 (use (match_operand:P 1 "register_operand" "l"))
14452 (use (match_operand:P 2 "call_operand" "s"))
14453 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14454 (match_operand:DF 4 "memory_operand" "m"))])]
14458 ; This is used in compiling the unwind routines.
14459 (define_expand "eh_return"
14460 [(use (match_operand 0 "general_operand" ""))]
14465 emit_insn (gen_eh_set_lr_si (operands[0]));
14467 emit_insn (gen_eh_set_lr_di (operands[0]));
14471 ; We can't expand this before we know where the link register is stored.
14472 (define_insn "eh_set_lr_<mode>"
14473 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14475 (clobber (match_scratch:P 1 "=&b"))]
14480 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14481 (clobber (match_scratch 1 ""))]
14486 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14490 (define_insn "prefetch"
14491 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14492 (match_operand:SI 1 "const_int_operand" "n")
14493 (match_operand:SI 2 "const_int_operand" "n"))]
14497 if (GET_CODE (operands[0]) == REG)
14498 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14499 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14501 [(set_attr "type" "load")])
14504 (include "sync.md")
14505 (include "altivec.md")