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 = ((!can_create_pseudo_p ()
1472 || rtx_equal_p (operands[0], operands[1]))
1473 ? operands[0] : gen_reg_rtx (<MODE>mode));
1475 HOST_WIDE_INT val = INTVAL (operands[2]);
1476 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1477 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1479 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1482 /* The ordering here is important for the prolog expander.
1483 When space is allocated from the stack, adding 'low' first may
1484 produce a temporary deallocation (which would be bad). */
1485 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1486 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1491 ;; Discourage ai/addic because of carry but provide it in an alternative
1492 ;; allowing register zero as source.
1493 (define_insn "*add<mode>3_internal1"
1494 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1495 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1496 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1497 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1500 {cal %0,%2(%1)|addi %0,%1,%2}
1502 {cau|addis} %0,%1,%v2"
1503 [(set_attr "length" "4,4,4,4")])
1505 (define_insn "addsi3_high"
1506 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1507 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1508 (high:SI (match_operand 2 "" ""))))]
1509 "TARGET_MACHO && !TARGET_64BIT"
1510 "{cau|addis} %0,%1,ha16(%2)"
1511 [(set_attr "length" "4")])
1513 (define_insn "*add<mode>3_internal2"
1514 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1515 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1516 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1518 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1521 {cax.|add.} %3,%1,%2
1522 {ai.|addic.} %3,%1,%2
1525 [(set_attr "type" "fast_compare,compare,compare,compare")
1526 (set_attr "length" "4,4,8,8")])
1529 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1530 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1531 (match_operand:GPR 2 "reg_or_short_operand" ""))
1533 (clobber (match_scratch:GPR 3 ""))]
1536 (plus:GPR (match_dup 1)
1539 (compare:CC (match_dup 3)
1543 (define_insn "*add<mode>3_internal3"
1544 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1545 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1546 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1548 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1549 (plus:P (match_dup 1)
1553 {cax.|add.} %0,%1,%2
1554 {ai.|addic.} %0,%1,%2
1557 [(set_attr "type" "fast_compare,compare,compare,compare")
1558 (set_attr "length" "4,4,8,8")])
1561 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1562 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1563 (match_operand:P 2 "reg_or_short_operand" ""))
1565 (set (match_operand:P 0 "gpc_reg_operand" "")
1566 (plus:P (match_dup 1) (match_dup 2)))]
1569 (plus:P (match_dup 1)
1572 (compare:CC (match_dup 0)
1576 ;; Split an add that we can't do in one insn into two insns, each of which
1577 ;; does one 16-bit part. This is used by combine. Note that the low-order
1578 ;; add should be last in case the result gets used in an address.
1581 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1582 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1583 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1585 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1586 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1588 HOST_WIDE_INT val = INTVAL (operands[2]);
1589 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1590 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1592 operands[4] = GEN_INT (low);
1593 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1594 operands[3] = GEN_INT (rest);
1595 else if (can_create_pseudo_p ())
1597 operands[3] = gen_reg_rtx (DImode);
1598 emit_move_insn (operands[3], operands[2]);
1599 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1606 (define_insn "one_cmpl<mode>2"
1607 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1608 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1613 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1614 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1616 (clobber (match_scratch:P 2 "=r,r"))]
1621 [(set_attr "type" "compare")
1622 (set_attr "length" "4,8")])
1625 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1626 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1628 (clobber (match_scratch:P 2 ""))]
1631 (not:P (match_dup 1)))
1633 (compare:CC (match_dup 2)
1638 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1639 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1641 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1642 (not:P (match_dup 1)))]
1647 [(set_attr "type" "compare")
1648 (set_attr "length" "4,8")])
1651 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1652 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1654 (set (match_operand:P 0 "gpc_reg_operand" "")
1655 (not:P (match_dup 1)))]
1658 (not:P (match_dup 1)))
1660 (compare:CC (match_dup 0)
1665 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1666 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1667 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1669 "{sf%I1|subf%I1c} %0,%2,%1")
1672 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1673 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1674 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1681 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1682 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1683 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1685 (clobber (match_scratch:SI 3 "=r,r"))]
1688 {sf.|subfc.} %3,%2,%1
1690 [(set_attr "type" "compare")
1691 (set_attr "length" "4,8")])
1694 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1695 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1696 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1698 (clobber (match_scratch:P 3 "=r,r"))]
1703 [(set_attr "type" "fast_compare")
1704 (set_attr "length" "4,8")])
1707 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1708 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1709 (match_operand:P 2 "gpc_reg_operand" ""))
1711 (clobber (match_scratch:P 3 ""))]
1714 (minus:P (match_dup 1)
1717 (compare:CC (match_dup 3)
1722 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1723 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1724 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1726 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1727 (minus:SI (match_dup 1) (match_dup 2)))]
1730 {sf.|subfc.} %0,%2,%1
1732 [(set_attr "type" "compare")
1733 (set_attr "length" "4,8")])
1736 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1737 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1738 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1740 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1741 (minus:P (match_dup 1)
1747 [(set_attr "type" "fast_compare")
1748 (set_attr "length" "4,8")])
1751 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1752 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1753 (match_operand:P 2 "gpc_reg_operand" ""))
1755 (set (match_operand:P 0 "gpc_reg_operand" "")
1756 (minus:P (match_dup 1)
1760 (minus:P (match_dup 1)
1763 (compare:CC (match_dup 0)
1767 (define_expand "sub<mode>3"
1768 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1769 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1770 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1774 if (GET_CODE (operands[2]) == CONST_INT)
1776 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1777 negate_rtx (<MODE>mode, operands[2])));
1782 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1783 ;; instruction and some auxiliary computations. Then we just have a single
1784 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1787 (define_expand "sminsi3"
1789 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1790 (match_operand:SI 2 "reg_or_short_operand" ""))
1792 (minus:SI (match_dup 2) (match_dup 1))))
1793 (set (match_operand:SI 0 "gpc_reg_operand" "")
1794 (minus:SI (match_dup 2) (match_dup 3)))]
1795 "TARGET_POWER || TARGET_ISEL"
1800 operands[2] = force_reg (SImode, operands[2]);
1801 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1805 operands[3] = gen_reg_rtx (SImode);
1809 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1810 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1811 (match_operand:SI 2 "reg_or_short_operand" "")))
1812 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1815 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1817 (minus:SI (match_dup 2) (match_dup 1))))
1818 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1821 (define_expand "smaxsi3"
1823 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1824 (match_operand:SI 2 "reg_or_short_operand" ""))
1826 (minus:SI (match_dup 2) (match_dup 1))))
1827 (set (match_operand:SI 0 "gpc_reg_operand" "")
1828 (plus:SI (match_dup 3) (match_dup 1)))]
1829 "TARGET_POWER || TARGET_ISEL"
1834 operands[2] = force_reg (SImode, operands[2]);
1835 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1838 operands[3] = gen_reg_rtx (SImode);
1842 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1843 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1844 (match_operand:SI 2 "reg_or_short_operand" "")))
1845 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1848 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1850 (minus:SI (match_dup 2) (match_dup 1))))
1851 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1854 (define_expand "uminsi3"
1855 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1857 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1859 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1861 (minus:SI (match_dup 4) (match_dup 3))))
1862 (set (match_operand:SI 0 "gpc_reg_operand" "")
1863 (minus:SI (match_dup 2) (match_dup 3)))]
1864 "TARGET_POWER || TARGET_ISEL"
1869 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1872 operands[3] = gen_reg_rtx (SImode);
1873 operands[4] = gen_reg_rtx (SImode);
1874 operands[5] = GEN_INT (-2147483647 - 1);
1877 (define_expand "umaxsi3"
1878 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1880 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1882 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1884 (minus:SI (match_dup 4) (match_dup 3))))
1885 (set (match_operand:SI 0 "gpc_reg_operand" "")
1886 (plus:SI (match_dup 3) (match_dup 1)))]
1887 "TARGET_POWER || TARGET_ISEL"
1892 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1895 operands[3] = gen_reg_rtx (SImode);
1896 operands[4] = gen_reg_rtx (SImode);
1897 operands[5] = GEN_INT (-2147483647 - 1);
1901 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1902 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1903 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1905 (minus:SI (match_dup 2) (match_dup 1))))]
1910 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1912 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1913 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1915 (minus:SI (match_dup 2) (match_dup 1)))
1917 (clobber (match_scratch:SI 3 "=r,r"))]
1922 [(set_attr "type" "delayed_compare")
1923 (set_attr "length" "4,8")])
1926 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1928 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1929 (match_operand:SI 2 "reg_or_short_operand" ""))
1931 (minus:SI (match_dup 2) (match_dup 1)))
1933 (clobber (match_scratch:SI 3 ""))]
1934 "TARGET_POWER && reload_completed"
1936 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1938 (minus:SI (match_dup 2) (match_dup 1))))
1940 (compare:CC (match_dup 3)
1945 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1947 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1948 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1950 (minus:SI (match_dup 2) (match_dup 1)))
1952 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1953 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1955 (minus:SI (match_dup 2) (match_dup 1))))]
1960 [(set_attr "type" "delayed_compare")
1961 (set_attr "length" "4,8")])
1964 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1966 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1967 (match_operand:SI 2 "reg_or_short_operand" ""))
1969 (minus:SI (match_dup 2) (match_dup 1)))
1971 (set (match_operand:SI 0 "gpc_reg_operand" "")
1972 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1974 (minus:SI (match_dup 2) (match_dup 1))))]
1975 "TARGET_POWER && reload_completed"
1977 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1979 (minus:SI (match_dup 2) (match_dup 1))))
1981 (compare:CC (match_dup 0)
1985 ;; We don't need abs with condition code because such comparisons should
1987 (define_expand "abssi2"
1988 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1989 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1995 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1998 else if (! TARGET_POWER)
2000 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2005 (define_insn "*abssi2_power"
2006 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2007 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2011 (define_insn_and_split "abssi2_isel"
2012 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2013 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2014 (clobber (match_scratch:SI 2 "=&b"))
2015 (clobber (match_scratch:CC 3 "=y"))]
2018 "&& reload_completed"
2019 [(set (match_dup 2) (neg:SI (match_dup 1)))
2021 (compare:CC (match_dup 1)
2024 (if_then_else:SI (ge (match_dup 3)
2030 (define_insn_and_split "abssi2_nopower"
2031 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2032 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2033 (clobber (match_scratch:SI 2 "=&r,&r"))]
2034 "! TARGET_POWER && ! TARGET_ISEL"
2036 "&& reload_completed"
2037 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2038 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2039 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2042 (define_insn "*nabs_power"
2043 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2044 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2048 (define_insn_and_split "*nabs_nopower"
2049 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2050 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2051 (clobber (match_scratch:SI 2 "=&r,&r"))]
2054 "&& reload_completed"
2055 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2056 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2057 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2060 (define_expand "neg<mode>2"
2061 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2062 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2066 (define_insn "*neg<mode>2_internal"
2067 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2068 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2073 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2074 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2076 (clobber (match_scratch:P 2 "=r,r"))]
2081 [(set_attr "type" "fast_compare")
2082 (set_attr "length" "4,8")])
2085 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2086 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2088 (clobber (match_scratch:P 2 ""))]
2091 (neg:P (match_dup 1)))
2093 (compare:CC (match_dup 2)
2098 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2099 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2101 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2102 (neg:P (match_dup 1)))]
2107 [(set_attr "type" "fast_compare")
2108 (set_attr "length" "4,8")])
2111 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2112 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2114 (set (match_operand:P 0 "gpc_reg_operand" "")
2115 (neg:P (match_dup 1)))]
2118 (neg:P (match_dup 1)))
2120 (compare:CC (match_dup 0)
2124 (define_insn "clz<mode>2"
2125 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2126 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2128 "{cntlz|cntlz<wd>} %0,%1"
2129 [(set_attr "type" "cntlz")])
2131 (define_expand "ctz<mode>2"
2133 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2134 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2136 (clobber (scratch:CC))])
2137 (set (match_dup 4) (clz:GPR (match_dup 3)))
2138 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2139 (minus:GPR (match_dup 5) (match_dup 4)))]
2142 operands[2] = gen_reg_rtx (<MODE>mode);
2143 operands[3] = gen_reg_rtx (<MODE>mode);
2144 operands[4] = gen_reg_rtx (<MODE>mode);
2145 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2148 (define_expand "ffs<mode>2"
2150 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2151 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2153 (clobber (scratch:CC))])
2154 (set (match_dup 4) (clz:GPR (match_dup 3)))
2155 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2156 (minus:GPR (match_dup 5) (match_dup 4)))]
2159 operands[2] = gen_reg_rtx (<MODE>mode);
2160 operands[3] = gen_reg_rtx (<MODE>mode);
2161 operands[4] = gen_reg_rtx (<MODE>mode);
2162 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2165 (define_insn "popcntb<mode>2"
2166 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2167 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2172 (define_expand "popcount<mode>2"
2173 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2174 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2177 rs6000_emit_popcount (operands[0], operands[1]);
2181 (define_expand "parity<mode>2"
2182 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2183 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2186 rs6000_emit_parity (operands[0], operands[1]);
2190 (define_insn "bswapsi2"
2191 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2192 (bswap:SI (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2196 {stbrx|stwbrx} %1,%y0
2198 [(set_attr "length" "4,4,12")])
2201 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2202 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2205 (rotate:SI (match_dup 1) (const_int 8)))
2206 (set (zero_extract:SI (match_dup 0)
2210 (set (zero_extract:SI (match_dup 0)
2213 (rotate:SI (match_dup 1)
2217 (define_expand "mulsi3"
2218 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2219 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2220 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2225 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2227 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2231 (define_insn "mulsi3_mq"
2232 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2233 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2234 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2235 (clobber (match_scratch:SI 3 "=q,q"))]
2238 {muls|mullw} %0,%1,%2
2239 {muli|mulli} %0,%1,%2"
2241 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2242 (const_string "imul3")
2243 (match_operand:SI 2 "short_cint_operand" "")
2244 (const_string "imul2")]
2245 (const_string "imul")))])
2247 (define_insn "mulsi3_no_mq"
2248 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2249 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2250 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2253 {muls|mullw} %0,%1,%2
2254 {muli|mulli} %0,%1,%2"
2256 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2257 (const_string "imul3")
2258 (match_operand:SI 2 "short_cint_operand" "")
2259 (const_string "imul2")]
2260 (const_string "imul")))])
2262 (define_insn "*mulsi3_mq_internal1"
2263 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2264 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2265 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2267 (clobber (match_scratch:SI 3 "=r,r"))
2268 (clobber (match_scratch:SI 4 "=q,q"))]
2271 {muls.|mullw.} %3,%1,%2
2273 [(set_attr "type" "imul_compare")
2274 (set_attr "length" "4,8")])
2277 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2278 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2279 (match_operand:SI 2 "gpc_reg_operand" ""))
2281 (clobber (match_scratch:SI 3 ""))
2282 (clobber (match_scratch:SI 4 ""))]
2283 "TARGET_POWER && reload_completed"
2284 [(parallel [(set (match_dup 3)
2285 (mult:SI (match_dup 1) (match_dup 2)))
2286 (clobber (match_dup 4))])
2288 (compare:CC (match_dup 3)
2292 (define_insn "*mulsi3_no_mq_internal1"
2293 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2294 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2295 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2297 (clobber (match_scratch:SI 3 "=r,r"))]
2300 {muls.|mullw.} %3,%1,%2
2302 [(set_attr "type" "imul_compare")
2303 (set_attr "length" "4,8")])
2306 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2307 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2308 (match_operand:SI 2 "gpc_reg_operand" ""))
2310 (clobber (match_scratch:SI 3 ""))]
2311 "! TARGET_POWER && reload_completed"
2313 (mult:SI (match_dup 1) (match_dup 2)))
2315 (compare:CC (match_dup 3)
2319 (define_insn "*mulsi3_mq_internal2"
2320 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2321 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2322 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2324 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2325 (mult:SI (match_dup 1) (match_dup 2)))
2326 (clobber (match_scratch:SI 4 "=q,q"))]
2329 {muls.|mullw.} %0,%1,%2
2331 [(set_attr "type" "imul_compare")
2332 (set_attr "length" "4,8")])
2335 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2336 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2337 (match_operand:SI 2 "gpc_reg_operand" ""))
2339 (set (match_operand:SI 0 "gpc_reg_operand" "")
2340 (mult:SI (match_dup 1) (match_dup 2)))
2341 (clobber (match_scratch:SI 4 ""))]
2342 "TARGET_POWER && reload_completed"
2343 [(parallel [(set (match_dup 0)
2344 (mult:SI (match_dup 1) (match_dup 2)))
2345 (clobber (match_dup 4))])
2347 (compare:CC (match_dup 0)
2351 (define_insn "*mulsi3_no_mq_internal2"
2352 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2353 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2354 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2356 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2357 (mult:SI (match_dup 1) (match_dup 2)))]
2360 {muls.|mullw.} %0,%1,%2
2362 [(set_attr "type" "imul_compare")
2363 (set_attr "length" "4,8")])
2366 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2367 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2368 (match_operand:SI 2 "gpc_reg_operand" ""))
2370 (set (match_operand:SI 0 "gpc_reg_operand" "")
2371 (mult:SI (match_dup 1) (match_dup 2)))]
2372 "! TARGET_POWER && reload_completed"
2374 (mult:SI (match_dup 1) (match_dup 2)))
2376 (compare:CC (match_dup 0)
2380 ;; Operand 1 is divided by operand 2; quotient goes to operand
2381 ;; 0 and remainder to operand 3.
2382 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2384 (define_expand "divmodsi4"
2385 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2386 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2387 (match_operand:SI 2 "gpc_reg_operand" "")))
2388 (set (match_operand:SI 3 "register_operand" "")
2389 (mod:SI (match_dup 1) (match_dup 2)))])]
2390 "TARGET_POWER || (! 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_divss_call ());
2398 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2399 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2404 (define_insn "*divmodsi4_internal"
2405 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2406 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2407 (match_operand:SI 2 "gpc_reg_operand" "r")))
2408 (set (match_operand:SI 3 "register_operand" "=q")
2409 (mod:SI (match_dup 1) (match_dup 2)))]
2412 [(set_attr "type" "idiv")])
2414 (define_expand "udiv<mode>3"
2415 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2416 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2417 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2418 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2421 if (! TARGET_POWER && ! TARGET_POWERPC)
2423 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2424 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2425 emit_insn (gen_quous_call ());
2426 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2429 else if (TARGET_POWER)
2431 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2436 (define_insn "udivsi3_mq"
2437 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2438 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2439 (match_operand:SI 2 "gpc_reg_operand" "r")))
2440 (clobber (match_scratch:SI 3 "=q"))]
2441 "TARGET_POWERPC && TARGET_POWER"
2443 [(set_attr "type" "idiv")])
2445 (define_insn "*udivsi3_no_mq"
2446 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2447 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2448 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2449 "TARGET_POWERPC && ! TARGET_POWER"
2452 (cond [(match_operand:SI 0 "" "")
2453 (const_string "idiv")]
2454 (const_string "ldiv")))])
2457 ;; For powers of two we can do srai/aze for divide and then adjust for
2458 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2459 ;; used; for PowerPC, force operands into register and do a normal divide;
2460 ;; for AIX common-mode, use quoss call on register operands.
2461 (define_expand "div<mode>3"
2462 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2463 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2464 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2468 if (GET_CODE (operands[2]) == CONST_INT
2469 && INTVAL (operands[2]) > 0
2470 && exact_log2 (INTVAL (operands[2])) >= 0)
2472 else if (TARGET_POWERPC)
2474 operands[2] = force_reg (<MODE>mode, operands[2]);
2477 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2481 else if (TARGET_POWER)
2485 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2486 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2487 emit_insn (gen_quoss_call ());
2488 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2493 (define_insn "divsi3_mq"
2494 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2495 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2496 (match_operand:SI 2 "gpc_reg_operand" "r")))
2497 (clobber (match_scratch:SI 3 "=q"))]
2498 "TARGET_POWERPC && TARGET_POWER"
2500 [(set_attr "type" "idiv")])
2502 (define_insn "*div<mode>3_no_mq"
2503 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2504 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2505 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2506 "TARGET_POWERPC && ! TARGET_POWER"
2509 (cond [(match_operand:SI 0 "" "")
2510 (const_string "idiv")]
2511 (const_string "ldiv")))])
2513 (define_expand "mod<mode>3"
2514 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2515 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2516 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2524 if (GET_CODE (operands[2]) != CONST_INT
2525 || INTVAL (operands[2]) <= 0
2526 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2529 temp1 = gen_reg_rtx (<MODE>mode);
2530 temp2 = gen_reg_rtx (<MODE>mode);
2532 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2533 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2534 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2539 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2540 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2541 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2543 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2544 [(set_attr "type" "two")
2545 (set_attr "length" "8")])
2548 [(set (match_operand:CC 0 "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 (clobber (match_scratch:P 3 "=r,r"))]
2555 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2557 [(set_attr "type" "compare")
2558 (set_attr "length" "8,12")])
2561 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2562 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2563 (match_operand:GPR 2 "exact_log2_cint_operand"
2566 (clobber (match_scratch:GPR 3 ""))]
2569 (div:<MODE> (match_dup 1) (match_dup 2)))
2571 (compare:CC (match_dup 3)
2576 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2577 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2578 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2580 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2581 (div:P (match_dup 1) (match_dup 2)))]
2584 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2586 [(set_attr "type" "compare")
2587 (set_attr "length" "8,12")])
2590 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2591 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2592 (match_operand:GPR 2 "exact_log2_cint_operand"
2595 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2596 (div:GPR (match_dup 1) (match_dup 2)))]
2599 (div:<MODE> (match_dup 1) (match_dup 2)))
2601 (compare:CC (match_dup 0)
2606 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2609 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2611 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2612 (match_operand:SI 3 "gpc_reg_operand" "r")))
2613 (set (match_operand:SI 2 "register_operand" "=*q")
2616 (zero_extend:DI (match_dup 1)) (const_int 32))
2617 (zero_extend:DI (match_dup 4)))
2621 [(set_attr "type" "idiv")])
2623 ;; To do unsigned divide we handle the cases of the divisor looking like a
2624 ;; negative number. If it is a constant that is less than 2**31, we don't
2625 ;; have to worry about the branches. So make a few subroutines here.
2627 ;; First comes the normal case.
2628 (define_expand "udivmodsi4_normal"
2629 [(set (match_dup 4) (const_int 0))
2630 (parallel [(set (match_operand:SI 0 "" "")
2631 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2633 (zero_extend:DI (match_operand:SI 1 "" "")))
2634 (match_operand:SI 2 "" "")))
2635 (set (match_operand:SI 3 "" "")
2636 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2638 (zero_extend:DI (match_dup 1)))
2642 { operands[4] = gen_reg_rtx (SImode); }")
2644 ;; This handles the branches.
2645 (define_expand "udivmodsi4_tests"
2646 [(set (match_operand:SI 0 "" "") (const_int 0))
2647 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2648 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2649 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2650 (label_ref (match_operand:SI 4 "" "")) (pc)))
2651 (set (match_dup 0) (const_int 1))
2652 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2653 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2654 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2655 (label_ref (match_dup 4)) (pc)))]
2658 { operands[5] = gen_reg_rtx (CCUNSmode);
2659 operands[6] = gen_reg_rtx (CCmode);
2662 (define_expand "udivmodsi4"
2663 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2664 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2665 (match_operand:SI 2 "reg_or_cint_operand" "")))
2666 (set (match_operand:SI 3 "gpc_reg_operand" "")
2667 (umod:SI (match_dup 1) (match_dup 2)))])]
2675 if (! TARGET_POWERPC)
2677 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2678 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2679 emit_insn (gen_divus_call ());
2680 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2681 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2688 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2690 operands[2] = force_reg (SImode, operands[2]);
2691 label = gen_label_rtx ();
2692 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2693 operands[3], label));
2696 operands[2] = force_reg (SImode, operands[2]);
2698 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2706 ;; AIX architecture-independent common-mode multiply (DImode),
2707 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2708 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2709 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2710 ;; assumed unused if generating common-mode, so ignore.
2711 (define_insn "mulh_call"
2714 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2715 (sign_extend:DI (reg:SI 4)))
2717 (clobber (reg:SI 65))]
2718 "! TARGET_POWER && ! TARGET_POWERPC"
2720 [(set_attr "type" "imul")])
2722 (define_insn "mull_call"
2724 (mult:DI (sign_extend:DI (reg:SI 3))
2725 (sign_extend:DI (reg:SI 4))))
2726 (clobber (reg:SI 65))
2727 (clobber (reg:SI 0))]
2728 "! TARGET_POWER && ! TARGET_POWERPC"
2730 [(set_attr "type" "imul")])
2732 (define_insn "divss_call"
2734 (div:SI (reg:SI 3) (reg:SI 4)))
2736 (mod:SI (reg:SI 3) (reg:SI 4)))
2737 (clobber (reg:SI 65))
2738 (clobber (reg:SI 0))]
2739 "! TARGET_POWER && ! TARGET_POWERPC"
2741 [(set_attr "type" "idiv")])
2743 (define_insn "divus_call"
2745 (udiv:SI (reg:SI 3) (reg:SI 4)))
2747 (umod:SI (reg:SI 3) (reg:SI 4)))
2748 (clobber (reg:SI 65))
2749 (clobber (reg:SI 0))
2750 (clobber (match_scratch:CC 0 "=x"))
2751 (clobber (reg:CC 69))]
2752 "! TARGET_POWER && ! TARGET_POWERPC"
2754 [(set_attr "type" "idiv")])
2756 (define_insn "quoss_call"
2758 (div:SI (reg:SI 3) (reg:SI 4)))
2759 (clobber (reg:SI 65))]
2760 "! TARGET_POWER && ! TARGET_POWERPC"
2762 [(set_attr "type" "idiv")])
2764 (define_insn "quous_call"
2766 (udiv:SI (reg:SI 3) (reg:SI 4)))
2767 (clobber (reg:SI 65))
2768 (clobber (reg:SI 0))
2769 (clobber (match_scratch:CC 0 "=x"))
2770 (clobber (reg:CC 69))]
2771 "! TARGET_POWER && ! TARGET_POWERPC"
2773 [(set_attr "type" "idiv")])
2775 ;; Logical instructions
2776 ;; The logical instructions are mostly combined by using match_operator,
2777 ;; but the plain AND insns are somewhat different because there is no
2778 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2779 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2781 (define_insn "andsi3"
2782 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2783 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2784 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2785 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2789 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2790 {andil.|andi.} %0,%1,%b2
2791 {andiu.|andis.} %0,%1,%u2"
2792 [(set_attr "type" "*,*,compare,compare")])
2794 ;; Note to set cr's other than cr0 we do the and immediate and then
2795 ;; the test again -- this avoids a mfcr which on the higher end
2796 ;; machines causes an execution serialization
2798 (define_insn "*andsi3_internal2"
2799 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2800 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2801 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2803 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2804 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2808 {andil.|andi.} %3,%1,%b2
2809 {andiu.|andis.} %3,%1,%u2
2810 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2815 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2816 (set_attr "length" "4,4,4,4,8,8,8,8")])
2818 (define_insn "*andsi3_internal3"
2819 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2820 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2821 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2823 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2824 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2828 {andil.|andi.} %3,%1,%b2
2829 {andiu.|andis.} %3,%1,%u2
2830 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2835 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2836 (set_attr "length" "8,4,4,4,8,8,8,8")])
2839 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2840 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2841 (match_operand:GPR 2 "and_operand" ""))
2843 (clobber (match_scratch:GPR 3 ""))
2844 (clobber (match_scratch:CC 4 ""))]
2846 [(parallel [(set (match_dup 3)
2847 (and:<MODE> (match_dup 1)
2849 (clobber (match_dup 4))])
2851 (compare:CC (match_dup 3)
2855 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2856 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2859 [(set (match_operand:CC 0 "cc_reg_operand" "")
2860 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2861 (match_operand:SI 2 "gpc_reg_operand" ""))
2863 (clobber (match_scratch:SI 3 ""))
2864 (clobber (match_scratch:CC 4 ""))]
2865 "TARGET_POWERPC64 && reload_completed"
2866 [(parallel [(set (match_dup 3)
2867 (and:SI (match_dup 1)
2869 (clobber (match_dup 4))])
2871 (compare:CC (match_dup 3)
2875 (define_insn "*andsi3_internal4"
2876 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2877 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2878 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2880 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2881 (and:SI (match_dup 1)
2883 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2887 {andil.|andi.} %0,%1,%b2
2888 {andiu.|andis.} %0,%1,%u2
2889 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2894 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2895 (set_attr "length" "4,4,4,4,8,8,8,8")])
2897 (define_insn "*andsi3_internal5"
2898 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2899 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2900 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2902 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2903 (and:SI (match_dup 1)
2905 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2909 {andil.|andi.} %0,%1,%b2
2910 {andiu.|andis.} %0,%1,%u2
2911 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2916 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2917 (set_attr "length" "8,4,4,4,8,8,8,8")])
2920 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2921 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2922 (match_operand:SI 2 "and_operand" ""))
2924 (set (match_operand:SI 0 "gpc_reg_operand" "")
2925 (and:SI (match_dup 1)
2927 (clobber (match_scratch:CC 4 ""))]
2929 [(parallel [(set (match_dup 0)
2930 (and:SI (match_dup 1)
2932 (clobber (match_dup 4))])
2934 (compare:CC (match_dup 0)
2939 [(set (match_operand:CC 3 "cc_reg_operand" "")
2940 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2941 (match_operand:SI 2 "gpc_reg_operand" ""))
2943 (set (match_operand:SI 0 "gpc_reg_operand" "")
2944 (and:SI (match_dup 1)
2946 (clobber (match_scratch:CC 4 ""))]
2947 "TARGET_POWERPC64 && reload_completed"
2948 [(parallel [(set (match_dup 0)
2949 (and:SI (match_dup 1)
2951 (clobber (match_dup 4))])
2953 (compare:CC (match_dup 0)
2957 ;; Handle the PowerPC64 rlwinm corner case
2959 (define_insn_and_split "*andsi3_internal6"
2960 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2961 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2962 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2967 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2970 (rotate:SI (match_dup 0) (match_dup 5)))]
2973 int mb = extract_MB (operands[2]);
2974 int me = extract_ME (operands[2]);
2975 operands[3] = GEN_INT (me + 1);
2976 operands[5] = GEN_INT (32 - (me + 1));
2977 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2979 [(set_attr "length" "8")])
2981 (define_expand "iorsi3"
2982 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2983 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2984 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2988 if (GET_CODE (operands[2]) == CONST_INT
2989 && ! logical_operand (operands[2], SImode))
2991 HOST_WIDE_INT value = INTVAL (operands[2]);
2992 rtx tmp = ((!can_create_pseudo_p ()
2993 || rtx_equal_p (operands[0], operands[1]))
2994 ? operands[0] : gen_reg_rtx (SImode));
2996 emit_insn (gen_iorsi3 (tmp, operands[1],
2997 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2998 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3003 (define_expand "xorsi3"
3004 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3005 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3006 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3010 if (GET_CODE (operands[2]) == CONST_INT
3011 && ! logical_operand (operands[2], SImode))
3013 HOST_WIDE_INT value = INTVAL (operands[2]);
3014 rtx tmp = ((!can_create_pseudo_p ()
3015 || rtx_equal_p (operands[0], operands[1]))
3016 ? operands[0] : gen_reg_rtx (SImode));
3018 emit_insn (gen_xorsi3 (tmp, operands[1],
3019 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3020 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3025 (define_insn "*boolsi3_internal1"
3026 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3027 (match_operator:SI 3 "boolean_or_operator"
3028 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3029 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3033 {%q3il|%q3i} %0,%1,%b2
3034 {%q3iu|%q3is} %0,%1,%u2")
3036 (define_insn "*boolsi3_internal2"
3037 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3038 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3039 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3040 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3042 (clobber (match_scratch:SI 3 "=r,r"))]
3047 [(set_attr "type" "compare")
3048 (set_attr "length" "4,8")])
3051 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3052 (compare:CC (match_operator:SI 4 "boolean_operator"
3053 [(match_operand:SI 1 "gpc_reg_operand" "")
3054 (match_operand:SI 2 "gpc_reg_operand" "")])
3056 (clobber (match_scratch:SI 3 ""))]
3057 "TARGET_32BIT && reload_completed"
3058 [(set (match_dup 3) (match_dup 4))
3060 (compare:CC (match_dup 3)
3064 (define_insn "*boolsi3_internal3"
3065 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3066 (compare:CC (match_operator:SI 4 "boolean_operator"
3067 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3068 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3070 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3076 [(set_attr "type" "compare")
3077 (set_attr "length" "4,8")])
3080 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3081 (compare:CC (match_operator:SI 4 "boolean_operator"
3082 [(match_operand:SI 1 "gpc_reg_operand" "")
3083 (match_operand:SI 2 "gpc_reg_operand" "")])
3085 (set (match_operand:SI 0 "gpc_reg_operand" "")
3087 "TARGET_32BIT && reload_completed"
3088 [(set (match_dup 0) (match_dup 4))
3090 (compare:CC (match_dup 0)
3094 ;; Split a logical operation that we can't do in one insn into two insns,
3095 ;; each of which does one 16-bit part. This is used by combine.
3098 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3099 (match_operator:SI 3 "boolean_or_operator"
3100 [(match_operand:SI 1 "gpc_reg_operand" "")
3101 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3103 [(set (match_dup 0) (match_dup 4))
3104 (set (match_dup 0) (match_dup 5))]
3108 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3109 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3111 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3112 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3116 (define_insn "*boolcsi3_internal1"
3117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3118 (match_operator:SI 3 "boolean_operator"
3119 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3120 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3124 (define_insn "*boolcsi3_internal2"
3125 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3126 (compare:CC (match_operator:SI 4 "boolean_operator"
3127 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3128 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3130 (clobber (match_scratch:SI 3 "=r,r"))]
3135 [(set_attr "type" "compare")
3136 (set_attr "length" "4,8")])
3139 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3140 (compare:CC (match_operator:SI 4 "boolean_operator"
3141 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3142 (match_operand:SI 2 "gpc_reg_operand" "")])
3144 (clobber (match_scratch:SI 3 ""))]
3145 "TARGET_32BIT && reload_completed"
3146 [(set (match_dup 3) (match_dup 4))
3148 (compare:CC (match_dup 3)
3152 (define_insn "*boolcsi3_internal3"
3153 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3154 (compare:CC (match_operator:SI 4 "boolean_operator"
3155 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3156 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3158 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3164 [(set_attr "type" "compare")
3165 (set_attr "length" "4,8")])
3168 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3169 (compare:CC (match_operator:SI 4 "boolean_operator"
3170 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3171 (match_operand:SI 2 "gpc_reg_operand" "")])
3173 (set (match_operand:SI 0 "gpc_reg_operand" "")
3175 "TARGET_32BIT && reload_completed"
3176 [(set (match_dup 0) (match_dup 4))
3178 (compare:CC (match_dup 0)
3182 (define_insn "*boolccsi3_internal1"
3183 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3184 (match_operator:SI 3 "boolean_operator"
3185 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3186 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3190 (define_insn "*boolccsi3_internal2"
3191 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3192 (compare:CC (match_operator:SI 4 "boolean_operator"
3193 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3194 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3196 (clobber (match_scratch:SI 3 "=r,r"))]
3201 [(set_attr "type" "compare")
3202 (set_attr "length" "4,8")])
3205 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3206 (compare:CC (match_operator:SI 4 "boolean_operator"
3207 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3208 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3210 (clobber (match_scratch:SI 3 ""))]
3211 "TARGET_32BIT && reload_completed"
3212 [(set (match_dup 3) (match_dup 4))
3214 (compare:CC (match_dup 3)
3218 (define_insn "*boolccsi3_internal3"
3219 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3220 (compare:CC (match_operator:SI 4 "boolean_operator"
3221 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3222 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3224 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3230 [(set_attr "type" "compare")
3231 (set_attr "length" "4,8")])
3234 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3235 (compare:CC (match_operator:SI 4 "boolean_operator"
3236 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3237 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3239 (set (match_operand:SI 0 "gpc_reg_operand" "")
3241 "TARGET_32BIT && reload_completed"
3242 [(set (match_dup 0) (match_dup 4))
3244 (compare:CC (match_dup 0)
3248 ;; maskir insn. We need four forms because things might be in arbitrary
3249 ;; orders. Don't define forms that only set CR fields because these
3250 ;; would modify an input register.
3252 (define_insn "*maskir_internal1"
3253 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3254 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3255 (match_operand:SI 1 "gpc_reg_operand" "0"))
3256 (and:SI (match_dup 2)
3257 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3261 (define_insn "*maskir_internal2"
3262 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3263 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3264 (match_operand:SI 1 "gpc_reg_operand" "0"))
3265 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3270 (define_insn "*maskir_internal3"
3271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3272 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3273 (match_operand:SI 3 "gpc_reg_operand" "r"))
3274 (and:SI (not:SI (match_dup 2))
3275 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3279 (define_insn "*maskir_internal4"
3280 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3281 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3282 (match_operand:SI 2 "gpc_reg_operand" "r"))
3283 (and:SI (not:SI (match_dup 2))
3284 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3288 (define_insn "*maskir_internal5"
3289 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3291 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3292 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3293 (and:SI (match_dup 2)
3294 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3296 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3297 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3298 (and:SI (match_dup 2) (match_dup 3))))]
3303 [(set_attr "type" "compare")
3304 (set_attr "length" "4,8")])
3307 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3309 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3310 (match_operand:SI 1 "gpc_reg_operand" ""))
3311 (and:SI (match_dup 2)
3312 (match_operand:SI 3 "gpc_reg_operand" "")))
3314 (set (match_operand:SI 0 "gpc_reg_operand" "")
3315 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3316 (and:SI (match_dup 2) (match_dup 3))))]
3317 "TARGET_POWER && reload_completed"
3319 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3320 (and:SI (match_dup 2) (match_dup 3))))
3322 (compare:CC (match_dup 0)
3326 (define_insn "*maskir_internal6"
3327 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3329 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3330 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3331 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3334 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3335 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3336 (and:SI (match_dup 3) (match_dup 2))))]
3341 [(set_attr "type" "compare")
3342 (set_attr "length" "4,8")])
3345 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3347 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3348 (match_operand:SI 1 "gpc_reg_operand" ""))
3349 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3352 (set (match_operand:SI 0 "gpc_reg_operand" "")
3353 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3354 (and:SI (match_dup 3) (match_dup 2))))]
3355 "TARGET_POWER && reload_completed"
3357 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3358 (and:SI (match_dup 3) (match_dup 2))))
3360 (compare:CC (match_dup 0)
3364 (define_insn "*maskir_internal7"
3365 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3367 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3368 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3369 (and:SI (not:SI (match_dup 2))
3370 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3372 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3373 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3374 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3379 [(set_attr "type" "compare")
3380 (set_attr "length" "4,8")])
3383 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3385 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3386 (match_operand:SI 3 "gpc_reg_operand" ""))
3387 (and:SI (not:SI (match_dup 2))
3388 (match_operand:SI 1 "gpc_reg_operand" "")))
3390 (set (match_operand:SI 0 "gpc_reg_operand" "")
3391 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3392 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3393 "TARGET_POWER && reload_completed"
3395 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3396 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3398 (compare:CC (match_dup 0)
3402 (define_insn "*maskir_internal8"
3403 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3405 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3406 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3407 (and:SI (not:SI (match_dup 2))
3408 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3410 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3411 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3412 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3417 [(set_attr "type" "compare")
3418 (set_attr "length" "4,8")])
3421 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3423 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3424 (match_operand:SI 2 "gpc_reg_operand" ""))
3425 (and:SI (not:SI (match_dup 2))
3426 (match_operand:SI 1 "gpc_reg_operand" "")))
3428 (set (match_operand:SI 0 "gpc_reg_operand" "")
3429 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3430 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3431 "TARGET_POWER && reload_completed"
3433 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3434 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3436 (compare:CC (match_dup 0)
3440 ;; Rotate and shift insns, in all their variants. These support shifts,
3441 ;; field inserts and extracts, and various combinations thereof.
3442 (define_expand "insv"
3443 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3444 (match_operand:SI 1 "const_int_operand" "")
3445 (match_operand:SI 2 "const_int_operand" ""))
3446 (match_operand 3 "gpc_reg_operand" ""))]
3450 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3451 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3452 compiler if the address of the structure is taken later. Likewise, do
3453 not handle invalid E500 subregs. */
3454 if (GET_CODE (operands[0]) == SUBREG
3455 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3456 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3457 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3460 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3461 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3463 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3467 (define_insn "insvsi"
3468 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3469 (match_operand:SI 1 "const_int_operand" "i")
3470 (match_operand:SI 2 "const_int_operand" "i"))
3471 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3475 int start = INTVAL (operands[2]) & 31;
3476 int size = INTVAL (operands[1]) & 31;
3478 operands[4] = GEN_INT (32 - start - size);
3479 operands[1] = GEN_INT (start + size - 1);
3480 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3482 [(set_attr "type" "insert_word")])
3484 (define_insn "*insvsi_internal1"
3485 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3486 (match_operand:SI 1 "const_int_operand" "i")
3487 (match_operand:SI 2 "const_int_operand" "i"))
3488 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3489 (match_operand:SI 4 "const_int_operand" "i")))]
3490 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3493 int shift = INTVAL (operands[4]) & 31;
3494 int start = INTVAL (operands[2]) & 31;
3495 int size = INTVAL (operands[1]) & 31;
3497 operands[4] = GEN_INT (shift - start - size);
3498 operands[1] = GEN_INT (start + size - 1);
3499 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3501 [(set_attr "type" "insert_word")])
3503 (define_insn "*insvsi_internal2"
3504 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3505 (match_operand:SI 1 "const_int_operand" "i")
3506 (match_operand:SI 2 "const_int_operand" "i"))
3507 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3508 (match_operand:SI 4 "const_int_operand" "i")))]
3509 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3512 int shift = INTVAL (operands[4]) & 31;
3513 int start = INTVAL (operands[2]) & 31;
3514 int size = INTVAL (operands[1]) & 31;
3516 operands[4] = GEN_INT (32 - shift - start - size);
3517 operands[1] = GEN_INT (start + size - 1);
3518 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3520 [(set_attr "type" "insert_word")])
3522 (define_insn "*insvsi_internal3"
3523 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3524 (match_operand:SI 1 "const_int_operand" "i")
3525 (match_operand:SI 2 "const_int_operand" "i"))
3526 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3527 (match_operand:SI 4 "const_int_operand" "i")))]
3528 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3531 int shift = INTVAL (operands[4]) & 31;
3532 int start = INTVAL (operands[2]) & 31;
3533 int size = INTVAL (operands[1]) & 31;
3535 operands[4] = GEN_INT (32 - shift - start - size);
3536 operands[1] = GEN_INT (start + size - 1);
3537 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3539 [(set_attr "type" "insert_word")])
3541 (define_insn "*insvsi_internal4"
3542 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3543 (match_operand:SI 1 "const_int_operand" "i")
3544 (match_operand:SI 2 "const_int_operand" "i"))
3545 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3546 (match_operand:SI 4 "const_int_operand" "i")
3547 (match_operand:SI 5 "const_int_operand" "i")))]
3548 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3551 int extract_start = INTVAL (operands[5]) & 31;
3552 int extract_size = INTVAL (operands[4]) & 31;
3553 int insert_start = INTVAL (operands[2]) & 31;
3554 int insert_size = INTVAL (operands[1]) & 31;
3556 /* Align extract field with insert field */
3557 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3558 operands[1] = GEN_INT (insert_start + insert_size - 1);
3559 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3561 [(set_attr "type" "insert_word")])
3563 ;; combine patterns for rlwimi
3564 (define_insn "*insvsi_internal5"
3565 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3566 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3567 (match_operand:SI 1 "mask_operand" "i"))
3568 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3569 (match_operand:SI 2 "const_int_operand" "i"))
3570 (match_operand:SI 5 "mask_operand" "i"))))]
3571 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3574 int me = extract_ME(operands[5]);
3575 int mb = extract_MB(operands[5]);
3576 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3577 operands[2] = GEN_INT(mb);
3578 operands[1] = GEN_INT(me);
3579 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3581 [(set_attr "type" "insert_word")])
3583 (define_insn "*insvsi_internal6"
3584 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3585 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3586 (match_operand:SI 2 "const_int_operand" "i"))
3587 (match_operand:SI 5 "mask_operand" "i"))
3588 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3589 (match_operand:SI 1 "mask_operand" "i"))))]
3590 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3593 int me = extract_ME(operands[5]);
3594 int mb = extract_MB(operands[5]);
3595 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3596 operands[2] = GEN_INT(mb);
3597 operands[1] = GEN_INT(me);
3598 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3600 [(set_attr "type" "insert_word")])
3602 (define_insn "insvdi"
3603 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3604 (match_operand:SI 1 "const_int_operand" "i")
3605 (match_operand:SI 2 "const_int_operand" "i"))
3606 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3610 int start = INTVAL (operands[2]) & 63;
3611 int size = INTVAL (operands[1]) & 63;
3613 operands[1] = GEN_INT (64 - start - size);
3614 return \"rldimi %0,%3,%H1,%H2\";
3616 [(set_attr "type" "insert_dword")])
3618 (define_insn "*insvdi_internal2"
3619 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3620 (match_operand:SI 1 "const_int_operand" "i")
3621 (match_operand:SI 2 "const_int_operand" "i"))
3622 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3623 (match_operand:SI 4 "const_int_operand" "i")))]
3625 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3628 int shift = INTVAL (operands[4]) & 63;
3629 int start = (INTVAL (operands[2]) & 63) - 32;
3630 int size = INTVAL (operands[1]) & 63;
3632 operands[4] = GEN_INT (64 - shift - start - size);
3633 operands[2] = GEN_INT (start);
3634 operands[1] = GEN_INT (start + size - 1);
3635 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3638 (define_insn "*insvdi_internal3"
3639 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3640 (match_operand:SI 1 "const_int_operand" "i")
3641 (match_operand:SI 2 "const_int_operand" "i"))
3642 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3643 (match_operand:SI 4 "const_int_operand" "i")))]
3645 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3648 int shift = INTVAL (operands[4]) & 63;
3649 int start = (INTVAL (operands[2]) & 63) - 32;
3650 int size = INTVAL (operands[1]) & 63;
3652 operands[4] = GEN_INT (64 - shift - start - size);
3653 operands[2] = GEN_INT (start);
3654 operands[1] = GEN_INT (start + size - 1);
3655 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3658 (define_expand "extzv"
3659 [(set (match_operand 0 "gpc_reg_operand" "")
3660 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3661 (match_operand:SI 2 "const_int_operand" "")
3662 (match_operand:SI 3 "const_int_operand" "")))]
3666 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3667 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3668 compiler if the address of the structure is taken later. */
3669 if (GET_CODE (operands[0]) == SUBREG
3670 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3673 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3674 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3676 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3680 (define_insn "extzvsi"
3681 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3682 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3683 (match_operand:SI 2 "const_int_operand" "i")
3684 (match_operand:SI 3 "const_int_operand" "i")))]
3688 int start = INTVAL (operands[3]) & 31;
3689 int size = INTVAL (operands[2]) & 31;
3691 if (start + size >= 32)
3692 operands[3] = const0_rtx;
3694 operands[3] = GEN_INT (start + size);
3695 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3698 (define_insn "*extzvsi_internal1"
3699 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3700 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3701 (match_operand:SI 2 "const_int_operand" "i,i")
3702 (match_operand:SI 3 "const_int_operand" "i,i"))
3704 (clobber (match_scratch:SI 4 "=r,r"))]
3708 int start = INTVAL (operands[3]) & 31;
3709 int size = INTVAL (operands[2]) & 31;
3711 /* Force split for non-cc0 compare. */
3712 if (which_alternative == 1)
3715 /* If the bit-field being tested fits in the upper or lower half of a
3716 word, it is possible to use andiu. or andil. to test it. This is
3717 useful because the condition register set-use delay is smaller for
3718 andi[ul]. than for rlinm. This doesn't work when the starting bit
3719 position is 0 because the LT and GT bits may be set wrong. */
3721 if ((start > 0 && start + size <= 16) || start >= 16)
3723 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3724 - (1 << (16 - (start & 15) - size))));
3726 return \"{andiu.|andis.} %4,%1,%3\";
3728 return \"{andil.|andi.} %4,%1,%3\";
3731 if (start + size >= 32)
3732 operands[3] = const0_rtx;
3734 operands[3] = GEN_INT (start + size);
3735 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3737 [(set_attr "type" "delayed_compare")
3738 (set_attr "length" "4,8")])
3741 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3742 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3743 (match_operand:SI 2 "const_int_operand" "")
3744 (match_operand:SI 3 "const_int_operand" ""))
3746 (clobber (match_scratch:SI 4 ""))]
3749 (zero_extract:SI (match_dup 1) (match_dup 2)
3752 (compare:CC (match_dup 4)
3756 (define_insn "*extzvsi_internal2"
3757 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3758 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3759 (match_operand:SI 2 "const_int_operand" "i,i")
3760 (match_operand:SI 3 "const_int_operand" "i,i"))
3762 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3763 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3767 int start = INTVAL (operands[3]) & 31;
3768 int size = INTVAL (operands[2]) & 31;
3770 /* Force split for non-cc0 compare. */
3771 if (which_alternative == 1)
3774 /* Since we are using the output value, we can't ignore any need for
3775 a shift. The bit-field must end at the LSB. */
3776 if (start >= 16 && start + size == 32)
3778 operands[3] = GEN_INT ((1 << size) - 1);
3779 return \"{andil.|andi.} %0,%1,%3\";
3782 if (start + size >= 32)
3783 operands[3] = const0_rtx;
3785 operands[3] = GEN_INT (start + size);
3786 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3788 [(set_attr "type" "delayed_compare")
3789 (set_attr "length" "4,8")])
3792 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3793 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3794 (match_operand:SI 2 "const_int_operand" "")
3795 (match_operand:SI 3 "const_int_operand" ""))
3797 (set (match_operand:SI 0 "gpc_reg_operand" "")
3798 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3801 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3803 (compare:CC (match_dup 0)
3807 (define_insn "extzvdi"
3808 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3809 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3810 (match_operand:SI 2 "const_int_operand" "i")
3811 (match_operand:SI 3 "const_int_operand" "i")))]
3815 int start = INTVAL (operands[3]) & 63;
3816 int size = INTVAL (operands[2]) & 63;
3818 if (start + size >= 64)
3819 operands[3] = const0_rtx;
3821 operands[3] = GEN_INT (start + size);
3822 operands[2] = GEN_INT (64 - size);
3823 return \"rldicl %0,%1,%3,%2\";
3826 (define_insn "*extzvdi_internal1"
3827 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3828 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3829 (match_operand:SI 2 "const_int_operand" "i")
3830 (match_operand:SI 3 "const_int_operand" "i"))
3832 (clobber (match_scratch:DI 4 "=r"))]
3836 int start = INTVAL (operands[3]) & 63;
3837 int size = INTVAL (operands[2]) & 63;
3839 if (start + size >= 64)
3840 operands[3] = const0_rtx;
3842 operands[3] = GEN_INT (start + size);
3843 operands[2] = GEN_INT (64 - size);
3844 return \"rldicl. %4,%1,%3,%2\";
3846 [(set_attr "type" "compare")])
3848 (define_insn "*extzvdi_internal2"
3849 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3850 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3851 (match_operand:SI 2 "const_int_operand" "i")
3852 (match_operand:SI 3 "const_int_operand" "i"))
3854 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3855 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3859 int start = INTVAL (operands[3]) & 63;
3860 int size = INTVAL (operands[2]) & 63;
3862 if (start + size >= 64)
3863 operands[3] = const0_rtx;
3865 operands[3] = GEN_INT (start + size);
3866 operands[2] = GEN_INT (64 - size);
3867 return \"rldicl. %0,%1,%3,%2\";
3869 [(set_attr "type" "compare")])
3871 (define_insn "rotlsi3"
3872 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3873 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3874 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3877 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3878 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3879 [(set_attr "type" "var_shift_rotate,integer")])
3881 (define_insn "*rotlsi3_internal2"
3882 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3883 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3884 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3886 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3889 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3890 {rlinm.|rlwinm.} %3,%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 0 "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 (clobber (match_scratch:SI 3 ""))]
3904 (rotate:SI (match_dup 1) (match_dup 2)))
3906 (compare:CC (match_dup 3)
3910 (define_insn "*rotlsi3_internal3"
3911 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3912 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3913 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3915 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3916 (rotate:SI (match_dup 1) (match_dup 2)))]
3919 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
3920 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
3923 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3924 (set_attr "length" "4,4,8,8")])
3927 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3928 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3929 (match_operand:SI 2 "reg_or_cint_operand" ""))
3931 (set (match_operand:SI 0 "gpc_reg_operand" "")
3932 (rotate:SI (match_dup 1) (match_dup 2)))]
3935 (rotate:SI (match_dup 1) (match_dup 2)))
3937 (compare:CC (match_dup 0)
3941 (define_insn "*rotlsi3_internal4"
3942 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3943 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3944 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3945 (match_operand:SI 3 "mask_operand" "n,n")))]
3948 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
3949 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
3950 [(set_attr "type" "var_shift_rotate,integer")])
3952 (define_insn "*rotlsi3_internal5"
3953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3955 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3956 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3957 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3959 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3962 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
3963 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3966 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3967 (set_attr "length" "4,4,8,8")])
3970 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3972 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3973 (match_operand:SI 2 "reg_or_cint_operand" ""))
3974 (match_operand:SI 3 "mask_operand" ""))
3976 (clobber (match_scratch:SI 4 ""))]
3979 (and:SI (rotate:SI (match_dup 1)
3983 (compare:CC (match_dup 4)
3987 (define_insn "*rotlsi3_internal6"
3988 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3990 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3991 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3992 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3994 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3995 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3998 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
3999 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4002 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4003 (set_attr "length" "4,4,8,8")])
4006 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4008 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4009 (match_operand:SI 2 "reg_or_cint_operand" ""))
4010 (match_operand:SI 3 "mask_operand" ""))
4012 (set (match_operand:SI 0 "gpc_reg_operand" "")
4013 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4016 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4018 (compare:CC (match_dup 0)
4022 (define_insn "*rotlsi3_internal7"
4023 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4026 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4027 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4029 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4031 (define_insn "*rotlsi3_internal8"
4032 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4033 (compare:CC (zero_extend:SI
4035 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4036 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4038 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4041 {rlnm.|rlwnm.} %3,%1,%2,0xff
4042 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4045 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4046 (set_attr "length" "4,4,8,8")])
4049 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4050 (compare:CC (zero_extend:SI
4052 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4053 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4055 (clobber (match_scratch:SI 3 ""))]
4058 (zero_extend:SI (subreg:QI
4059 (rotate:SI (match_dup 1)
4062 (compare:CC (match_dup 3)
4066 (define_insn "*rotlsi3_internal9"
4067 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4068 (compare:CC (zero_extend:SI
4070 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4071 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4073 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4074 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4077 {rlnm.|rlwnm.} %0,%1,%2,0xff
4078 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4081 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4082 (set_attr "length" "4,4,8,8")])
4085 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4086 (compare:CC (zero_extend:SI
4088 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4089 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4091 (set (match_operand:SI 0 "gpc_reg_operand" "")
4092 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4095 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4097 (compare:CC (match_dup 0)
4101 (define_insn "*rotlsi3_internal10"
4102 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4105 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4106 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4109 {rlnm|rlwnm} %0,%1,%2,0xffff
4110 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4111 [(set_attr "type" "var_shift_rotate,integer")])
4114 (define_insn "*rotlsi3_internal11"
4115 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4116 (compare:CC (zero_extend:SI
4118 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4119 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4121 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4124 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4125 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4128 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4129 (set_attr "length" "4,4,8,8")])
4132 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4133 (compare:CC (zero_extend:SI
4135 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4136 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4138 (clobber (match_scratch:SI 3 ""))]
4141 (zero_extend:SI (subreg:HI
4142 (rotate:SI (match_dup 1)
4145 (compare:CC (match_dup 3)
4149 (define_insn "*rotlsi3_internal12"
4150 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4151 (compare:CC (zero_extend:SI
4153 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4154 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4156 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4157 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4160 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4161 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4164 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4165 (set_attr "length" "4,4,8,8")])
4168 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4169 (compare:CC (zero_extend:SI
4171 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4172 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4174 (set (match_operand:SI 0 "gpc_reg_operand" "")
4175 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4178 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4180 (compare:CC (match_dup 0)
4184 ;; Note that we use "sle." instead of "sl." so that we can set
4185 ;; SHIFT_COUNT_TRUNCATED.
4187 (define_expand "ashlsi3"
4188 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4189 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4190 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4195 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4197 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4201 (define_insn "ashlsi3_power"
4202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4203 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4204 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4205 (clobber (match_scratch:SI 3 "=q,X"))]
4209 {sli|slwi} %0,%1,%h2")
4211 (define_insn "ashlsi3_no_power"
4212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4213 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4214 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4218 {sli|slwi} %0,%1,%h2"
4219 [(set_attr "type" "var_shift_rotate,shift")])
4222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4223 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4224 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4226 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4227 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4231 {sli.|slwi.} %3,%1,%h2
4234 [(set_attr "type" "delayed_compare")
4235 (set_attr "length" "4,4,8,8")])
4238 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4239 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4240 (match_operand:SI 2 "reg_or_cint_operand" ""))
4242 (clobber (match_scratch:SI 3 ""))
4243 (clobber (match_scratch:SI 4 ""))]
4244 "TARGET_POWER && reload_completed"
4245 [(parallel [(set (match_dup 3)
4246 (ashift:SI (match_dup 1) (match_dup 2)))
4247 (clobber (match_dup 4))])
4249 (compare:CC (match_dup 3)
4254 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4255 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4256 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4258 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4259 "! TARGET_POWER && TARGET_32BIT"
4262 {sli.|slwi.} %3,%1,%h2
4265 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4266 (set_attr "length" "4,4,8,8")])
4269 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4270 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4271 (match_operand:SI 2 "reg_or_cint_operand" ""))
4273 (clobber (match_scratch:SI 3 ""))]
4274 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4276 (ashift:SI (match_dup 1) (match_dup 2)))
4278 (compare:CC (match_dup 3)
4283 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4284 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4285 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4287 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4288 (ashift:SI (match_dup 1) (match_dup 2)))
4289 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4293 {sli.|slwi.} %0,%1,%h2
4296 [(set_attr "type" "delayed_compare")
4297 (set_attr "length" "4,4,8,8")])
4300 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4301 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4302 (match_operand:SI 2 "reg_or_cint_operand" ""))
4304 (set (match_operand:SI 0 "gpc_reg_operand" "")
4305 (ashift:SI (match_dup 1) (match_dup 2)))
4306 (clobber (match_scratch:SI 4 ""))]
4307 "TARGET_POWER && reload_completed"
4308 [(parallel [(set (match_dup 0)
4309 (ashift:SI (match_dup 1) (match_dup 2)))
4310 (clobber (match_dup 4))])
4312 (compare:CC (match_dup 0)
4317 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4318 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4319 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4321 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4322 (ashift:SI (match_dup 1) (match_dup 2)))]
4323 "! TARGET_POWER && TARGET_32BIT"
4326 {sli.|slwi.} %0,%1,%h2
4329 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4330 (set_attr "length" "4,4,8,8")])
4333 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4334 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4335 (match_operand:SI 2 "reg_or_cint_operand" ""))
4337 (set (match_operand:SI 0 "gpc_reg_operand" "")
4338 (ashift:SI (match_dup 1) (match_dup 2)))]
4339 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4341 (ashift:SI (match_dup 1) (match_dup 2)))
4343 (compare:CC (match_dup 0)
4347 (define_insn "rlwinm"
4348 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4349 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4350 (match_operand:SI 2 "const_int_operand" "i"))
4351 (match_operand:SI 3 "mask_operand" "n")))]
4352 "includes_lshift_p (operands[2], operands[3])"
4353 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4356 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4358 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4359 (match_operand:SI 2 "const_int_operand" "i,i"))
4360 (match_operand:SI 3 "mask_operand" "n,n"))
4362 (clobber (match_scratch:SI 4 "=r,r"))]
4363 "includes_lshift_p (operands[2], operands[3])"
4365 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4367 [(set_attr "type" "delayed_compare")
4368 (set_attr "length" "4,8")])
4371 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4373 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4374 (match_operand:SI 2 "const_int_operand" ""))
4375 (match_operand:SI 3 "mask_operand" ""))
4377 (clobber (match_scratch:SI 4 ""))]
4378 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4380 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4383 (compare:CC (match_dup 4)
4388 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4390 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4391 (match_operand:SI 2 "const_int_operand" "i,i"))
4392 (match_operand:SI 3 "mask_operand" "n,n"))
4394 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4395 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4396 "includes_lshift_p (operands[2], operands[3])"
4398 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4400 [(set_attr "type" "delayed_compare")
4401 (set_attr "length" "4,8")])
4404 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4406 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4407 (match_operand:SI 2 "const_int_operand" ""))
4408 (match_operand:SI 3 "mask_operand" ""))
4410 (set (match_operand:SI 0 "gpc_reg_operand" "")
4411 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4412 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4414 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4416 (compare:CC (match_dup 0)
4420 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4422 (define_expand "lshrsi3"
4423 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4424 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4425 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4430 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4432 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4436 (define_insn "lshrsi3_power"
4437 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4438 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4439 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4440 (clobber (match_scratch:SI 3 "=q,X,X"))]
4445 {s%A2i|s%A2wi} %0,%1,%h2")
4447 (define_insn "lshrsi3_no_power"
4448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4449 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4450 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4455 {sri|srwi} %0,%1,%h2"
4456 [(set_attr "type" "integer,var_shift_rotate,shift")])
4459 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4460 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4461 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4463 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4464 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4469 {s%A2i.|s%A2wi.} %3,%1,%h2
4473 [(set_attr "type" "delayed_compare")
4474 (set_attr "length" "4,4,4,8,8,8")])
4477 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4478 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4479 (match_operand:SI 2 "reg_or_cint_operand" ""))
4481 (clobber (match_scratch:SI 3 ""))
4482 (clobber (match_scratch:SI 4 ""))]
4483 "TARGET_POWER && reload_completed"
4484 [(parallel [(set (match_dup 3)
4485 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4486 (clobber (match_dup 4))])
4488 (compare:CC (match_dup 3)
4493 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4494 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4495 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4497 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4498 "! TARGET_POWER && TARGET_32BIT"
4502 {sri.|srwi.} %3,%1,%h2
4506 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4507 (set_attr "length" "4,4,4,8,8,8")])
4510 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4511 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4512 (match_operand:SI 2 "reg_or_cint_operand" ""))
4514 (clobber (match_scratch:SI 3 ""))]
4515 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4517 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4519 (compare:CC (match_dup 3)
4524 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4525 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4526 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4528 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4529 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4530 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4535 {s%A2i.|s%A2wi.} %0,%1,%h2
4539 [(set_attr "type" "delayed_compare")
4540 (set_attr "length" "4,4,4,8,8,8")])
4543 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4544 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4545 (match_operand:SI 2 "reg_or_cint_operand" ""))
4547 (set (match_operand:SI 0 "gpc_reg_operand" "")
4548 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4549 (clobber (match_scratch:SI 4 ""))]
4550 "TARGET_POWER && reload_completed"
4551 [(parallel [(set (match_dup 0)
4552 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4553 (clobber (match_dup 4))])
4555 (compare:CC (match_dup 0)
4560 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4561 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4562 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4564 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4565 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4566 "! TARGET_POWER && TARGET_32BIT"
4570 {sri.|srwi.} %0,%1,%h2
4574 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4575 (set_attr "length" "4,4,4,8,8,8")])
4578 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4579 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4580 (match_operand:SI 2 "reg_or_cint_operand" ""))
4582 (set (match_operand:SI 0 "gpc_reg_operand" "")
4583 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4584 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4586 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4588 (compare:CC (match_dup 0)
4593 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4594 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4595 (match_operand:SI 2 "const_int_operand" "i"))
4596 (match_operand:SI 3 "mask_operand" "n")))]
4597 "includes_rshift_p (operands[2], operands[3])"
4598 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4603 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4604 (match_operand:SI 2 "const_int_operand" "i,i"))
4605 (match_operand:SI 3 "mask_operand" "n,n"))
4607 (clobber (match_scratch:SI 4 "=r,r"))]
4608 "includes_rshift_p (operands[2], operands[3])"
4610 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4612 [(set_attr "type" "delayed_compare")
4613 (set_attr "length" "4,8")])
4616 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4618 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4619 (match_operand:SI 2 "const_int_operand" ""))
4620 (match_operand:SI 3 "mask_operand" ""))
4622 (clobber (match_scratch:SI 4 ""))]
4623 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4625 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4628 (compare:CC (match_dup 4)
4633 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4635 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4636 (match_operand:SI 2 "const_int_operand" "i,i"))
4637 (match_operand:SI 3 "mask_operand" "n,n"))
4639 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4640 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4641 "includes_rshift_p (operands[2], operands[3])"
4643 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4645 [(set_attr "type" "delayed_compare")
4646 (set_attr "length" "4,8")])
4649 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4651 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4652 (match_operand:SI 2 "const_int_operand" ""))
4653 (match_operand:SI 3 "mask_operand" ""))
4655 (set (match_operand:SI 0 "gpc_reg_operand" "")
4656 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4657 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4659 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4661 (compare:CC (match_dup 0)
4666 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4669 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4670 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4671 "includes_rshift_p (operands[2], GEN_INT (255))"
4672 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4675 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4679 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4680 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4682 (clobber (match_scratch:SI 3 "=r,r"))]
4683 "includes_rshift_p (operands[2], GEN_INT (255))"
4685 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4687 [(set_attr "type" "delayed_compare")
4688 (set_attr "length" "4,8")])
4691 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4695 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4696 (match_operand:SI 2 "const_int_operand" "")) 0))
4698 (clobber (match_scratch:SI 3 ""))]
4699 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4701 (zero_extend:SI (subreg:QI
4702 (lshiftrt:SI (match_dup 1)
4705 (compare:CC (match_dup 3)
4710 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4714 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4715 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4717 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4718 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4719 "includes_rshift_p (operands[2], GEN_INT (255))"
4721 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4723 [(set_attr "type" "delayed_compare")
4724 (set_attr "length" "4,8")])
4727 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4731 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4732 (match_operand:SI 2 "const_int_operand" "")) 0))
4734 (set (match_operand:SI 0 "gpc_reg_operand" "")
4735 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4736 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4738 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4740 (compare:CC (match_dup 0)
4745 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4748 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4749 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4750 "includes_rshift_p (operands[2], GEN_INT (65535))"
4751 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4754 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4758 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4759 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4761 (clobber (match_scratch:SI 3 "=r,r"))]
4762 "includes_rshift_p (operands[2], GEN_INT (65535))"
4764 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4766 [(set_attr "type" "delayed_compare")
4767 (set_attr "length" "4,8")])
4770 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4774 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4775 (match_operand:SI 2 "const_int_operand" "")) 0))
4777 (clobber (match_scratch:SI 3 ""))]
4778 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4780 (zero_extend:SI (subreg:HI
4781 (lshiftrt:SI (match_dup 1)
4784 (compare:CC (match_dup 3)
4789 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4793 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4794 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4796 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4797 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4798 "includes_rshift_p (operands[2], GEN_INT (65535))"
4800 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4802 [(set_attr "type" "delayed_compare")
4803 (set_attr "length" "4,8")])
4806 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4810 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4811 (match_operand:SI 2 "const_int_operand" "")) 0))
4813 (set (match_operand:SI 0 "gpc_reg_operand" "")
4814 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4815 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4817 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4819 (compare:CC (match_dup 0)
4824 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4826 (match_operand:SI 1 "gpc_reg_operand" "r"))
4827 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4833 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4835 (match_operand:SI 1 "gpc_reg_operand" "r"))
4836 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4842 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4844 (match_operand:SI 1 "gpc_reg_operand" "r"))
4845 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4851 (define_expand "ashrsi3"
4852 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4853 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4854 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4859 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4861 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4865 (define_insn "ashrsi3_power"
4866 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4867 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4868 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4869 (clobber (match_scratch:SI 3 "=q,X"))]
4873 {srai|srawi} %0,%1,%h2"
4874 [(set_attr "type" "shift")])
4876 (define_insn "ashrsi3_no_power"
4877 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4878 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4879 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4883 {srai|srawi} %0,%1,%h2"
4884 [(set_attr "type" "var_shift_rotate,shift")])
4887 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4888 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4889 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4891 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4892 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4896 {srai.|srawi.} %3,%1,%h2
4899 [(set_attr "type" "delayed_compare")
4900 (set_attr "length" "4,4,8,8")])
4903 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4904 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4905 (match_operand:SI 2 "reg_or_cint_operand" ""))
4907 (clobber (match_scratch:SI 3 ""))
4908 (clobber (match_scratch:SI 4 ""))]
4909 "TARGET_POWER && reload_completed"
4910 [(parallel [(set (match_dup 3)
4911 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4912 (clobber (match_dup 4))])
4914 (compare:CC (match_dup 3)
4919 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4920 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4921 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4923 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4926 {sra.|sraw.} %3,%1,%2
4927 {srai.|srawi.} %3,%1,%h2
4930 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4931 (set_attr "length" "4,4,8,8")])
4934 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4935 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4936 (match_operand:SI 2 "reg_or_cint_operand" ""))
4938 (clobber (match_scratch:SI 3 ""))]
4939 "! TARGET_POWER && reload_completed"
4941 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4943 (compare:CC (match_dup 3)
4948 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4949 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4950 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4952 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4953 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4954 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4958 {srai.|srawi.} %0,%1,%h2
4961 [(set_attr "type" "delayed_compare")
4962 (set_attr "length" "4,4,8,8")])
4965 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4966 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4967 (match_operand:SI 2 "reg_or_cint_operand" ""))
4969 (set (match_operand:SI 0 "gpc_reg_operand" "")
4970 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4971 (clobber (match_scratch:SI 4 ""))]
4972 "TARGET_POWER && reload_completed"
4973 [(parallel [(set (match_dup 0)
4974 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4975 (clobber (match_dup 4))])
4977 (compare:CC (match_dup 0)
4982 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4983 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4984 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4986 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4987 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4990 {sra.|sraw.} %0,%1,%2
4991 {srai.|srawi.} %0,%1,%h2
4994 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4995 (set_attr "length" "4,4,8,8")])
4998 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4999 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5000 (match_operand:SI 2 "reg_or_cint_operand" ""))
5002 (set (match_operand:SI 0 "gpc_reg_operand" "")
5003 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5004 "! TARGET_POWER && reload_completed"
5006 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5008 (compare:CC (match_dup 0)
5012 ;; Floating-point insns, excluding normal data motion.
5014 ;; PowerPC has a full set of single-precision floating point instructions.
5016 ;; For the POWER architecture, we pretend that we have both SFmode and
5017 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5018 ;; The only conversions we will do will be when storing to memory. In that
5019 ;; case, we will use the "frsp" instruction before storing.
5021 ;; Note that when we store into a single-precision memory location, we need to
5022 ;; use the frsp insn first. If the register being stored isn't dead, we
5023 ;; need a scratch register for the frsp. But this is difficult when the store
5024 ;; is done by reload. It is not incorrect to do the frsp on the register in
5025 ;; this case, we just lose precision that we would have otherwise gotten but
5026 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5028 (define_expand "extendsfdf2"
5029 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5030 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5031 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5034 (define_insn_and_split "*extendsfdf2_fpr"
5035 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
5036 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5037 "TARGET_HARD_FLOAT && TARGET_FPRS"
5042 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5045 emit_note (NOTE_INSN_DELETED);
5048 [(set_attr "type" "fp,fp,fpload")])
5050 (define_expand "truncdfsf2"
5051 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5052 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5053 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5056 (define_insn "*truncdfsf2_fpr"
5057 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5058 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5059 "TARGET_HARD_FLOAT && TARGET_FPRS"
5061 [(set_attr "type" "fp")])
5063 (define_insn "aux_truncdfsf2"
5064 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5065 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5066 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5068 [(set_attr "type" "fp")])
5070 (define_expand "negsf2"
5071 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5072 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5076 (define_insn "*negsf2"
5077 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5078 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5079 "TARGET_HARD_FLOAT && TARGET_FPRS"
5081 [(set_attr "type" "fp")])
5083 (define_expand "abssf2"
5084 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5085 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5089 (define_insn "*abssf2"
5090 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5091 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5092 "TARGET_HARD_FLOAT && TARGET_FPRS"
5094 [(set_attr "type" "fp")])
5097 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5098 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5099 "TARGET_HARD_FLOAT && TARGET_FPRS"
5101 [(set_attr "type" "fp")])
5103 (define_expand "addsf3"
5104 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5105 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5106 (match_operand:SF 2 "gpc_reg_operand" "")))]
5111 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5112 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5113 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5114 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5116 [(set_attr "type" "fp")])
5119 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5120 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5121 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5122 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5123 "{fa|fadd} %0,%1,%2"
5124 [(set_attr "type" "fp")])
5126 (define_expand "subsf3"
5127 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5128 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5129 (match_operand:SF 2 "gpc_reg_operand" "")))]
5134 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5135 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5136 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5137 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5139 [(set_attr "type" "fp")])
5142 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5143 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5144 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5145 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5146 "{fs|fsub} %0,%1,%2"
5147 [(set_attr "type" "fp")])
5149 (define_expand "mulsf3"
5150 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5151 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5152 (match_operand:SF 2 "gpc_reg_operand" "")))]
5157 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5158 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5159 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5160 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5162 [(set_attr "type" "fp")])
5165 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5166 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5167 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5168 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5169 "{fm|fmul} %0,%1,%2"
5170 [(set_attr "type" "dmul")])
5173 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5174 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5175 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5177 [(set_attr "type" "fp")])
5179 (define_expand "divsf3"
5180 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5181 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5182 (match_operand:SF 2 "gpc_reg_operand" "")))]
5185 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
5186 && flag_finite_math_only && !flag_trapping_math)
5188 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5194 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5195 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5196 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5197 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5199 [(set_attr "type" "sdiv")])
5202 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5203 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5204 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5205 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5206 "{fd|fdiv} %0,%1,%2"
5207 [(set_attr "type" "ddiv")])
5210 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5211 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5212 (match_operand:SF 2 "gpc_reg_operand" "f"))
5213 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5214 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5215 "fmadds %0,%1,%2,%3"
5216 [(set_attr "type" "fp")])
5219 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5220 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5221 (match_operand:SF 2 "gpc_reg_operand" "f"))
5222 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5223 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5224 "{fma|fmadd} %0,%1,%2,%3"
5225 [(set_attr "type" "dmul")])
5228 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5229 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5230 (match_operand:SF 2 "gpc_reg_operand" "f"))
5231 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5232 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5233 "fmsubs %0,%1,%2,%3"
5234 [(set_attr "type" "fp")])
5237 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5238 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5239 (match_operand:SF 2 "gpc_reg_operand" "f"))
5240 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5241 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5242 "{fms|fmsub} %0,%1,%2,%3"
5243 [(set_attr "type" "dmul")])
5246 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5247 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5248 (match_operand:SF 2 "gpc_reg_operand" "f"))
5249 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5250 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5251 && HONOR_SIGNED_ZEROS (SFmode)"
5252 "fnmadds %0,%1,%2,%3"
5253 [(set_attr "type" "fp")])
5256 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5257 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5258 (match_operand:SF 2 "gpc_reg_operand" "f"))
5259 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5260 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5261 && ! HONOR_SIGNED_ZEROS (SFmode)"
5262 "fnmadds %0,%1,%2,%3"
5263 [(set_attr "type" "fp")])
5266 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5267 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5268 (match_operand:SF 2 "gpc_reg_operand" "f"))
5269 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5270 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5271 "{fnma|fnmadd} %0,%1,%2,%3"
5272 [(set_attr "type" "dmul")])
5275 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5276 (minus:SF (mult:SF (neg: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 && ! HONOR_SIGNED_ZEROS (SFmode)"
5281 "{fnma|fnmadd} %0,%1,%2,%3"
5282 [(set_attr "type" "dmul")])
5285 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5286 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5287 (match_operand:SF 2 "gpc_reg_operand" "f"))
5288 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5289 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5290 && HONOR_SIGNED_ZEROS (SFmode)"
5291 "fnmsubs %0,%1,%2,%3"
5292 [(set_attr "type" "fp")])
5295 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5296 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5297 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5298 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5299 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5300 && ! HONOR_SIGNED_ZEROS (SFmode)"
5301 "fnmsubs %0,%1,%2,%3"
5302 [(set_attr "type" "fp")])
5305 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5306 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5307 (match_operand:SF 2 "gpc_reg_operand" "f"))
5308 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5309 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5310 "{fnms|fnmsub} %0,%1,%2,%3"
5311 [(set_attr "type" "dmul")])
5314 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5315 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5316 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5317 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5318 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5319 && ! HONOR_SIGNED_ZEROS (SFmode)"
5320 "{fnms|fnmsub} %0,%1,%2,%3"
5321 [(set_attr "type" "dmul")])
5323 (define_expand "sqrtsf2"
5324 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5325 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5326 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5330 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5331 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5332 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5334 [(set_attr "type" "ssqrt")])
5337 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5338 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5339 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5341 [(set_attr "type" "dsqrt")])
5343 (define_expand "copysignsf3"
5345 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5347 (neg:SF (abs:SF (match_dup 1))))
5348 (set (match_operand:SF 0 "gpc_reg_operand" "")
5349 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5353 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5354 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5356 operands[3] = gen_reg_rtx (SFmode);
5357 operands[4] = gen_reg_rtx (SFmode);
5358 operands[5] = CONST0_RTX (SFmode);
5361 (define_expand "copysigndf3"
5363 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5365 (neg:DF (abs:DF (match_dup 1))))
5366 (set (match_operand:DF 0 "gpc_reg_operand" "")
5367 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5371 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5372 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5374 operands[3] = gen_reg_rtx (DFmode);
5375 operands[4] = gen_reg_rtx (DFmode);
5376 operands[5] = CONST0_RTX (DFmode);
5379 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5380 ;; fsel instruction and some auxiliary computations. Then we just have a
5381 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5383 (define_expand "smaxsf3"
5384 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5385 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5386 (match_operand:SF 2 "gpc_reg_operand" ""))
5389 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5390 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5392 (define_expand "sminsf3"
5393 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5394 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5395 (match_operand:SF 2 "gpc_reg_operand" ""))
5398 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5399 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5402 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5403 (match_operator:SF 3 "min_max_operator"
5404 [(match_operand:SF 1 "gpc_reg_operand" "")
5405 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5406 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5409 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5410 operands[1], operands[2]);
5414 (define_expand "movsicc"
5415 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5416 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5417 (match_operand:SI 2 "gpc_reg_operand" "")
5418 (match_operand:SI 3 "gpc_reg_operand" "")))]
5422 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5428 ;; We use the BASE_REGS for the isel input operands because, if rA is
5429 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5430 ;; because we may switch the operands and rB may end up being rA.
5432 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5433 ;; leave out the mode in operand 4 and use one pattern, but reload can
5434 ;; change the mode underneath our feet and then gets confused trying
5435 ;; to reload the value.
5436 (define_insn "isel_signed"
5437 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5439 (match_operator 1 "comparison_operator"
5440 [(match_operand:CC 4 "cc_reg_operand" "y")
5442 (match_operand:SI 2 "gpc_reg_operand" "b")
5443 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5446 { return output_isel (operands); }"
5447 [(set_attr "length" "4")])
5449 (define_insn "isel_unsigned"
5450 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5452 (match_operator 1 "comparison_operator"
5453 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5455 (match_operand:SI 2 "gpc_reg_operand" "b")
5456 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5459 { return output_isel (operands); }"
5460 [(set_attr "length" "4")])
5462 (define_expand "movsfcc"
5463 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5464 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5465 (match_operand:SF 2 "gpc_reg_operand" "")
5466 (match_operand:SF 3 "gpc_reg_operand" "")))]
5467 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5470 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5476 (define_insn "*fselsfsf4"
5477 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5478 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5479 (match_operand:SF 4 "zero_fp_constant" "F"))
5480 (match_operand:SF 2 "gpc_reg_operand" "f")
5481 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5482 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5484 [(set_attr "type" "fp")])
5486 (define_insn "*fseldfsf4"
5487 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5488 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5489 (match_operand:DF 4 "zero_fp_constant" "F"))
5490 (match_operand:SF 2 "gpc_reg_operand" "f")
5491 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5492 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5494 [(set_attr "type" "fp")])
5496 (define_expand "negdf2"
5497 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5498 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5499 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5502 (define_insn "*negdf2_fpr"
5503 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5504 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5505 "TARGET_HARD_FLOAT && TARGET_FPRS"
5507 [(set_attr "type" "fp")])
5509 (define_expand "absdf2"
5510 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5511 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5512 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5515 (define_insn "*absdf2_fpr"
5516 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5517 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5518 "TARGET_HARD_FLOAT && TARGET_FPRS"
5520 [(set_attr "type" "fp")])
5522 (define_insn "*nabsdf2_fpr"
5523 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5524 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5525 "TARGET_HARD_FLOAT && TARGET_FPRS"
5527 [(set_attr "type" "fp")])
5529 (define_expand "adddf3"
5530 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5531 (plus: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 "*adddf3_fpr"
5537 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5538 (plus: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 "{fa|fadd} %0,%1,%2"
5542 [(set_attr "type" "fp")])
5544 (define_expand "subdf3"
5545 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5546 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5547 (match_operand:DF 2 "gpc_reg_operand" "")))]
5548 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5551 (define_insn "*subdf3_fpr"
5552 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5553 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5554 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5555 "TARGET_HARD_FLOAT && TARGET_FPRS"
5556 "{fs|fsub} %0,%1,%2"
5557 [(set_attr "type" "fp")])
5559 (define_expand "muldf3"
5560 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5561 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5562 (match_operand:DF 2 "gpc_reg_operand" "")))]
5563 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5566 (define_insn "*muldf3_fpr"
5567 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5568 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5569 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5570 "TARGET_HARD_FLOAT && TARGET_FPRS"
5571 "{fm|fmul} %0,%1,%2"
5572 [(set_attr "type" "dmul")])
5575 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5576 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5577 "TARGET_POPCNTB && flag_finite_math_only"
5579 [(set_attr "type" "fp")])
5581 (define_expand "divdf3"
5582 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5583 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5584 (match_operand:DF 2 "gpc_reg_operand" "")))]
5585 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5587 if (swdiv && !optimize_size && TARGET_POPCNTB
5588 && flag_finite_math_only && !flag_trapping_math)
5590 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5595 (define_insn "*divdf3_fpr"
5596 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5597 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5598 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5599 "TARGET_HARD_FLOAT && TARGET_FPRS"
5600 "{fd|fdiv} %0,%1,%2"
5601 [(set_attr "type" "ddiv")])
5604 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5605 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5606 (match_operand:DF 2 "gpc_reg_operand" "f"))
5607 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5608 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5609 "{fma|fmadd} %0,%1,%2,%3"
5610 [(set_attr "type" "dmul")])
5613 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5614 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5615 (match_operand:DF 2 "gpc_reg_operand" "f"))
5616 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5617 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5618 "{fms|fmsub} %0,%1,%2,%3"
5619 [(set_attr "type" "dmul")])
5622 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5623 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5624 (match_operand:DF 2 "gpc_reg_operand" "f"))
5625 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5626 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5627 && HONOR_SIGNED_ZEROS (DFmode)"
5628 "{fnma|fnmadd} %0,%1,%2,%3"
5629 [(set_attr "type" "dmul")])
5632 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5633 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5634 (match_operand:DF 2 "gpc_reg_operand" "f"))
5635 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5636 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5637 && ! HONOR_SIGNED_ZEROS (DFmode)"
5638 "{fnma|fnmadd} %0,%1,%2,%3"
5639 [(set_attr "type" "dmul")])
5642 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5643 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5644 (match_operand:DF 2 "gpc_reg_operand" "f"))
5645 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5646 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5647 && HONOR_SIGNED_ZEROS (DFmode)"
5648 "{fnms|fnmsub} %0,%1,%2,%3"
5649 [(set_attr "type" "dmul")])
5652 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5653 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5654 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5655 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5656 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5657 && ! HONOR_SIGNED_ZEROS (DFmode)"
5658 "{fnms|fnmsub} %0,%1,%2,%3"
5659 [(set_attr "type" "dmul")])
5661 (define_insn "sqrtdf2"
5662 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5663 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5664 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5666 [(set_attr "type" "dsqrt")])
5668 ;; The conditional move instructions allow us to perform max and min
5669 ;; operations even when
5671 (define_expand "smaxdf3"
5672 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5673 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5674 (match_operand:DF 2 "gpc_reg_operand" ""))
5677 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5678 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5680 (define_expand "smindf3"
5681 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5682 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5683 (match_operand:DF 2 "gpc_reg_operand" ""))
5686 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5687 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5690 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5691 (match_operator:DF 3 "min_max_operator"
5692 [(match_operand:DF 1 "gpc_reg_operand" "")
5693 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5694 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5697 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5698 operands[1], operands[2]);
5702 (define_expand "movdfcc"
5703 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5704 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5705 (match_operand:DF 2 "gpc_reg_operand" "")
5706 (match_operand:DF 3 "gpc_reg_operand" "")))]
5707 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5710 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5716 (define_insn "*fseldfdf4"
5717 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5718 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5719 (match_operand:DF 4 "zero_fp_constant" "F"))
5720 (match_operand:DF 2 "gpc_reg_operand" "f")
5721 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5722 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5724 [(set_attr "type" "fp")])
5726 (define_insn "*fselsfdf4"
5727 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5728 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5729 (match_operand:SF 4 "zero_fp_constant" "F"))
5730 (match_operand:DF 2 "gpc_reg_operand" "f")
5731 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5734 [(set_attr "type" "fp")])
5736 ;; Conversions to and from floating-point.
5738 (define_expand "fixuns_truncsfsi2"
5739 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5740 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5741 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5744 (define_expand "fix_truncsfsi2"
5745 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5746 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5747 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5750 ; For each of these conversions, there is a define_expand, a define_insn
5751 ; with a '#' template, and a define_split (with C code). The idea is
5752 ; to allow constant folding with the template of the define_insn,
5753 ; then to have the insns split later (between sched1 and final).
5755 (define_expand "floatsidf2"
5756 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5757 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5760 (clobber (match_dup 4))
5761 (clobber (match_dup 5))
5762 (clobber (match_dup 6))])]
5763 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5766 if (TARGET_E500_DOUBLE)
5768 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5771 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS)
5773 rtx t1 = gen_reg_rtx (DImode);
5774 emit_insn (gen_floatsidf_ppc64_mfpgpr (operands[0], operands[1], t1));
5777 if (TARGET_POWERPC64)
5779 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5780 rtx t1 = gen_reg_rtx (DImode);
5781 rtx t2 = gen_reg_rtx (DImode);
5782 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5786 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5787 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5788 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5789 operands[5] = gen_reg_rtx (DFmode);
5790 operands[6] = gen_reg_rtx (SImode);
5793 (define_insn_and_split "*floatsidf2_internal"
5794 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5795 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5796 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5797 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5798 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5799 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5800 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5801 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5803 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5807 rtx lowword, highword;
5808 gcc_assert (MEM_P (operands[4]));
5809 highword = adjust_address (operands[4], SImode, 0);
5810 lowword = adjust_address (operands[4], SImode, 4);
5811 if (! WORDS_BIG_ENDIAN)
5814 tmp = highword; highword = lowword; lowword = tmp;
5817 emit_insn (gen_xorsi3 (operands[6], operands[1],
5818 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5819 emit_move_insn (lowword, operands[6]);
5820 emit_move_insn (highword, operands[2]);
5821 emit_move_insn (operands[5], operands[4]);
5822 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5825 [(set_attr "length" "24")])
5827 (define_expand "floatunssisf2"
5828 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5829 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5830 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5833 (define_expand "floatunssidf2"
5834 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5835 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5838 (clobber (match_dup 4))
5839 (clobber (match_dup 5))])]
5840 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5843 if (TARGET_E500_DOUBLE)
5845 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5848 if (TARGET_POWERPC64)
5850 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5851 rtx t1 = gen_reg_rtx (DImode);
5852 rtx t2 = gen_reg_rtx (DImode);
5853 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5858 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5859 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5860 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5861 operands[5] = gen_reg_rtx (DFmode);
5864 (define_insn_and_split "*floatunssidf2_internal"
5865 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5866 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5867 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5868 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5869 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5870 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5871 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5873 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5877 rtx lowword, highword;
5878 gcc_assert (MEM_P (operands[4]));
5879 highword = adjust_address (operands[4], SImode, 0);
5880 lowword = adjust_address (operands[4], SImode, 4);
5881 if (! WORDS_BIG_ENDIAN)
5884 tmp = highword; highword = lowword; lowword = tmp;
5887 emit_move_insn (lowword, operands[1]);
5888 emit_move_insn (highword, operands[2]);
5889 emit_move_insn (operands[5], operands[4]);
5890 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5893 [(set_attr "length" "20")])
5895 (define_expand "fix_truncdfsi2"
5896 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5897 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5898 (clobber (match_dup 2))
5899 (clobber (match_dup 3))])]
5900 "(TARGET_POWER2 || TARGET_POWERPC)
5901 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5904 if (TARGET_E500_DOUBLE)
5906 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5909 operands[2] = gen_reg_rtx (DImode);
5910 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
5911 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
5913 operands[3] = gen_reg_rtx (DImode);
5914 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
5915 operands[2], operands[3]));
5918 if (TARGET_PPC_GFXOPT)
5920 rtx orig_dest = operands[0];
5921 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5922 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5923 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5925 if (operands[0] != orig_dest)
5926 emit_move_insn (orig_dest, operands[0]);
5929 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5932 (define_insn_and_split "*fix_truncdfsi2_internal"
5933 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5934 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5935 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5936 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5937 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5939 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[3]))"
5944 gcc_assert (MEM_P (operands[3]));
5945 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5947 emit_insn (gen_fctiwz (operands[2], operands[1]));
5948 emit_move_insn (operands[3], operands[2]);
5949 emit_move_insn (operands[0], lowword);
5952 [(set_attr "length" "16")])
5954 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5955 [(set (match_operand:SI 0 "memory_operand" "=Z")
5956 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5957 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5958 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5959 && TARGET_PPC_GFXOPT"
5965 emit_insn (gen_fctiwz (operands[2], operands[1]));
5966 emit_insn (gen_stfiwx (operands[0], operands[2]));
5969 [(set_attr "length" "16")])
5971 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
5972 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5973 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5974 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5975 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
5976 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
5979 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
5980 (set (match_dup 3) (match_dup 2))
5981 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
5983 [(set_attr "length" "12")])
5985 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5986 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5987 ; because the first makes it clear that operand 0 is not live
5988 ; before the instruction.
5989 (define_insn "fctiwz"
5990 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5991 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5993 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5994 "{fcirz|fctiwz} %0,%1"
5995 [(set_attr "type" "fp")])
5997 (define_insn "btruncdf2"
5998 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5999 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6000 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6002 [(set_attr "type" "fp")])
6004 (define_insn "btruncsf2"
6005 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6006 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6007 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6009 [(set_attr "type" "fp")])
6011 (define_insn "ceildf2"
6012 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6013 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6014 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6016 [(set_attr "type" "fp")])
6018 (define_insn "ceilsf2"
6019 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6020 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6021 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6023 [(set_attr "type" "fp")])
6025 (define_insn "floordf2"
6026 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6027 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6028 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6030 [(set_attr "type" "fp")])
6032 (define_insn "floorsf2"
6033 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6034 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6035 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6037 [(set_attr "type" "fp")])
6039 (define_insn "rounddf2"
6040 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6041 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6042 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6044 [(set_attr "type" "fp")])
6046 (define_insn "roundsf2"
6047 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6048 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6049 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6051 [(set_attr "type" "fp")])
6053 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6054 (define_insn "stfiwx"
6055 [(set (match_operand:SI 0 "memory_operand" "=Z")
6056 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6060 [(set_attr "type" "fpstore")])
6062 (define_expand "floatsisf2"
6063 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6064 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6065 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6068 (define_insn "floatdidf2"
6069 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6070 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
6071 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6073 [(set_attr "type" "fp")])
6075 (define_insn_and_split "floatsidf_ppc64_mfpgpr"
6076 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6077 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6078 (clobber (match_operand:DI 2 "gpc_reg_operand" "=r"))]
6079 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6082 [(set (match_dup 2) (sign_extend:DI (match_dup 1)))
6083 (set (match_dup 0) (float:DF (match_dup 2)))]
6086 (define_insn_and_split "floatsidf_ppc64"
6087 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6088 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6089 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6090 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6091 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6092 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6095 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
6096 (set (match_dup 2) (match_dup 3))
6097 (set (match_dup 4) (match_dup 2))
6098 (set (match_dup 0) (float:DF (match_dup 4)))]
6101 (define_insn_and_split "floatunssidf_ppc64"
6102 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6103 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6104 (clobber (match_operand:DI 2 "memory_operand" "=o"))
6105 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6106 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6107 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6110 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
6111 (set (match_dup 2) (match_dup 3))
6112 (set (match_dup 4) (match_dup 2))
6113 (set (match_dup 0) (float:DF (match_dup 4)))]
6116 (define_insn "fix_truncdfdi2"
6117 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
6118 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6119 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6121 [(set_attr "type" "fp")])
6123 (define_expand "floatdisf2"
6124 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6125 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6126 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6129 rtx val = operands[1];
6130 if (!flag_unsafe_math_optimizations)
6132 rtx label = gen_label_rtx ();
6133 val = gen_reg_rtx (DImode);
6134 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6137 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6141 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6142 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6143 ;; from double rounding.
6144 (define_insn_and_split "floatdisf2_internal1"
6145 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6146 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
6147 (clobber (match_scratch:DF 2 "=f"))]
6148 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6150 "&& reload_completed"
6152 (float:DF (match_dup 1)))
6154 (float_truncate:SF (match_dup 2)))]
6157 ;; Twiddles bits to avoid double rounding.
6158 ;; Bits that might be truncated when converting to DFmode are replaced
6159 ;; by a bit that won't be lost at that stage, but is below the SFmode
6160 ;; rounding position.
6161 (define_expand "floatdisf2_internal2"
6162 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6164 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6166 (clobber (scratch:CC))])
6167 (set (match_dup 3) (plus:DI (match_dup 3)
6169 (set (match_dup 0) (plus:DI (match_dup 0)
6171 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6173 (set (match_dup 0) (ior:DI (match_dup 0)
6175 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6177 (clobber (scratch:CC))])
6178 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6179 (label_ref (match_operand:DI 2 "" ""))
6181 (set (match_dup 0) (match_dup 1))]
6182 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6185 operands[3] = gen_reg_rtx (DImode);
6186 operands[4] = gen_reg_rtx (CCUNSmode);
6189 ;; Define the DImode operations that can be done in a small number
6190 ;; of instructions. The & constraints are to prevent the register
6191 ;; allocator from allocating registers that overlap with the inputs
6192 ;; (for example, having an input in 7,8 and an output in 6,7). We
6193 ;; also allow for the output being the same as one of the inputs.
6195 (define_insn "*adddi3_noppc64"
6196 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6197 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6198 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6199 "! TARGET_POWERPC64"
6202 if (WORDS_BIG_ENDIAN)
6203 return (GET_CODE (operands[2])) != CONST_INT
6204 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6205 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6207 return (GET_CODE (operands[2])) != CONST_INT
6208 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6209 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6211 [(set_attr "type" "two")
6212 (set_attr "length" "8")])
6214 (define_insn "*subdi3_noppc64"
6215 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6216 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6217 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6218 "! TARGET_POWERPC64"
6221 if (WORDS_BIG_ENDIAN)
6222 return (GET_CODE (operands[1]) != CONST_INT)
6223 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6224 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6226 return (GET_CODE (operands[1]) != CONST_INT)
6227 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6228 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6230 [(set_attr "type" "two")
6231 (set_attr "length" "8")])
6233 (define_insn "*negdi2_noppc64"
6234 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6235 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6236 "! TARGET_POWERPC64"
6239 return (WORDS_BIG_ENDIAN)
6240 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6241 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6243 [(set_attr "type" "two")
6244 (set_attr "length" "8")])
6246 (define_expand "mulsidi3"
6247 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6248 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6249 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6250 "! TARGET_POWERPC64"
6253 if (! TARGET_POWER && ! TARGET_POWERPC)
6255 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6256 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6257 emit_insn (gen_mull_call ());
6258 if (WORDS_BIG_ENDIAN)
6259 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6262 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6263 gen_rtx_REG (SImode, 3));
6264 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6265 gen_rtx_REG (SImode, 4));
6269 else if (TARGET_POWER)
6271 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6276 (define_insn "mulsidi3_mq"
6277 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6278 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6279 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6280 (clobber (match_scratch:SI 3 "=q"))]
6282 "mul %0,%1,%2\;mfmq %L0"
6283 [(set_attr "type" "imul")
6284 (set_attr "length" "8")])
6286 (define_insn "*mulsidi3_no_mq"
6287 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6288 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6289 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6290 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6293 return (WORDS_BIG_ENDIAN)
6294 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6295 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6297 [(set_attr "type" "imul")
6298 (set_attr "length" "8")])
6301 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6302 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6303 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6304 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6307 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6308 (sign_extend:DI (match_dup 2)))
6311 (mult:SI (match_dup 1)
6315 int endian = (WORDS_BIG_ENDIAN == 0);
6316 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6317 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6320 (define_expand "umulsidi3"
6321 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6322 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6323 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6324 "TARGET_POWERPC && ! TARGET_POWERPC64"
6329 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6334 (define_insn "umulsidi3_mq"
6335 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6336 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6337 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6338 (clobber (match_scratch:SI 3 "=q"))]
6339 "TARGET_POWERPC && TARGET_POWER"
6342 return (WORDS_BIG_ENDIAN)
6343 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6344 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6346 [(set_attr "type" "imul")
6347 (set_attr "length" "8")])
6349 (define_insn "*umulsidi3_no_mq"
6350 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6351 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6352 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6353 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6356 return (WORDS_BIG_ENDIAN)
6357 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6358 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6360 [(set_attr "type" "imul")
6361 (set_attr "length" "8")])
6364 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6365 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6366 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6367 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6370 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6371 (zero_extend:DI (match_dup 2)))
6374 (mult:SI (match_dup 1)
6378 int endian = (WORDS_BIG_ENDIAN == 0);
6379 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6380 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6383 (define_expand "smulsi3_highpart"
6384 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6386 (lshiftrt:DI (mult:DI (sign_extend:DI
6387 (match_operand:SI 1 "gpc_reg_operand" ""))
6389 (match_operand:SI 2 "gpc_reg_operand" "")))
6394 if (! TARGET_POWER && ! TARGET_POWERPC)
6396 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6397 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6398 emit_insn (gen_mulh_call ());
6399 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6402 else if (TARGET_POWER)
6404 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6409 (define_insn "smulsi3_highpart_mq"
6410 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6412 (lshiftrt:DI (mult:DI (sign_extend:DI
6413 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6415 (match_operand:SI 2 "gpc_reg_operand" "r")))
6417 (clobber (match_scratch:SI 3 "=q"))]
6420 [(set_attr "type" "imul")])
6422 (define_insn "*smulsi3_highpart_no_mq"
6423 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6425 (lshiftrt:DI (mult:DI (sign_extend:DI
6426 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6428 (match_operand:SI 2 "gpc_reg_operand" "r")))
6430 "TARGET_POWERPC && ! TARGET_POWER"
6432 [(set_attr "type" "imul")])
6434 (define_expand "umulsi3_highpart"
6435 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6437 (lshiftrt:DI (mult:DI (zero_extend:DI
6438 (match_operand:SI 1 "gpc_reg_operand" ""))
6440 (match_operand:SI 2 "gpc_reg_operand" "")))
6447 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6452 (define_insn "umulsi3_highpart_mq"
6453 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6455 (lshiftrt:DI (mult:DI (zero_extend:DI
6456 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6458 (match_operand:SI 2 "gpc_reg_operand" "r")))
6460 (clobber (match_scratch:SI 3 "=q"))]
6461 "TARGET_POWERPC && TARGET_POWER"
6463 [(set_attr "type" "imul")])
6465 (define_insn "*umulsi3_highpart_no_mq"
6466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6468 (lshiftrt:DI (mult:DI (zero_extend:DI
6469 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6471 (match_operand:SI 2 "gpc_reg_operand" "r")))
6473 "TARGET_POWERPC && ! TARGET_POWER"
6475 [(set_attr "type" "imul")])
6477 ;; If operands 0 and 2 are in the same register, we have a problem. But
6478 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6479 ;; why we have the strange constraints below.
6480 (define_insn "ashldi3_power"
6481 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6482 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6483 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6484 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6487 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6488 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6489 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6490 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6491 [(set_attr "length" "8")])
6493 (define_insn "lshrdi3_power"
6494 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6495 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6496 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6497 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6500 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6501 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6502 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6503 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6504 [(set_attr "length" "8")])
6506 ;; Shift by a variable amount is too complex to be worth open-coding. We
6507 ;; just handle shifts by constants.
6508 (define_insn "ashrdi3_power"
6509 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6510 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6511 (match_operand:SI 2 "const_int_operand" "M,i")))
6512 (clobber (match_scratch:SI 3 "=X,q"))]
6515 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6516 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6517 [(set_attr "type" "shift")
6518 (set_attr "length" "8")])
6520 (define_insn "ashrdi3_no_power"
6521 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6522 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6523 (match_operand:SI 2 "const_int_operand" "M,i")))]
6524 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6526 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6527 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6528 [(set_attr "type" "two,three")
6529 (set_attr "length" "8,12")])
6531 (define_insn "*ashrdisi3_noppc64"
6532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6533 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6534 (const_int 32)) 4))]
6535 "TARGET_32BIT && !TARGET_POWERPC64"
6538 if (REGNO (operands[0]) == REGNO (operands[1]))
6541 return \"mr %0,%1\";
6543 [(set_attr "length" "4")])
6546 ;; PowerPC64 DImode operations.
6548 (define_insn_and_split "absdi2"
6549 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6550 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6551 (clobber (match_scratch:DI 2 "=&r,&r"))]
6554 "&& reload_completed"
6555 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6556 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6557 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6560 (define_insn_and_split "*nabsdi2"
6561 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6562 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6563 (clobber (match_scratch:DI 2 "=&r,&r"))]
6566 "&& reload_completed"
6567 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6568 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6569 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6572 (define_insn "muldi3"
6573 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6574 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6575 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6581 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6582 (const_string "imul3")
6583 (match_operand:SI 2 "short_cint_operand" "")
6584 (const_string "imul2")]
6585 (const_string "lmul")))])
6587 (define_insn "*muldi3_internal1"
6588 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6589 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6590 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6592 (clobber (match_scratch:DI 3 "=r,r"))]
6597 [(set_attr "type" "lmul_compare")
6598 (set_attr "length" "4,8")])
6601 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6602 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6603 (match_operand:DI 2 "gpc_reg_operand" ""))
6605 (clobber (match_scratch:DI 3 ""))]
6606 "TARGET_POWERPC64 && reload_completed"
6608 (mult:DI (match_dup 1) (match_dup 2)))
6610 (compare:CC (match_dup 3)
6614 (define_insn "*muldi3_internal2"
6615 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6616 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6617 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6619 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6620 (mult:DI (match_dup 1) (match_dup 2)))]
6625 [(set_attr "type" "lmul_compare")
6626 (set_attr "length" "4,8")])
6629 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6630 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6631 (match_operand:DI 2 "gpc_reg_operand" ""))
6633 (set (match_operand:DI 0 "gpc_reg_operand" "")
6634 (mult:DI (match_dup 1) (match_dup 2)))]
6635 "TARGET_POWERPC64 && reload_completed"
6637 (mult:DI (match_dup 1) (match_dup 2)))
6639 (compare:CC (match_dup 0)
6643 (define_insn "smuldi3_highpart"
6644 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6646 (lshiftrt:TI (mult:TI (sign_extend:TI
6647 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6649 (match_operand:DI 2 "gpc_reg_operand" "r")))
6653 [(set_attr "type" "lmul")])
6655 (define_insn "umuldi3_highpart"
6656 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6658 (lshiftrt:TI (mult:TI (zero_extend:TI
6659 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6661 (match_operand:DI 2 "gpc_reg_operand" "r")))
6665 [(set_attr "type" "lmul")])
6667 (define_insn "rotldi3"
6668 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6669 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6670 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6675 [(set_attr "type" "var_shift_rotate,integer")])
6677 (define_insn "*rotldi3_internal2"
6678 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6679 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6680 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6682 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
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 0 "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 (clobber (match_scratch:DI 3 ""))]
6698 "TARGET_POWERPC64 && reload_completed"
6700 (rotate:DI (match_dup 1) (match_dup 2)))
6702 (compare:CC (match_dup 3)
6706 (define_insn "*rotldi3_internal3"
6707 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6708 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6709 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6711 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6712 (rotate:DI (match_dup 1) (match_dup 2)))]
6719 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6720 (set_attr "length" "4,4,8,8")])
6723 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6724 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6725 (match_operand:DI 2 "reg_or_cint_operand" ""))
6727 (set (match_operand:DI 0 "gpc_reg_operand" "")
6728 (rotate:DI (match_dup 1) (match_dup 2)))]
6729 "TARGET_POWERPC64 && reload_completed"
6731 (rotate:DI (match_dup 1) (match_dup 2)))
6733 (compare:CC (match_dup 0)
6737 (define_insn "*rotldi3_internal4"
6738 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6739 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6740 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6741 (match_operand:DI 3 "mask64_operand" "n,n")))]
6744 rldc%B3 %0,%1,%2,%S3
6745 rldic%B3 %0,%1,%H2,%S3"
6746 [(set_attr "type" "var_shift_rotate,integer")])
6748 (define_insn "*rotldi3_internal5"
6749 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6751 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6752 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6753 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6755 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6758 rldc%B3. %4,%1,%2,%S3
6759 rldic%B3. %4,%1,%H2,%S3
6762 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6763 (set_attr "length" "4,4,8,8")])
6766 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6768 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6769 (match_operand:DI 2 "reg_or_cint_operand" ""))
6770 (match_operand:DI 3 "mask64_operand" ""))
6772 (clobber (match_scratch:DI 4 ""))]
6773 "TARGET_POWERPC64 && reload_completed"
6775 (and:DI (rotate:DI (match_dup 1)
6779 (compare:CC (match_dup 4)
6783 (define_insn "*rotldi3_internal6"
6784 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6786 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6787 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6788 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6790 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6791 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6794 rldc%B3. %0,%1,%2,%S3
6795 rldic%B3. %0,%1,%H2,%S3
6798 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6799 (set_attr "length" "4,4,8,8")])
6802 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6804 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6805 (match_operand:DI 2 "reg_or_cint_operand" ""))
6806 (match_operand:DI 3 "mask64_operand" ""))
6808 (set (match_operand:DI 0 "gpc_reg_operand" "")
6809 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6810 "TARGET_POWERPC64 && reload_completed"
6812 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6814 (compare:CC (match_dup 0)
6818 (define_insn "*rotldi3_internal7"
6819 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6822 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6823 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6827 rldicl %0,%1,%H2,56"
6828 [(set_attr "type" "var_shift_rotate,integer")])
6830 (define_insn "*rotldi3_internal8"
6831 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6832 (compare:CC (zero_extend:DI
6834 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6835 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6837 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6841 rldicl. %3,%1,%H2,56
6844 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6845 (set_attr "length" "4,4,8,8")])
6848 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6849 (compare:CC (zero_extend:DI
6851 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6852 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6854 (clobber (match_scratch:DI 3 ""))]
6855 "TARGET_POWERPC64 && reload_completed"
6857 (zero_extend:DI (subreg:QI
6858 (rotate:DI (match_dup 1)
6861 (compare:CC (match_dup 3)
6865 (define_insn "*rotldi3_internal9"
6866 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6867 (compare:CC (zero_extend:DI
6869 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6870 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6872 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6873 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6877 rldicl. %0,%1,%H2,56
6880 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6881 (set_attr "length" "4,4,8,8")])
6884 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6885 (compare:CC (zero_extend:DI
6887 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6888 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6890 (set (match_operand:DI 0 "gpc_reg_operand" "")
6891 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6892 "TARGET_POWERPC64 && reload_completed"
6894 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6896 (compare:CC (match_dup 0)
6900 (define_insn "*rotldi3_internal10"
6901 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6904 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6905 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6909 rldicl %0,%1,%H2,48"
6910 [(set_attr "type" "var_shift_rotate,integer")])
6912 (define_insn "*rotldi3_internal11"
6913 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6914 (compare:CC (zero_extend:DI
6916 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6917 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6919 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6923 rldicl. %3,%1,%H2,48
6926 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6927 (set_attr "length" "4,4,8,8")])
6930 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6931 (compare:CC (zero_extend:DI
6933 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6934 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6936 (clobber (match_scratch:DI 3 ""))]
6937 "TARGET_POWERPC64 && reload_completed"
6939 (zero_extend:DI (subreg:HI
6940 (rotate:DI (match_dup 1)
6943 (compare:CC (match_dup 3)
6947 (define_insn "*rotldi3_internal12"
6948 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6949 (compare:CC (zero_extend:DI
6951 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6952 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6954 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6955 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6959 rldicl. %0,%1,%H2,48
6962 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6963 (set_attr "length" "4,4,8,8")])
6966 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6967 (compare:CC (zero_extend:DI
6969 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6970 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6972 (set (match_operand:DI 0 "gpc_reg_operand" "")
6973 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6974 "TARGET_POWERPC64 && reload_completed"
6976 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6978 (compare:CC (match_dup 0)
6982 (define_insn "*rotldi3_internal13"
6983 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6986 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6987 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6991 rldicl %0,%1,%H2,32"
6992 [(set_attr "type" "var_shift_rotate,integer")])
6994 (define_insn "*rotldi3_internal14"
6995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6996 (compare:CC (zero_extend:DI
6998 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6999 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7001 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7005 rldicl. %3,%1,%H2,32
7008 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7009 (set_attr "length" "4,4,8,8")])
7012 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7013 (compare:CC (zero_extend:DI
7015 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7016 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7018 (clobber (match_scratch:DI 3 ""))]
7019 "TARGET_POWERPC64 && reload_completed"
7021 (zero_extend:DI (subreg:SI
7022 (rotate:DI (match_dup 1)
7025 (compare:CC (match_dup 3)
7029 (define_insn "*rotldi3_internal15"
7030 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7031 (compare:CC (zero_extend:DI
7033 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7034 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7036 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7037 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7041 rldicl. %0,%1,%H2,32
7044 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7045 (set_attr "length" "4,4,8,8")])
7048 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7049 (compare:CC (zero_extend:DI
7051 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7052 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7054 (set (match_operand:DI 0 "gpc_reg_operand" "")
7055 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7056 "TARGET_POWERPC64 && reload_completed"
7058 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7060 (compare:CC (match_dup 0)
7064 (define_expand "ashldi3"
7065 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7066 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7067 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7068 "TARGET_POWERPC64 || TARGET_POWER"
7071 if (TARGET_POWERPC64)
7073 else if (TARGET_POWER)
7075 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7082 (define_insn "*ashldi3_internal1"
7083 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7084 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7085 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7090 [(set_attr "type" "var_shift_rotate,shift")])
7092 (define_insn "*ashldi3_internal2"
7093 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7094 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7095 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7097 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
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 0 "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 (clobber (match_scratch:DI 3 ""))]
7113 "TARGET_POWERPC64 && reload_completed"
7115 (ashift:DI (match_dup 1) (match_dup 2)))
7117 (compare:CC (match_dup 3)
7121 (define_insn "*ashldi3_internal3"
7122 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7123 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7124 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7126 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7127 (ashift:DI (match_dup 1) (match_dup 2)))]
7134 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7135 (set_attr "length" "4,4,8,8")])
7138 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7139 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7140 (match_operand:SI 2 "reg_or_cint_operand" ""))
7142 (set (match_operand:DI 0 "gpc_reg_operand" "")
7143 (ashift:DI (match_dup 1) (match_dup 2)))]
7144 "TARGET_POWERPC64 && reload_completed"
7146 (ashift:DI (match_dup 1) (match_dup 2)))
7148 (compare:CC (match_dup 0)
7152 (define_insn "*ashldi3_internal4"
7153 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7154 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7155 (match_operand:SI 2 "const_int_operand" "i"))
7156 (match_operand:DI 3 "const_int_operand" "n")))]
7157 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7158 "rldic %0,%1,%H2,%W3")
7160 (define_insn "ashldi3_internal5"
7161 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7163 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7164 (match_operand:SI 2 "const_int_operand" "i,i"))
7165 (match_operand:DI 3 "const_int_operand" "n,n"))
7167 (clobber (match_scratch:DI 4 "=r,r"))]
7168 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7170 rldic. %4,%1,%H2,%W3
7172 [(set_attr "type" "compare")
7173 (set_attr "length" "4,8")])
7176 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7178 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7179 (match_operand:SI 2 "const_int_operand" ""))
7180 (match_operand:DI 3 "const_int_operand" ""))
7182 (clobber (match_scratch:DI 4 ""))]
7183 "TARGET_POWERPC64 && reload_completed
7184 && includes_rldic_lshift_p (operands[2], operands[3])"
7186 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7189 (compare:CC (match_dup 4)
7193 (define_insn "*ashldi3_internal6"
7194 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7196 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7197 (match_operand:SI 2 "const_int_operand" "i,i"))
7198 (match_operand:DI 3 "const_int_operand" "n,n"))
7200 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7201 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7202 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7204 rldic. %0,%1,%H2,%W3
7206 [(set_attr "type" "compare")
7207 (set_attr "length" "4,8")])
7210 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7212 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7213 (match_operand:SI 2 "const_int_operand" ""))
7214 (match_operand:DI 3 "const_int_operand" ""))
7216 (set (match_operand:DI 0 "gpc_reg_operand" "")
7217 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7218 "TARGET_POWERPC64 && reload_completed
7219 && includes_rldic_lshift_p (operands[2], operands[3])"
7221 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7224 (compare:CC (match_dup 0)
7228 (define_insn "*ashldi3_internal7"
7229 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7230 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7231 (match_operand:SI 2 "const_int_operand" "i"))
7232 (match_operand:DI 3 "mask64_operand" "n")))]
7233 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7234 "rldicr %0,%1,%H2,%S3")
7236 (define_insn "ashldi3_internal8"
7237 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7239 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7240 (match_operand:SI 2 "const_int_operand" "i,i"))
7241 (match_operand:DI 3 "mask64_operand" "n,n"))
7243 (clobber (match_scratch:DI 4 "=r,r"))]
7244 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7246 rldicr. %4,%1,%H2,%S3
7248 [(set_attr "type" "compare")
7249 (set_attr "length" "4,8")])
7252 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7254 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7255 (match_operand:SI 2 "const_int_operand" ""))
7256 (match_operand:DI 3 "mask64_operand" ""))
7258 (clobber (match_scratch:DI 4 ""))]
7259 "TARGET_POWERPC64 && reload_completed
7260 && includes_rldicr_lshift_p (operands[2], operands[3])"
7262 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7265 (compare:CC (match_dup 4)
7269 (define_insn "*ashldi3_internal9"
7270 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7272 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7273 (match_operand:SI 2 "const_int_operand" "i,i"))
7274 (match_operand:DI 3 "mask64_operand" "n,n"))
7276 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7277 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7278 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7280 rldicr. %0,%1,%H2,%S3
7282 [(set_attr "type" "compare")
7283 (set_attr "length" "4,8")])
7286 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7288 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7289 (match_operand:SI 2 "const_int_operand" ""))
7290 (match_operand:DI 3 "mask64_operand" ""))
7292 (set (match_operand:DI 0 "gpc_reg_operand" "")
7293 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7294 "TARGET_POWERPC64 && reload_completed
7295 && includes_rldicr_lshift_p (operands[2], operands[3])"
7297 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7300 (compare:CC (match_dup 0)
7304 (define_expand "lshrdi3"
7305 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7306 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7307 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7308 "TARGET_POWERPC64 || TARGET_POWER"
7311 if (TARGET_POWERPC64)
7313 else if (TARGET_POWER)
7315 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7322 (define_insn "*lshrdi3_internal1"
7323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7324 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7325 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7330 [(set_attr "type" "var_shift_rotate,shift")])
7332 (define_insn "*lshrdi3_internal2"
7333 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7334 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7335 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7337 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
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 0 "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 (clobber (match_scratch:DI 3 ""))]
7353 "TARGET_POWERPC64 && reload_completed"
7355 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7357 (compare:CC (match_dup 3)
7361 (define_insn "*lshrdi3_internal3"
7362 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7363 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7364 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7366 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7367 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7374 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7375 (set_attr "length" "4,4,8,8")])
7378 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7379 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7380 (match_operand:SI 2 "reg_or_cint_operand" ""))
7382 (set (match_operand:DI 0 "gpc_reg_operand" "")
7383 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7384 "TARGET_POWERPC64 && reload_completed"
7386 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7388 (compare:CC (match_dup 0)
7392 (define_expand "ashrdi3"
7393 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7394 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7395 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7399 if (TARGET_POWERPC64)
7401 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7403 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7406 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7407 && WORDS_BIG_ENDIAN)
7409 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7416 (define_insn "*ashrdi3_internal1"
7417 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7418 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7419 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7424 [(set_attr "type" "var_shift_rotate,shift")])
7426 (define_insn "*ashrdi3_internal2"
7427 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7428 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7429 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7431 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
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 0 "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 (clobber (match_scratch:DI 3 ""))]
7447 "TARGET_POWERPC64 && reload_completed"
7449 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7451 (compare:CC (match_dup 3)
7455 (define_insn "*ashrdi3_internal3"
7456 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7457 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7458 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7460 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7461 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7468 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7469 (set_attr "length" "4,4,8,8")])
7472 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7473 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7474 (match_operand:SI 2 "reg_or_cint_operand" ""))
7476 (set (match_operand:DI 0 "gpc_reg_operand" "")
7477 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7478 "TARGET_POWERPC64 && reload_completed"
7480 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7482 (compare:CC (match_dup 0)
7486 (define_insn "anddi3"
7487 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7488 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7489 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7490 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7494 rldic%B2 %0,%1,0,%S2
7495 rlwinm %0,%1,0,%m2,%M2
7499 [(set_attr "type" "*,*,*,compare,compare,*")
7500 (set_attr "length" "4,4,4,4,4,8")])
7503 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7504 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7505 (match_operand:DI 2 "mask64_2_operand" "")))
7506 (clobber (match_scratch:CC 3 ""))]
7508 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7509 && !mask_operand (operands[2], DImode)
7510 && !mask64_operand (operands[2], DImode)"
7512 (and:DI (rotate:DI (match_dup 1)
7516 (and:DI (rotate:DI (match_dup 0)
7520 build_mask64_2_operands (operands[2], &operands[4]);
7523 (define_insn "*anddi3_internal2"
7524 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7525 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7526 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7528 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7529 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7533 rldic%B2. %3,%1,0,%S2
7534 rlwinm. %3,%1,0,%m2,%M2
7544 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7545 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7548 [(set (match_operand:CC 0 "cc_reg_operand" "")
7549 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7550 (match_operand:DI 2 "mask64_2_operand" ""))
7552 (clobber (match_scratch:DI 3 ""))
7553 (clobber (match_scratch:CC 4 ""))]
7554 "TARGET_64BIT && reload_completed
7555 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7556 && !mask_operand (operands[2], DImode)
7557 && !mask64_operand (operands[2], DImode)"
7559 (and:DI (rotate:DI (match_dup 1)
7562 (parallel [(set (match_dup 0)
7563 (compare:CC (and:DI (rotate:DI (match_dup 3)
7567 (clobber (match_dup 3))])]
7570 build_mask64_2_operands (operands[2], &operands[5]);
7573 (define_insn "*anddi3_internal3"
7574 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7575 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7576 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7578 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7579 (and:DI (match_dup 1) (match_dup 2)))
7580 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7584 rldic%B2. %0,%1,0,%S2
7585 rlwinm. %0,%1,0,%m2,%M2
7595 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7596 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7599 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7600 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7601 (match_operand:DI 2 "and64_2_operand" ""))
7603 (set (match_operand:DI 0 "gpc_reg_operand" "")
7604 (and:DI (match_dup 1) (match_dup 2)))
7605 (clobber (match_scratch:CC 4 ""))]
7606 "TARGET_64BIT && reload_completed"
7607 [(parallel [(set (match_dup 0)
7608 (and:DI (match_dup 1) (match_dup 2)))
7609 (clobber (match_dup 4))])
7611 (compare:CC (match_dup 0)
7616 [(set (match_operand:CC 3 "cc_reg_operand" "")
7617 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7618 (match_operand:DI 2 "mask64_2_operand" ""))
7620 (set (match_operand:DI 0 "gpc_reg_operand" "")
7621 (and:DI (match_dup 1) (match_dup 2)))
7622 (clobber (match_scratch:CC 4 ""))]
7623 "TARGET_64BIT && reload_completed
7624 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7625 && !mask_operand (operands[2], DImode)
7626 && !mask64_operand (operands[2], DImode)"
7628 (and:DI (rotate:DI (match_dup 1)
7631 (parallel [(set (match_dup 3)
7632 (compare:CC (and:DI (rotate:DI (match_dup 0)
7637 (and:DI (rotate:DI (match_dup 0)
7642 build_mask64_2_operands (operands[2], &operands[5]);
7645 (define_expand "iordi3"
7646 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7647 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7648 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7652 if (non_logical_cint_operand (operands[2], DImode))
7654 HOST_WIDE_INT value;
7655 rtx tmp = ((!can_create_pseudo_p ()
7656 || rtx_equal_p (operands[0], operands[1]))
7657 ? operands[0] : gen_reg_rtx (DImode));
7659 if (GET_CODE (operands[2]) == CONST_INT)
7661 value = INTVAL (operands[2]);
7662 emit_insn (gen_iordi3 (tmp, operands[1],
7663 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7667 value = CONST_DOUBLE_LOW (operands[2]);
7668 emit_insn (gen_iordi3 (tmp, operands[1],
7669 immed_double_const (value
7670 & (~ (HOST_WIDE_INT) 0xffff),
7674 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7679 (define_expand "xordi3"
7680 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7681 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7682 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7686 if (non_logical_cint_operand (operands[2], DImode))
7688 HOST_WIDE_INT value;
7689 rtx tmp = ((!can_create_pseudo_p ()
7690 || rtx_equal_p (operands[0], operands[1]))
7691 ? operands[0] : gen_reg_rtx (DImode));
7693 if (GET_CODE (operands[2]) == CONST_INT)
7695 value = INTVAL (operands[2]);
7696 emit_insn (gen_xordi3 (tmp, operands[1],
7697 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7701 value = CONST_DOUBLE_LOW (operands[2]);
7702 emit_insn (gen_xordi3 (tmp, operands[1],
7703 immed_double_const (value
7704 & (~ (HOST_WIDE_INT) 0xffff),
7708 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7713 (define_insn "*booldi3_internal1"
7714 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7715 (match_operator:DI 3 "boolean_or_operator"
7716 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7717 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7724 (define_insn "*booldi3_internal2"
7725 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7726 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7727 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7728 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7730 (clobber (match_scratch:DI 3 "=r,r"))]
7735 [(set_attr "type" "compare")
7736 (set_attr "length" "4,8")])
7739 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7740 (compare:CC (match_operator:DI 4 "boolean_operator"
7741 [(match_operand:DI 1 "gpc_reg_operand" "")
7742 (match_operand:DI 2 "gpc_reg_operand" "")])
7744 (clobber (match_scratch:DI 3 ""))]
7745 "TARGET_POWERPC64 && reload_completed"
7746 [(set (match_dup 3) (match_dup 4))
7748 (compare:CC (match_dup 3)
7752 (define_insn "*booldi3_internal3"
7753 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7754 (compare:CC (match_operator:DI 4 "boolean_operator"
7755 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7756 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7758 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7764 [(set_attr "type" "compare")
7765 (set_attr "length" "4,8")])
7768 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7769 (compare:CC (match_operator:DI 4 "boolean_operator"
7770 [(match_operand:DI 1 "gpc_reg_operand" "")
7771 (match_operand:DI 2 "gpc_reg_operand" "")])
7773 (set (match_operand:DI 0 "gpc_reg_operand" "")
7775 "TARGET_POWERPC64 && reload_completed"
7776 [(set (match_dup 0) (match_dup 4))
7778 (compare:CC (match_dup 0)
7782 ;; Split a logical operation that we can't do in one insn into two insns,
7783 ;; each of which does one 16-bit part. This is used by combine.
7786 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7787 (match_operator:DI 3 "boolean_or_operator"
7788 [(match_operand:DI 1 "gpc_reg_operand" "")
7789 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7791 [(set (match_dup 0) (match_dup 4))
7792 (set (match_dup 0) (match_dup 5))]
7797 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7799 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7800 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7802 i4 = GEN_INT (value & 0xffff);
7806 i3 = GEN_INT (INTVAL (operands[2])
7807 & (~ (HOST_WIDE_INT) 0xffff));
7808 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7810 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7812 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7816 (define_insn "*boolcdi3_internal1"
7817 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7818 (match_operator:DI 3 "boolean_operator"
7819 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7820 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7824 (define_insn "*boolcdi3_internal2"
7825 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7826 (compare:CC (match_operator:DI 4 "boolean_operator"
7827 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7828 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7830 (clobber (match_scratch:DI 3 "=r,r"))]
7835 [(set_attr "type" "compare")
7836 (set_attr "length" "4,8")])
7839 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7840 (compare:CC (match_operator:DI 4 "boolean_operator"
7841 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7842 (match_operand:DI 2 "gpc_reg_operand" "")])
7844 (clobber (match_scratch:DI 3 ""))]
7845 "TARGET_POWERPC64 && reload_completed"
7846 [(set (match_dup 3) (match_dup 4))
7848 (compare:CC (match_dup 3)
7852 (define_insn "*boolcdi3_internal3"
7853 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7854 (compare:CC (match_operator:DI 4 "boolean_operator"
7855 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7856 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7858 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7864 [(set_attr "type" "compare")
7865 (set_attr "length" "4,8")])
7868 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7869 (compare:CC (match_operator:DI 4 "boolean_operator"
7870 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7871 (match_operand:DI 2 "gpc_reg_operand" "")])
7873 (set (match_operand:DI 0 "gpc_reg_operand" "")
7875 "TARGET_POWERPC64 && reload_completed"
7876 [(set (match_dup 0) (match_dup 4))
7878 (compare:CC (match_dup 0)
7882 (define_insn "*boolccdi3_internal1"
7883 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7884 (match_operator:DI 3 "boolean_operator"
7885 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7886 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7890 (define_insn "*boolccdi3_internal2"
7891 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7892 (compare:CC (match_operator:DI 4 "boolean_operator"
7893 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7894 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7896 (clobber (match_scratch:DI 3 "=r,r"))]
7901 [(set_attr "type" "compare")
7902 (set_attr "length" "4,8")])
7905 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7906 (compare:CC (match_operator:DI 4 "boolean_operator"
7907 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7908 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7910 (clobber (match_scratch:DI 3 ""))]
7911 "TARGET_POWERPC64 && reload_completed"
7912 [(set (match_dup 3) (match_dup 4))
7914 (compare:CC (match_dup 3)
7918 (define_insn "*boolccdi3_internal3"
7919 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7920 (compare:CC (match_operator:DI 4 "boolean_operator"
7921 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7922 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7924 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7930 [(set_attr "type" "compare")
7931 (set_attr "length" "4,8")])
7934 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7935 (compare:CC (match_operator:DI 4 "boolean_operator"
7936 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7937 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7939 (set (match_operand:DI 0 "gpc_reg_operand" "")
7941 "TARGET_POWERPC64 && reload_completed"
7942 [(set (match_dup 0) (match_dup 4))
7944 (compare:CC (match_dup 0)
7948 ;; Now define ways of moving data around.
7950 ;; Set up a register with a value from the GOT table
7952 (define_expand "movsi_got"
7953 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7954 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7955 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7956 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7959 if (GET_CODE (operands[1]) == CONST)
7961 rtx offset = const0_rtx;
7962 HOST_WIDE_INT value;
7964 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7965 value = INTVAL (offset);
7968 rtx tmp = (!can_create_pseudo_p ()
7970 : gen_reg_rtx (Pmode));
7971 emit_insn (gen_movsi_got (tmp, operands[1]));
7972 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7977 operands[2] = rs6000_got_register (operands[1]);
7980 (define_insn "*movsi_got_internal"
7981 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7982 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7983 (match_operand:SI 2 "gpc_reg_operand" "b")]
7985 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7986 "{l|lwz} %0,%a1@got(%2)"
7987 [(set_attr "type" "load")])
7989 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7990 ;; didn't get allocated to a hard register.
7992 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7993 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7994 (match_operand:SI 2 "memory_operand" "")]
7996 "DEFAULT_ABI == ABI_V4
7998 && (reload_in_progress || reload_completed)"
7999 [(set (match_dup 0) (match_dup 2))
8000 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8004 ;; For SI, we special-case integers that can't be loaded in one insn. We
8005 ;; do the load 16-bits at a time. We could do this by loading from memory,
8006 ;; and this is even supposed to be faster, but it is simpler not to get
8007 ;; integers in the TOC.
8008 (define_insn "movsi_low"
8009 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8010 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8011 (match_operand 2 "" ""))))]
8012 "TARGET_MACHO && ! TARGET_64BIT"
8013 "{l|lwz} %0,lo16(%2)(%1)"
8014 [(set_attr "type" "load")
8015 (set_attr "length" "4")])
8017 (define_insn "*movsi_internal1"
8018 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8019 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8020 "gpc_reg_operand (operands[0], SImode)
8021 || gpc_reg_operand (operands[1], SImode)"
8025 {l%U1%X1|lwz%U1%X1} %0,%1
8026 {st%U0%X0|stw%U0%X0} %1,%0
8036 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8037 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8039 ;; Split a load of a large constant into the appropriate two-insn
8043 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8044 (match_operand:SI 1 "const_int_operand" ""))]
8045 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8046 && (INTVAL (operands[1]) & 0xffff) != 0"
8050 (ior:SI (match_dup 0)
8053 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8055 if (tem == operands[0])
8061 (define_insn "*mov<mode>_internal2"
8062 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8063 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8065 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8068 {cmpi|cmp<wd>i} %2,%0,0
8071 [(set_attr "type" "cmp,compare,cmp")
8072 (set_attr "length" "4,4,8")])
8075 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8076 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8078 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8080 [(set (match_dup 0) (match_dup 1))
8082 (compare:CC (match_dup 0)
8086 (define_insn "*movhi_internal"
8087 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8088 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8089 "gpc_reg_operand (operands[0], HImode)
8090 || gpc_reg_operand (operands[1], HImode)"
8100 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8102 (define_expand "mov<mode>"
8103 [(set (match_operand:INT 0 "general_operand" "")
8104 (match_operand:INT 1 "any_operand" ""))]
8106 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8108 (define_insn "*movqi_internal"
8109 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8110 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8111 "gpc_reg_operand (operands[0], QImode)
8112 || gpc_reg_operand (operands[1], QImode)"
8122 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8124 ;; Here is how to move condition codes around. When we store CC data in
8125 ;; an integer register or memory, we store just the high-order 4 bits.
8126 ;; This lets us not shift in the most common case of CR0.
8127 (define_expand "movcc"
8128 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8129 (match_operand:CC 1 "nonimmediate_operand" ""))]
8133 (define_insn "*movcc_internal1"
8134 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8135 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8136 "register_operand (operands[0], CCmode)
8137 || register_operand (operands[1], CCmode)"
8141 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8144 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8150 {l%U1%X1|lwz%U1%X1} %0,%1
8151 {st%U0%U1|stw%U0%U1} %1,%0"
8153 (cond [(eq_attr "alternative" "0,3")
8154 (const_string "cr_logical")
8155 (eq_attr "alternative" "1,2")
8156 (const_string "mtcr")
8157 (eq_attr "alternative" "6,7,9")
8158 (const_string "integer")
8159 (eq_attr "alternative" "8")
8160 (const_string "mfjmpr")
8161 (eq_attr "alternative" "10")
8162 (const_string "mtjmpr")
8163 (eq_attr "alternative" "11")
8164 (const_string "load")
8165 (eq_attr "alternative" "12")
8166 (const_string "store")
8167 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8168 (const_string "mfcrf")
8170 (const_string "mfcr")))
8171 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8173 ;; For floating-point, we normally deal with the floating-point registers
8174 ;; unless -msoft-float is used. The sole exception is that parameter passing
8175 ;; can produce floating-point values in fixed-point registers. Unless the
8176 ;; value is a simple constant or already in memory, we deal with this by
8177 ;; allocating memory and copying the value explicitly via that memory location.
8178 (define_expand "movsf"
8179 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8180 (match_operand:SF 1 "any_operand" ""))]
8182 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8185 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8186 (match_operand:SF 1 "const_double_operand" ""))]
8188 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8189 || (GET_CODE (operands[0]) == SUBREG
8190 && GET_CODE (SUBREG_REG (operands[0])) == REG
8191 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8192 [(set (match_dup 2) (match_dup 3))]
8198 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8199 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8201 if (! TARGET_POWERPC64)
8202 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8204 operands[2] = gen_lowpart (SImode, operands[0]);
8206 operands[3] = gen_int_mode (l, SImode);
8209 (define_insn "*movsf_hardfloat"
8210 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8211 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8212 "(gpc_reg_operand (operands[0], SFmode)
8213 || gpc_reg_operand (operands[1], SFmode))
8214 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8217 {l%U1%X1|lwz%U1%X1} %0,%1
8218 {st%U0%X0|stw%U0%X0} %1,%0
8228 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8229 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8231 (define_insn "*movsf_softfloat"
8232 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8233 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8234 "(gpc_reg_operand (operands[0], SFmode)
8235 || gpc_reg_operand (operands[1], SFmode))
8236 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8242 {l%U1%X1|lwz%U1%X1} %0,%1
8243 {st%U0%X0|stw%U0%X0} %1,%0
8250 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8251 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8254 (define_expand "movdf"
8255 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8256 (match_operand:DF 1 "any_operand" ""))]
8258 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8261 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8262 (match_operand:DF 1 "const_int_operand" ""))]
8263 "! TARGET_POWERPC64 && reload_completed
8264 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8265 || (GET_CODE (operands[0]) == SUBREG
8266 && GET_CODE (SUBREG_REG (operands[0])) == REG
8267 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8268 [(set (match_dup 2) (match_dup 4))
8269 (set (match_dup 3) (match_dup 1))]
8272 int endian = (WORDS_BIG_ENDIAN == 0);
8273 HOST_WIDE_INT value = INTVAL (operands[1]);
8275 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8276 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8277 #if HOST_BITS_PER_WIDE_INT == 32
8278 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8280 operands[4] = GEN_INT (value >> 32);
8281 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8286 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8287 (match_operand:DF 1 "const_double_operand" ""))]
8288 "! TARGET_POWERPC64 && reload_completed
8289 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8290 || (GET_CODE (operands[0]) == SUBREG
8291 && GET_CODE (SUBREG_REG (operands[0])) == REG
8292 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8293 [(set (match_dup 2) (match_dup 4))
8294 (set (match_dup 3) (match_dup 5))]
8297 int endian = (WORDS_BIG_ENDIAN == 0);
8301 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8302 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8304 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8305 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8306 operands[4] = gen_int_mode (l[endian], SImode);
8307 operands[5] = gen_int_mode (l[1 - endian], SImode);
8311 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8312 (match_operand:DF 1 "const_double_operand" ""))]
8313 "TARGET_POWERPC64 && reload_completed
8314 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8315 || (GET_CODE (operands[0]) == SUBREG
8316 && GET_CODE (SUBREG_REG (operands[0])) == REG
8317 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8318 [(set (match_dup 2) (match_dup 3))]
8321 int endian = (WORDS_BIG_ENDIAN == 0);
8324 #if HOST_BITS_PER_WIDE_INT >= 64
8328 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8329 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8331 operands[2] = gen_lowpart (DImode, operands[0]);
8332 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8333 #if HOST_BITS_PER_WIDE_INT >= 64
8334 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8335 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8337 operands[3] = gen_int_mode (val, DImode);
8339 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8343 ;; Don't have reload use general registers to load a constant. First,
8344 ;; it might not work if the output operand is the equivalent of
8345 ;; a non-offsettable memref, but also it is less efficient than loading
8346 ;; the constant into an FP register, since it will probably be used there.
8347 ;; The "??" is a kludge until we can figure out a more reasonable way
8348 ;; of handling these non-offsettable values.
8349 (define_insn "*movdf_hardfloat32"
8350 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8351 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8352 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8353 && (gpc_reg_operand (operands[0], DFmode)
8354 || gpc_reg_operand (operands[1], DFmode))"
8357 switch (which_alternative)
8362 /* We normally copy the low-numbered register first. However, if
8363 the first register operand 0 is the same as the second register
8364 of operand 1, we must copy in the opposite order. */
8365 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8366 return \"mr %L0,%L1\;mr %0,%1\";
8368 return \"mr %0,%1\;mr %L0,%L1\";
8370 if (rs6000_offsettable_memref_p (operands[1])
8371 || (GET_CODE (operands[1]) == MEM
8372 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8373 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8374 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
8375 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
8377 /* If the low-address word is used in the address, we must load
8378 it last. Otherwise, load it first. Note that we cannot have
8379 auto-increment in that case since the address register is
8380 known to be dead. */
8381 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8383 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8385 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8391 addreg = find_addr_reg (XEXP (operands[1], 0));
8392 if (refers_to_regno_p (REGNO (operands[0]),
8393 REGNO (operands[0]) + 1,
8396 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8397 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8398 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8399 return \"{l%X1|lwz%X1} %0,%1\";
8403 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
8404 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8405 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8406 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8411 if (rs6000_offsettable_memref_p (operands[0])
8412 || (GET_CODE (operands[0]) == MEM
8413 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8414 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8415 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
8416 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
8417 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8422 addreg = find_addr_reg (XEXP (operands[0], 0));
8423 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
8424 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8425 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
8426 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8430 return \"fmr %0,%1\";
8432 return \"lfd%U1%X1 %0,%1\";
8434 return \"stfd%U0%X0 %1,%0\";
8441 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8442 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8444 (define_insn "*movdf_softfloat32"
8445 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8446 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8447 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8448 && (gpc_reg_operand (operands[0], DFmode)
8449 || gpc_reg_operand (operands[1], DFmode))"
8452 switch (which_alternative)
8457 /* We normally copy the low-numbered register first. However, if
8458 the first register operand 0 is the same as the second register of
8459 operand 1, we must copy in the opposite order. */
8460 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8461 return \"mr %L0,%L1\;mr %0,%1\";
8463 return \"mr %0,%1\;mr %L0,%L1\";
8465 /* If the low-address word is used in the address, we must load
8466 it last. Otherwise, load it first. Note that we cannot have
8467 auto-increment in that case since the address register is
8468 known to be dead. */
8469 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8471 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8473 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8475 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8482 [(set_attr "type" "two,load,store,*,*,*")
8483 (set_attr "length" "8,8,8,8,12,16")])
8485 ; ld/std require word-aligned displacements -> 'Y' constraint.
8486 ; List Y->r and r->Y before r->r for reload.
8487 (define_insn "*movdf_hardfloat64_mfpgpr"
8488 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8489 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8490 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8491 && (gpc_reg_operand (operands[0], DFmode)
8492 || gpc_reg_operand (operands[1], DFmode))"
8508 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8509 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8511 ; ld/std require word-aligned displacements -> 'Y' constraint.
8512 ; List Y->r and r->Y before r->r for reload.
8513 (define_insn "*movdf_hardfloat64"
8514 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8515 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8516 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8517 && (gpc_reg_operand (operands[0], DFmode)
8518 || gpc_reg_operand (operands[1], DFmode))"
8532 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8533 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8535 (define_insn "*movdf_softfloat64"
8536 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8537 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8538 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8539 && (gpc_reg_operand (operands[0], DFmode)
8540 || gpc_reg_operand (operands[1], DFmode))"
8551 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8552 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8554 (define_expand "movtf"
8555 [(set (match_operand:TF 0 "general_operand" "")
8556 (match_operand:TF 1 "any_operand" ""))]
8557 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8558 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8560 ; It's important to list the o->f and f->o moves before f->f because
8561 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8562 ; which doesn't make progress. Likewise r->Y must be before r->r.
8563 (define_insn_and_split "*movtf_internal"
8564 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8565 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8567 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8568 && (gpc_reg_operand (operands[0], TFmode)
8569 || gpc_reg_operand (operands[1], TFmode))"
8571 "&& reload_completed"
8573 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8574 [(set_attr "length" "8,8,8,20,20,16")])
8576 (define_insn_and_split "*movtf_softfloat"
8577 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
8578 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
8580 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8581 && (gpc_reg_operand (operands[0], TFmode)
8582 || gpc_reg_operand (operands[1], TFmode))"
8584 "&& reload_completed"
8586 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8587 [(set_attr "length" "20,20,16")])
8589 (define_expand "extenddftf2"
8590 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8591 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8593 && TARGET_HARD_FLOAT
8594 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8595 && TARGET_LONG_DOUBLE_128"
8597 if (TARGET_E500_DOUBLE)
8598 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8600 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8604 (define_expand "extenddftf2_fprs"
8605 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8606 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8607 (use (match_dup 2))])]
8609 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8611 operands[2] = CONST0_RTX (DFmode);
8612 /* Generate GOT reference early for SVR4 PIC. */
8613 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8614 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8617 (define_insn_and_split "*extenddftf2_internal"
8618 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8619 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8620 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8622 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8624 "&& reload_completed"
8627 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8628 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8629 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8631 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8636 (define_expand "extendsftf2"
8637 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8638 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8640 && TARGET_HARD_FLOAT
8641 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8642 && TARGET_LONG_DOUBLE_128"
8644 rtx tmp = gen_reg_rtx (DFmode);
8645 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8646 emit_insn (gen_extenddftf2 (operands[0], tmp));
8650 (define_expand "trunctfdf2"
8651 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8652 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8654 && TARGET_HARD_FLOAT
8655 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8656 && TARGET_LONG_DOUBLE_128"
8659 (define_insn_and_split "trunctfdf2_internal1"
8660 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8661 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8662 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8663 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8667 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8670 emit_note (NOTE_INSN_DELETED);
8673 [(set_attr "type" "fp")])
8675 (define_insn "trunctfdf2_internal2"
8676 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8677 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8678 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8679 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8681 [(set_attr "type" "fp")])
8683 (define_expand "trunctfsf2"
8684 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8685 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8687 && TARGET_HARD_FLOAT
8688 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8689 && TARGET_LONG_DOUBLE_128"
8691 if (TARGET_E500_DOUBLE)
8692 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8694 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8698 (define_insn_and_split "trunctfsf2_fprs"
8699 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8700 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8701 (clobber (match_scratch:DF 2 "=f"))]
8703 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8705 "&& reload_completed"
8707 (float_truncate:DF (match_dup 1)))
8709 (float_truncate:SF (match_dup 2)))]
8712 (define_expand "floatsitf2"
8713 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8714 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8716 && TARGET_HARD_FLOAT
8717 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8718 && TARGET_LONG_DOUBLE_128"
8720 rtx tmp = gen_reg_rtx (DFmode);
8721 expand_float (tmp, operands[1], false);
8722 emit_insn (gen_extenddftf2 (operands[0], tmp));
8726 ; fadd, but rounding towards zero.
8727 ; This is probably not the optimal code sequence.
8728 (define_insn "fix_trunc_helper"
8729 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8730 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8731 UNSPEC_FIX_TRUNC_TF))
8732 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8733 "TARGET_HARD_FLOAT && TARGET_FPRS"
8734 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8735 [(set_attr "type" "fp")
8736 (set_attr "length" "20")])
8738 (define_expand "fix_trunctfsi2"
8739 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8740 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8742 && (TARGET_POWER2 || TARGET_POWERPC)
8743 && TARGET_HARD_FLOAT
8744 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8745 && TARGET_LONG_DOUBLE_128"
8747 if (TARGET_E500_DOUBLE)
8748 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8750 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8754 (define_expand "fix_trunctfsi2_fprs"
8755 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8756 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8757 (clobber (match_dup 2))
8758 (clobber (match_dup 3))
8759 (clobber (match_dup 4))
8760 (clobber (match_dup 5))])]
8762 && (TARGET_POWER2 || TARGET_POWERPC)
8763 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8765 operands[2] = gen_reg_rtx (DFmode);
8766 operands[3] = gen_reg_rtx (DFmode);
8767 operands[4] = gen_reg_rtx (DImode);
8768 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8771 (define_insn_and_split "*fix_trunctfsi2_internal"
8772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8773 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8774 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8775 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8776 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8777 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
8779 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8781 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[5]))"
8785 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8787 gcc_assert (MEM_P (operands[5]));
8788 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8790 emit_insn (gen_fctiwz (operands[4], operands[2]));
8791 emit_move_insn (operands[5], operands[4]);
8792 emit_move_insn (operands[0], lowword);
8796 (define_expand "negtf2"
8797 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8798 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8800 && TARGET_HARD_FLOAT
8801 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8802 && TARGET_LONG_DOUBLE_128"
8805 (define_insn "negtf2_internal"
8806 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8807 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8809 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8812 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8813 return \"fneg %L0,%L1\;fneg %0,%1\";
8815 return \"fneg %0,%1\;fneg %L0,%L1\";
8817 [(set_attr "type" "fp")
8818 (set_attr "length" "8")])
8820 (define_expand "abstf2"
8821 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8822 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8824 && TARGET_HARD_FLOAT
8825 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8826 && TARGET_LONG_DOUBLE_128"
8829 rtx label = gen_label_rtx ();
8830 if (TARGET_E500_DOUBLE)
8832 if (flag_unsafe_math_optimizations)
8833 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8835 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8838 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8843 (define_expand "abstf2_internal"
8844 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8845 (match_operand:TF 1 "gpc_reg_operand" ""))
8846 (set (match_dup 3) (match_dup 5))
8847 (set (match_dup 5) (abs:DF (match_dup 5)))
8848 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8849 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8850 (label_ref (match_operand 2 "" ""))
8852 (set (match_dup 6) (neg:DF (match_dup 6)))]
8854 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8857 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8858 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8859 operands[3] = gen_reg_rtx (DFmode);
8860 operands[4] = gen_reg_rtx (CCFPmode);
8861 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8862 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8865 ;; Next come the multi-word integer load and store and the load and store
8868 ; List r->r after r->"o<>", otherwise reload will try to reload a
8869 ; non-offsettable address by using r->r which won't make progress.
8870 (define_insn "*movdi_internal32"
8871 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8872 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8874 && (gpc_reg_operand (operands[0], DImode)
8875 || gpc_reg_operand (operands[1], DImode))"
8884 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8887 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8888 (match_operand:DI 1 "const_int_operand" ""))]
8889 "! TARGET_POWERPC64 && reload_completed"
8890 [(set (match_dup 2) (match_dup 4))
8891 (set (match_dup 3) (match_dup 1))]
8894 HOST_WIDE_INT value = INTVAL (operands[1]);
8895 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8897 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8899 #if HOST_BITS_PER_WIDE_INT == 32
8900 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8902 operands[4] = GEN_INT (value >> 32);
8903 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8908 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
8909 (match_operand:DI 1 "input_operand" ""))]
8910 "reload_completed && !TARGET_POWERPC64
8911 && gpr_or_gpr_p (operands[0], operands[1])"
8913 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8915 (define_insn "*movdi_mfpgpr"
8916 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
8917 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
8918 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8919 && (gpc_reg_operand (operands[0], DImode)
8920 || gpc_reg_operand (operands[1], DImode))"
8937 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8938 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
8940 (define_insn "*movdi_internal64"
8941 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8942 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8943 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
8944 && (gpc_reg_operand (operands[0], DImode)
8945 || gpc_reg_operand (operands[1], DImode))"
8960 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8961 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8963 ;; immediate value valid for a single instruction hiding in a const_double
8965 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8966 (match_operand:DI 1 "const_double_operand" "F"))]
8967 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8968 && GET_CODE (operands[1]) == CONST_DOUBLE
8969 && num_insns_constant (operands[1], DImode) == 1"
8972 return ((unsigned HOST_WIDE_INT)
8973 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8974 ? \"li %0,%1\" : \"lis %0,%v1\";
8977 ;; Generate all one-bits and clear left or right.
8978 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8980 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8981 (match_operand:DI 1 "mask64_operand" ""))]
8982 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8983 [(set (match_dup 0) (const_int -1))
8985 (and:DI (rotate:DI (match_dup 0)
8990 ;; Split a load of a large constant into the appropriate five-instruction
8991 ;; sequence. Handle anything in a constant number of insns.
8992 ;; When non-easy constants can go in the TOC, this should use
8993 ;; easy_fp_constant predicate.
8995 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8996 (match_operand:DI 1 "const_int_operand" ""))]
8997 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8998 [(set (match_dup 0) (match_dup 2))
8999 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9001 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9003 if (tem == operands[0])
9010 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9011 (match_operand:DI 1 "const_double_operand" ""))]
9012 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9013 [(set (match_dup 0) (match_dup 2))
9014 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9016 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9018 if (tem == operands[0])
9024 ;; TImode is similar, except that we usually want to compute the address into
9025 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9026 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9028 ;; We say that MQ is clobbered in the last alternative because the first
9029 ;; alternative would never get used otherwise since it would need a reload
9030 ;; while the 2nd alternative would not. We put memory cases first so they
9031 ;; are preferred. Otherwise, we'd try to reload the output instead of
9032 ;; giving the SCRATCH mq.
9034 (define_insn "*movti_power"
9035 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9036 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9037 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9038 "TARGET_POWER && ! TARGET_POWERPC64
9039 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9042 switch (which_alternative)
9049 return \"{stsi|stswi} %1,%P0,16\";
9054 /* If the address is not used in the output, we can use lsi. Otherwise,
9055 fall through to generating four loads. */
9057 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9058 return \"{lsi|lswi} %0,%P1,16\";
9059 /* ... fall through ... */
9065 [(set_attr "type" "store,store,*,load,load,*")])
9067 (define_insn "*movti_string"
9068 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9069 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9070 "! TARGET_POWER && ! TARGET_POWERPC64
9071 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9074 switch (which_alternative)
9080 return \"{stsi|stswi} %1,%P0,16\";
9085 /* If the address is not used in the output, we can use lsi. Otherwise,
9086 fall through to generating four loads. */
9088 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9089 return \"{lsi|lswi} %0,%P1,16\";
9090 /* ... fall through ... */
9096 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
9098 (define_insn "*movti_ppc64"
9099 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9100 (match_operand:TI 1 "input_operand" "r,r,m"))]
9101 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9102 || gpc_reg_operand (operands[1], TImode))"
9104 [(set_attr "type" "*,load,store")])
9107 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9108 (match_operand:TI 1 "const_double_operand" ""))]
9110 [(set (match_dup 2) (match_dup 4))
9111 (set (match_dup 3) (match_dup 5))]
9114 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9116 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9118 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9120 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9121 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9123 else if (GET_CODE (operands[1]) == CONST_INT)
9125 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9126 operands[5] = operands[1];
9133 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9134 (match_operand:TI 1 "input_operand" ""))]
9136 && gpr_or_gpr_p (operands[0], operands[1])"
9138 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9140 (define_expand "load_multiple"
9141 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9142 (match_operand:SI 1 "" ""))
9143 (use (match_operand:SI 2 "" ""))])]
9144 "TARGET_STRING && !TARGET_POWERPC64"
9152 /* Support only loading a constant number of fixed-point registers from
9153 memory and only bother with this if more than two; the machine
9154 doesn't support more than eight. */
9155 if (GET_CODE (operands[2]) != CONST_INT
9156 || INTVAL (operands[2]) <= 2
9157 || INTVAL (operands[2]) > 8
9158 || GET_CODE (operands[1]) != MEM
9159 || GET_CODE (operands[0]) != REG
9160 || REGNO (operands[0]) >= 32)
9163 count = INTVAL (operands[2]);
9164 regno = REGNO (operands[0]);
9166 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9167 op1 = replace_equiv_address (operands[1],
9168 force_reg (SImode, XEXP (operands[1], 0)));
9170 for (i = 0; i < count; i++)
9171 XVECEXP (operands[3], 0, i)
9172 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9173 adjust_address_nv (op1, SImode, i * 4));
9176 (define_insn "*ldmsi8"
9177 [(match_parallel 0 "load_multiple_operation"
9178 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9179 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9180 (set (match_operand:SI 3 "gpc_reg_operand" "")
9181 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9182 (set (match_operand:SI 4 "gpc_reg_operand" "")
9183 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9184 (set (match_operand:SI 5 "gpc_reg_operand" "")
9185 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9186 (set (match_operand:SI 6 "gpc_reg_operand" "")
9187 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9188 (set (match_operand:SI 7 "gpc_reg_operand" "")
9189 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9190 (set (match_operand:SI 8 "gpc_reg_operand" "")
9191 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9192 (set (match_operand:SI 9 "gpc_reg_operand" "")
9193 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9194 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9196 { return rs6000_output_load_multiple (operands); }"
9197 [(set_attr "type" "load_ux")
9198 (set_attr "length" "32")])
9200 (define_insn "*ldmsi7"
9201 [(match_parallel 0 "load_multiple_operation"
9202 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9203 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9204 (set (match_operand:SI 3 "gpc_reg_operand" "")
9205 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9206 (set (match_operand:SI 4 "gpc_reg_operand" "")
9207 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9208 (set (match_operand:SI 5 "gpc_reg_operand" "")
9209 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9210 (set (match_operand:SI 6 "gpc_reg_operand" "")
9211 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9212 (set (match_operand:SI 7 "gpc_reg_operand" "")
9213 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9214 (set (match_operand:SI 8 "gpc_reg_operand" "")
9215 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9216 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9218 { return rs6000_output_load_multiple (operands); }"
9219 [(set_attr "type" "load_ux")
9220 (set_attr "length" "32")])
9222 (define_insn "*ldmsi6"
9223 [(match_parallel 0 "load_multiple_operation"
9224 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9225 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9226 (set (match_operand:SI 3 "gpc_reg_operand" "")
9227 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9228 (set (match_operand:SI 4 "gpc_reg_operand" "")
9229 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9230 (set (match_operand:SI 5 "gpc_reg_operand" "")
9231 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9232 (set (match_operand:SI 6 "gpc_reg_operand" "")
9233 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9234 (set (match_operand:SI 7 "gpc_reg_operand" "")
9235 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9236 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9238 { return rs6000_output_load_multiple (operands); }"
9239 [(set_attr "type" "load_ux")
9240 (set_attr "length" "32")])
9242 (define_insn "*ldmsi5"
9243 [(match_parallel 0 "load_multiple_operation"
9244 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9245 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9246 (set (match_operand:SI 3 "gpc_reg_operand" "")
9247 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9248 (set (match_operand:SI 4 "gpc_reg_operand" "")
9249 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9250 (set (match_operand:SI 5 "gpc_reg_operand" "")
9251 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9252 (set (match_operand:SI 6 "gpc_reg_operand" "")
9253 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9254 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9256 { return rs6000_output_load_multiple (operands); }"
9257 [(set_attr "type" "load_ux")
9258 (set_attr "length" "32")])
9260 (define_insn "*ldmsi4"
9261 [(match_parallel 0 "load_multiple_operation"
9262 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9263 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9264 (set (match_operand:SI 3 "gpc_reg_operand" "")
9265 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9266 (set (match_operand:SI 4 "gpc_reg_operand" "")
9267 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9268 (set (match_operand:SI 5 "gpc_reg_operand" "")
9269 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9270 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9272 { return rs6000_output_load_multiple (operands); }"
9273 [(set_attr "type" "load_ux")
9274 (set_attr "length" "32")])
9276 (define_insn "*ldmsi3"
9277 [(match_parallel 0 "load_multiple_operation"
9278 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9279 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9280 (set (match_operand:SI 3 "gpc_reg_operand" "")
9281 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9282 (set (match_operand:SI 4 "gpc_reg_operand" "")
9283 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9284 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9286 { return rs6000_output_load_multiple (operands); }"
9287 [(set_attr "type" "load_ux")
9288 (set_attr "length" "32")])
9290 (define_expand "store_multiple"
9291 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9292 (match_operand:SI 1 "" ""))
9293 (clobber (scratch:SI))
9294 (use (match_operand:SI 2 "" ""))])]
9295 "TARGET_STRING && !TARGET_POWERPC64"
9304 /* Support only storing a constant number of fixed-point registers to
9305 memory and only bother with this if more than two; the machine
9306 doesn't support more than eight. */
9307 if (GET_CODE (operands[2]) != CONST_INT
9308 || INTVAL (operands[2]) <= 2
9309 || INTVAL (operands[2]) > 8
9310 || GET_CODE (operands[0]) != MEM
9311 || GET_CODE (operands[1]) != REG
9312 || REGNO (operands[1]) >= 32)
9315 count = INTVAL (operands[2]);
9316 regno = REGNO (operands[1]);
9318 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9319 to = force_reg (SImode, XEXP (operands[0], 0));
9320 op0 = replace_equiv_address (operands[0], to);
9322 XVECEXP (operands[3], 0, 0)
9323 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9324 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9325 gen_rtx_SCRATCH (SImode));
9327 for (i = 1; i < count; i++)
9328 XVECEXP (operands[3], 0, i + 1)
9329 = gen_rtx_SET (VOIDmode,
9330 adjust_address_nv (op0, SImode, i * 4),
9331 gen_rtx_REG (SImode, regno + i));
9334 (define_insn "*stmsi8"
9335 [(match_parallel 0 "store_multiple_operation"
9336 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9337 (match_operand:SI 2 "gpc_reg_operand" "r"))
9338 (clobber (match_scratch:SI 3 "=X"))
9339 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9340 (match_operand:SI 4 "gpc_reg_operand" "r"))
9341 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9342 (match_operand:SI 5 "gpc_reg_operand" "r"))
9343 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9344 (match_operand:SI 6 "gpc_reg_operand" "r"))
9345 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9346 (match_operand:SI 7 "gpc_reg_operand" "r"))
9347 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9348 (match_operand:SI 8 "gpc_reg_operand" "r"))
9349 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9350 (match_operand:SI 9 "gpc_reg_operand" "r"))
9351 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9352 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9353 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9354 "{stsi|stswi} %2,%1,%O0"
9355 [(set_attr "type" "store_ux")])
9357 (define_insn "*stmsi7"
9358 [(match_parallel 0 "store_multiple_operation"
9359 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9360 (match_operand:SI 2 "gpc_reg_operand" "r"))
9361 (clobber (match_scratch:SI 3 "=X"))
9362 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9363 (match_operand:SI 4 "gpc_reg_operand" "r"))
9364 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9365 (match_operand:SI 5 "gpc_reg_operand" "r"))
9366 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9367 (match_operand:SI 6 "gpc_reg_operand" "r"))
9368 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9369 (match_operand:SI 7 "gpc_reg_operand" "r"))
9370 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9371 (match_operand:SI 8 "gpc_reg_operand" "r"))
9372 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9373 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9374 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9375 "{stsi|stswi} %2,%1,%O0"
9376 [(set_attr "type" "store_ux")])
9378 (define_insn "*stmsi6"
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 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9390 (match_operand:SI 7 "gpc_reg_operand" "r"))
9391 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9392 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9393 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9394 "{stsi|stswi} %2,%1,%O0"
9395 [(set_attr "type" "store_ux")])
9397 (define_insn "*stmsi5"
9398 [(match_parallel 0 "store_multiple_operation"
9399 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9400 (match_operand:SI 2 "gpc_reg_operand" "r"))
9401 (clobber (match_scratch:SI 3 "=X"))
9402 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9403 (match_operand:SI 4 "gpc_reg_operand" "r"))
9404 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9405 (match_operand:SI 5 "gpc_reg_operand" "r"))
9406 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9407 (match_operand:SI 6 "gpc_reg_operand" "r"))
9408 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9409 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9410 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9411 "{stsi|stswi} %2,%1,%O0"
9412 [(set_attr "type" "store_ux")])
9414 (define_insn "*stmsi4"
9415 [(match_parallel 0 "store_multiple_operation"
9416 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9417 (match_operand:SI 2 "gpc_reg_operand" "r"))
9418 (clobber (match_scratch:SI 3 "=X"))
9419 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9420 (match_operand:SI 4 "gpc_reg_operand" "r"))
9421 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9422 (match_operand:SI 5 "gpc_reg_operand" "r"))
9423 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9424 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9425 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9426 "{stsi|stswi} %2,%1,%O0"
9427 [(set_attr "type" "store_ux")])
9429 (define_insn "*stmsi3"
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 "=X"))
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 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9439 "{stsi|stswi} %2,%1,%O0"
9440 [(set_attr "type" "store_ux")])
9442 (define_insn "*stmsi8_power"
9443 [(match_parallel 0 "store_multiple_operation"
9444 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9445 (match_operand:SI 2 "gpc_reg_operand" "r"))
9446 (clobber (match_scratch:SI 3 "=q"))
9447 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9448 (match_operand:SI 4 "gpc_reg_operand" "r"))
9449 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9450 (match_operand:SI 5 "gpc_reg_operand" "r"))
9451 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9452 (match_operand:SI 6 "gpc_reg_operand" "r"))
9453 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9454 (match_operand:SI 7 "gpc_reg_operand" "r"))
9455 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9456 (match_operand:SI 8 "gpc_reg_operand" "r"))
9457 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9458 (match_operand:SI 9 "gpc_reg_operand" "r"))
9459 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9460 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9461 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9462 "{stsi|stswi} %2,%1,%O0"
9463 [(set_attr "type" "store_ux")])
9465 (define_insn "*stmsi7_power"
9466 [(match_parallel 0 "store_multiple_operation"
9467 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9468 (match_operand:SI 2 "gpc_reg_operand" "r"))
9469 (clobber (match_scratch:SI 3 "=q"))
9470 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9471 (match_operand:SI 4 "gpc_reg_operand" "r"))
9472 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9473 (match_operand:SI 5 "gpc_reg_operand" "r"))
9474 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9475 (match_operand:SI 6 "gpc_reg_operand" "r"))
9476 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9477 (match_operand:SI 7 "gpc_reg_operand" "r"))
9478 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9479 (match_operand:SI 8 "gpc_reg_operand" "r"))
9480 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9481 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9482 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9483 "{stsi|stswi} %2,%1,%O0"
9484 [(set_attr "type" "store_ux")])
9486 (define_insn "*stmsi6_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 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9498 (match_operand:SI 7 "gpc_reg_operand" "r"))
9499 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9500 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9501 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9502 "{stsi|stswi} %2,%1,%O0"
9503 [(set_attr "type" "store_ux")])
9505 (define_insn "*stmsi5_power"
9506 [(match_parallel 0 "store_multiple_operation"
9507 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9508 (match_operand:SI 2 "gpc_reg_operand" "r"))
9509 (clobber (match_scratch:SI 3 "=q"))
9510 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9511 (match_operand:SI 4 "gpc_reg_operand" "r"))
9512 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9513 (match_operand:SI 5 "gpc_reg_operand" "r"))
9514 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9515 (match_operand:SI 6 "gpc_reg_operand" "r"))
9516 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9517 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9518 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9519 "{stsi|stswi} %2,%1,%O0"
9520 [(set_attr "type" "store_ux")])
9522 (define_insn "*stmsi4_power"
9523 [(match_parallel 0 "store_multiple_operation"
9524 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9525 (match_operand:SI 2 "gpc_reg_operand" "r"))
9526 (clobber (match_scratch:SI 3 "=q"))
9527 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9528 (match_operand:SI 4 "gpc_reg_operand" "r"))
9529 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9530 (match_operand:SI 5 "gpc_reg_operand" "r"))
9531 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9532 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9533 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9534 "{stsi|stswi} %2,%1,%O0"
9535 [(set_attr "type" "store_ux")])
9537 (define_insn "*stmsi3_power"
9538 [(match_parallel 0 "store_multiple_operation"
9539 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9540 (match_operand:SI 2 "gpc_reg_operand" "r"))
9541 (clobber (match_scratch:SI 3 "=q"))
9542 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9543 (match_operand:SI 4 "gpc_reg_operand" "r"))
9544 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9545 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9546 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9547 "{stsi|stswi} %2,%1,%O0"
9548 [(set_attr "type" "store_ux")])
9550 (define_expand "setmemsi"
9551 [(parallel [(set (match_operand:BLK 0 "" "")
9552 (match_operand 2 "const_int_operand" ""))
9553 (use (match_operand:SI 1 "" ""))
9554 (use (match_operand:SI 3 "" ""))])]
9558 /* If value to set is not zero, use the library routine. */
9559 if (operands[2] != const0_rtx)
9562 if (expand_block_clear (operands))
9568 ;; String/block move insn.
9569 ;; Argument 0 is the destination
9570 ;; Argument 1 is the source
9571 ;; Argument 2 is the length
9572 ;; Argument 3 is the alignment
9574 (define_expand "movmemsi"
9575 [(parallel [(set (match_operand:BLK 0 "" "")
9576 (match_operand:BLK 1 "" ""))
9577 (use (match_operand:SI 2 "" ""))
9578 (use (match_operand:SI 3 "" ""))])]
9582 if (expand_block_move (operands))
9588 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9589 ;; register allocator doesn't have a clue about allocating 8 word registers.
9590 ;; rD/rS = r5 is preferred, efficient form.
9591 (define_expand "movmemsi_8reg"
9592 [(parallel [(set (match_operand 0 "" "")
9593 (match_operand 1 "" ""))
9594 (use (match_operand 2 "" ""))
9595 (use (match_operand 3 "" ""))
9596 (clobber (reg:SI 5))
9597 (clobber (reg:SI 6))
9598 (clobber (reg:SI 7))
9599 (clobber (reg:SI 8))
9600 (clobber (reg:SI 9))
9601 (clobber (reg:SI 10))
9602 (clobber (reg:SI 11))
9603 (clobber (reg:SI 12))
9604 (clobber (match_scratch:SI 4 ""))])]
9609 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9610 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9611 (use (match_operand:SI 2 "immediate_operand" "i"))
9612 (use (match_operand:SI 3 "immediate_operand" "i"))
9613 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9614 (clobber (reg:SI 6))
9615 (clobber (reg:SI 7))
9616 (clobber (reg:SI 8))
9617 (clobber (reg:SI 9))
9618 (clobber (reg:SI 10))
9619 (clobber (reg:SI 11))
9620 (clobber (reg:SI 12))
9621 (clobber (match_scratch:SI 5 "=q"))]
9622 "TARGET_STRING && TARGET_POWER
9623 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9624 || INTVAL (operands[2]) == 0)
9625 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9626 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9627 && REGNO (operands[4]) == 5"
9628 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9629 [(set_attr "type" "store_ux")
9630 (set_attr "length" "8")])
9633 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9634 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9635 (use (match_operand:SI 2 "immediate_operand" "i"))
9636 (use (match_operand:SI 3 "immediate_operand" "i"))
9637 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9638 (clobber (reg:SI 6))
9639 (clobber (reg:SI 7))
9640 (clobber (reg:SI 8))
9641 (clobber (reg:SI 9))
9642 (clobber (reg:SI 10))
9643 (clobber (reg:SI 11))
9644 (clobber (reg:SI 12))
9645 (clobber (match_scratch:SI 5 "=X"))]
9646 "TARGET_STRING && ! TARGET_POWER
9647 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9648 || INTVAL (operands[2]) == 0)
9649 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9650 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9651 && REGNO (operands[4]) == 5"
9652 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9653 [(set_attr "type" "store_ux")
9654 (set_attr "length" "8")])
9656 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9657 ;; register allocator doesn't have a clue about allocating 6 word registers.
9658 ;; rD/rS = r5 is preferred, efficient form.
9659 (define_expand "movmemsi_6reg"
9660 [(parallel [(set (match_operand 0 "" "")
9661 (match_operand 1 "" ""))
9662 (use (match_operand 2 "" ""))
9663 (use (match_operand 3 "" ""))
9664 (clobber (reg:SI 5))
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 4 ""))])]
9675 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9676 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9677 (use (match_operand:SI 2 "immediate_operand" "i"))
9678 (use (match_operand:SI 3 "immediate_operand" "i"))
9679 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9680 (clobber (reg:SI 6))
9681 (clobber (reg:SI 7))
9682 (clobber (reg:SI 8))
9683 (clobber (reg:SI 9))
9684 (clobber (reg:SI 10))
9685 (clobber (match_scratch:SI 5 "=q"))]
9686 "TARGET_STRING && TARGET_POWER
9687 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9688 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9689 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9690 && REGNO (operands[4]) == 5"
9691 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9692 [(set_attr "type" "store_ux")
9693 (set_attr "length" "8")])
9696 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9697 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9698 (use (match_operand:SI 2 "immediate_operand" "i"))
9699 (use (match_operand:SI 3 "immediate_operand" "i"))
9700 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9701 (clobber (reg:SI 6))
9702 (clobber (reg:SI 7))
9703 (clobber (reg:SI 8))
9704 (clobber (reg:SI 9))
9705 (clobber (reg:SI 10))
9706 (clobber (match_scratch:SI 5 "=X"))]
9707 "TARGET_STRING && ! TARGET_POWER
9708 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9709 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9710 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9711 && REGNO (operands[4]) == 5"
9712 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9713 [(set_attr "type" "store_ux")
9714 (set_attr "length" "8")])
9716 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9717 ;; problems with TImode.
9718 ;; rD/rS = r5 is preferred, efficient form.
9719 (define_expand "movmemsi_4reg"
9720 [(parallel [(set (match_operand 0 "" "")
9721 (match_operand 1 "" ""))
9722 (use (match_operand 2 "" ""))
9723 (use (match_operand 3 "" ""))
9724 (clobber (reg:SI 5))
9725 (clobber (reg:SI 6))
9726 (clobber (reg:SI 7))
9727 (clobber (reg:SI 8))
9728 (clobber (match_scratch:SI 4 ""))])]
9733 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9734 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9735 (use (match_operand:SI 2 "immediate_operand" "i"))
9736 (use (match_operand:SI 3 "immediate_operand" "i"))
9737 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9738 (clobber (reg:SI 6))
9739 (clobber (reg:SI 7))
9740 (clobber (reg:SI 8))
9741 (clobber (match_scratch:SI 5 "=q"))]
9742 "TARGET_STRING && TARGET_POWER
9743 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9744 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9745 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9746 && REGNO (operands[4]) == 5"
9747 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9748 [(set_attr "type" "store_ux")
9749 (set_attr "length" "8")])
9752 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9753 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9754 (use (match_operand:SI 2 "immediate_operand" "i"))
9755 (use (match_operand:SI 3 "immediate_operand" "i"))
9756 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9757 (clobber (reg:SI 6))
9758 (clobber (reg:SI 7))
9759 (clobber (reg:SI 8))
9760 (clobber (match_scratch:SI 5 "=X"))]
9761 "TARGET_STRING && ! TARGET_POWER
9762 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9763 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9764 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9765 && REGNO (operands[4]) == 5"
9766 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9767 [(set_attr "type" "store_ux")
9768 (set_attr "length" "8")])
9770 ;; Move up to 8 bytes at a time.
9771 (define_expand "movmemsi_2reg"
9772 [(parallel [(set (match_operand 0 "" "")
9773 (match_operand 1 "" ""))
9774 (use (match_operand 2 "" ""))
9775 (use (match_operand 3 "" ""))
9776 (clobber (match_scratch:DI 4 ""))
9777 (clobber (match_scratch:SI 5 ""))])]
9778 "TARGET_STRING && ! TARGET_POWERPC64"
9782 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9783 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9784 (use (match_operand:SI 2 "immediate_operand" "i"))
9785 (use (match_operand:SI 3 "immediate_operand" "i"))
9786 (clobber (match_scratch:DI 4 "=&r"))
9787 (clobber (match_scratch:SI 5 "=q"))]
9788 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9789 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9790 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9791 [(set_attr "type" "store_ux")
9792 (set_attr "length" "8")])
9795 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9796 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9797 (use (match_operand:SI 2 "immediate_operand" "i"))
9798 (use (match_operand:SI 3 "immediate_operand" "i"))
9799 (clobber (match_scratch:DI 4 "=&r"))
9800 (clobber (match_scratch:SI 5 "=X"))]
9801 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9802 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9803 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9804 [(set_attr "type" "store_ux")
9805 (set_attr "length" "8")])
9807 ;; Move up to 4 bytes at a time.
9808 (define_expand "movmemsi_1reg"
9809 [(parallel [(set (match_operand 0 "" "")
9810 (match_operand 1 "" ""))
9811 (use (match_operand 2 "" ""))
9812 (use (match_operand 3 "" ""))
9813 (clobber (match_scratch:SI 4 ""))
9814 (clobber (match_scratch:SI 5 ""))])]
9819 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9820 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9821 (use (match_operand:SI 2 "immediate_operand" "i"))
9822 (use (match_operand:SI 3 "immediate_operand" "i"))
9823 (clobber (match_scratch:SI 4 "=&r"))
9824 (clobber (match_scratch:SI 5 "=q"))]
9825 "TARGET_STRING && TARGET_POWER
9826 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9827 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9828 [(set_attr "type" "store_ux")
9829 (set_attr "length" "8")])
9832 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9833 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9834 (use (match_operand:SI 2 "immediate_operand" "i"))
9835 (use (match_operand:SI 3 "immediate_operand" "i"))
9836 (clobber (match_scratch:SI 4 "=&r"))
9837 (clobber (match_scratch:SI 5 "=X"))]
9838 "TARGET_STRING && ! TARGET_POWER
9839 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9840 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9841 [(set_attr "type" "store_ux")
9842 (set_attr "length" "8")])
9844 ;; Define insns that do load or store with update. Some of these we can
9845 ;; get by using pre-decrement or pre-increment, but the hardware can also
9846 ;; do cases where the increment is not the size of the object.
9848 ;; In all these cases, we use operands 0 and 1 for the register being
9849 ;; incremented because those are the operands that local-alloc will
9850 ;; tie and these are the pair most likely to be tieable (and the ones
9851 ;; that will benefit the most).
9853 (define_insn "*movdi_update1"
9854 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9855 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9856 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9857 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9858 (plus:DI (match_dup 1) (match_dup 2)))]
9859 "TARGET_POWERPC64 && TARGET_UPDATE"
9863 [(set_attr "type" "load_ux,load_u")])
9865 (define_insn "movdi_<mode>_update"
9866 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9867 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9868 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9869 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9870 (plus:P (match_dup 1) (match_dup 2)))]
9871 "TARGET_POWERPC64 && TARGET_UPDATE"
9875 [(set_attr "type" "store_ux,store_u")])
9877 (define_insn "*movsi_update1"
9878 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9879 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9880 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9881 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9882 (plus:SI (match_dup 1) (match_dup 2)))]
9885 {lux|lwzux} %3,%0,%2
9886 {lu|lwzu} %3,%2(%0)"
9887 [(set_attr "type" "load_ux,load_u")])
9889 (define_insn "*movsi_update2"
9890 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9892 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9893 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9894 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9895 (plus:DI (match_dup 1) (match_dup 2)))]
9898 [(set_attr "type" "load_ext_ux")])
9900 (define_insn "movsi_update"
9901 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9902 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9903 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9904 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9905 (plus:SI (match_dup 1) (match_dup 2)))]
9908 {stux|stwux} %3,%0,%2
9909 {stu|stwu} %3,%2(%0)"
9910 [(set_attr "type" "store_ux,store_u")])
9912 (define_insn "*movhi_update1"
9913 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9914 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9915 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9916 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9917 (plus:SI (match_dup 1) (match_dup 2)))]
9922 [(set_attr "type" "load_ux,load_u")])
9924 (define_insn "*movhi_update2"
9925 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9927 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9928 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9929 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9930 (plus:SI (match_dup 1) (match_dup 2)))]
9935 [(set_attr "type" "load_ux,load_u")])
9937 (define_insn "*movhi_update3"
9938 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9940 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9941 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9942 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9943 (plus:SI (match_dup 1) (match_dup 2)))]
9948 [(set_attr "type" "load_ext_ux,load_ext_u")])
9950 (define_insn "*movhi_update4"
9951 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9952 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9953 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9954 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9955 (plus:SI (match_dup 1) (match_dup 2)))]
9960 [(set_attr "type" "store_ux,store_u")])
9962 (define_insn "*movqi_update1"
9963 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9964 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9965 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9966 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9967 (plus:SI (match_dup 1) (match_dup 2)))]
9972 [(set_attr "type" "load_ux,load_u")])
9974 (define_insn "*movqi_update2"
9975 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9977 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9978 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9979 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9980 (plus:SI (match_dup 1) (match_dup 2)))]
9985 [(set_attr "type" "load_ux,load_u")])
9987 (define_insn "*movqi_update3"
9988 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9989 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9990 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9991 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9992 (plus:SI (match_dup 1) (match_dup 2)))]
9997 [(set_attr "type" "store_ux,store_u")])
9999 (define_insn "*movsf_update1"
10000 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10001 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10002 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10003 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10004 (plus:SI (match_dup 1) (match_dup 2)))]
10005 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10009 [(set_attr "type" "fpload_ux,fpload_u")])
10011 (define_insn "*movsf_update2"
10012 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10013 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10014 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
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" "fpstore_ux,fpstore_u")])
10023 (define_insn "*movsf_update3"
10024 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10025 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10026 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10027 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10028 (plus:SI (match_dup 1) (match_dup 2)))]
10029 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10031 {lux|lwzux} %3,%0,%2
10032 {lu|lwzu} %3,%2(%0)"
10033 [(set_attr "type" "load_ux,load_u")])
10035 (define_insn "*movsf_update4"
10036 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10037 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10038 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10039 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10040 (plus:SI (match_dup 1) (match_dup 2)))]
10041 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10043 {stux|stwux} %3,%0,%2
10044 {stu|stwu} %3,%2(%0)"
10045 [(set_attr "type" "store_ux,store_u")])
10047 (define_insn "*movdf_update1"
10048 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10049 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10050 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10051 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10052 (plus:SI (match_dup 1) (match_dup 2)))]
10053 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10057 [(set_attr "type" "fpload_ux,fpload_u")])
10059 (define_insn "*movdf_update2"
10060 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10061 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10062 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10063 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10064 (plus:SI (match_dup 1) (match_dup 2)))]
10065 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10069 [(set_attr "type" "fpstore_ux,fpstore_u")])
10071 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10073 (define_insn "*lfq_power2"
10074 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10075 (match_operand:V2DF 1 "memory_operand" ""))]
10077 && TARGET_HARD_FLOAT && TARGET_FPRS"
10081 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10082 (match_operand:DF 1 "memory_operand" ""))
10083 (set (match_operand:DF 2 "gpc_reg_operand" "")
10084 (match_operand:DF 3 "memory_operand" ""))]
10086 && TARGET_HARD_FLOAT && TARGET_FPRS
10087 && registers_ok_for_quad_peep (operands[0], operands[2])
10088 && mems_ok_for_quad_peep (operands[1], operands[3])"
10089 [(set (match_dup 0)
10091 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10092 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10094 (define_insn "*stfq_power2"
10095 [(set (match_operand:V2DF 0 "memory_operand" "")
10096 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10098 && TARGET_HARD_FLOAT && TARGET_FPRS"
10099 "stfq%U0%X0 %1,%0")
10103 [(set (match_operand:DF 0 "memory_operand" "")
10104 (match_operand:DF 1 "gpc_reg_operand" ""))
10105 (set (match_operand:DF 2 "memory_operand" "")
10106 (match_operand:DF 3 "gpc_reg_operand" ""))]
10108 && TARGET_HARD_FLOAT && TARGET_FPRS
10109 && registers_ok_for_quad_peep (operands[1], operands[3])
10110 && mems_ok_for_quad_peep (operands[0], operands[2])"
10111 [(set (match_dup 0)
10113 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10114 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10116 ;; After inserting conditional returns we can sometimes have
10117 ;; unnecessary register moves. Unfortunately we cannot have a
10118 ;; modeless peephole here, because some single SImode sets have early
10119 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10120 ;; sequences, using get_attr_length here will smash the operands
10121 ;; array. Neither is there an early_cobbler_p predicate.
10122 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10124 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10125 (match_operand:DF 1 "any_operand" ""))
10126 (set (match_operand:DF 2 "gpc_reg_operand" "")
10128 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10129 && peep2_reg_dead_p (2, operands[0])"
10130 [(set (match_dup 2) (match_dup 1))])
10133 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10134 (match_operand:SF 1 "any_operand" ""))
10135 (set (match_operand:SF 2 "gpc_reg_operand" "")
10137 "peep2_reg_dead_p (2, operands[0])"
10138 [(set (match_dup 2) (match_dup 1))])
10143 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
10144 (define_insn "tls_gd_32"
10145 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10146 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10147 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10149 "HAVE_AS_TLS && !TARGET_64BIT"
10150 "addi %0,%1,%2@got@tlsgd")
10152 (define_insn "tls_gd_64"
10153 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10154 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10155 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10157 "HAVE_AS_TLS && TARGET_64BIT"
10158 "addi %0,%1,%2@got@tlsgd")
10160 (define_insn "tls_ld_32"
10161 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10162 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
10164 "HAVE_AS_TLS && !TARGET_64BIT"
10165 "addi %0,%1,%&@got@tlsld")
10167 (define_insn "tls_ld_64"
10168 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10169 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
10171 "HAVE_AS_TLS && TARGET_64BIT"
10172 "addi %0,%1,%&@got@tlsld")
10174 (define_insn "tls_dtprel_32"
10175 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10176 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10177 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10178 UNSPEC_TLSDTPREL))]
10179 "HAVE_AS_TLS && !TARGET_64BIT"
10180 "addi %0,%1,%2@dtprel")
10182 (define_insn "tls_dtprel_64"
10183 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10184 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10185 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10186 UNSPEC_TLSDTPREL))]
10187 "HAVE_AS_TLS && TARGET_64BIT"
10188 "addi %0,%1,%2@dtprel")
10190 (define_insn "tls_dtprel_ha_32"
10191 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10192 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10193 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10194 UNSPEC_TLSDTPRELHA))]
10195 "HAVE_AS_TLS && !TARGET_64BIT"
10196 "addis %0,%1,%2@dtprel@ha")
10198 (define_insn "tls_dtprel_ha_64"
10199 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10200 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10201 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10202 UNSPEC_TLSDTPRELHA))]
10203 "HAVE_AS_TLS && TARGET_64BIT"
10204 "addis %0,%1,%2@dtprel@ha")
10206 (define_insn "tls_dtprel_lo_32"
10207 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10208 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10209 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10210 UNSPEC_TLSDTPRELLO))]
10211 "HAVE_AS_TLS && !TARGET_64BIT"
10212 "addi %0,%1,%2@dtprel@l")
10214 (define_insn "tls_dtprel_lo_64"
10215 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10216 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10217 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10218 UNSPEC_TLSDTPRELLO))]
10219 "HAVE_AS_TLS && TARGET_64BIT"
10220 "addi %0,%1,%2@dtprel@l")
10222 (define_insn "tls_got_dtprel_32"
10223 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10224 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10225 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10226 UNSPEC_TLSGOTDTPREL))]
10227 "HAVE_AS_TLS && !TARGET_64BIT"
10228 "lwz %0,%2@got@dtprel(%1)")
10230 (define_insn "tls_got_dtprel_64"
10231 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10232 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10233 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10234 UNSPEC_TLSGOTDTPREL))]
10235 "HAVE_AS_TLS && TARGET_64BIT"
10236 "ld %0,%2@got@dtprel(%1)")
10238 (define_insn "tls_tprel_32"
10239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10240 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10241 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10243 "HAVE_AS_TLS && !TARGET_64BIT"
10244 "addi %0,%1,%2@tprel")
10246 (define_insn "tls_tprel_64"
10247 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10248 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10249 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10251 "HAVE_AS_TLS && TARGET_64BIT"
10252 "addi %0,%1,%2@tprel")
10254 (define_insn "tls_tprel_ha_32"
10255 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10256 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10257 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10258 UNSPEC_TLSTPRELHA))]
10259 "HAVE_AS_TLS && !TARGET_64BIT"
10260 "addis %0,%1,%2@tprel@ha")
10262 (define_insn "tls_tprel_ha_64"
10263 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10264 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10265 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10266 UNSPEC_TLSTPRELHA))]
10267 "HAVE_AS_TLS && TARGET_64BIT"
10268 "addis %0,%1,%2@tprel@ha")
10270 (define_insn "tls_tprel_lo_32"
10271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10272 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10273 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10274 UNSPEC_TLSTPRELLO))]
10275 "HAVE_AS_TLS && !TARGET_64BIT"
10276 "addi %0,%1,%2@tprel@l")
10278 (define_insn "tls_tprel_lo_64"
10279 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10280 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10281 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10282 UNSPEC_TLSTPRELLO))]
10283 "HAVE_AS_TLS && TARGET_64BIT"
10284 "addi %0,%1,%2@tprel@l")
10286 ;; "b" output constraint here and on tls_tls input to support linker tls
10287 ;; optimization. The linker may edit the instructions emitted by a
10288 ;; tls_got_tprel/tls_tls pair to addis,addi.
10289 (define_insn "tls_got_tprel_32"
10290 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10291 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10292 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10293 UNSPEC_TLSGOTTPREL))]
10294 "HAVE_AS_TLS && !TARGET_64BIT"
10295 "lwz %0,%2@got@tprel(%1)")
10297 (define_insn "tls_got_tprel_64"
10298 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10299 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10300 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10301 UNSPEC_TLSGOTTPREL))]
10302 "HAVE_AS_TLS && TARGET_64BIT"
10303 "ld %0,%2@got@tprel(%1)")
10305 (define_insn "tls_tls_32"
10306 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10307 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10308 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10310 "HAVE_AS_TLS && !TARGET_64BIT"
10311 "add %0,%1,%2@tls")
10313 (define_insn "tls_tls_64"
10314 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10315 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10316 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10318 "HAVE_AS_TLS && TARGET_64BIT"
10319 "add %0,%1,%2@tls")
10321 ;; Next come insns related to the calling sequence.
10323 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10324 ;; We move the back-chain and decrement the stack pointer.
10326 (define_expand "allocate_stack"
10327 [(set (match_operand 0 "gpc_reg_operand" "")
10328 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10330 (minus (reg 1) (match_dup 1)))]
10333 { rtx chain = gen_reg_rtx (Pmode);
10334 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10337 emit_move_insn (chain, stack_bot);
10339 /* Check stack bounds if necessary. */
10340 if (current_function_limit_stack)
10343 available = expand_binop (Pmode, sub_optab,
10344 stack_pointer_rtx, stack_limit_rtx,
10345 NULL_RTX, 1, OPTAB_WIDEN);
10346 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10349 if (GET_CODE (operands[1]) != CONST_INT
10350 || INTVAL (operands[1]) < -32767
10351 || INTVAL (operands[1]) > 32768)
10353 neg_op0 = gen_reg_rtx (Pmode);
10355 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10357 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10360 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10363 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10364 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10368 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10369 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10370 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10373 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10377 ;; These patterns say how to save and restore the stack pointer. We need not
10378 ;; save the stack pointer at function level since we are careful to
10379 ;; preserve the backchain. At block level, we have to restore the backchain
10380 ;; when we restore the stack pointer.
10382 ;; For nonlocal gotos, we must save both the stack pointer and its
10383 ;; backchain and restore both. Note that in the nonlocal case, the
10384 ;; save area is a memory location.
10386 (define_expand "save_stack_function"
10387 [(match_operand 0 "any_operand" "")
10388 (match_operand 1 "any_operand" "")]
10392 (define_expand "restore_stack_function"
10393 [(match_operand 0 "any_operand" "")
10394 (match_operand 1 "any_operand" "")]
10398 ;; Adjust stack pointer (op0) to a new value (op1).
10399 ;; First copy old stack backchain to new location, and ensure that the
10400 ;; scheduler won't reorder the sp assignment before the backchain write.
10401 (define_expand "restore_stack_block"
10402 [(set (match_dup 2) (match_dup 3))
10403 (set (match_dup 4) (match_dup 2))
10404 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10405 (set (match_operand 0 "register_operand" "")
10406 (match_operand 1 "register_operand" ""))]
10410 operands[2] = gen_reg_rtx (Pmode);
10411 operands[3] = gen_frame_mem (Pmode, operands[0]);
10412 operands[4] = gen_frame_mem (Pmode, operands[1]);
10413 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10416 (define_expand "save_stack_nonlocal"
10417 [(set (match_dup 3) (match_dup 4))
10418 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10419 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10423 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10425 /* Copy the backchain to the first word, sp to the second. */
10426 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10427 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10428 operands[3] = gen_reg_rtx (Pmode);
10429 operands[4] = gen_frame_mem (Pmode, operands[1]);
10432 (define_expand "restore_stack_nonlocal"
10433 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10434 (set (match_dup 3) (match_dup 4))
10435 (set (match_dup 5) (match_dup 2))
10436 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10437 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10441 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10443 /* Restore the backchain from the first word, sp from the second. */
10444 operands[2] = gen_reg_rtx (Pmode);
10445 operands[3] = gen_reg_rtx (Pmode);
10446 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10447 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10448 operands[5] = gen_frame_mem (Pmode, operands[3]);
10449 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10452 ;; TOC register handling.
10454 ;; Code to initialize the TOC register...
10456 (define_insn "load_toc_aix_si"
10457 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10458 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10459 (use (reg:SI 2))])]
10460 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10464 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10465 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10466 operands[2] = gen_rtx_REG (Pmode, 2);
10467 return \"{l|lwz} %0,%1(%2)\";
10469 [(set_attr "type" "load")])
10471 (define_insn "load_toc_aix_di"
10472 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10473 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10474 (use (reg:DI 2))])]
10475 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10479 #ifdef TARGET_RELOCATABLE
10480 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10481 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10483 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10486 strcat (buf, \"@toc\");
10487 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10488 operands[2] = gen_rtx_REG (Pmode, 2);
10489 return \"ld %0,%1(%2)\";
10491 [(set_attr "type" "load")])
10493 (define_insn "load_toc_v4_pic_si"
10495 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10496 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10497 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10498 [(set_attr "type" "branch")
10499 (set_attr "length" "4")])
10501 (define_insn "load_toc_v4_PIC_1"
10503 (match_operand:SI 0 "immediate_operand" "s"))
10504 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10505 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10506 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10507 "bcl 20,31,%0\\n%0:"
10508 [(set_attr "type" "branch")
10509 (set_attr "length" "4")])
10511 (define_insn "load_toc_v4_PIC_1b"
10513 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
10515 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10516 "bcl 20,31,$+8\\n\\t.long %0-$"
10517 [(set_attr "type" "branch")
10518 (set_attr "length" "8")])
10520 (define_insn "load_toc_v4_PIC_2"
10521 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10522 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10523 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10524 (match_operand:SI 3 "immediate_operand" "s")))))]
10525 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10526 "{l|lwz} %0,%2-%3(%1)"
10527 [(set_attr "type" "load")])
10529 (define_insn "load_toc_v4_PIC_3b"
10530 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10531 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10533 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10534 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10535 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10536 "{cau|addis} %0,%1,%2-%3@ha")
10538 (define_insn "load_toc_v4_PIC_3c"
10539 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10540 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10541 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10542 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10543 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10544 "{cal|addi} %0,%1,%2-%3@l")
10546 ;; If the TOC is shared over a translation unit, as happens with all
10547 ;; the kinds of PIC that we support, we need to restore the TOC
10548 ;; pointer only when jumping over units of translation.
10549 ;; On Darwin, we need to reload the picbase.
10551 (define_expand "builtin_setjmp_receiver"
10552 [(use (label_ref (match_operand 0 "" "")))]
10553 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10554 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10555 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10559 if (DEFAULT_ABI == ABI_DARWIN)
10561 const char *picbase = machopic_function_base_name ();
10562 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10563 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10567 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10568 CODE_LABEL_NUMBER (operands[0]));
10569 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10571 emit_insn (gen_load_macho_picbase (tmplabrtx));
10572 emit_move_insn (picreg, gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM));
10573 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10577 rs6000_emit_load_toc_table (FALSE);
10581 ;; Elf specific ways of loading addresses for non-PIC code.
10582 ;; The output of this could be r0, but we make a very strong
10583 ;; preference for a base register because it will usually
10584 ;; be needed there.
10585 (define_insn "elf_high"
10586 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10587 (high:SI (match_operand 1 "" "")))]
10588 "TARGET_ELF && ! TARGET_64BIT"
10589 "{liu|lis} %0,%1@ha")
10591 (define_insn "elf_low"
10592 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10593 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10594 (match_operand 2 "" "")))]
10595 "TARGET_ELF && ! TARGET_64BIT"
10597 {cal|la} %0,%2@l(%1)
10598 {ai|addic} %0,%1,%K2")
10600 ;; A function pointer under AIX is a pointer to a data area whose first word
10601 ;; contains the actual address of the function, whose second word contains a
10602 ;; pointer to its TOC, and whose third word contains a value to place in the
10603 ;; static chain register (r11). Note that if we load the static chain, our
10604 ;; "trampoline" need not have any executable code.
10606 (define_expand "call_indirect_aix32"
10607 [(set (match_dup 2)
10608 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10609 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10612 (mem:SI (plus:SI (match_dup 0)
10615 (mem:SI (plus:SI (match_dup 0)
10617 (parallel [(call (mem:SI (match_dup 2))
10618 (match_operand 1 "" ""))
10622 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10623 (clobber (reg:SI 65))])]
10626 { operands[2] = gen_reg_rtx (SImode); }")
10628 (define_expand "call_indirect_aix64"
10629 [(set (match_dup 2)
10630 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10631 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10634 (mem:DI (plus:DI (match_dup 0)
10637 (mem:DI (plus:DI (match_dup 0)
10639 (parallel [(call (mem:SI (match_dup 2))
10640 (match_operand 1 "" ""))
10644 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10645 (clobber (reg:SI 65))])]
10648 { operands[2] = gen_reg_rtx (DImode); }")
10650 (define_expand "call_value_indirect_aix32"
10651 [(set (match_dup 3)
10652 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10653 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10656 (mem:SI (plus:SI (match_dup 1)
10659 (mem:SI (plus:SI (match_dup 1)
10661 (parallel [(set (match_operand 0 "" "")
10662 (call (mem:SI (match_dup 3))
10663 (match_operand 2 "" "")))
10667 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10668 (clobber (reg:SI 65))])]
10671 { operands[3] = gen_reg_rtx (SImode); }")
10673 (define_expand "call_value_indirect_aix64"
10674 [(set (match_dup 3)
10675 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10676 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10679 (mem:DI (plus:DI (match_dup 1)
10682 (mem:DI (plus:DI (match_dup 1)
10684 (parallel [(set (match_operand 0 "" "")
10685 (call (mem:SI (match_dup 3))
10686 (match_operand 2 "" "")))
10690 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10691 (clobber (reg:SI 65))])]
10694 { operands[3] = gen_reg_rtx (DImode); }")
10696 ;; Now the definitions for the call and call_value insns
10697 (define_expand "call"
10698 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10699 (match_operand 1 "" ""))
10700 (use (match_operand 2 "" ""))
10701 (clobber (reg:SI 65))])]
10706 if (MACHOPIC_INDIRECT)
10707 operands[0] = machopic_indirect_call_target (operands[0]);
10710 gcc_assert (GET_CODE (operands[0]) == MEM);
10711 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10713 operands[0] = XEXP (operands[0], 0);
10715 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10717 && GET_CODE (operands[0]) == SYMBOL_REF
10718 && !SYMBOL_REF_LOCAL_P (operands[0]))
10723 tmp = gen_rtvec (3,
10724 gen_rtx_CALL (VOIDmode,
10725 gen_rtx_MEM (SImode, operands[0]),
10727 gen_rtx_USE (VOIDmode, operands[2]),
10728 gen_rtx_CLOBBER (VOIDmode,
10729 gen_rtx_REG (Pmode,
10730 LINK_REGISTER_REGNUM)));
10731 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10732 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10736 if (GET_CODE (operands[0]) != SYMBOL_REF
10737 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10738 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10740 if (INTVAL (operands[2]) & CALL_LONG)
10741 operands[0] = rs6000_longcall_ref (operands[0]);
10743 switch (DEFAULT_ABI)
10747 operands[0] = force_reg (Pmode, operands[0]);
10751 /* AIX function pointers are really pointers to a three word
10753 emit_call_insn (TARGET_32BIT
10754 ? gen_call_indirect_aix32 (force_reg (SImode,
10757 : gen_call_indirect_aix64 (force_reg (DImode,
10763 gcc_unreachable ();
10768 (define_expand "call_value"
10769 [(parallel [(set (match_operand 0 "" "")
10770 (call (mem:SI (match_operand 1 "address_operand" ""))
10771 (match_operand 2 "" "")))
10772 (use (match_operand 3 "" ""))
10773 (clobber (reg:SI 65))])]
10778 if (MACHOPIC_INDIRECT)
10779 operands[1] = machopic_indirect_call_target (operands[1]);
10782 gcc_assert (GET_CODE (operands[1]) == MEM);
10783 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10785 operands[1] = XEXP (operands[1], 0);
10787 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10789 && GET_CODE (operands[1]) == SYMBOL_REF
10790 && !SYMBOL_REF_LOCAL_P (operands[1]))
10795 tmp = gen_rtvec (3,
10796 gen_rtx_SET (VOIDmode,
10798 gen_rtx_CALL (VOIDmode,
10799 gen_rtx_MEM (SImode,
10802 gen_rtx_USE (VOIDmode, operands[3]),
10803 gen_rtx_CLOBBER (VOIDmode,
10804 gen_rtx_REG (Pmode,
10805 LINK_REGISTER_REGNUM)));
10806 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10807 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10811 if (GET_CODE (operands[1]) != SYMBOL_REF
10812 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10813 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10815 if (INTVAL (operands[3]) & CALL_LONG)
10816 operands[1] = rs6000_longcall_ref (operands[1]);
10818 switch (DEFAULT_ABI)
10822 operands[1] = force_reg (Pmode, operands[1]);
10826 /* AIX function pointers are really pointers to a three word
10828 emit_call_insn (TARGET_32BIT
10829 ? gen_call_value_indirect_aix32 (operands[0],
10833 : gen_call_value_indirect_aix64 (operands[0],
10840 gcc_unreachable ();
10845 ;; Call to function in current module. No TOC pointer reload needed.
10846 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10847 ;; either the function was not prototyped, or it was prototyped as a
10848 ;; variable argument function. It is > 0 if FP registers were passed
10849 ;; and < 0 if they were not.
10851 (define_insn "*call_local32"
10852 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10853 (match_operand 1 "" "g,g"))
10854 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10855 (clobber (reg:SI 65))]
10856 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10859 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10860 output_asm_insn (\"crxor 6,6,6\", operands);
10862 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10863 output_asm_insn (\"creqv 6,6,6\", operands);
10865 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10867 [(set_attr "type" "branch")
10868 (set_attr "length" "4,8")])
10870 (define_insn "*call_local64"
10871 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10872 (match_operand 1 "" "g,g"))
10873 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10874 (clobber (reg:SI 65))]
10875 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10878 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10879 output_asm_insn (\"crxor 6,6,6\", operands);
10881 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10882 output_asm_insn (\"creqv 6,6,6\", operands);
10884 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10886 [(set_attr "type" "branch")
10887 (set_attr "length" "4,8")])
10889 (define_insn "*call_value_local32"
10890 [(set (match_operand 0 "" "")
10891 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10892 (match_operand 2 "" "g,g")))
10893 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10894 (clobber (reg:SI 65))]
10895 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10898 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10899 output_asm_insn (\"crxor 6,6,6\", operands);
10901 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10902 output_asm_insn (\"creqv 6,6,6\", operands);
10904 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10906 [(set_attr "type" "branch")
10907 (set_attr "length" "4,8")])
10910 (define_insn "*call_value_local64"
10911 [(set (match_operand 0 "" "")
10912 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10913 (match_operand 2 "" "g,g")))
10914 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10915 (clobber (reg:SI 65))]
10916 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10919 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10920 output_asm_insn (\"crxor 6,6,6\", operands);
10922 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10923 output_asm_insn (\"creqv 6,6,6\", operands);
10925 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10927 [(set_attr "type" "branch")
10928 (set_attr "length" "4,8")])
10930 ;; Call to function which may be in another module. Restore the TOC
10931 ;; pointer (r2) after the call unless this is System V.
10932 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10933 ;; either the function was not prototyped, or it was prototyped as a
10934 ;; variable argument function. It is > 0 if FP registers were passed
10935 ;; and < 0 if they were not.
10937 (define_insn "*call_indirect_nonlocal_aix32"
10938 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10939 (match_operand 1 "" "g,g"))
10943 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10944 (clobber (reg:SI 65))]
10945 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10946 "b%T0l\;{l|lwz} 2,20(1)"
10947 [(set_attr "type" "jmpreg")
10948 (set_attr "length" "8")])
10950 (define_insn "*call_nonlocal_aix32"
10951 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10952 (match_operand 1 "" "g"))
10953 (use (match_operand:SI 2 "immediate_operand" "O"))
10954 (clobber (reg:SI 65))]
10956 && DEFAULT_ABI == ABI_AIX
10957 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10959 [(set_attr "type" "branch")
10960 (set_attr "length" "8")])
10962 (define_insn "*call_indirect_nonlocal_aix64"
10963 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10964 (match_operand 1 "" "g,g"))
10968 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10969 (clobber (reg:SI 65))]
10970 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10971 "b%T0l\;ld 2,40(1)"
10972 [(set_attr "type" "jmpreg")
10973 (set_attr "length" "8")])
10975 (define_insn "*call_nonlocal_aix64"
10976 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10977 (match_operand 1 "" "g"))
10978 (use (match_operand:SI 2 "immediate_operand" "O"))
10979 (clobber (reg:SI 65))]
10981 && DEFAULT_ABI == ABI_AIX
10982 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10984 [(set_attr "type" "branch")
10985 (set_attr "length" "8")])
10987 (define_insn "*call_value_indirect_nonlocal_aix32"
10988 [(set (match_operand 0 "" "")
10989 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10990 (match_operand 2 "" "g,g")))
10994 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10995 (clobber (reg:SI 65))]
10996 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10997 "b%T1l\;{l|lwz} 2,20(1)"
10998 [(set_attr "type" "jmpreg")
10999 (set_attr "length" "8")])
11001 (define_insn "*call_value_nonlocal_aix32"
11002 [(set (match_operand 0 "" "")
11003 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11004 (match_operand 2 "" "g")))
11005 (use (match_operand:SI 3 "immediate_operand" "O"))
11006 (clobber (reg:SI 65))]
11008 && DEFAULT_ABI == ABI_AIX
11009 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11011 [(set_attr "type" "branch")
11012 (set_attr "length" "8")])
11014 (define_insn "*call_value_indirect_nonlocal_aix64"
11015 [(set (match_operand 0 "" "")
11016 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11017 (match_operand 2 "" "g,g")))
11021 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11022 (clobber (reg:SI 65))]
11023 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11024 "b%T1l\;ld 2,40(1)"
11025 [(set_attr "type" "jmpreg")
11026 (set_attr "length" "8")])
11028 (define_insn "*call_value_nonlocal_aix64"
11029 [(set (match_operand 0 "" "")
11030 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11031 (match_operand 2 "" "g")))
11032 (use (match_operand:SI 3 "immediate_operand" "O"))
11033 (clobber (reg:SI 65))]
11035 && DEFAULT_ABI == ABI_AIX
11036 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11038 [(set_attr "type" "branch")
11039 (set_attr "length" "8")])
11041 ;; A function pointer under System V is just a normal pointer
11042 ;; operands[0] is the function pointer
11043 ;; operands[1] is the stack size to clean up
11044 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11045 ;; which indicates how to set cr1
11047 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11048 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11049 (match_operand 1 "" "g,g,g,g"))
11050 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11051 (clobber (reg:SI 65))]
11052 "DEFAULT_ABI == ABI_V4
11053 || DEFAULT_ABI == ABI_DARWIN"
11055 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11056 output_asm_insn ("crxor 6,6,6", operands);
11058 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11059 output_asm_insn ("creqv 6,6,6", operands);
11063 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11064 (set_attr "length" "4,4,8,8")])
11066 (define_insn "*call_nonlocal_sysv<mode>"
11067 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11068 (match_operand 1 "" "g,g"))
11069 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11070 (clobber (reg:SI 65))]
11071 "(DEFAULT_ABI == ABI_DARWIN
11072 || (DEFAULT_ABI == ABI_V4
11073 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11075 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11076 output_asm_insn ("crxor 6,6,6", operands);
11078 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11079 output_asm_insn ("creqv 6,6,6", operands);
11082 return output_call(insn, operands, 0, 2);
11084 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11086 if (TARGET_SECURE_PLT && flag_pic == 2)
11087 /* The magic 32768 offset here and in the other sysv call insns
11088 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11089 See sysv4.h:toc_section. */
11090 return "bl %z0+32768@plt";
11092 return "bl %z0@plt";
11098 [(set_attr "type" "branch,branch")
11099 (set_attr "length" "4,8")])
11101 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11102 [(set (match_operand 0 "" "")
11103 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11104 (match_operand 2 "" "g,g,g,g")))
11105 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11106 (clobber (reg:SI 65))]
11107 "DEFAULT_ABI == ABI_V4
11108 || DEFAULT_ABI == ABI_DARWIN"
11110 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11111 output_asm_insn ("crxor 6,6,6", operands);
11113 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11114 output_asm_insn ("creqv 6,6,6", operands);
11118 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11119 (set_attr "length" "4,4,8,8")])
11121 (define_insn "*call_value_nonlocal_sysv<mode>"
11122 [(set (match_operand 0 "" "")
11123 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11124 (match_operand 2 "" "g,g")))
11125 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11126 (clobber (reg:SI 65))]
11127 "(DEFAULT_ABI == ABI_DARWIN
11128 || (DEFAULT_ABI == ABI_V4
11129 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11131 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11132 output_asm_insn ("crxor 6,6,6", operands);
11134 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11135 output_asm_insn ("creqv 6,6,6", operands);
11138 return output_call(insn, operands, 1, 3);
11140 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11142 if (TARGET_SECURE_PLT && flag_pic == 2)
11143 return "bl %z1+32768@plt";
11145 return "bl %z1@plt";
11151 [(set_attr "type" "branch,branch")
11152 (set_attr "length" "4,8")])
11154 ;; Call subroutine returning any type.
11155 (define_expand "untyped_call"
11156 [(parallel [(call (match_operand 0 "" "")
11158 (match_operand 1 "" "")
11159 (match_operand 2 "" "")])]
11165 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11167 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11169 rtx set = XVECEXP (operands[2], 0, i);
11170 emit_move_insn (SET_DEST (set), SET_SRC (set));
11173 /* The optimizer does not know that the call sets the function value
11174 registers we stored in the result block. We avoid problems by
11175 claiming that all hard registers are used and clobbered at this
11177 emit_insn (gen_blockage ());
11182 ;; sibling call patterns
11183 (define_expand "sibcall"
11184 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11185 (match_operand 1 "" ""))
11186 (use (match_operand 2 "" ""))
11193 if (MACHOPIC_INDIRECT)
11194 operands[0] = machopic_indirect_call_target (operands[0]);
11197 gcc_assert (GET_CODE (operands[0]) == MEM);
11198 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11200 operands[0] = XEXP (operands[0], 0);
11203 ;; this and similar patterns must be marked as using LR, otherwise
11204 ;; dataflow will try to delete the store into it. This is true
11205 ;; even when the actual reg to jump to is in CTR, when LR was
11206 ;; saved and restored around the PIC-setting BCL.
11207 (define_insn "*sibcall_local32"
11208 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11209 (match_operand 1 "" "g,g"))
11210 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11213 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11216 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11217 output_asm_insn (\"crxor 6,6,6\", operands);
11219 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11220 output_asm_insn (\"creqv 6,6,6\", operands);
11222 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11224 [(set_attr "type" "branch")
11225 (set_attr "length" "4,8")])
11227 (define_insn "*sibcall_local64"
11228 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11229 (match_operand 1 "" "g,g"))
11230 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11233 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11236 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11237 output_asm_insn (\"crxor 6,6,6\", operands);
11239 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11240 output_asm_insn (\"creqv 6,6,6\", operands);
11242 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11244 [(set_attr "type" "branch")
11245 (set_attr "length" "4,8")])
11247 (define_insn "*sibcall_value_local32"
11248 [(set (match_operand 0 "" "")
11249 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11250 (match_operand 2 "" "g,g")))
11251 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11254 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11257 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11258 output_asm_insn (\"crxor 6,6,6\", operands);
11260 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11261 output_asm_insn (\"creqv 6,6,6\", operands);
11263 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11265 [(set_attr "type" "branch")
11266 (set_attr "length" "4,8")])
11269 (define_insn "*sibcall_value_local64"
11270 [(set (match_operand 0 "" "")
11271 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11272 (match_operand 2 "" "g,g")))
11273 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11276 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11279 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11280 output_asm_insn (\"crxor 6,6,6\", operands);
11282 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11283 output_asm_insn (\"creqv 6,6,6\", operands);
11285 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11287 [(set_attr "type" "branch")
11288 (set_attr "length" "4,8")])
11290 (define_insn "*sibcall_nonlocal_aix32"
11291 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11292 (match_operand 1 "" "g"))
11293 (use (match_operand:SI 2 "immediate_operand" "O"))
11297 && DEFAULT_ABI == ABI_AIX
11298 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11300 [(set_attr "type" "branch")
11301 (set_attr "length" "4")])
11303 (define_insn "*sibcall_nonlocal_aix64"
11304 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11305 (match_operand 1 "" "g"))
11306 (use (match_operand:SI 2 "immediate_operand" "O"))
11310 && DEFAULT_ABI == ABI_AIX
11311 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11313 [(set_attr "type" "branch")
11314 (set_attr "length" "4")])
11316 (define_insn "*sibcall_value_nonlocal_aix32"
11317 [(set (match_operand 0 "" "")
11318 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11319 (match_operand 2 "" "g")))
11320 (use (match_operand:SI 3 "immediate_operand" "O"))
11324 && DEFAULT_ABI == ABI_AIX
11325 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11327 [(set_attr "type" "branch")
11328 (set_attr "length" "4")])
11330 (define_insn "*sibcall_value_nonlocal_aix64"
11331 [(set (match_operand 0 "" "")
11332 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11333 (match_operand 2 "" "g")))
11334 (use (match_operand:SI 3 "immediate_operand" "O"))
11338 && DEFAULT_ABI == ABI_AIX
11339 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11341 [(set_attr "type" "branch")
11342 (set_attr "length" "4")])
11344 (define_insn "*sibcall_nonlocal_sysv<mode>"
11345 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11346 (match_operand 1 "" ""))
11347 (use (match_operand 2 "immediate_operand" "O,n"))
11350 "(DEFAULT_ABI == ABI_DARWIN
11351 || DEFAULT_ABI == ABI_V4)
11352 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11355 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11356 output_asm_insn (\"crxor 6,6,6\", operands);
11358 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11359 output_asm_insn (\"creqv 6,6,6\", operands);
11361 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11363 if (TARGET_SECURE_PLT && flag_pic == 2)
11364 return \"b %z0+32768@plt\";
11366 return \"b %z0@plt\";
11371 [(set_attr "type" "branch,branch")
11372 (set_attr "length" "4,8")])
11374 (define_expand "sibcall_value"
11375 [(parallel [(set (match_operand 0 "register_operand" "")
11376 (call (mem:SI (match_operand 1 "address_operand" ""))
11377 (match_operand 2 "" "")))
11378 (use (match_operand 3 "" ""))
11385 if (MACHOPIC_INDIRECT)
11386 operands[1] = machopic_indirect_call_target (operands[1]);
11389 gcc_assert (GET_CODE (operands[1]) == MEM);
11390 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11392 operands[1] = XEXP (operands[1], 0);
11395 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11396 [(set (match_operand 0 "" "")
11397 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11398 (match_operand 2 "" "")))
11399 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11402 "(DEFAULT_ABI == ABI_DARWIN
11403 || DEFAULT_ABI == ABI_V4)
11404 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11407 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11408 output_asm_insn (\"crxor 6,6,6\", operands);
11410 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11411 output_asm_insn (\"creqv 6,6,6\", operands);
11413 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11415 if (TARGET_SECURE_PLT && flag_pic == 2)
11416 return \"b %z1+32768@plt\";
11418 return \"b %z1@plt\";
11423 [(set_attr "type" "branch,branch")
11424 (set_attr "length" "4,8")])
11426 (define_expand "sibcall_epilogue"
11427 [(use (const_int 0))]
11428 "TARGET_SCHED_PROLOG"
11431 rs6000_emit_epilogue (TRUE);
11435 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11436 ;; all of memory. This blocks insns from being moved across this point.
11438 (define_insn "blockage"
11439 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11443 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11444 ;; signed & unsigned, and one type of branch.
11446 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11447 ;; insns, and branches. We store the operands of compares until we see
11449 (define_expand "cmp<mode>"
11451 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11452 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11456 /* Take care of the possibility that operands[1] might be negative but
11457 this might be a logical operation. That insn doesn't exist. */
11458 if (GET_CODE (operands[1]) == CONST_INT
11459 && INTVAL (operands[1]) < 0)
11460 operands[1] = force_reg (<MODE>mode, operands[1]);
11462 rs6000_compare_op0 = operands[0];
11463 rs6000_compare_op1 = operands[1];
11464 rs6000_compare_fp_p = 0;
11468 (define_expand "cmp<mode>"
11469 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11470 (match_operand:FP 1 "gpc_reg_operand" "")))]
11474 rs6000_compare_op0 = operands[0];
11475 rs6000_compare_op1 = operands[1];
11476 rs6000_compare_fp_p = 1;
11480 (define_expand "beq"
11481 [(use (match_operand 0 "" ""))]
11483 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11485 (define_expand "bne"
11486 [(use (match_operand 0 "" ""))]
11488 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11490 (define_expand "bge"
11491 [(use (match_operand 0 "" ""))]
11493 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11495 (define_expand "bgt"
11496 [(use (match_operand 0 "" ""))]
11498 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11500 (define_expand "ble"
11501 [(use (match_operand 0 "" ""))]
11503 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11505 (define_expand "blt"
11506 [(use (match_operand 0 "" ""))]
11508 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11510 (define_expand "bgeu"
11511 [(use (match_operand 0 "" ""))]
11513 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11515 (define_expand "bgtu"
11516 [(use (match_operand 0 "" ""))]
11518 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11520 (define_expand "bleu"
11521 [(use (match_operand 0 "" ""))]
11523 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11525 (define_expand "bltu"
11526 [(use (match_operand 0 "" ""))]
11528 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11530 (define_expand "bunordered"
11531 [(use (match_operand 0 "" ""))]
11532 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11533 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11535 (define_expand "bordered"
11536 [(use (match_operand 0 "" ""))]
11537 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11538 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11540 (define_expand "buneq"
11541 [(use (match_operand 0 "" ""))]
11542 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11543 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11545 (define_expand "bunge"
11546 [(use (match_operand 0 "" ""))]
11547 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11548 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11550 (define_expand "bungt"
11551 [(use (match_operand 0 "" ""))]
11552 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11553 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11555 (define_expand "bunle"
11556 [(use (match_operand 0 "" ""))]
11557 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11558 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11560 (define_expand "bunlt"
11561 [(use (match_operand 0 "" ""))]
11562 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11563 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11565 (define_expand "bltgt"
11566 [(use (match_operand 0 "" ""))]
11568 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11570 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11571 ;; For SEQ, likewise, except that comparisons with zero should be done
11572 ;; with an scc insns. However, due to the order that combine see the
11573 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11574 ;; the cases we don't want to handle.
11575 (define_expand "seq"
11576 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11578 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11580 (define_expand "sne"
11581 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11585 if (! rs6000_compare_fp_p)
11588 rs6000_emit_sCOND (NE, operands[0]);
11592 ;; A >= 0 is best done the portable way for A an integer.
11593 (define_expand "sge"
11594 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11598 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11601 rs6000_emit_sCOND (GE, operands[0]);
11605 ;; A > 0 is best done using the portable sequence, so fail in that case.
11606 (define_expand "sgt"
11607 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11611 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11614 rs6000_emit_sCOND (GT, operands[0]);
11618 ;; A <= 0 is best done the portable way for A an integer.
11619 (define_expand "sle"
11620 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11624 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11627 rs6000_emit_sCOND (LE, operands[0]);
11631 ;; A < 0 is best done in the portable way for A an integer.
11632 (define_expand "slt"
11633 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11637 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11640 rs6000_emit_sCOND (LT, operands[0]);
11644 (define_expand "sgeu"
11645 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11647 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11649 (define_expand "sgtu"
11650 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11652 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11654 (define_expand "sleu"
11655 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11657 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11659 (define_expand "sltu"
11660 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11662 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11664 (define_expand "sunordered"
11665 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11666 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11667 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11669 (define_expand "sordered"
11670 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11671 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11672 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11674 (define_expand "suneq"
11675 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11676 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11677 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11679 (define_expand "sunge"
11680 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11681 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11682 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11684 (define_expand "sungt"
11685 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11686 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11687 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11689 (define_expand "sunle"
11690 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11691 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11692 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11694 (define_expand "sunlt"
11695 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11696 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11697 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11699 (define_expand "sltgt"
11700 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11702 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11704 (define_expand "stack_protect_set"
11705 [(match_operand 0 "memory_operand" "")
11706 (match_operand 1 "memory_operand" "")]
11709 #ifdef TARGET_THREAD_SSP_OFFSET
11710 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11711 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11712 operands[1] = gen_rtx_MEM (Pmode, addr);
11715 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11717 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11721 (define_insn "stack_protect_setsi"
11722 [(set (match_operand:SI 0 "memory_operand" "=m")
11723 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11724 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11726 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11727 [(set_attr "type" "three")
11728 (set_attr "length" "12")])
11730 (define_insn "stack_protect_setdi"
11731 [(set (match_operand:DI 0 "memory_operand" "=m")
11732 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11733 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11735 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11736 [(set_attr "type" "three")
11737 (set_attr "length" "12")])
11739 (define_expand "stack_protect_test"
11740 [(match_operand 0 "memory_operand" "")
11741 (match_operand 1 "memory_operand" "")
11742 (match_operand 2 "" "")]
11745 #ifdef TARGET_THREAD_SSP_OFFSET
11746 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11747 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11748 operands[1] = gen_rtx_MEM (Pmode, addr);
11750 rs6000_compare_op0 = operands[0];
11751 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11753 rs6000_compare_fp_p = 0;
11754 emit_jump_insn (gen_beq (operands[2]));
11758 (define_insn "stack_protect_testsi"
11759 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11760 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11761 (match_operand:SI 2 "memory_operand" "m,m")]
11763 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11764 (clobber (match_scratch:SI 3 "=&r,&r"))]
11767 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11768 {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"
11769 [(set_attr "length" "16,20")])
11771 (define_insn "stack_protect_testdi"
11772 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11773 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11774 (match_operand:DI 2 "memory_operand" "m,m")]
11776 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11777 (clobber (match_scratch:DI 3 "=&r,&r"))]
11780 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11781 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11782 [(set_attr "length" "16,20")])
11785 ;; Here are the actual compare insns.
11786 (define_insn "*cmp<mode>_internal1"
11787 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11788 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11789 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11791 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11792 [(set_attr "type" "cmp")])
11794 ;; If we are comparing a register for equality with a large constant,
11795 ;; we can do this with an XOR followed by a compare. But this is profitable
11796 ;; only if the large constant is only used for the comparison (and in this
11797 ;; case we already have a register to reuse as scratch).
11799 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11800 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11803 [(set (match_operand:SI 0 "register_operand")
11804 (match_operand:SI 1 "logical_const_operand" ""))
11805 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11807 (match_operand:SI 2 "logical_const_operand" "")]))
11808 (set (match_operand:CC 4 "cc_reg_operand" "")
11809 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11812 (if_then_else (match_operator 6 "equality_operator"
11813 [(match_dup 4) (const_int 0)])
11814 (match_operand 7 "" "")
11815 (match_operand 8 "" "")))]
11816 "peep2_reg_dead_p (3, operands[0])
11817 && peep2_reg_dead_p (4, operands[4])"
11818 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11819 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11820 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11823 /* Get the constant we are comparing against, and see what it looks like
11824 when sign-extended from 16 to 32 bits. Then see what constant we could
11825 XOR with SEXTC to get the sign-extended value. */
11826 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11828 operands[1], operands[2]);
11829 HOST_WIDE_INT c = INTVAL (cnst);
11830 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11831 HOST_WIDE_INT xorv = c ^ sextc;
11833 operands[9] = GEN_INT (xorv);
11834 operands[10] = GEN_INT (sextc);
11837 (define_insn "*cmpsi_internal2"
11838 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11839 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11840 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11842 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11843 [(set_attr "type" "cmp")])
11845 (define_insn "*cmpdi_internal2"
11846 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11847 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11848 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11850 "cmpld%I2 %0,%1,%b2"
11851 [(set_attr "type" "cmp")])
11853 ;; The following two insns don't exist as single insns, but if we provide
11854 ;; them, we can swap an add and compare, which will enable us to overlap more
11855 ;; of the required delay between a compare and branch. We generate code for
11856 ;; them by splitting.
11859 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11860 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11861 (match_operand:SI 2 "short_cint_operand" "i")))
11862 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11863 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11866 [(set_attr "length" "8")])
11869 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11870 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11871 (match_operand:SI 2 "u_short_cint_operand" "i")))
11872 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11873 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11876 [(set_attr "length" "8")])
11879 [(set (match_operand:CC 3 "cc_reg_operand" "")
11880 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11881 (match_operand:SI 2 "short_cint_operand" "")))
11882 (set (match_operand:SI 0 "gpc_reg_operand" "")
11883 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11885 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11886 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11889 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11890 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11891 (match_operand:SI 2 "u_short_cint_operand" "")))
11892 (set (match_operand:SI 0 "gpc_reg_operand" "")
11893 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11895 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11896 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11898 (define_insn "*cmpsf_internal1"
11899 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11900 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11901 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11902 "TARGET_HARD_FLOAT && TARGET_FPRS"
11904 [(set_attr "type" "fpcompare")])
11906 (define_insn "*cmpdf_internal1"
11907 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11908 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11909 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11910 "TARGET_HARD_FLOAT && TARGET_FPRS"
11912 [(set_attr "type" "fpcompare")])
11914 ;; Only need to compare second words if first words equal
11915 (define_insn "*cmptf_internal1"
11916 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11917 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11918 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11919 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11920 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11921 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11922 [(set_attr "type" "fpcompare")
11923 (set_attr "length" "12")])
11925 (define_insn_and_split "*cmptf_internal2"
11926 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11927 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11928 (match_operand:TF 2 "gpc_reg_operand" "f")))
11929 (clobber (match_scratch:DF 3 "=f"))
11930 (clobber (match_scratch:DF 4 "=f"))
11931 (clobber (match_scratch:DF 5 "=f"))
11932 (clobber (match_scratch:DF 6 "=f"))
11933 (clobber (match_scratch:DF 7 "=f"))
11934 (clobber (match_scratch:DF 8 "=f"))
11935 (clobber (match_scratch:DF 9 "=f"))
11936 (clobber (match_scratch:DF 10 "=f"))]
11937 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11938 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11940 "&& reload_completed"
11941 [(set (match_dup 3) (match_dup 13))
11942 (set (match_dup 4) (match_dup 14))
11943 (set (match_dup 9) (abs:DF (match_dup 5)))
11944 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
11945 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
11946 (label_ref (match_dup 11))
11948 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
11949 (set (pc) (label_ref (match_dup 12)))
11951 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11952 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11953 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11954 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11957 REAL_VALUE_TYPE rv;
11958 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11959 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11961 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11962 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11963 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11964 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11965 operands[11] = gen_label_rtx ();
11966 operands[12] = gen_label_rtx ();
11968 operands[13] = force_const_mem (DFmode,
11969 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11970 operands[14] = force_const_mem (DFmode,
11971 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11975 operands[13] = gen_const_mem (DFmode,
11976 create_TOC_reference (XEXP (operands[13], 0)));
11977 operands[14] = gen_const_mem (DFmode,
11978 create_TOC_reference (XEXP (operands[14], 0)));
11979 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11980 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11984 ;; Now we have the scc insns. We can do some combinations because of the
11985 ;; way the machine works.
11987 ;; Note that this is probably faster if we can put an insn between the
11988 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11989 ;; cases the insns below which don't use an intermediate CR field will
11990 ;; be used instead.
11992 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11993 (match_operator:SI 1 "scc_comparison_operator"
11994 [(match_operand 2 "cc_reg_operand" "y")
11997 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11998 [(set (attr "type")
11999 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12000 (const_string "mfcrf")
12002 (const_string "mfcr")))
12003 (set_attr "length" "8")])
12005 ;; Same as above, but get the GT bit.
12006 (define_insn "move_from_CR_gt_bit"
12007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12008 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12010 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12011 [(set_attr "type" "mfcr")
12012 (set_attr "length" "8")])
12014 ;; Same as above, but get the OV/ORDERED bit.
12015 (define_insn "move_from_CR_ov_bit"
12016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12017 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12019 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12020 [(set_attr "type" "mfcr")
12021 (set_attr "length" "8")])
12024 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12025 (match_operator:DI 1 "scc_comparison_operator"
12026 [(match_operand 2 "cc_reg_operand" "y")
12029 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12030 [(set (attr "type")
12031 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12032 (const_string "mfcrf")
12034 (const_string "mfcr")))
12035 (set_attr "length" "8")])
12038 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12039 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12040 [(match_operand 2 "cc_reg_operand" "y,y")
12043 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12044 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12047 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12049 [(set_attr "type" "delayed_compare")
12050 (set_attr "length" "8,16")])
12053 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12054 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12055 [(match_operand 2 "cc_reg_operand" "")
12058 (set (match_operand:SI 3 "gpc_reg_operand" "")
12059 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12060 "TARGET_32BIT && reload_completed"
12061 [(set (match_dup 3)
12062 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12064 (compare:CC (match_dup 3)
12069 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12070 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12071 [(match_operand 2 "cc_reg_operand" "y")
12073 (match_operand:SI 3 "const_int_operand" "n")))]
12077 int is_bit = ccr_bit (operands[1], 1);
12078 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12081 if (is_bit >= put_bit)
12082 count = is_bit - put_bit;
12084 count = 32 - (put_bit - is_bit);
12086 operands[4] = GEN_INT (count);
12087 operands[5] = GEN_INT (put_bit);
12089 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12091 [(set (attr "type")
12092 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12093 (const_string "mfcrf")
12095 (const_string "mfcr")))
12096 (set_attr "length" "8")])
12099 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12101 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12102 [(match_operand 2 "cc_reg_operand" "y,y")
12104 (match_operand:SI 3 "const_int_operand" "n,n"))
12106 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12107 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12112 int is_bit = ccr_bit (operands[1], 1);
12113 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12116 /* Force split for non-cc0 compare. */
12117 if (which_alternative == 1)
12120 if (is_bit >= put_bit)
12121 count = is_bit - put_bit;
12123 count = 32 - (put_bit - is_bit);
12125 operands[5] = GEN_INT (count);
12126 operands[6] = GEN_INT (put_bit);
12128 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12130 [(set_attr "type" "delayed_compare")
12131 (set_attr "length" "8,16")])
12134 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12136 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12137 [(match_operand 2 "cc_reg_operand" "")
12139 (match_operand:SI 3 "const_int_operand" ""))
12141 (set (match_operand:SI 4 "gpc_reg_operand" "")
12142 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12145 [(set (match_dup 4)
12146 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12149 (compare:CC (match_dup 4)
12153 ;; There is a 3 cycle delay between consecutive mfcr instructions
12154 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12157 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12158 (match_operator:SI 1 "scc_comparison_operator"
12159 [(match_operand 2 "cc_reg_operand" "y")
12161 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12162 (match_operator:SI 4 "scc_comparison_operator"
12163 [(match_operand 5 "cc_reg_operand" "y")
12165 "REGNO (operands[2]) != REGNO (operands[5])"
12166 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12167 [(set_attr "type" "mfcr")
12168 (set_attr "length" "12")])
12171 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12172 (match_operator:DI 1 "scc_comparison_operator"
12173 [(match_operand 2 "cc_reg_operand" "y")
12175 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12176 (match_operator:DI 4 "scc_comparison_operator"
12177 [(match_operand 5 "cc_reg_operand" "y")
12179 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12180 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12181 [(set_attr "type" "mfcr")
12182 (set_attr "length" "12")])
12184 ;; There are some scc insns that can be done directly, without a compare.
12185 ;; These are faster because they don't involve the communications between
12186 ;; the FXU and branch units. In fact, we will be replacing all of the
12187 ;; integer scc insns here or in the portable methods in emit_store_flag.
12189 ;; Also support (neg (scc ..)) since that construct is used to replace
12190 ;; branches, (plus (scc ..) ..) since that construct is common and
12191 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12192 ;; cases where it is no more expensive than (neg (scc ..)).
12194 ;; Have reload force a constant into a register for the simple insns that
12195 ;; otherwise won't accept constants. We do this because it is faster than
12196 ;; the cmp/mfcr sequence we would otherwise generate.
12198 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12201 (define_insn_and_split "*eq<mode>"
12202 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12203 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12204 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12208 [(set (match_dup 0)
12209 (clz:GPR (match_dup 3)))
12211 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12213 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12215 /* Use output operand as intermediate. */
12216 operands[3] = operands[0];
12218 if (logical_operand (operands[2], <MODE>mode))
12219 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12220 gen_rtx_XOR (<MODE>mode,
12221 operands[1], operands[2])));
12223 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12224 gen_rtx_PLUS (<MODE>mode, operands[1],
12225 negate_rtx (<MODE>mode,
12229 operands[3] = operands[1];
12231 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12234 (define_insn_and_split "*eq<mode>_compare"
12235 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12237 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12238 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12240 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12241 (eq:P (match_dup 1) (match_dup 2)))]
12242 "!TARGET_POWER && optimize_size"
12244 "!TARGET_POWER && optimize_size"
12245 [(set (match_dup 0)
12246 (clz:P (match_dup 4)))
12247 (parallel [(set (match_dup 3)
12248 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12251 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12253 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12255 /* Use output operand as intermediate. */
12256 operands[4] = operands[0];
12258 if (logical_operand (operands[2], <MODE>mode))
12259 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12260 gen_rtx_XOR (<MODE>mode,
12261 operands[1], operands[2])));
12263 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12264 gen_rtx_PLUS (<MODE>mode, operands[1],
12265 negate_rtx (<MODE>mode,
12269 operands[4] = operands[1];
12271 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12274 (define_insn "*eqsi_power"
12275 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12276 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12277 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12278 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12281 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12282 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12283 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12284 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12285 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12286 [(set_attr "type" "three,two,three,three,three")
12287 (set_attr "length" "12,8,12,12,12")])
12289 ;; We have insns of the form shown by the first define_insn below. If
12290 ;; there is something inside the comparison operation, we must split it.
12292 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12293 (plus:SI (match_operator 1 "comparison_operator"
12294 [(match_operand:SI 2 "" "")
12295 (match_operand:SI 3
12296 "reg_or_cint_operand" "")])
12297 (match_operand:SI 4 "gpc_reg_operand" "")))
12298 (clobber (match_operand:SI 5 "register_operand" ""))]
12299 "! gpc_reg_operand (operands[2], SImode)"
12300 [(set (match_dup 5) (match_dup 2))
12301 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12304 (define_insn "*plus_eqsi"
12305 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12306 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12307 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12308 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12311 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12312 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12313 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12314 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12315 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12316 [(set_attr "type" "three,two,three,three,three")
12317 (set_attr "length" "12,8,12,12,12")])
12319 (define_insn "*compare_plus_eqsi"
12320 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12323 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12324 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12325 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12327 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12328 "TARGET_32BIT && optimize_size"
12330 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12331 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12332 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12333 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12334 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12340 [(set_attr "type" "compare")
12341 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12344 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12347 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12348 (match_operand:SI 2 "scc_eq_operand" ""))
12349 (match_operand:SI 3 "gpc_reg_operand" ""))
12351 (clobber (match_scratch:SI 4 ""))]
12352 "TARGET_32BIT && optimize_size && reload_completed"
12353 [(set (match_dup 4)
12354 (plus:SI (eq:SI (match_dup 1)
12358 (compare:CC (match_dup 4)
12362 (define_insn "*plus_eqsi_compare"
12363 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12366 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12367 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12368 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12370 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12371 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12372 "TARGET_32BIT && optimize_size"
12374 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12375 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12376 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12377 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12378 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12384 [(set_attr "type" "compare")
12385 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12388 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12391 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12392 (match_operand:SI 2 "scc_eq_operand" ""))
12393 (match_operand:SI 3 "gpc_reg_operand" ""))
12395 (set (match_operand:SI 0 "gpc_reg_operand" "")
12396 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12397 "TARGET_32BIT && optimize_size && reload_completed"
12398 [(set (match_dup 0)
12399 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12401 (compare:CC (match_dup 0)
12405 (define_insn "*neg_eq0<mode>"
12406 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12407 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12410 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12411 [(set_attr "type" "two")
12412 (set_attr "length" "8")])
12414 (define_insn_and_split "*neg_eq<mode>"
12415 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12416 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12417 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12421 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12423 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12425 /* Use output operand as intermediate. */
12426 operands[3] = operands[0];
12428 if (logical_operand (operands[2], <MODE>mode))
12429 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12430 gen_rtx_XOR (<MODE>mode,
12431 operands[1], operands[2])));
12433 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12434 gen_rtx_PLUS (<MODE>mode, operands[1],
12435 negate_rtx (<MODE>mode,
12439 operands[3] = operands[1];
12442 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12443 ;; since it nabs/sr is just as fast.
12444 (define_insn "*ne0si"
12445 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12446 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12448 (clobber (match_scratch:SI 2 "=&r"))]
12449 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12450 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12451 [(set_attr "type" "two")
12452 (set_attr "length" "8")])
12454 (define_insn "*ne0di"
12455 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12456 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12458 (clobber (match_scratch:DI 2 "=&r"))]
12460 "addic %2,%1,-1\;subfe %0,%2,%1"
12461 [(set_attr "type" "two")
12462 (set_attr "length" "8")])
12464 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12465 (define_insn "*plus_ne0si"
12466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12467 (plus:SI (lshiftrt:SI
12468 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12470 (match_operand:SI 2 "gpc_reg_operand" "r")))
12471 (clobber (match_scratch:SI 3 "=&r"))]
12473 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12474 [(set_attr "type" "two")
12475 (set_attr "length" "8")])
12477 (define_insn "*plus_ne0di"
12478 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12479 (plus:DI (lshiftrt:DI
12480 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12482 (match_operand:DI 2 "gpc_reg_operand" "r")))
12483 (clobber (match_scratch:DI 3 "=&r"))]
12485 "addic %3,%1,-1\;addze %0,%2"
12486 [(set_attr "type" "two")
12487 (set_attr "length" "8")])
12489 (define_insn "*compare_plus_ne0si"
12490 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12492 (plus:SI (lshiftrt:SI
12493 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12495 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12497 (clobber (match_scratch:SI 3 "=&r,&r"))
12498 (clobber (match_scratch:SI 4 "=X,&r"))]
12501 {ai|addic} %3,%1,-1\;{aze.|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:SI (lshiftrt:SI
12510 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12512 (match_operand:SI 2 "gpc_reg_operand" ""))
12514 (clobber (match_scratch:SI 3 ""))
12515 (clobber (match_scratch:SI 4 ""))]
12516 "TARGET_32BIT && reload_completed"
12517 [(parallel [(set (match_dup 3)
12518 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12521 (clobber (match_dup 4))])
12523 (compare:CC (match_dup 3)
12527 (define_insn "*compare_plus_ne0di"
12528 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12530 (plus:DI (lshiftrt:DI
12531 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12533 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12535 (clobber (match_scratch:DI 3 "=&r,&r"))]
12538 addic %3,%1,-1\;addze. %3,%2
12540 [(set_attr "type" "compare")
12541 (set_attr "length" "8,12")])
12544 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12546 (plus:DI (lshiftrt:DI
12547 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12549 (match_operand:DI 2 "gpc_reg_operand" ""))
12551 (clobber (match_scratch:DI 3 ""))]
12552 "TARGET_64BIT && reload_completed"
12553 [(set (match_dup 3)
12554 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12558 (compare:CC (match_dup 3)
12562 (define_insn "*plus_ne0si_compare"
12563 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12565 (plus:SI (lshiftrt:SI
12566 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12568 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12570 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12571 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12573 (clobber (match_scratch:SI 3 "=&r,&r"))]
12576 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12578 [(set_attr "type" "compare")
12579 (set_attr "length" "8,12")])
12582 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12584 (plus:SI (lshiftrt:SI
12585 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12587 (match_operand:SI 2 "gpc_reg_operand" ""))
12589 (set (match_operand:SI 0 "gpc_reg_operand" "")
12590 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12592 (clobber (match_scratch:SI 3 ""))]
12593 "TARGET_32BIT && reload_completed"
12594 [(parallel [(set (match_dup 0)
12595 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12597 (clobber (match_dup 3))])
12599 (compare:CC (match_dup 0)
12603 (define_insn "*plus_ne0di_compare"
12604 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12606 (plus:DI (lshiftrt:DI
12607 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12609 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12611 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12612 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12614 (clobber (match_scratch:DI 3 "=&r,&r"))]
12617 addic %3,%1,-1\;addze. %0,%2
12619 [(set_attr "type" "compare")
12620 (set_attr "length" "8,12")])
12623 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12625 (plus:DI (lshiftrt:DI
12626 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12628 (match_operand:DI 2 "gpc_reg_operand" ""))
12630 (set (match_operand:DI 0 "gpc_reg_operand" "")
12631 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12633 (clobber (match_scratch:DI 3 ""))]
12634 "TARGET_64BIT && reload_completed"
12635 [(parallel [(set (match_dup 0)
12636 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12638 (clobber (match_dup 3))])
12640 (compare:CC (match_dup 0)
12645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12646 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12647 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12648 (clobber (match_scratch:SI 3 "=r,X"))]
12651 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12652 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12653 [(set_attr "length" "12")])
12656 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12658 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12659 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12661 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12662 (le:SI (match_dup 1) (match_dup 2)))
12663 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12666 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12667 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12670 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12671 (set_attr "length" "12,12,16,16")])
12674 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12676 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12677 (match_operand:SI 2 "reg_or_short_operand" ""))
12679 (set (match_operand:SI 0 "gpc_reg_operand" "")
12680 (le:SI (match_dup 1) (match_dup 2)))
12681 (clobber (match_scratch:SI 3 ""))]
12682 "TARGET_POWER && reload_completed"
12683 [(parallel [(set (match_dup 0)
12684 (le:SI (match_dup 1) (match_dup 2)))
12685 (clobber (match_dup 3))])
12687 (compare:CC (match_dup 0)
12692 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12693 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12694 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12695 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12698 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12699 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12700 [(set_attr "length" "12")])
12703 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12705 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12706 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12707 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12709 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12712 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12713 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12716 [(set_attr "type" "compare")
12717 (set_attr "length" "12,12,16,16")])
12720 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12722 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12723 (match_operand:SI 2 "reg_or_short_operand" ""))
12724 (match_operand:SI 3 "gpc_reg_operand" ""))
12726 (clobber (match_scratch:SI 4 ""))]
12727 "TARGET_POWER && reload_completed"
12728 [(set (match_dup 4)
12729 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12732 (compare:CC (match_dup 4)
12737 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12739 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12740 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12741 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12743 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12744 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12747 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12748 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12751 [(set_attr "type" "compare")
12752 (set_attr "length" "12,12,16,16")])
12755 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12757 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12758 (match_operand:SI 2 "reg_or_short_operand" ""))
12759 (match_operand:SI 3 "gpc_reg_operand" ""))
12761 (set (match_operand:SI 0 "gpc_reg_operand" "")
12762 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12763 "TARGET_POWER && reload_completed"
12764 [(set (match_dup 0)
12765 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12767 (compare:CC (match_dup 0)
12772 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12773 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12774 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12777 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12778 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12779 [(set_attr "length" "12")])
12781 (define_insn "*leu<mode>"
12782 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12783 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12784 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12786 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12787 [(set_attr "type" "three")
12788 (set_attr "length" "12")])
12790 (define_insn "*leu<mode>_compare"
12791 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12793 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12794 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12796 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12797 (leu:P (match_dup 1) (match_dup 2)))]
12800 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12802 [(set_attr "type" "compare")
12803 (set_attr "length" "12,16")])
12806 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12808 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12809 (match_operand:P 2 "reg_or_short_operand" ""))
12811 (set (match_operand:P 0 "gpc_reg_operand" "")
12812 (leu:P (match_dup 1) (match_dup 2)))]
12814 [(set (match_dup 0)
12815 (leu:P (match_dup 1) (match_dup 2)))
12817 (compare:CC (match_dup 0)
12821 (define_insn "*plus_leu<mode>"
12822 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12823 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12824 (match_operand:P 2 "reg_or_short_operand" "rI"))
12825 (match_operand:P 3 "gpc_reg_operand" "r")))]
12827 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12828 [(set_attr "type" "two")
12829 (set_attr "length" "8")])
12832 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12834 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12835 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12836 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12838 (clobber (match_scratch:SI 4 "=&r,&r"))]
12841 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12843 [(set_attr "type" "compare")
12844 (set_attr "length" "8,12")])
12847 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12849 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12850 (match_operand:SI 2 "reg_or_short_operand" ""))
12851 (match_operand:SI 3 "gpc_reg_operand" ""))
12853 (clobber (match_scratch:SI 4 ""))]
12854 "TARGET_32BIT && reload_completed"
12855 [(set (match_dup 4)
12856 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12859 (compare:CC (match_dup 4)
12864 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12866 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12867 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12868 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12870 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12871 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12874 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12876 [(set_attr "type" "compare")
12877 (set_attr "length" "8,12")])
12880 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12882 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12883 (match_operand:SI 2 "reg_or_short_operand" ""))
12884 (match_operand:SI 3 "gpc_reg_operand" ""))
12886 (set (match_operand:SI 0 "gpc_reg_operand" "")
12887 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12888 "TARGET_32BIT && reload_completed"
12889 [(set (match_dup 0)
12890 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12892 (compare:CC (match_dup 0)
12896 (define_insn "*neg_leu<mode>"
12897 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12898 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12899 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12901 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12902 [(set_attr "type" "three")
12903 (set_attr "length" "12")])
12905 (define_insn "*and_neg_leu<mode>"
12906 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12908 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12909 (match_operand:P 2 "reg_or_short_operand" "rI")))
12910 (match_operand:P 3 "gpc_reg_operand" "r")))]
12912 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12913 [(set_attr "type" "three")
12914 (set_attr "length" "12")])
12917 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12920 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12921 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12922 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12924 (clobber (match_scratch:SI 4 "=&r,&r"))]
12927 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12929 [(set_attr "type" "compare")
12930 (set_attr "length" "12,16")])
12933 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12936 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12937 (match_operand:SI 2 "reg_or_short_operand" "")))
12938 (match_operand:SI 3 "gpc_reg_operand" ""))
12940 (clobber (match_scratch:SI 4 ""))]
12941 "TARGET_32BIT && reload_completed"
12942 [(set (match_dup 4)
12943 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12946 (compare:CC (match_dup 4)
12951 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12954 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12955 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12956 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12958 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12959 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12962 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12964 [(set_attr "type" "compare")
12965 (set_attr "length" "12,16")])
12968 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12971 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12972 (match_operand:SI 2 "reg_or_short_operand" "")))
12973 (match_operand:SI 3 "gpc_reg_operand" ""))
12975 (set (match_operand:SI 0 "gpc_reg_operand" "")
12976 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12977 "TARGET_32BIT && reload_completed"
12978 [(set (match_dup 0)
12979 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12982 (compare:CC (match_dup 0)
12987 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12988 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12989 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12991 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12992 [(set_attr "length" "12")])
12995 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12997 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12998 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13000 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13001 (lt:SI (match_dup 1) (match_dup 2)))]
13004 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13006 [(set_attr "type" "delayed_compare")
13007 (set_attr "length" "12,16")])
13010 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13012 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13013 (match_operand:SI 2 "reg_or_short_operand" ""))
13015 (set (match_operand:SI 0 "gpc_reg_operand" "")
13016 (lt:SI (match_dup 1) (match_dup 2)))]
13017 "TARGET_POWER && reload_completed"
13018 [(set (match_dup 0)
13019 (lt:SI (match_dup 1) (match_dup 2)))
13021 (compare:CC (match_dup 0)
13026 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13027 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13028 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13029 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13031 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13032 [(set_attr "length" "12")])
13035 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13037 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13038 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13039 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13041 (clobber (match_scratch:SI 4 "=&r,&r"))]
13044 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13046 [(set_attr "type" "compare")
13047 (set_attr "length" "12,16")])
13050 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13052 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13053 (match_operand:SI 2 "reg_or_short_operand" ""))
13054 (match_operand:SI 3 "gpc_reg_operand" ""))
13056 (clobber (match_scratch:SI 4 ""))]
13057 "TARGET_POWER && reload_completed"
13058 [(set (match_dup 4)
13059 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13062 (compare:CC (match_dup 4)
13067 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13069 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13070 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13071 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13073 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13074 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13077 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13079 [(set_attr "type" "compare")
13080 (set_attr "length" "12,16")])
13083 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13085 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13086 (match_operand:SI 2 "reg_or_short_operand" ""))
13087 (match_operand:SI 3 "gpc_reg_operand" ""))
13089 (set (match_operand:SI 0 "gpc_reg_operand" "")
13090 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13091 "TARGET_POWER && reload_completed"
13092 [(set (match_dup 0)
13093 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13095 (compare:CC (match_dup 0)
13100 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13101 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13102 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13104 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13105 [(set_attr "length" "12")])
13107 (define_insn_and_split "*ltu<mode>"
13108 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13109 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13110 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13114 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13115 (set (match_dup 0) (neg:P (match_dup 0)))]
13118 (define_insn_and_split "*ltu<mode>_compare"
13119 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13121 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13122 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13124 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13125 (ltu:P (match_dup 1) (match_dup 2)))]
13129 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13130 (parallel [(set (match_dup 3)
13131 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13132 (set (match_dup 0) (neg:P (match_dup 0)))])]
13135 (define_insn_and_split "*plus_ltu<mode>"
13136 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13137 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13138 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13139 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13142 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13143 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13144 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13147 (define_insn_and_split "*plus_ltu<mode>_compare"
13148 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13150 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13151 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13152 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13154 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13155 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13158 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13159 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13160 (parallel [(set (match_dup 4)
13161 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13163 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13166 (define_insn "*neg_ltu<mode>"
13167 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13168 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13169 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13172 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13173 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13174 [(set_attr "type" "two")
13175 (set_attr "length" "8")])
13178 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13179 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13180 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13181 (clobber (match_scratch:SI 3 "=r"))]
13183 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13184 [(set_attr "length" "12")])
13187 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13189 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13190 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13192 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13193 (ge:SI (match_dup 1) (match_dup 2)))
13194 (clobber (match_scratch:SI 3 "=r,r"))]
13197 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13199 [(set_attr "type" "compare")
13200 (set_attr "length" "12,16")])
13203 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13205 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13206 (match_operand:SI 2 "reg_or_short_operand" ""))
13208 (set (match_operand:SI 0 "gpc_reg_operand" "")
13209 (ge:SI (match_dup 1) (match_dup 2)))
13210 (clobber (match_scratch:SI 3 ""))]
13211 "TARGET_POWER && reload_completed"
13212 [(parallel [(set (match_dup 0)
13213 (ge:SI (match_dup 1) (match_dup 2)))
13214 (clobber (match_dup 3))])
13216 (compare:CC (match_dup 0)
13221 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13222 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13223 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13224 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13226 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13227 [(set_attr "length" "12")])
13230 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13232 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13233 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13234 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13236 (clobber (match_scratch:SI 4 "=&r,&r"))]
13239 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13241 [(set_attr "type" "compare")
13242 (set_attr "length" "12,16")])
13245 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13247 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13248 (match_operand:SI 2 "reg_or_short_operand" ""))
13249 (match_operand:SI 3 "gpc_reg_operand" ""))
13251 (clobber (match_scratch:SI 4 ""))]
13252 "TARGET_POWER && reload_completed"
13253 [(set (match_dup 4)
13254 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13257 (compare:CC (match_dup 4)
13262 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13264 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13265 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13266 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13268 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13269 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13272 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13274 [(set_attr "type" "compare")
13275 (set_attr "length" "12,16")])
13278 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13280 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13281 (match_operand:SI 2 "reg_or_short_operand" ""))
13282 (match_operand:SI 3 "gpc_reg_operand" ""))
13284 (set (match_operand:SI 0 "gpc_reg_operand" "")
13285 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13286 "TARGET_POWER && reload_completed"
13287 [(set (match_dup 0)
13288 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13290 (compare:CC (match_dup 0)
13295 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13296 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13297 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13299 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13300 [(set_attr "length" "12")])
13302 (define_insn "*geu<mode>"
13303 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13304 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13305 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13308 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13309 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13310 [(set_attr "type" "three")
13311 (set_attr "length" "12")])
13313 (define_insn "*geu<mode>_compare"
13314 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13316 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13317 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13319 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13320 (geu:P (match_dup 1) (match_dup 2)))]
13323 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13324 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13327 [(set_attr "type" "compare")
13328 (set_attr "length" "12,12,16,16")])
13331 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13333 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13334 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13336 (set (match_operand:P 0 "gpc_reg_operand" "")
13337 (geu:P (match_dup 1) (match_dup 2)))]
13339 [(set (match_dup 0)
13340 (geu:P (match_dup 1) (match_dup 2)))
13342 (compare:CC (match_dup 0)
13346 (define_insn "*plus_geu<mode>"
13347 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13348 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13349 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13350 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13353 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13354 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13355 [(set_attr "type" "two")
13356 (set_attr "length" "8")])
13359 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13361 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13362 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13363 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13365 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13368 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13369 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13372 [(set_attr "type" "compare")
13373 (set_attr "length" "8,8,12,12")])
13376 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13378 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13379 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13380 (match_operand:SI 3 "gpc_reg_operand" ""))
13382 (clobber (match_scratch:SI 4 ""))]
13383 "TARGET_32BIT && reload_completed"
13384 [(set (match_dup 4)
13385 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13388 (compare:CC (match_dup 4)
13393 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13395 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13396 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13397 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13399 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13400 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13403 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13404 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13407 [(set_attr "type" "compare")
13408 (set_attr "length" "8,8,12,12")])
13411 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13413 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13414 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13415 (match_operand:SI 3 "gpc_reg_operand" ""))
13417 (set (match_operand:SI 0 "gpc_reg_operand" "")
13418 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13419 "TARGET_32BIT && reload_completed"
13420 [(set (match_dup 0)
13421 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13423 (compare:CC (match_dup 0)
13427 (define_insn "*neg_geu<mode>"
13428 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13429 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13430 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13433 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13434 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13435 [(set_attr "type" "three")
13436 (set_attr "length" "12")])
13438 (define_insn "*and_neg_geu<mode>"
13439 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13441 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13442 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13443 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13446 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13447 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13448 [(set_attr "type" "three")
13449 (set_attr "length" "12")])
13452 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13455 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13456 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13457 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13459 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13462 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13463 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13466 [(set_attr "type" "compare")
13467 (set_attr "length" "12,12,16,16")])
13470 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 4 ""))]
13478 "TARGET_32BIT && reload_completed"
13479 [(set (match_dup 4)
13480 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13483 (compare:CC (match_dup 4)
13488 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13491 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13492 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13493 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13495 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13496 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13499 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13500 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13503 [(set_attr "type" "compare")
13504 (set_attr "length" "12,12,16,16")])
13507 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13510 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13511 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13512 (match_operand:SI 3 "gpc_reg_operand" ""))
13514 (set (match_operand:SI 0 "gpc_reg_operand" "")
13515 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13516 "TARGET_32BIT && reload_completed"
13517 [(set (match_dup 0)
13518 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13520 (compare:CC (match_dup 0)
13525 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13526 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13527 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13529 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13530 [(set_attr "length" "12")])
13533 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13535 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13536 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13538 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13539 (gt:SI (match_dup 1) (match_dup 2)))]
13542 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13544 [(set_attr "type" "delayed_compare")
13545 (set_attr "length" "12,16")])
13548 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13550 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13551 (match_operand:SI 2 "reg_or_short_operand" ""))
13553 (set (match_operand:SI 0 "gpc_reg_operand" "")
13554 (gt:SI (match_dup 1) (match_dup 2)))]
13555 "TARGET_POWER && reload_completed"
13556 [(set (match_dup 0)
13557 (gt:SI (match_dup 1) (match_dup 2)))
13559 (compare:CC (match_dup 0)
13563 (define_insn "*plus_gt0<mode>"
13564 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13565 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13567 (match_operand:P 2 "gpc_reg_operand" "r")))]
13569 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13570 [(set_attr "type" "three")
13571 (set_attr "length" "12")])
13574 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13576 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13578 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13580 (clobber (match_scratch:SI 3 "=&r,&r"))]
13583 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13585 [(set_attr "type" "compare")
13586 (set_attr "length" "12,16")])
13589 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13591 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13593 (match_operand:SI 2 "gpc_reg_operand" ""))
13595 (clobber (match_scratch:SI 3 ""))]
13596 "TARGET_32BIT && reload_completed"
13597 [(set (match_dup 3)
13598 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13601 (compare:CC (match_dup 3)
13606 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13608 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13610 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13612 (clobber (match_scratch:DI 3 "=&r,&r"))]
13615 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13617 [(set_attr "type" "compare")
13618 (set_attr "length" "12,16")])
13621 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13623 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13625 (match_operand:DI 2 "gpc_reg_operand" ""))
13627 (clobber (match_scratch:DI 3 ""))]
13628 "TARGET_64BIT && reload_completed"
13629 [(set (match_dup 3)
13630 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13633 (compare:CC (match_dup 3)
13638 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13640 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13642 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13644 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13645 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13648 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13650 [(set_attr "type" "compare")
13651 (set_attr "length" "12,16")])
13654 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13656 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13658 (match_operand:SI 2 "gpc_reg_operand" ""))
13660 (set (match_operand:SI 0 "gpc_reg_operand" "")
13661 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13662 "TARGET_32BIT && reload_completed"
13663 [(set (match_dup 0)
13664 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13666 (compare:CC (match_dup 0)
13671 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13673 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13675 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13677 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13678 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13681 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13683 [(set_attr "type" "compare")
13684 (set_attr "length" "12,16")])
13687 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13689 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13691 (match_operand:DI 2 "gpc_reg_operand" ""))
13693 (set (match_operand:DI 0 "gpc_reg_operand" "")
13694 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13695 "TARGET_64BIT && reload_completed"
13696 [(set (match_dup 0)
13697 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13699 (compare:CC (match_dup 0)
13704 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13705 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13706 (match_operand:SI 2 "reg_or_short_operand" "r"))
13707 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13709 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13710 [(set_attr "length" "12")])
13713 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13715 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13716 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13717 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13719 (clobber (match_scratch:SI 4 "=&r,&r"))]
13722 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13724 [(set_attr "type" "compare")
13725 (set_attr "length" "12,16")])
13728 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13730 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13731 (match_operand:SI 2 "reg_or_short_operand" ""))
13732 (match_operand:SI 3 "gpc_reg_operand" ""))
13734 (clobber (match_scratch:SI 4 ""))]
13735 "TARGET_POWER && reload_completed"
13736 [(set (match_dup 4)
13737 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13739 (compare:CC (match_dup 4)
13744 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13746 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13747 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13748 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13750 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13751 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13754 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13756 [(set_attr "type" "compare")
13757 (set_attr "length" "12,16")])
13760 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13762 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13763 (match_operand:SI 2 "reg_or_short_operand" ""))
13764 (match_operand:SI 3 "gpc_reg_operand" ""))
13766 (set (match_operand:SI 0 "gpc_reg_operand" "")
13767 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13768 "TARGET_POWER && reload_completed"
13769 [(set (match_dup 0)
13770 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13772 (compare:CC (match_dup 0)
13777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13778 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13779 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13781 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13782 [(set_attr "length" "12")])
13784 (define_insn_and_split "*gtu<mode>"
13785 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13786 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13787 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13791 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13792 (set (match_dup 0) (neg:P (match_dup 0)))]
13795 (define_insn_and_split "*gtu<mode>_compare"
13796 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13798 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13799 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13801 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13802 (gtu:P (match_dup 1) (match_dup 2)))]
13806 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13807 (parallel [(set (match_dup 3)
13808 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13809 (set (match_dup 0) (neg:P (match_dup 0)))])]
13812 (define_insn_and_split "*plus_gtu<mode>"
13813 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13814 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13815 (match_operand:P 2 "reg_or_short_operand" "rI"))
13816 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13819 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13820 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13821 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13824 (define_insn_and_split "*plus_gtu<mode>_compare"
13825 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13827 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13828 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13829 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13831 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13832 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13835 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13836 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13837 (parallel [(set (match_dup 4)
13838 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13840 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13843 (define_insn "*neg_gtu<mode>"
13844 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13845 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13846 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13848 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13849 [(set_attr "type" "two")
13850 (set_attr "length" "8")])
13853 ;; Define both directions of branch and return. If we need a reload
13854 ;; register, we'd rather use CR0 since it is much easier to copy a
13855 ;; register CC value to there.
13859 (if_then_else (match_operator 1 "branch_comparison_operator"
13861 "cc_reg_operand" "y")
13863 (label_ref (match_operand 0 "" ""))
13868 return output_cbranch (operands[1], \"%l0\", 0, insn);
13870 [(set_attr "type" "branch")])
13874 (if_then_else (match_operator 0 "branch_comparison_operator"
13876 "cc_reg_operand" "y")
13883 return output_cbranch (operands[0], NULL, 0, insn);
13885 [(set_attr "type" "jmpreg")
13886 (set_attr "length" "4")])
13890 (if_then_else (match_operator 1 "branch_comparison_operator"
13892 "cc_reg_operand" "y")
13895 (label_ref (match_operand 0 "" ""))))]
13899 return output_cbranch (operands[1], \"%l0\", 1, insn);
13901 [(set_attr "type" "branch")])
13905 (if_then_else (match_operator 0 "branch_comparison_operator"
13907 "cc_reg_operand" "y")
13914 return output_cbranch (operands[0], NULL, 1, insn);
13916 [(set_attr "type" "jmpreg")
13917 (set_attr "length" "4")])
13919 ;; Logic on condition register values.
13921 ; This pattern matches things like
13922 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13923 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13925 ; which are generated by the branch logic.
13926 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13928 (define_insn "*cceq_ior_compare"
13929 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13930 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13931 [(match_operator:SI 2
13932 "branch_positive_comparison_operator"
13934 "cc_reg_operand" "y,y")
13936 (match_operator:SI 4
13937 "branch_positive_comparison_operator"
13939 "cc_reg_operand" "0,y")
13943 "cr%q1 %E0,%j2,%j4"
13944 [(set_attr "type" "cr_logical,delayed_cr")])
13946 ; Why is the constant -1 here, but 1 in the previous pattern?
13947 ; Because ~1 has all but the low bit set.
13949 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13950 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13951 [(not:SI (match_operator:SI 2
13952 "branch_positive_comparison_operator"
13954 "cc_reg_operand" "y,y")
13956 (match_operator:SI 4
13957 "branch_positive_comparison_operator"
13959 "cc_reg_operand" "0,y")
13963 "cr%q1 %E0,%j2,%j4"
13964 [(set_attr "type" "cr_logical,delayed_cr")])
13966 (define_insn "*cceq_rev_compare"
13967 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13968 (compare:CCEQ (match_operator:SI 1
13969 "branch_positive_comparison_operator"
13971 "cc_reg_operand" "0,y")
13975 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13976 [(set_attr "type" "cr_logical,delayed_cr")])
13978 ;; If we are comparing the result of two comparisons, this can be done
13979 ;; using creqv or crxor.
13981 (define_insn_and_split ""
13982 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13983 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13984 [(match_operand 2 "cc_reg_operand" "y")
13986 (match_operator 3 "branch_comparison_operator"
13987 [(match_operand 4 "cc_reg_operand" "y")
13992 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13996 int positive_1, positive_2;
13998 positive_1 = branch_positive_comparison_operator (operands[1],
13999 GET_MODE (operands[1]));
14000 positive_2 = branch_positive_comparison_operator (operands[3],
14001 GET_MODE (operands[3]));
14004 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14005 GET_CODE (operands[1])),
14007 operands[2], const0_rtx);
14008 else if (GET_MODE (operands[1]) != SImode)
14009 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14010 operands[2], const0_rtx);
14013 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14014 GET_CODE (operands[3])),
14016 operands[4], const0_rtx);
14017 else if (GET_MODE (operands[3]) != SImode)
14018 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14019 operands[4], const0_rtx);
14021 if (positive_1 == positive_2)
14023 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14024 operands[5] = constm1_rtx;
14028 operands[5] = const1_rtx;
14032 ;; Unconditional branch and return.
14034 (define_insn "jump"
14036 (label_ref (match_operand 0 "" "")))]
14039 [(set_attr "type" "branch")])
14041 (define_insn "return"
14045 [(set_attr "type" "jmpreg")])
14047 (define_expand "indirect_jump"
14048 [(set (pc) (match_operand 0 "register_operand" ""))])
14050 (define_insn "*indirect_jump<mode>"
14051 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14056 [(set_attr "type" "jmpreg")])
14058 ;; Table jump for switch statements:
14059 (define_expand "tablejump"
14060 [(use (match_operand 0 "" ""))
14061 (use (label_ref (match_operand 1 "" "")))]
14066 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14068 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14072 (define_expand "tablejumpsi"
14073 [(set (match_dup 3)
14074 (plus:SI (match_operand:SI 0 "" "")
14076 (parallel [(set (pc) (match_dup 3))
14077 (use (label_ref (match_operand 1 "" "")))])]
14080 { operands[0] = force_reg (SImode, operands[0]);
14081 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14082 operands[3] = gen_reg_rtx (SImode);
14085 (define_expand "tablejumpdi"
14086 [(set (match_dup 4)
14087 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14089 (plus:DI (match_dup 4)
14091 (parallel [(set (pc) (match_dup 3))
14092 (use (label_ref (match_operand 1 "" "")))])]
14095 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14096 operands[3] = gen_reg_rtx (DImode);
14097 operands[4] = gen_reg_rtx (DImode);
14100 (define_insn "*tablejump<mode>_internal1"
14102 (match_operand:P 0 "register_operand" "c,*l"))
14103 (use (label_ref (match_operand 1 "" "")))]
14108 [(set_attr "type" "jmpreg")])
14113 "{cror 0,0,0|nop}")
14115 ;; Define the subtract-one-and-jump insns, starting with the template
14116 ;; so loop.c knows what to generate.
14118 (define_expand "doloop_end"
14119 [(use (match_operand 0 "" "")) ; loop pseudo
14120 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14121 (use (match_operand 2 "" "")) ; max iterations
14122 (use (match_operand 3 "" "")) ; loop level
14123 (use (match_operand 4 "" ""))] ; label
14127 /* Only use this on innermost loops. */
14128 if (INTVAL (operands[3]) > 1)
14132 if (GET_MODE (operands[0]) != DImode)
14134 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14138 if (GET_MODE (operands[0]) != SImode)
14140 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14145 (define_expand "ctr<mode>"
14146 [(parallel [(set (pc)
14147 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14149 (label_ref (match_operand 1 "" ""))
14152 (plus:P (match_dup 0)
14154 (clobber (match_scratch:CC 2 ""))
14155 (clobber (match_scratch:P 3 ""))])]
14159 ;; We need to be able to do this for any operand, including MEM, or we
14160 ;; will cause reload to blow up since we don't allow output reloads on
14162 ;; For the length attribute to be calculated correctly, the
14163 ;; label MUST be operand 0.
14165 (define_insn "*ctr<mode>_internal1"
14167 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14169 (label_ref (match_operand 0 "" ""))
14171 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14172 (plus:P (match_dup 1)
14174 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14175 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14179 if (which_alternative != 0)
14181 else if (get_attr_length (insn) == 4)
14182 return \"{bdn|bdnz} %l0\";
14184 return \"bdz $+8\;b %l0\";
14186 [(set_attr "type" "branch")
14187 (set_attr "length" "*,12,16,16")])
14189 (define_insn "*ctr<mode>_internal2"
14191 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14194 (label_ref (match_operand 0 "" ""))))
14195 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14196 (plus:P (match_dup 1)
14198 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14199 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14203 if (which_alternative != 0)
14205 else if (get_attr_length (insn) == 4)
14206 return \"bdz %l0\";
14208 return \"{bdn|bdnz} $+8\;b %l0\";
14210 [(set_attr "type" "branch")
14211 (set_attr "length" "*,12,16,16")])
14213 ;; Similar but use EQ
14215 (define_insn "*ctr<mode>_internal5"
14217 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14219 (label_ref (match_operand 0 "" ""))
14221 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14222 (plus:P (match_dup 1)
14224 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14225 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14229 if (which_alternative != 0)
14231 else if (get_attr_length (insn) == 4)
14232 return \"bdz %l0\";
14234 return \"{bdn|bdnz} $+8\;b %l0\";
14236 [(set_attr "type" "branch")
14237 (set_attr "length" "*,12,16,16")])
14239 (define_insn "*ctr<mode>_internal6"
14241 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14244 (label_ref (match_operand 0 "" ""))))
14245 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14246 (plus:P (match_dup 1)
14248 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14249 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14253 if (which_alternative != 0)
14255 else if (get_attr_length (insn) == 4)
14256 return \"{bdn|bdnz} %l0\";
14258 return \"bdz $+8\;b %l0\";
14260 [(set_attr "type" "branch")
14261 (set_attr "length" "*,12,16,16")])
14263 ;; Now the splitters if we could not allocate the CTR register
14267 (if_then_else (match_operator 2 "comparison_operator"
14268 [(match_operand:P 1 "gpc_reg_operand" "")
14270 (match_operand 5 "" "")
14271 (match_operand 6 "" "")))
14272 (set (match_operand:P 0 "gpc_reg_operand" "")
14273 (plus:P (match_dup 1) (const_int -1)))
14274 (clobber (match_scratch:CC 3 ""))
14275 (clobber (match_scratch:P 4 ""))]
14277 [(parallel [(set (match_dup 3)
14278 (compare:CC (plus:P (match_dup 1)
14282 (plus:P (match_dup 1)
14284 (set (pc) (if_then_else (match_dup 7)
14288 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14289 operands[3], const0_rtx); }")
14293 (if_then_else (match_operator 2 "comparison_operator"
14294 [(match_operand:P 1 "gpc_reg_operand" "")
14296 (match_operand 5 "" "")
14297 (match_operand 6 "" "")))
14298 (set (match_operand:P 0 "nonimmediate_operand" "")
14299 (plus:P (match_dup 1) (const_int -1)))
14300 (clobber (match_scratch:CC 3 ""))
14301 (clobber (match_scratch:P 4 ""))]
14302 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14303 [(parallel [(set (match_dup 3)
14304 (compare:CC (plus:P (match_dup 1)
14308 (plus:P (match_dup 1)
14312 (set (pc) (if_then_else (match_dup 7)
14316 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14317 operands[3], const0_rtx); }")
14319 (define_insn "trap"
14320 [(trap_if (const_int 1) (const_int 0))]
14323 [(set_attr "type" "trap")])
14325 (define_expand "conditional_trap"
14326 [(trap_if (match_operator 0 "trap_comparison_operator"
14327 [(match_dup 2) (match_dup 3)])
14328 (match_operand 1 "const_int_operand" ""))]
14330 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14331 operands[2] = rs6000_compare_op0;
14332 operands[3] = rs6000_compare_op1;")
14335 [(trap_if (match_operator 0 "trap_comparison_operator"
14336 [(match_operand:GPR 1 "register_operand" "r")
14337 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14340 "{t|t<wd>}%V0%I2 %1,%2"
14341 [(set_attr "type" "trap")])
14343 ;; Insns related to generating the function prologue and epilogue.
14345 (define_expand "prologue"
14346 [(use (const_int 0))]
14347 "TARGET_SCHED_PROLOG"
14350 rs6000_emit_prologue ();
14354 (define_insn "*movesi_from_cr_one"
14355 [(match_parallel 0 "mfcr_operation"
14356 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14357 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14358 (match_operand 3 "immediate_operand" "n")]
14359 UNSPEC_MOVESI_FROM_CR))])]
14365 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14367 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14368 operands[4] = GEN_INT (mask);
14369 output_asm_insn (\"mfcr %1,%4\", operands);
14373 [(set_attr "type" "mfcrf")])
14375 (define_insn "movesi_from_cr"
14376 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14377 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14378 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
14379 UNSPEC_MOVESI_FROM_CR))]
14382 [(set_attr "type" "mfcr")])
14384 (define_insn "*stmw"
14385 [(match_parallel 0 "stmw_operation"
14386 [(set (match_operand:SI 1 "memory_operand" "=m")
14387 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14390 [(set_attr "type" "store_ux")])
14392 (define_insn "*save_fpregs_<mode>"
14393 [(match_parallel 0 "any_parallel_operand"
14394 [(clobber (reg:P 65))
14395 (use (match_operand:P 1 "call_operand" "s"))
14396 (set (match_operand:DF 2 "memory_operand" "=m")
14397 (match_operand:DF 3 "gpc_reg_operand" "f"))])]
14400 [(set_attr "type" "branch")
14401 (set_attr "length" "4")])
14403 ; These are to explain that changes to the stack pointer should
14404 ; not be moved over stores to stack memory.
14405 (define_insn "stack_tie"
14406 [(set (match_operand:BLK 0 "memory_operand" "+m")
14407 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14410 [(set_attr "length" "0")])
14413 (define_expand "epilogue"
14414 [(use (const_int 0))]
14415 "TARGET_SCHED_PROLOG"
14418 rs6000_emit_epilogue (FALSE);
14422 ; On some processors, doing the mtcrf one CC register at a time is
14423 ; faster (like on the 604e). On others, doing them all at once is
14424 ; faster; for instance, on the 601 and 750.
14426 (define_expand "movsi_to_cr_one"
14427 [(set (match_operand:CC 0 "cc_reg_operand" "")
14428 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14429 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14431 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14433 (define_insn "*movsi_to_cr"
14434 [(match_parallel 0 "mtcrf_operation"
14435 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14436 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14437 (match_operand 3 "immediate_operand" "n")]
14438 UNSPEC_MOVESI_TO_CR))])]
14444 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14445 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14446 operands[4] = GEN_INT (mask);
14447 return \"mtcrf %4,%2\";
14449 [(set_attr "type" "mtcr")])
14451 (define_insn "*mtcrfsi"
14452 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14453 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14454 (match_operand 2 "immediate_operand" "n")]
14455 UNSPEC_MOVESI_TO_CR))]
14456 "GET_CODE (operands[0]) == REG
14457 && CR_REGNO_P (REGNO (operands[0]))
14458 && GET_CODE (operands[2]) == CONST_INT
14459 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14461 [(set_attr "type" "mtcr")])
14463 ; The load-multiple instructions have similar properties.
14464 ; Note that "load_multiple" is a name known to the machine-independent
14465 ; code that actually corresponds to the PowerPC load-string.
14467 (define_insn "*lmw"
14468 [(match_parallel 0 "lmw_operation"
14469 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14470 (match_operand:SI 2 "memory_operand" "m"))])]
14473 [(set_attr "type" "load_ux")])
14475 (define_insn "*return_internal_<mode>"
14477 (use (match_operand:P 0 "register_operand" "lc"))]
14480 [(set_attr "type" "jmpreg")])
14482 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14483 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14485 (define_insn "*return_and_restore_fpregs_<mode>"
14486 [(match_parallel 0 "any_parallel_operand"
14489 (use (match_operand:P 1 "call_operand" "s"))
14490 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
14491 (match_operand:DF 3 "memory_operand" "m"))])]
14495 ; This is used in compiling the unwind routines.
14496 (define_expand "eh_return"
14497 [(use (match_operand 0 "general_operand" ""))]
14502 emit_insn (gen_eh_set_lr_si (operands[0]));
14504 emit_insn (gen_eh_set_lr_di (operands[0]));
14508 ; We can't expand this before we know where the link register is stored.
14509 (define_insn "eh_set_lr_<mode>"
14510 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14512 (clobber (match_scratch:P 1 "=&b"))]
14517 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14518 (clobber (match_scratch 1 ""))]
14523 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14527 (define_insn "prefetch"
14528 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14529 (match_operand:SI 1 "const_int_operand" "n")
14530 (match_operand:SI 2 "const_int_operand" "n"))]
14534 if (GET_CODE (operands[0]) == REG)
14535 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14536 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14538 [(set_attr "type" "load")])
14541 (include "sync.md")
14542 (include "altivec.md")