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 3, 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 COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
43 (FIRST_ALTIVEC_REGNO 77)
44 (LAST_ALTIVEC_REGNO 108)
57 [(UNSPEC_FRSP 0) ; frsp for POWER machines
58 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
59 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
60 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
62 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
68 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
69 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
72 (UNSPEC_MOVESI_FROM_CR 19)
73 (UNSPEC_MOVESI_TO_CR 20)
75 (UNSPEC_TLSDTPRELHA 22)
76 (UNSPEC_TLSDTPRELLO 23)
77 (UNSPEC_TLSGOTDTPREL 24)
79 (UNSPEC_TLSTPRELHA 26)
80 (UNSPEC_TLSTPRELLO 27)
81 (UNSPEC_TLSGOTTPREL 28)
83 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
84 (UNSPEC_MV_CR_GT 31) ; move_from_CR_gt_bit
100 (UNSPEC_DLMZB_STRLEN 47)
105 ;; UNSPEC_VOLATILE usage
110 (UNSPECV_LL 1) ; load-locked
111 (UNSPECV_SC 2) ; store-conditional
112 (UNSPECV_EH_RR 9) ; eh_reg_restore
115 ;; Define an insn type attribute. This is used in function unit delay
117 (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"
118 (const_string "integer"))
120 ;; Length (in bytes).
121 ; '(pc)' in the following doesn't include the instruction itself; it is
122 ; calculated as if the instruction had zero size.
123 (define_attr "length" ""
124 (if_then_else (eq_attr "type" "branch")
125 (if_then_else (and (ge (minus (match_dup 0) (pc))
127 (lt (minus (match_dup 0) (pc))
133 ;; Processor type -- this attribute must exactly match the processor_type
134 ;; enumeration in rs6000.h.
136 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5,power6,cell"
137 (const (symbol_ref "rs6000_cpu_attr")))
140 ;; If this instruction is microcoded on the CELL processor
141 ; The default for load and stores is conditional
142 ; The default for load extended and the recorded instructions is always microcoded
143 (define_attr "cell_micro" "not,conditional,always"
144 (if_then_else (ior (ior (eq_attr "type" "load")
145 (eq_attr "type" "store"))
146 (ior (eq_attr "type" "fpload")
147 (eq_attr "type" "fpstore")))
148 (const_string "conditional")
149 (if_then_else (ior (eq_attr "type" "load_ext")
150 (ior (eq_attr "type" "compare")
151 (eq_attr "type" "delayed_compare")))
152 (const_string "always")
153 (const_string "not"))))
156 (automata_option "ndfa")
169 (include "power4.md")
170 (include "power5.md")
171 (include "power6.md")
174 (include "predicates.md")
175 (include "constraints.md")
177 (include "darwin.md")
182 ; This mode iterator allows :GPR to be used to indicate the allowable size
183 ; of whole values in GPRs.
184 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
186 ; Any supported integer mode.
187 (define_mode_iterator INT [QI HI SI DI TI])
189 ; Any supported integer mode that fits in one register.
190 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
192 ; extend modes for DImode
193 (define_mode_iterator QHSI [QI HI SI])
195 ; SImode or DImode, even if DImode doesn't fit in GPRs.
196 (define_mode_iterator SDI [SI DI])
198 ; The size of a pointer. Also, the size of the value that a record-condition
199 ; (one with a '.') will compare.
200 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
202 ; Any hardware-supported floating-point mode
203 (define_mode_iterator FP [(SF "TARGET_HARD_FLOAT")
204 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
205 (TF "!TARGET_IEEEQUAD
207 && (TARGET_FPRS || TARGET_E500_DOUBLE)
208 && TARGET_LONG_DOUBLE_128")
212 ; Various instructions that come in SI and DI forms.
213 ; A generic w/d attribute, for things like cmpw/cmpd.
214 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
217 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
220 ;; Start with fixed-point load and store insns. Here we put only the more
221 ;; complex forms. Basic data transfer is done later.
223 (define_expand "zero_extend<mode>di2"
224 [(set (match_operand:DI 0 "gpc_reg_operand" "")
225 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
229 (define_insn "*zero_extend<mode>di2_internal1"
230 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
231 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
235 rldicl %0,%1,0,<dbits>"
236 [(set_attr "type" "load,*")])
238 (define_insn "*zero_extend<mode>di2_internal2"
239 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
240 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
242 (clobber (match_scratch:DI 2 "=r,r"))]
245 rldicl. %2,%1,0,<dbits>
247 [(set_attr "type" "compare")
248 (set_attr "length" "4,8")])
251 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
252 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
254 (clobber (match_scratch:DI 2 ""))]
255 "TARGET_POWERPC64 && reload_completed"
257 (zero_extend:DI (match_dup 1)))
259 (compare:CC (match_dup 2)
263 (define_insn "*zero_extend<mode>di2_internal3"
264 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
265 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
267 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
268 (zero_extend:DI (match_dup 1)))]
271 rldicl. %0,%1,0,<dbits>
273 [(set_attr "type" "compare")
274 (set_attr "length" "4,8")])
277 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
278 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
280 (set (match_operand:DI 0 "gpc_reg_operand" "")
281 (zero_extend:DI (match_dup 1)))]
282 "TARGET_POWERPC64 && reload_completed"
284 (zero_extend:DI (match_dup 1)))
286 (compare:CC (match_dup 0)
290 (define_insn "extendqidi2"
291 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
292 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
295 [(set_attr "type" "exts")])
298 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
299 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
301 (clobber (match_scratch:DI 2 "=r,r"))]
306 [(set_attr "type" "compare")
307 (set_attr "length" "4,8")])
310 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
311 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
313 (clobber (match_scratch:DI 2 ""))]
314 "TARGET_POWERPC64 && reload_completed"
316 (sign_extend:DI (match_dup 1)))
318 (compare:CC (match_dup 2)
323 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
324 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
326 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
327 (sign_extend:DI (match_dup 1)))]
332 [(set_attr "type" "compare")
333 (set_attr "length" "4,8")])
336 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
337 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
339 (set (match_operand:DI 0 "gpc_reg_operand" "")
340 (sign_extend:DI (match_dup 1)))]
341 "TARGET_POWERPC64 && reload_completed"
343 (sign_extend:DI (match_dup 1)))
345 (compare:CC (match_dup 0)
349 (define_expand "extendhidi2"
350 [(set (match_operand:DI 0 "gpc_reg_operand" "")
351 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
356 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
357 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
362 [(set_attr "type" "load_ext,exts")])
365 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
366 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
368 (clobber (match_scratch:DI 2 "=r,r"))]
373 [(set_attr "type" "compare")
374 (set_attr "length" "4,8")])
377 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
378 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
380 (clobber (match_scratch:DI 2 ""))]
381 "TARGET_POWERPC64 && reload_completed"
383 (sign_extend:DI (match_dup 1)))
385 (compare:CC (match_dup 2)
390 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
391 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
393 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
394 (sign_extend:DI (match_dup 1)))]
399 [(set_attr "type" "compare")
400 (set_attr "length" "4,8")])
403 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
404 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
406 (set (match_operand:DI 0 "gpc_reg_operand" "")
407 (sign_extend:DI (match_dup 1)))]
408 "TARGET_POWERPC64 && reload_completed"
410 (sign_extend:DI (match_dup 1)))
412 (compare:CC (match_dup 0)
416 (define_expand "extendsidi2"
417 [(set (match_operand:DI 0 "gpc_reg_operand" "")
418 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
423 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
424 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
429 [(set_attr "type" "load_ext,exts")])
432 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
433 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
435 (clobber (match_scratch:DI 2 "=r,r"))]
440 [(set_attr "type" "compare")
441 (set_attr "length" "4,8")])
444 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
445 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
447 (clobber (match_scratch:DI 2 ""))]
448 "TARGET_POWERPC64 && reload_completed"
450 (sign_extend:DI (match_dup 1)))
452 (compare:CC (match_dup 2)
457 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
458 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
460 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
461 (sign_extend:DI (match_dup 1)))]
466 [(set_attr "type" "compare")
467 (set_attr "length" "4,8")])
470 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
471 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
473 (set (match_operand:DI 0 "gpc_reg_operand" "")
474 (sign_extend:DI (match_dup 1)))]
475 "TARGET_POWERPC64 && reload_completed"
477 (sign_extend:DI (match_dup 1)))
479 (compare:CC (match_dup 0)
483 (define_expand "zero_extendqisi2"
484 [(set (match_operand:SI 0 "gpc_reg_operand" "")
485 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
491 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
495 {rlinm|rlwinm} %0,%1,0,0xff"
496 [(set_attr "type" "load,*")])
499 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
500 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
502 (clobber (match_scratch:SI 2 "=r,r"))]
505 {andil.|andi.} %2,%1,0xff
507 [(set_attr "type" "compare")
508 (set_attr "length" "4,8")])
511 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
512 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
514 (clobber (match_scratch:SI 2 ""))]
517 (zero_extend:SI (match_dup 1)))
519 (compare:CC (match_dup 2)
524 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
525 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
527 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
528 (zero_extend:SI (match_dup 1)))]
531 {andil.|andi.} %0,%1,0xff
533 [(set_attr "type" "compare")
534 (set_attr "length" "4,8")])
537 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
538 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
540 (set (match_operand:SI 0 "gpc_reg_operand" "")
541 (zero_extend:SI (match_dup 1)))]
544 (zero_extend:SI (match_dup 1)))
546 (compare:CC (match_dup 0)
550 (define_expand "extendqisi2"
551 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
552 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
557 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
558 else if (TARGET_POWER)
559 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
561 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
565 (define_insn "extendqisi2_ppc"
566 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
567 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
570 [(set_attr "type" "exts")])
573 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
574 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
576 (clobber (match_scratch:SI 2 "=r,r"))]
581 [(set_attr "type" "compare")
582 (set_attr "length" "4,8")])
585 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
586 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
588 (clobber (match_scratch:SI 2 ""))]
589 "TARGET_POWERPC && reload_completed"
591 (sign_extend:SI (match_dup 1)))
593 (compare:CC (match_dup 2)
598 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
599 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
601 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
602 (sign_extend:SI (match_dup 1)))]
607 [(set_attr "type" "compare")
608 (set_attr "length" "4,8")])
611 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
612 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
614 (set (match_operand:SI 0 "gpc_reg_operand" "")
615 (sign_extend:SI (match_dup 1)))]
616 "TARGET_POWERPC && reload_completed"
618 (sign_extend:SI (match_dup 1)))
620 (compare:CC (match_dup 0)
624 (define_expand "extendqisi2_power"
625 [(parallel [(set (match_dup 2)
626 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
628 (clobber (scratch:SI))])
629 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
630 (ashiftrt:SI (match_dup 2)
632 (clobber (scratch:SI))])]
635 { operands[1] = gen_lowpart (SImode, operands[1]);
636 operands[2] = gen_reg_rtx (SImode); }")
638 (define_expand "extendqisi2_no_power"
640 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
642 (set (match_operand:SI 0 "gpc_reg_operand" "")
643 (ashiftrt:SI (match_dup 2)
645 "! TARGET_POWER && ! TARGET_POWERPC"
647 { operands[1] = gen_lowpart (SImode, operands[1]);
648 operands[2] = gen_reg_rtx (SImode); }")
650 (define_expand "zero_extendqihi2"
651 [(set (match_operand:HI 0 "gpc_reg_operand" "")
652 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
657 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
658 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
662 {rlinm|rlwinm} %0,%1,0,0xff"
663 [(set_attr "type" "load,*")])
666 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
667 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
669 (clobber (match_scratch:HI 2 "=r,r"))]
672 {andil.|andi.} %2,%1,0xff
674 [(set_attr "type" "compare")
675 (set_attr "length" "4,8")])
678 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
679 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
681 (clobber (match_scratch:HI 2 ""))]
684 (zero_extend:HI (match_dup 1)))
686 (compare:CC (match_dup 2)
691 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
692 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
694 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
695 (zero_extend:HI (match_dup 1)))]
698 {andil.|andi.} %0,%1,0xff
700 [(set_attr "type" "compare")
701 (set_attr "length" "4,8")])
704 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
705 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
707 (set (match_operand:HI 0 "gpc_reg_operand" "")
708 (zero_extend:HI (match_dup 1)))]
711 (zero_extend:HI (match_dup 1)))
713 (compare:CC (match_dup 0)
717 (define_expand "extendqihi2"
718 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
719 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
724 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
725 else if (TARGET_POWER)
726 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
728 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
732 (define_insn "extendqihi2_ppc"
733 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
734 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
737 [(set_attr "type" "exts")])
740 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
741 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
743 (clobber (match_scratch:HI 2 "=r,r"))]
748 [(set_attr "type" "compare")
749 (set_attr "length" "4,8")])
752 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
753 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
755 (clobber (match_scratch:HI 2 ""))]
756 "TARGET_POWERPC && reload_completed"
758 (sign_extend:HI (match_dup 1)))
760 (compare:CC (match_dup 2)
765 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
766 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
768 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
769 (sign_extend:HI (match_dup 1)))]
774 [(set_attr "type" "compare")
775 (set_attr "length" "4,8")])
778 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
779 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
781 (set (match_operand:HI 0 "gpc_reg_operand" "")
782 (sign_extend:HI (match_dup 1)))]
783 "TARGET_POWERPC && reload_completed"
785 (sign_extend:HI (match_dup 1)))
787 (compare:CC (match_dup 0)
791 (define_expand "extendqihi2_power"
792 [(parallel [(set (match_dup 2)
793 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
795 (clobber (scratch:SI))])
796 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
797 (ashiftrt:SI (match_dup 2)
799 (clobber (scratch:SI))])]
802 { operands[0] = gen_lowpart (SImode, operands[0]);
803 operands[1] = gen_lowpart (SImode, operands[1]);
804 operands[2] = gen_reg_rtx (SImode); }")
806 (define_expand "extendqihi2_no_power"
808 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
810 (set (match_operand:HI 0 "gpc_reg_operand" "")
811 (ashiftrt:SI (match_dup 2)
813 "! TARGET_POWER && ! TARGET_POWERPC"
815 { operands[0] = gen_lowpart (SImode, operands[0]);
816 operands[1] = gen_lowpart (SImode, operands[1]);
817 operands[2] = gen_reg_rtx (SImode); }")
819 (define_expand "zero_extendhisi2"
820 [(set (match_operand:SI 0 "gpc_reg_operand" "")
821 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
826 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
827 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
831 {rlinm|rlwinm} %0,%1,0,0xffff"
832 [(set_attr "type" "load,*")])
835 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
836 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
838 (clobber (match_scratch:SI 2 "=r,r"))]
841 {andil.|andi.} %2,%1,0xffff
843 [(set_attr "type" "compare")
844 (set_attr "length" "4,8")])
847 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
848 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
850 (clobber (match_scratch:SI 2 ""))]
853 (zero_extend:SI (match_dup 1)))
855 (compare:CC (match_dup 2)
860 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
861 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
863 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
864 (zero_extend:SI (match_dup 1)))]
867 {andil.|andi.} %0,%1,0xffff
869 [(set_attr "type" "compare")
870 (set_attr "length" "4,8")])
873 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
874 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
876 (set (match_operand:SI 0 "gpc_reg_operand" "")
877 (zero_extend:SI (match_dup 1)))]
880 (zero_extend:SI (match_dup 1)))
882 (compare:CC (match_dup 0)
886 (define_expand "extendhisi2"
887 [(set (match_operand:SI 0 "gpc_reg_operand" "")
888 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
893 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
894 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
899 [(set_attr "type" "load_ext,exts")])
902 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
903 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
905 (clobber (match_scratch:SI 2 "=r,r"))]
910 [(set_attr "type" "compare")
911 (set_attr "length" "4,8")])
914 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
915 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
917 (clobber (match_scratch:SI 2 ""))]
920 (sign_extend:SI (match_dup 1)))
922 (compare:CC (match_dup 2)
927 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
928 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
930 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
931 (sign_extend:SI (match_dup 1)))]
936 [(set_attr "type" "compare")
937 (set_attr "length" "4,8")])
939 ;; IBM 405 and 440 half-word multiplication operations.
941 (define_insn "*macchwc"
942 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
943 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
944 (match_operand:SI 2 "gpc_reg_operand" "r")
947 (match_operand:HI 1 "gpc_reg_operand" "r")))
948 (match_operand:SI 4 "gpc_reg_operand" "0"))
950 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
951 (plus:SI (mult:SI (ashiftrt:SI
959 [(set_attr "type" "imul3")])
961 (define_insn "*macchw"
962 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
963 (plus:SI (mult:SI (ashiftrt:SI
964 (match_operand:SI 2 "gpc_reg_operand" "r")
967 (match_operand:HI 1 "gpc_reg_operand" "r")))
968 (match_operand:SI 3 "gpc_reg_operand" "0")))]
971 [(set_attr "type" "imul3")])
973 (define_insn "*macchwuc"
974 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
975 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
976 (match_operand:SI 2 "gpc_reg_operand" "r")
979 (match_operand:HI 1 "gpc_reg_operand" "r")))
980 (match_operand:SI 4 "gpc_reg_operand" "0"))
982 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
983 (plus:SI (mult:SI (lshiftrt:SI
990 "macchwu. %0, %1, %2"
991 [(set_attr "type" "imul3")])
993 (define_insn "*macchwu"
994 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
995 (plus:SI (mult:SI (lshiftrt:SI
996 (match_operand:SI 2 "gpc_reg_operand" "r")
999 (match_operand:HI 1 "gpc_reg_operand" "r")))
1000 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1002 "macchwu %0, %1, %2"
1003 [(set_attr "type" "imul3")])
1005 (define_insn "*machhwc"
1006 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1007 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1008 (match_operand:SI 1 "gpc_reg_operand" "%r")
1011 (match_operand:SI 2 "gpc_reg_operand" "r")
1013 (match_operand:SI 4 "gpc_reg_operand" "0"))
1015 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1016 (plus:SI (mult:SI (ashiftrt:SI
1024 "machhw. %0, %1, %2"
1025 [(set_attr "type" "imul3")])
1027 (define_insn "*machhw"
1028 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1029 (plus:SI (mult:SI (ashiftrt:SI
1030 (match_operand:SI 1 "gpc_reg_operand" "%r")
1033 (match_operand:SI 2 "gpc_reg_operand" "r")
1035 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1038 [(set_attr "type" "imul3")])
1040 (define_insn "*machhwuc"
1041 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1042 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1043 (match_operand:SI 1 "gpc_reg_operand" "%r")
1046 (match_operand:SI 2 "gpc_reg_operand" "r")
1048 (match_operand:SI 4 "gpc_reg_operand" "0"))
1050 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1051 (plus:SI (mult:SI (lshiftrt:SI
1059 "machhwu. %0, %1, %2"
1060 [(set_attr "type" "imul3")])
1062 (define_insn "*machhwu"
1063 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1064 (plus:SI (mult:SI (lshiftrt:SI
1065 (match_operand:SI 1 "gpc_reg_operand" "%r")
1068 (match_operand:SI 2 "gpc_reg_operand" "r")
1070 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1072 "machhwu %0, %1, %2"
1073 [(set_attr "type" "imul3")])
1075 (define_insn "*maclhwc"
1076 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1077 (compare:CC (plus:SI (mult:SI (sign_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 (sign_extend:SI
1090 "maclhw. %0, %1, %2"
1091 [(set_attr "type" "imul3")])
1093 (define_insn "*maclhw"
1094 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1095 (plus:SI (mult:SI (sign_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")))]
1102 [(set_attr "type" "imul3")])
1104 (define_insn "*maclhwuc"
1105 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1106 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1107 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1109 (match_operand:HI 2 "gpc_reg_operand" "r")))
1110 (match_operand:SI 4 "gpc_reg_operand" "0"))
1112 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1113 (plus:SI (mult:SI (zero_extend:SI
1119 "maclhwu. %0, %1, %2"
1120 [(set_attr "type" "imul3")])
1122 (define_insn "*maclhwu"
1123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1124 (plus:SI (mult:SI (zero_extend:SI
1125 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1127 (match_operand:HI 2 "gpc_reg_operand" "r")))
1128 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1130 "maclhwu %0, %1, %2"
1131 [(set_attr "type" "imul3")])
1133 (define_insn "*nmacchwc"
1134 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1135 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1136 (mult:SI (ashiftrt:SI
1137 (match_operand:SI 2 "gpc_reg_operand" "r")
1140 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1142 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1143 (minus:SI (match_dup 4)
1144 (mult:SI (ashiftrt:SI
1150 "nmacchw. %0, %1, %2"
1151 [(set_attr "type" "imul3")])
1153 (define_insn "*nmacchw"
1154 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1155 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1156 (mult:SI (ashiftrt:SI
1157 (match_operand:SI 2 "gpc_reg_operand" "r")
1160 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1162 "nmacchw %0, %1, %2"
1163 [(set_attr "type" "imul3")])
1165 (define_insn "*nmachhwc"
1166 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1167 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1168 (mult:SI (ashiftrt:SI
1169 (match_operand:SI 1 "gpc_reg_operand" "%r")
1172 (match_operand:SI 2 "gpc_reg_operand" "r")
1175 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1176 (minus:SI (match_dup 4)
1177 (mult:SI (ashiftrt:SI
1184 "nmachhw. %0, %1, %2"
1185 [(set_attr "type" "imul3")])
1187 (define_insn "*nmachhw"
1188 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1189 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1190 (mult:SI (ashiftrt:SI
1191 (match_operand:SI 1 "gpc_reg_operand" "%r")
1194 (match_operand:SI 2 "gpc_reg_operand" "r")
1197 "nmachhw %0, %1, %2"
1198 [(set_attr "type" "imul3")])
1200 (define_insn "*nmaclhwc"
1201 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1202 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1203 (mult:SI (sign_extend:SI
1204 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1206 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1208 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1209 (minus:SI (match_dup 4)
1210 (mult:SI (sign_extend:SI
1215 "nmaclhw. %0, %1, %2"
1216 [(set_attr "type" "imul3")])
1218 (define_insn "*nmaclhw"
1219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1220 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1221 (mult:SI (sign_extend:SI
1222 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1224 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1226 "nmaclhw %0, %1, %2"
1227 [(set_attr "type" "imul3")])
1229 (define_insn "*mulchwc"
1230 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1231 (compare:CC (mult:SI (ashiftrt: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 (ashiftrt:SI
1244 "mulchw. %0, %1, %2"
1245 [(set_attr "type" "imul3")])
1247 (define_insn "*mulchw"
1248 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1249 (mult:SI (ashiftrt:SI
1250 (match_operand:SI 2 "gpc_reg_operand" "r")
1253 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1256 [(set_attr "type" "imul3")])
1258 (define_insn "*mulchwuc"
1259 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1260 (compare:CC (mult:SI (lshiftrt:SI
1261 (match_operand:SI 2 "gpc_reg_operand" "r")
1264 (match_operand:HI 1 "gpc_reg_operand" "r")))
1266 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1267 (mult:SI (lshiftrt:SI
1273 "mulchwu. %0, %1, %2"
1274 [(set_attr "type" "imul3")])
1276 (define_insn "*mulchwu"
1277 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1278 (mult:SI (lshiftrt:SI
1279 (match_operand:SI 2 "gpc_reg_operand" "r")
1282 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1284 "mulchwu %0, %1, %2"
1285 [(set_attr "type" "imul3")])
1287 (define_insn "*mulhhwc"
1288 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1289 (compare:CC (mult:SI (ashiftrt:SI
1290 (match_operand:SI 1 "gpc_reg_operand" "%r")
1293 (match_operand:SI 2 "gpc_reg_operand" "r")
1296 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1297 (mult:SI (ashiftrt:SI
1304 "mulhhw. %0, %1, %2"
1305 [(set_attr "type" "imul3")])
1307 (define_insn "*mulhhw"
1308 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1309 (mult:SI (ashiftrt:SI
1310 (match_operand:SI 1 "gpc_reg_operand" "%r")
1313 (match_operand:SI 2 "gpc_reg_operand" "r")
1317 [(set_attr "type" "imul3")])
1319 (define_insn "*mulhhwuc"
1320 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1321 (compare:CC (mult:SI (lshiftrt:SI
1322 (match_operand:SI 1 "gpc_reg_operand" "%r")
1325 (match_operand:SI 2 "gpc_reg_operand" "r")
1328 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1329 (mult:SI (lshiftrt:SI
1336 "mulhhwu. %0, %1, %2"
1337 [(set_attr "type" "imul3")])
1339 (define_insn "*mulhhwu"
1340 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1341 (mult:SI (lshiftrt:SI
1342 (match_operand:SI 1 "gpc_reg_operand" "%r")
1345 (match_operand:SI 2 "gpc_reg_operand" "r")
1348 "mulhhwu %0, %1, %2"
1349 [(set_attr "type" "imul3")])
1351 (define_insn "*mullhwc"
1352 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1353 (compare:CC (mult:SI (sign_extend:SI
1354 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1356 (match_operand:HI 2 "gpc_reg_operand" "r")))
1358 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1359 (mult:SI (sign_extend:SI
1364 "mullhw. %0, %1, %2"
1365 [(set_attr "type" "imul3")])
1367 (define_insn "*mullhw"
1368 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1369 (mult:SI (sign_extend:SI
1370 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1372 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1375 [(set_attr "type" "imul3")])
1377 (define_insn "*mullhwuc"
1378 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1379 (compare:CC (mult:SI (zero_extend:SI
1380 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1382 (match_operand:HI 2 "gpc_reg_operand" "r")))
1384 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1385 (mult:SI (zero_extend:SI
1390 "mullhwu. %0, %1, %2"
1391 [(set_attr "type" "imul3")])
1393 (define_insn "*mullhwu"
1394 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1395 (mult:SI (zero_extend:SI
1396 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1398 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1400 "mullhwu %0, %1, %2"
1401 [(set_attr "type" "imul3")])
1403 ;; IBM 405 and 440 string-search dlmzb instruction support.
1404 (define_insn "dlmzb"
1405 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1406 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1407 (match_operand:SI 2 "gpc_reg_operand" "r")]
1409 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1410 (unspec:SI [(match_dup 1)
1414 "dlmzb. %0, %1, %2")
1416 (define_expand "strlensi"
1417 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1418 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1419 (match_operand:QI 2 "const_int_operand" "")
1420 (match_operand 3 "const_int_operand" "")]
1421 UNSPEC_DLMZB_STRLEN))
1422 (clobber (match_scratch:CC 4 "=x"))]
1423 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1425 rtx result = operands[0];
1426 rtx src = operands[1];
1427 rtx search_char = operands[2];
1428 rtx align = operands[3];
1429 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1430 rtx loop_label, end_label, mem, cr0, cond;
1431 if (search_char != const0_rtx
1432 || GET_CODE (align) != CONST_INT
1433 || INTVAL (align) < 8)
1435 word1 = gen_reg_rtx (SImode);
1436 word2 = gen_reg_rtx (SImode);
1437 scratch_dlmzb = gen_reg_rtx (SImode);
1438 scratch_string = gen_reg_rtx (Pmode);
1439 loop_label = gen_label_rtx ();
1440 end_label = gen_label_rtx ();
1441 addr = force_reg (Pmode, XEXP (src, 0));
1442 emit_move_insn (scratch_string, addr);
1443 emit_label (loop_label);
1444 mem = change_address (src, SImode, scratch_string);
1445 emit_move_insn (word1, mem);
1446 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1447 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1448 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1449 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1450 emit_jump_insn (gen_rtx_SET (VOIDmode,
1452 gen_rtx_IF_THEN_ELSE (VOIDmode,
1458 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1459 emit_jump_insn (gen_rtx_SET (VOIDmode,
1461 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1463 emit_label (end_label);
1464 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1465 emit_insn (gen_subsi3 (result, scratch_string, addr));
1466 emit_insn (gen_subsi3 (result, result, const1_rtx));
1471 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1472 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1474 (set (match_operand:SI 0 "gpc_reg_operand" "")
1475 (sign_extend:SI (match_dup 1)))]
1478 (sign_extend:SI (match_dup 1)))
1480 (compare:CC (match_dup 0)
1484 ;; Fixed-point arithmetic insns.
1486 (define_expand "add<mode>3"
1487 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1488 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1489 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1492 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1494 if (non_short_cint_operand (operands[2], DImode))
1497 else if (GET_CODE (operands[2]) == CONST_INT
1498 && ! add_operand (operands[2], <MODE>mode))
1500 rtx tmp = ((!can_create_pseudo_p ()
1501 || rtx_equal_p (operands[0], operands[1]))
1502 ? operands[0] : gen_reg_rtx (<MODE>mode));
1504 HOST_WIDE_INT val = INTVAL (operands[2]);
1505 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1506 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1508 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1511 /* The ordering here is important for the prolog expander.
1512 When space is allocated from the stack, adding 'low' first may
1513 produce a temporary deallocation (which would be bad). */
1514 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1515 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1520 ;; Discourage ai/addic because of carry but provide it in an alternative
1521 ;; allowing register zero as source.
1522 (define_insn "*add<mode>3_internal1"
1523 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1524 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1525 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1526 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1529 {cal %0,%2(%1)|addi %0,%1,%2}
1531 {cau|addis} %0,%1,%v2"
1532 [(set_attr "length" "4,4,4,4")])
1534 (define_insn "addsi3_high"
1535 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1536 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1537 (high:SI (match_operand 2 "" ""))))]
1538 "TARGET_MACHO && !TARGET_64BIT"
1539 "{cau|addis} %0,%1,ha16(%2)"
1540 [(set_attr "length" "4")])
1542 (define_insn "*add<mode>3_internal2"
1543 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1544 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1545 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1547 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1550 {cax.|add.} %3,%1,%2
1551 {ai.|addic.} %3,%1,%2
1554 [(set_attr "type" "fast_compare,compare,compare,compare")
1555 (set_attr "length" "4,4,8,8")])
1558 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1559 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1560 (match_operand:GPR 2 "reg_or_short_operand" ""))
1562 (clobber (match_scratch:GPR 3 ""))]
1565 (plus:GPR (match_dup 1)
1568 (compare:CC (match_dup 3)
1572 (define_insn "*add<mode>3_internal3"
1573 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1574 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1575 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1577 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1578 (plus:P (match_dup 1)
1582 {cax.|add.} %0,%1,%2
1583 {ai.|addic.} %0,%1,%2
1586 [(set_attr "type" "fast_compare,compare,compare,compare")
1587 (set_attr "length" "4,4,8,8")])
1590 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1591 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1592 (match_operand:P 2 "reg_or_short_operand" ""))
1594 (set (match_operand:P 0 "gpc_reg_operand" "")
1595 (plus:P (match_dup 1) (match_dup 2)))]
1598 (plus:P (match_dup 1)
1601 (compare:CC (match_dup 0)
1605 ;; Split an add that we can't do in one insn into two insns, each of which
1606 ;; does one 16-bit part. This is used by combine. Note that the low-order
1607 ;; add should be last in case the result gets used in an address.
1610 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1611 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1612 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1614 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1615 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1617 HOST_WIDE_INT val = INTVAL (operands[2]);
1618 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1619 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1621 operands[4] = GEN_INT (low);
1622 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1623 operands[3] = GEN_INT (rest);
1624 else if (can_create_pseudo_p ())
1626 operands[3] = gen_reg_rtx (DImode);
1627 emit_move_insn (operands[3], operands[2]);
1628 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1635 (define_insn "one_cmpl<mode>2"
1636 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1637 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1642 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1643 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1645 (clobber (match_scratch:P 2 "=r,r"))]
1650 [(set_attr "type" "compare")
1651 (set_attr "length" "4,8")])
1654 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1655 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1657 (clobber (match_scratch:P 2 ""))]
1660 (not:P (match_dup 1)))
1662 (compare:CC (match_dup 2)
1667 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1668 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1670 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1671 (not:P (match_dup 1)))]
1676 [(set_attr "type" "compare")
1677 (set_attr "length" "4,8")])
1680 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1681 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1683 (set (match_operand:P 0 "gpc_reg_operand" "")
1684 (not:P (match_dup 1)))]
1687 (not:P (match_dup 1)))
1689 (compare:CC (match_dup 0)
1694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1695 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1696 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1698 "{sf%I1|subf%I1c} %0,%2,%1")
1701 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1702 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1703 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1710 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1711 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1712 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1714 (clobber (match_scratch:SI 3 "=r,r"))]
1717 {sf.|subfc.} %3,%2,%1
1719 [(set_attr "type" "compare")
1720 (set_attr "length" "4,8")])
1723 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1724 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1725 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1727 (clobber (match_scratch:P 3 "=r,r"))]
1732 [(set_attr "type" "fast_compare")
1733 (set_attr "length" "4,8")])
1736 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1737 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1738 (match_operand:P 2 "gpc_reg_operand" ""))
1740 (clobber (match_scratch:P 3 ""))]
1743 (minus:P (match_dup 1)
1746 (compare:CC (match_dup 3)
1751 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1752 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1753 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1755 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1756 (minus:SI (match_dup 1) (match_dup 2)))]
1759 {sf.|subfc.} %0,%2,%1
1761 [(set_attr "type" "compare")
1762 (set_attr "length" "4,8")])
1765 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1766 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1767 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1769 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1770 (minus:P (match_dup 1)
1776 [(set_attr "type" "fast_compare")
1777 (set_attr "length" "4,8")])
1780 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1781 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1782 (match_operand:P 2 "gpc_reg_operand" ""))
1784 (set (match_operand:P 0 "gpc_reg_operand" "")
1785 (minus:P (match_dup 1)
1789 (minus:P (match_dup 1)
1792 (compare:CC (match_dup 0)
1796 (define_expand "sub<mode>3"
1797 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1798 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1799 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1803 if (GET_CODE (operands[2]) == CONST_INT)
1805 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1806 negate_rtx (<MODE>mode, operands[2])));
1811 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1812 ;; instruction and some auxiliary computations. Then we just have a single
1813 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1816 (define_expand "sminsi3"
1818 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1819 (match_operand:SI 2 "reg_or_short_operand" ""))
1821 (minus:SI (match_dup 2) (match_dup 1))))
1822 (set (match_operand:SI 0 "gpc_reg_operand" "")
1823 (minus:SI (match_dup 2) (match_dup 3)))]
1824 "TARGET_POWER || TARGET_ISEL"
1829 operands[2] = force_reg (SImode, operands[2]);
1830 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1834 operands[3] = gen_reg_rtx (SImode);
1838 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1839 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1840 (match_operand:SI 2 "reg_or_short_operand" "")))
1841 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1844 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1846 (minus:SI (match_dup 2) (match_dup 1))))
1847 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1850 (define_expand "smaxsi3"
1852 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1853 (match_operand:SI 2 "reg_or_short_operand" ""))
1855 (minus:SI (match_dup 2) (match_dup 1))))
1856 (set (match_operand:SI 0 "gpc_reg_operand" "")
1857 (plus:SI (match_dup 3) (match_dup 1)))]
1858 "TARGET_POWER || TARGET_ISEL"
1863 operands[2] = force_reg (SImode, operands[2]);
1864 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1867 operands[3] = gen_reg_rtx (SImode);
1871 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1872 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1873 (match_operand:SI 2 "reg_or_short_operand" "")))
1874 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1877 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1879 (minus:SI (match_dup 2) (match_dup 1))))
1880 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1883 (define_expand "uminsi3"
1884 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1886 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1888 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1890 (minus:SI (match_dup 4) (match_dup 3))))
1891 (set (match_operand:SI 0 "gpc_reg_operand" "")
1892 (minus:SI (match_dup 2) (match_dup 3)))]
1893 "TARGET_POWER || TARGET_ISEL"
1898 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1901 operands[3] = gen_reg_rtx (SImode);
1902 operands[4] = gen_reg_rtx (SImode);
1903 operands[5] = GEN_INT (-2147483647 - 1);
1906 (define_expand "umaxsi3"
1907 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1909 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1911 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1913 (minus:SI (match_dup 4) (match_dup 3))))
1914 (set (match_operand:SI 0 "gpc_reg_operand" "")
1915 (plus:SI (match_dup 3) (match_dup 1)))]
1916 "TARGET_POWER || TARGET_ISEL"
1921 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1924 operands[3] = gen_reg_rtx (SImode);
1925 operands[4] = gen_reg_rtx (SImode);
1926 operands[5] = GEN_INT (-2147483647 - 1);
1930 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1931 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1932 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1934 (minus:SI (match_dup 2) (match_dup 1))))]
1939 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1941 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1942 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1944 (minus:SI (match_dup 2) (match_dup 1)))
1946 (clobber (match_scratch:SI 3 "=r,r"))]
1951 [(set_attr "type" "delayed_compare")
1952 (set_attr "length" "4,8")])
1955 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1957 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1958 (match_operand:SI 2 "reg_or_short_operand" ""))
1960 (minus:SI (match_dup 2) (match_dup 1)))
1962 (clobber (match_scratch:SI 3 ""))]
1963 "TARGET_POWER && reload_completed"
1965 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1967 (minus:SI (match_dup 2) (match_dup 1))))
1969 (compare:CC (match_dup 3)
1974 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1976 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1977 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1979 (minus:SI (match_dup 2) (match_dup 1)))
1981 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1982 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1984 (minus:SI (match_dup 2) (match_dup 1))))]
1989 [(set_attr "type" "delayed_compare")
1990 (set_attr "length" "4,8")])
1993 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1995 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1996 (match_operand:SI 2 "reg_or_short_operand" ""))
1998 (minus:SI (match_dup 2) (match_dup 1)))
2000 (set (match_operand:SI 0 "gpc_reg_operand" "")
2001 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2003 (minus:SI (match_dup 2) (match_dup 1))))]
2004 "TARGET_POWER && reload_completed"
2006 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2008 (minus:SI (match_dup 2) (match_dup 1))))
2010 (compare:CC (match_dup 0)
2014 ;; We don't need abs with condition code because such comparisons should
2016 (define_expand "abssi2"
2017 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2018 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2024 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2027 else if (! TARGET_POWER)
2029 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2034 (define_insn "*abssi2_power"
2035 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2036 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2040 (define_insn_and_split "abssi2_isel"
2041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2042 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2043 (clobber (match_scratch:SI 2 "=&b"))
2044 (clobber (match_scratch:CC 3 "=y"))]
2047 "&& reload_completed"
2048 [(set (match_dup 2) (neg:SI (match_dup 1)))
2050 (compare:CC (match_dup 1)
2053 (if_then_else:SI (ge (match_dup 3)
2059 (define_insn_and_split "abssi2_nopower"
2060 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2061 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2062 (clobber (match_scratch:SI 2 "=&r,&r"))]
2063 "! TARGET_POWER && ! TARGET_ISEL"
2065 "&& reload_completed"
2066 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2067 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2068 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2071 (define_insn "*nabs_power"
2072 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2073 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2077 (define_insn_and_split "*nabs_nopower"
2078 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2079 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2080 (clobber (match_scratch:SI 2 "=&r,&r"))]
2083 "&& reload_completed"
2084 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2085 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2086 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2089 (define_expand "neg<mode>2"
2090 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2091 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2095 (define_insn "*neg<mode>2_internal"
2096 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2097 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2102 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2103 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2105 (clobber (match_scratch:P 2 "=r,r"))]
2110 [(set_attr "type" "fast_compare")
2111 (set_attr "length" "4,8")])
2114 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2115 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2117 (clobber (match_scratch:P 2 ""))]
2120 (neg:P (match_dup 1)))
2122 (compare:CC (match_dup 2)
2127 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2128 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2130 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2131 (neg:P (match_dup 1)))]
2136 [(set_attr "type" "fast_compare")
2137 (set_attr "length" "4,8")])
2140 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2141 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2143 (set (match_operand:P 0 "gpc_reg_operand" "")
2144 (neg:P (match_dup 1)))]
2147 (neg:P (match_dup 1)))
2149 (compare:CC (match_dup 0)
2153 (define_insn "clz<mode>2"
2154 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2155 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2157 "{cntlz|cntlz<wd>} %0,%1"
2158 [(set_attr "type" "cntlz")])
2160 (define_expand "ctz<mode>2"
2162 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2163 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2165 (clobber (scratch:CC))])
2166 (set (match_dup 4) (clz:GPR (match_dup 3)))
2167 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2168 (minus:GPR (match_dup 5) (match_dup 4)))]
2171 operands[2] = gen_reg_rtx (<MODE>mode);
2172 operands[3] = gen_reg_rtx (<MODE>mode);
2173 operands[4] = gen_reg_rtx (<MODE>mode);
2174 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2177 (define_expand "ffs<mode>2"
2179 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2180 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2182 (clobber (scratch:CC))])
2183 (set (match_dup 4) (clz:GPR (match_dup 3)))
2184 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2185 (minus:GPR (match_dup 5) (match_dup 4)))]
2188 operands[2] = gen_reg_rtx (<MODE>mode);
2189 operands[3] = gen_reg_rtx (<MODE>mode);
2190 operands[4] = gen_reg_rtx (<MODE>mode);
2191 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2194 (define_insn "popcntb<mode>2"
2195 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2196 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2201 (define_expand "popcount<mode>2"
2202 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2203 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2206 rs6000_emit_popcount (operands[0], operands[1]);
2210 (define_expand "parity<mode>2"
2211 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2212 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2215 rs6000_emit_parity (operands[0], operands[1]);
2219 (define_insn "bswapsi2"
2220 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2221 (bswap:SI (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2225 {stbrx|stwbrx} %1,%y0
2227 [(set_attr "length" "4,4,12")])
2230 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2231 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2234 (rotate:SI (match_dup 1) (const_int 8)))
2235 (set (zero_extract:SI (match_dup 0)
2239 (set (zero_extract:SI (match_dup 0)
2242 (rotate:SI (match_dup 1)
2246 (define_expand "mulsi3"
2247 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2248 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2249 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2254 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2256 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2260 (define_insn "mulsi3_mq"
2261 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2262 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2263 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2264 (clobber (match_scratch:SI 3 "=q,q"))]
2267 {muls|mullw} %0,%1,%2
2268 {muli|mulli} %0,%1,%2"
2270 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2271 (const_string "imul3")
2272 (match_operand:SI 2 "short_cint_operand" "")
2273 (const_string "imul2")]
2274 (const_string "imul")))])
2276 (define_insn "mulsi3_no_mq"
2277 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2278 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2279 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2282 {muls|mullw} %0,%1,%2
2283 {muli|mulli} %0,%1,%2"
2285 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2286 (const_string "imul3")
2287 (match_operand:SI 2 "short_cint_operand" "")
2288 (const_string "imul2")]
2289 (const_string "imul")))])
2291 (define_insn "*mulsi3_mq_internal1"
2292 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2293 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2294 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2296 (clobber (match_scratch:SI 3 "=r,r"))
2297 (clobber (match_scratch:SI 4 "=q,q"))]
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 (clobber (match_scratch:SI 4 ""))]
2312 "TARGET_POWER && reload_completed"
2313 [(parallel [(set (match_dup 3)
2314 (mult:SI (match_dup 1) (match_dup 2)))
2315 (clobber (match_dup 4))])
2317 (compare:CC (match_dup 3)
2321 (define_insn "*mulsi3_no_mq_internal1"
2322 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2323 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2324 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2326 (clobber (match_scratch:SI 3 "=r,r"))]
2329 {muls.|mullw.} %3,%1,%2
2331 [(set_attr "type" "imul_compare")
2332 (set_attr "length" "4,8")])
2335 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 ""))]
2340 "! TARGET_POWER && reload_completed"
2342 (mult:SI (match_dup 1) (match_dup 2)))
2344 (compare:CC (match_dup 3)
2348 (define_insn "*mulsi3_mq_internal2"
2349 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2350 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2351 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2353 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2354 (mult:SI (match_dup 1) (match_dup 2)))
2355 (clobber (match_scratch:SI 4 "=q,q"))]
2358 {muls.|mullw.} %0,%1,%2
2360 [(set_attr "type" "imul_compare")
2361 (set_attr "length" "4,8")])
2364 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2365 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2366 (match_operand:SI 2 "gpc_reg_operand" ""))
2368 (set (match_operand:SI 0 "gpc_reg_operand" "")
2369 (mult:SI (match_dup 1) (match_dup 2)))
2370 (clobber (match_scratch:SI 4 ""))]
2371 "TARGET_POWER && reload_completed"
2372 [(parallel [(set (match_dup 0)
2373 (mult:SI (match_dup 1) (match_dup 2)))
2374 (clobber (match_dup 4))])
2376 (compare:CC (match_dup 0)
2380 (define_insn "*mulsi3_no_mq_internal2"
2381 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2382 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2383 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2385 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2386 (mult:SI (match_dup 1) (match_dup 2)))]
2389 {muls.|mullw.} %0,%1,%2
2391 [(set_attr "type" "imul_compare")
2392 (set_attr "length" "4,8")])
2395 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2396 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2397 (match_operand:SI 2 "gpc_reg_operand" ""))
2399 (set (match_operand:SI 0 "gpc_reg_operand" "")
2400 (mult:SI (match_dup 1) (match_dup 2)))]
2401 "! TARGET_POWER && reload_completed"
2403 (mult:SI (match_dup 1) (match_dup 2)))
2405 (compare:CC (match_dup 0)
2409 ;; Operand 1 is divided by operand 2; quotient goes to operand
2410 ;; 0 and remainder to operand 3.
2411 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2413 (define_expand "divmodsi4"
2414 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2415 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2416 (match_operand:SI 2 "gpc_reg_operand" "")))
2417 (set (match_operand:SI 3 "register_operand" "")
2418 (mod:SI (match_dup 1) (match_dup 2)))])]
2419 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2422 if (! TARGET_POWER && ! TARGET_POWERPC)
2424 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2425 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2426 emit_insn (gen_divss_call ());
2427 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2428 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2433 (define_insn "*divmodsi4_internal"
2434 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2435 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2436 (match_operand:SI 2 "gpc_reg_operand" "r")))
2437 (set (match_operand:SI 3 "register_operand" "=q")
2438 (mod:SI (match_dup 1) (match_dup 2)))]
2441 [(set_attr "type" "idiv")])
2443 (define_expand "udiv<mode>3"
2444 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2445 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2446 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2447 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2450 if (! TARGET_POWER && ! TARGET_POWERPC)
2452 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2453 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2454 emit_insn (gen_quous_call ());
2455 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2458 else if (TARGET_POWER)
2460 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2465 (define_insn "udivsi3_mq"
2466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2467 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2468 (match_operand:SI 2 "gpc_reg_operand" "r")))
2469 (clobber (match_scratch:SI 3 "=q"))]
2470 "TARGET_POWERPC && TARGET_POWER"
2472 [(set_attr "type" "idiv")])
2474 (define_insn "*udivsi3_no_mq"
2475 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2476 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2477 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2478 "TARGET_POWERPC && ! TARGET_POWER"
2481 (cond [(match_operand:SI 0 "" "")
2482 (const_string "idiv")]
2483 (const_string "ldiv")))])
2486 ;; For powers of two we can do srai/aze for divide and then adjust for
2487 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2488 ;; used; for PowerPC, force operands into register and do a normal divide;
2489 ;; for AIX common-mode, use quoss call on register operands.
2490 (define_expand "div<mode>3"
2491 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2492 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2493 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2497 if (GET_CODE (operands[2]) == CONST_INT
2498 && INTVAL (operands[2]) > 0
2499 && exact_log2 (INTVAL (operands[2])) >= 0)
2501 else if (TARGET_POWERPC)
2503 operands[2] = force_reg (<MODE>mode, operands[2]);
2506 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2510 else if (TARGET_POWER)
2514 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2515 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2516 emit_insn (gen_quoss_call ());
2517 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2522 (define_insn "divsi3_mq"
2523 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2524 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2525 (match_operand:SI 2 "gpc_reg_operand" "r")))
2526 (clobber (match_scratch:SI 3 "=q"))]
2527 "TARGET_POWERPC && TARGET_POWER"
2529 [(set_attr "type" "idiv")])
2531 (define_insn "*div<mode>3_no_mq"
2532 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2533 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2534 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2535 "TARGET_POWERPC && ! TARGET_POWER"
2538 (cond [(match_operand:SI 0 "" "")
2539 (const_string "idiv")]
2540 (const_string "ldiv")))])
2542 (define_expand "mod<mode>3"
2543 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2544 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2545 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2553 if (GET_CODE (operands[2]) != CONST_INT
2554 || INTVAL (operands[2]) <= 0
2555 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2558 temp1 = gen_reg_rtx (<MODE>mode);
2559 temp2 = gen_reg_rtx (<MODE>mode);
2561 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2562 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2563 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2568 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2569 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2570 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2572 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2573 [(set_attr "type" "two")
2574 (set_attr "length" "8")])
2577 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2578 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2579 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2581 (clobber (match_scratch:P 3 "=r,r"))]
2584 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2586 [(set_attr "type" "compare")
2587 (set_attr "length" "8,12")])
2590 [(set (match_operand:CC 0 "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 (clobber (match_scratch:GPR 3 ""))]
2598 (div:<MODE> (match_dup 1) (match_dup 2)))
2600 (compare:CC (match_dup 3)
2605 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2606 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2607 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2609 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2610 (div:P (match_dup 1) (match_dup 2)))]
2613 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2615 [(set_attr "type" "compare")
2616 (set_attr "length" "8,12")])
2619 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2620 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2621 (match_operand:GPR 2 "exact_log2_cint_operand"
2624 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2625 (div:GPR (match_dup 1) (match_dup 2)))]
2628 (div:<MODE> (match_dup 1) (match_dup 2)))
2630 (compare:CC (match_dup 0)
2635 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2638 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2640 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2641 (match_operand:SI 3 "gpc_reg_operand" "r")))
2642 (set (match_operand:SI 2 "register_operand" "=*q")
2645 (zero_extend:DI (match_dup 1)) (const_int 32))
2646 (zero_extend:DI (match_dup 4)))
2650 [(set_attr "type" "idiv")])
2652 ;; To do unsigned divide we handle the cases of the divisor looking like a
2653 ;; negative number. If it is a constant that is less than 2**31, we don't
2654 ;; have to worry about the branches. So make a few subroutines here.
2656 ;; First comes the normal case.
2657 (define_expand "udivmodsi4_normal"
2658 [(set (match_dup 4) (const_int 0))
2659 (parallel [(set (match_operand:SI 0 "" "")
2660 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2662 (zero_extend:DI (match_operand:SI 1 "" "")))
2663 (match_operand:SI 2 "" "")))
2664 (set (match_operand:SI 3 "" "")
2665 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2667 (zero_extend:DI (match_dup 1)))
2671 { operands[4] = gen_reg_rtx (SImode); }")
2673 ;; This handles the branches.
2674 (define_expand "udivmodsi4_tests"
2675 [(set (match_operand:SI 0 "" "") (const_int 0))
2676 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2677 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2678 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2679 (label_ref (match_operand:SI 4 "" "")) (pc)))
2680 (set (match_dup 0) (const_int 1))
2681 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2682 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2683 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2684 (label_ref (match_dup 4)) (pc)))]
2687 { operands[5] = gen_reg_rtx (CCUNSmode);
2688 operands[6] = gen_reg_rtx (CCmode);
2691 (define_expand "udivmodsi4"
2692 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2693 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2694 (match_operand:SI 2 "reg_or_cint_operand" "")))
2695 (set (match_operand:SI 3 "gpc_reg_operand" "")
2696 (umod:SI (match_dup 1) (match_dup 2)))])]
2704 if (! TARGET_POWERPC)
2706 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2707 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2708 emit_insn (gen_divus_call ());
2709 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2710 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2717 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2719 operands[2] = force_reg (SImode, operands[2]);
2720 label = gen_label_rtx ();
2721 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2722 operands[3], label));
2725 operands[2] = force_reg (SImode, operands[2]);
2727 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2735 ;; AIX architecture-independent common-mode multiply (DImode),
2736 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2737 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2738 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2739 ;; assumed unused if generating common-mode, so ignore.
2740 (define_insn "mulh_call"
2743 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2744 (sign_extend:DI (reg:SI 4)))
2746 (clobber (reg:SI LR_REGNO))]
2747 "! TARGET_POWER && ! TARGET_POWERPC"
2749 [(set_attr "type" "imul")])
2751 (define_insn "mull_call"
2753 (mult:DI (sign_extend:DI (reg:SI 3))
2754 (sign_extend:DI (reg:SI 4))))
2755 (clobber (reg:SI LR_REGNO))
2756 (clobber (reg:SI 0))]
2757 "! TARGET_POWER && ! TARGET_POWERPC"
2759 [(set_attr "type" "imul")])
2761 (define_insn "divss_call"
2763 (div:SI (reg:SI 3) (reg:SI 4)))
2765 (mod:SI (reg:SI 3) (reg:SI 4)))
2766 (clobber (reg:SI LR_REGNO))
2767 (clobber (reg:SI 0))]
2768 "! TARGET_POWER && ! TARGET_POWERPC"
2770 [(set_attr "type" "idiv")])
2772 (define_insn "divus_call"
2774 (udiv:SI (reg:SI 3) (reg:SI 4)))
2776 (umod:SI (reg:SI 3) (reg:SI 4)))
2777 (clobber (reg:SI LR_REGNO))
2778 (clobber (reg:SI 0))
2779 (clobber (match_scratch:CC 0 "=x"))
2780 (clobber (reg:CC CR1_REGNO))]
2781 "! TARGET_POWER && ! TARGET_POWERPC"
2783 [(set_attr "type" "idiv")])
2785 (define_insn "quoss_call"
2787 (div:SI (reg:SI 3) (reg:SI 4)))
2788 (clobber (reg:SI LR_REGNO))]
2789 "! TARGET_POWER && ! TARGET_POWERPC"
2791 [(set_attr "type" "idiv")])
2793 (define_insn "quous_call"
2795 (udiv:SI (reg:SI 3) (reg:SI 4)))
2796 (clobber (reg:SI LR_REGNO))
2797 (clobber (reg:SI 0))
2798 (clobber (match_scratch:CC 0 "=x"))
2799 (clobber (reg:CC CR1_REGNO))]
2800 "! TARGET_POWER && ! TARGET_POWERPC"
2802 [(set_attr "type" "idiv")])
2804 ;; Logical instructions
2805 ;; The logical instructions are mostly combined by using match_operator,
2806 ;; but the plain AND insns are somewhat different because there is no
2807 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2808 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2810 (define_insn "andsi3"
2811 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2812 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2813 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2814 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2818 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2819 {andil.|andi.} %0,%1,%b2
2820 {andiu.|andis.} %0,%1,%u2"
2821 [(set_attr "type" "*,*,compare,compare")])
2823 ;; Note to set cr's other than cr0 we do the and immediate and then
2824 ;; the test again -- this avoids a mfcr which on the higher end
2825 ;; machines causes an execution serialization
2827 (define_insn "*andsi3_internal2"
2828 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2829 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2830 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2832 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2833 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2837 {andil.|andi.} %3,%1,%b2
2838 {andiu.|andis.} %3,%1,%u2
2839 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2844 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2845 (set_attr "length" "4,4,4,4,8,8,8,8")])
2847 (define_insn "*andsi3_internal3"
2848 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2849 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2850 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2852 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2853 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2857 {andil.|andi.} %3,%1,%b2
2858 {andiu.|andis.} %3,%1,%u2
2859 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2864 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2865 (set_attr "length" "8,4,4,4,8,8,8,8")])
2868 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2869 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2870 (match_operand:GPR 2 "and_operand" ""))
2872 (clobber (match_scratch:GPR 3 ""))
2873 (clobber (match_scratch:CC 4 ""))]
2875 [(parallel [(set (match_dup 3)
2876 (and:<MODE> (match_dup 1)
2878 (clobber (match_dup 4))])
2880 (compare:CC (match_dup 3)
2884 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2885 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2888 [(set (match_operand:CC 0 "cc_reg_operand" "")
2889 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2890 (match_operand:SI 2 "gpc_reg_operand" ""))
2892 (clobber (match_scratch:SI 3 ""))
2893 (clobber (match_scratch:CC 4 ""))]
2894 "TARGET_POWERPC64 && reload_completed"
2895 [(parallel [(set (match_dup 3)
2896 (and:SI (match_dup 1)
2898 (clobber (match_dup 4))])
2900 (compare:CC (match_dup 3)
2904 (define_insn "*andsi3_internal4"
2905 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2906 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2907 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2909 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2910 (and:SI (match_dup 1)
2912 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2916 {andil.|andi.} %0,%1,%b2
2917 {andiu.|andis.} %0,%1,%u2
2918 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2923 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2924 (set_attr "length" "4,4,4,4,8,8,8,8")])
2926 (define_insn "*andsi3_internal5"
2927 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2928 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2929 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2931 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2932 (and:SI (match_dup 1)
2934 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2938 {andil.|andi.} %0,%1,%b2
2939 {andiu.|andis.} %0,%1,%u2
2940 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2945 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2946 (set_attr "length" "8,4,4,4,8,8,8,8")])
2949 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2950 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2951 (match_operand:SI 2 "and_operand" ""))
2953 (set (match_operand:SI 0 "gpc_reg_operand" "")
2954 (and:SI (match_dup 1)
2956 (clobber (match_scratch:CC 4 ""))]
2958 [(parallel [(set (match_dup 0)
2959 (and:SI (match_dup 1)
2961 (clobber (match_dup 4))])
2963 (compare:CC (match_dup 0)
2968 [(set (match_operand:CC 3 "cc_reg_operand" "")
2969 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2970 (match_operand:SI 2 "gpc_reg_operand" ""))
2972 (set (match_operand:SI 0 "gpc_reg_operand" "")
2973 (and:SI (match_dup 1)
2975 (clobber (match_scratch:CC 4 ""))]
2976 "TARGET_POWERPC64 && reload_completed"
2977 [(parallel [(set (match_dup 0)
2978 (and:SI (match_dup 1)
2980 (clobber (match_dup 4))])
2982 (compare:CC (match_dup 0)
2986 ;; Handle the PowerPC64 rlwinm corner case
2988 (define_insn_and_split "*andsi3_internal6"
2989 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2990 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2991 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2996 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2999 (rotate:SI (match_dup 0) (match_dup 5)))]
3002 int mb = extract_MB (operands[2]);
3003 int me = extract_ME (operands[2]);
3004 operands[3] = GEN_INT (me + 1);
3005 operands[5] = GEN_INT (32 - (me + 1));
3006 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3008 [(set_attr "length" "8")])
3010 (define_expand "iorsi3"
3011 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3012 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3013 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3017 if (GET_CODE (operands[2]) == CONST_INT
3018 && ! logical_operand (operands[2], SImode))
3020 HOST_WIDE_INT value = INTVAL (operands[2]);
3021 rtx tmp = ((!can_create_pseudo_p ()
3022 || rtx_equal_p (operands[0], operands[1]))
3023 ? operands[0] : gen_reg_rtx (SImode));
3025 emit_insn (gen_iorsi3 (tmp, operands[1],
3026 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3027 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3032 (define_expand "xorsi3"
3033 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3034 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3035 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3039 if (GET_CODE (operands[2]) == CONST_INT
3040 && ! logical_operand (operands[2], SImode))
3042 HOST_WIDE_INT value = INTVAL (operands[2]);
3043 rtx tmp = ((!can_create_pseudo_p ()
3044 || rtx_equal_p (operands[0], operands[1]))
3045 ? operands[0] : gen_reg_rtx (SImode));
3047 emit_insn (gen_xorsi3 (tmp, operands[1],
3048 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3049 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3054 (define_insn "*boolsi3_internal1"
3055 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3056 (match_operator:SI 3 "boolean_or_operator"
3057 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3058 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3062 {%q3il|%q3i} %0,%1,%b2
3063 {%q3iu|%q3is} %0,%1,%u2")
3065 (define_insn "*boolsi3_internal2"
3066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3067 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3068 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3069 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3071 (clobber (match_scratch:SI 3 "=r,r"))]
3076 [(set_attr "type" "compare")
3077 (set_attr "length" "4,8")])
3080 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 ""))]
3086 "TARGET_32BIT && reload_completed"
3087 [(set (match_dup 3) (match_dup 4))
3089 (compare:CC (match_dup 3)
3093 (define_insn "*boolsi3_internal3"
3094 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3095 (compare:CC (match_operator:SI 4 "boolean_operator"
3096 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3097 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3099 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3105 [(set_attr "type" "compare")
3106 (set_attr "length" "4,8")])
3109 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3110 (compare:CC (match_operator:SI 4 "boolean_operator"
3111 [(match_operand:SI 1 "gpc_reg_operand" "")
3112 (match_operand:SI 2 "gpc_reg_operand" "")])
3114 (set (match_operand:SI 0 "gpc_reg_operand" "")
3116 "TARGET_32BIT && reload_completed"
3117 [(set (match_dup 0) (match_dup 4))
3119 (compare:CC (match_dup 0)
3123 ;; Split a logical operation that we can't do in one insn into two insns,
3124 ;; each of which does one 16-bit part. This is used by combine.
3127 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3128 (match_operator:SI 3 "boolean_or_operator"
3129 [(match_operand:SI 1 "gpc_reg_operand" "")
3130 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3132 [(set (match_dup 0) (match_dup 4))
3133 (set (match_dup 0) (match_dup 5))]
3137 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3138 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3140 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3141 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3145 (define_insn "*boolcsi3_internal1"
3146 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3147 (match_operator:SI 3 "boolean_operator"
3148 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3149 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3153 (define_insn "*boolcsi3_internal2"
3154 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3155 (compare:CC (match_operator:SI 4 "boolean_operator"
3156 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3157 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3159 (clobber (match_scratch:SI 3 "=r,r"))]
3164 [(set_attr "type" "compare")
3165 (set_attr "length" "4,8")])
3168 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 ""))]
3174 "TARGET_32BIT && reload_completed"
3175 [(set (match_dup 3) (match_dup 4))
3177 (compare:CC (match_dup 3)
3181 (define_insn "*boolcsi3_internal3"
3182 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3183 (compare:CC (match_operator:SI 4 "boolean_operator"
3184 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3185 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3187 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3193 [(set_attr "type" "compare")
3194 (set_attr "length" "4,8")])
3197 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3198 (compare:CC (match_operator:SI 4 "boolean_operator"
3199 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3200 (match_operand:SI 2 "gpc_reg_operand" "")])
3202 (set (match_operand:SI 0 "gpc_reg_operand" "")
3204 "TARGET_32BIT && reload_completed"
3205 [(set (match_dup 0) (match_dup 4))
3207 (compare:CC (match_dup 0)
3211 (define_insn "*boolccsi3_internal1"
3212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3213 (match_operator:SI 3 "boolean_operator"
3214 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3215 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3219 (define_insn "*boolccsi3_internal2"
3220 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3221 (compare:CC (match_operator:SI 4 "boolean_operator"
3222 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3223 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3225 (clobber (match_scratch:SI 3 "=r,r"))]
3230 [(set_attr "type" "compare")
3231 (set_attr "length" "4,8")])
3234 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 ""))]
3240 "TARGET_32BIT && reload_completed"
3241 [(set (match_dup 3) (match_dup 4))
3243 (compare:CC (match_dup 3)
3247 (define_insn "*boolccsi3_internal3"
3248 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3249 (compare:CC (match_operator:SI 4 "boolean_operator"
3250 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3251 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3253 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3259 [(set_attr "type" "compare")
3260 (set_attr "length" "4,8")])
3263 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3264 (compare:CC (match_operator:SI 4 "boolean_operator"
3265 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3266 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3268 (set (match_operand:SI 0 "gpc_reg_operand" "")
3270 "TARGET_32BIT && reload_completed"
3271 [(set (match_dup 0) (match_dup 4))
3273 (compare:CC (match_dup 0)
3277 ;; maskir insn. We need four forms because things might be in arbitrary
3278 ;; orders. Don't define forms that only set CR fields because these
3279 ;; would modify an input register.
3281 (define_insn "*maskir_internal1"
3282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3283 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3284 (match_operand:SI 1 "gpc_reg_operand" "0"))
3285 (and:SI (match_dup 2)
3286 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3290 (define_insn "*maskir_internal2"
3291 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3292 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3293 (match_operand:SI 1 "gpc_reg_operand" "0"))
3294 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3299 (define_insn "*maskir_internal3"
3300 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3301 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3302 (match_operand:SI 3 "gpc_reg_operand" "r"))
3303 (and:SI (not:SI (match_dup 2))
3304 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3308 (define_insn "*maskir_internal4"
3309 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3310 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3311 (match_operand:SI 2 "gpc_reg_operand" "r"))
3312 (and:SI (not:SI (match_dup 2))
3313 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3317 (define_insn "*maskir_internal5"
3318 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3320 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3321 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3322 (and:SI (match_dup 2)
3323 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3325 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3326 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3327 (and:SI (match_dup 2) (match_dup 3))))]
3332 [(set_attr "type" "compare")
3333 (set_attr "length" "4,8")])
3336 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3338 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3339 (match_operand:SI 1 "gpc_reg_operand" ""))
3340 (and:SI (match_dup 2)
3341 (match_operand:SI 3 "gpc_reg_operand" "")))
3343 (set (match_operand:SI 0 "gpc_reg_operand" "")
3344 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3345 (and:SI (match_dup 2) (match_dup 3))))]
3346 "TARGET_POWER && reload_completed"
3348 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3349 (and:SI (match_dup 2) (match_dup 3))))
3351 (compare:CC (match_dup 0)
3355 (define_insn "*maskir_internal6"
3356 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3358 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3359 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3360 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3363 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3364 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3365 (and:SI (match_dup 3) (match_dup 2))))]
3370 [(set_attr "type" "compare")
3371 (set_attr "length" "4,8")])
3374 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3376 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3377 (match_operand:SI 1 "gpc_reg_operand" ""))
3378 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3381 (set (match_operand:SI 0 "gpc_reg_operand" "")
3382 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3383 (and:SI (match_dup 3) (match_dup 2))))]
3384 "TARGET_POWER && reload_completed"
3386 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3387 (and:SI (match_dup 3) (match_dup 2))))
3389 (compare:CC (match_dup 0)
3393 (define_insn "*maskir_internal7"
3394 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3396 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3397 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3398 (and:SI (not:SI (match_dup 2))
3399 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3401 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3402 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3403 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3408 [(set_attr "type" "compare")
3409 (set_attr "length" "4,8")])
3412 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3414 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3415 (match_operand:SI 3 "gpc_reg_operand" ""))
3416 (and:SI (not:SI (match_dup 2))
3417 (match_operand:SI 1 "gpc_reg_operand" "")))
3419 (set (match_operand:SI 0 "gpc_reg_operand" "")
3420 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3421 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3422 "TARGET_POWER && reload_completed"
3424 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3425 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3427 (compare:CC (match_dup 0)
3431 (define_insn "*maskir_internal8"
3432 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3434 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3435 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3436 (and:SI (not:SI (match_dup 2))
3437 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3439 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3440 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3441 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3446 [(set_attr "type" "compare")
3447 (set_attr "length" "4,8")])
3450 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3452 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3453 (match_operand:SI 2 "gpc_reg_operand" ""))
3454 (and:SI (not:SI (match_dup 2))
3455 (match_operand:SI 1 "gpc_reg_operand" "")))
3457 (set (match_operand:SI 0 "gpc_reg_operand" "")
3458 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3459 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3460 "TARGET_POWER && reload_completed"
3462 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3463 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3465 (compare:CC (match_dup 0)
3469 ;; Rotate and shift insns, in all their variants. These support shifts,
3470 ;; field inserts and extracts, and various combinations thereof.
3471 (define_expand "insv"
3472 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3473 (match_operand:SI 1 "const_int_operand" "")
3474 (match_operand:SI 2 "const_int_operand" ""))
3475 (match_operand 3 "gpc_reg_operand" ""))]
3479 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3480 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3481 compiler if the address of the structure is taken later. Likewise, do
3482 not handle invalid E500 subregs. */
3483 if (GET_CODE (operands[0]) == SUBREG
3484 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3485 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3486 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3489 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3490 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3492 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3496 (define_insn "insvsi"
3497 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3498 (match_operand:SI 1 "const_int_operand" "i")
3499 (match_operand:SI 2 "const_int_operand" "i"))
3500 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3504 int start = INTVAL (operands[2]) & 31;
3505 int size = INTVAL (operands[1]) & 31;
3507 operands[4] = GEN_INT (32 - start - size);
3508 operands[1] = GEN_INT (start + size - 1);
3509 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3511 [(set_attr "type" "insert_word")])
3513 (define_insn "*insvsi_internal1"
3514 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3515 (match_operand:SI 1 "const_int_operand" "i")
3516 (match_operand:SI 2 "const_int_operand" "i"))
3517 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3518 (match_operand:SI 4 "const_int_operand" "i")))]
3519 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3522 int shift = INTVAL (operands[4]) & 31;
3523 int start = INTVAL (operands[2]) & 31;
3524 int size = INTVAL (operands[1]) & 31;
3526 operands[4] = GEN_INT (shift - start - size);
3527 operands[1] = GEN_INT (start + size - 1);
3528 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3530 [(set_attr "type" "insert_word")])
3532 (define_insn "*insvsi_internal2"
3533 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3534 (match_operand:SI 1 "const_int_operand" "i")
3535 (match_operand:SI 2 "const_int_operand" "i"))
3536 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3537 (match_operand:SI 4 "const_int_operand" "i")))]
3538 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3541 int shift = INTVAL (operands[4]) & 31;
3542 int start = INTVAL (operands[2]) & 31;
3543 int size = INTVAL (operands[1]) & 31;
3545 operands[4] = GEN_INT (32 - shift - start - size);
3546 operands[1] = GEN_INT (start + size - 1);
3547 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3549 [(set_attr "type" "insert_word")])
3551 (define_insn "*insvsi_internal3"
3552 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3553 (match_operand:SI 1 "const_int_operand" "i")
3554 (match_operand:SI 2 "const_int_operand" "i"))
3555 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3556 (match_operand:SI 4 "const_int_operand" "i")))]
3557 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3560 int shift = INTVAL (operands[4]) & 31;
3561 int start = INTVAL (operands[2]) & 31;
3562 int size = INTVAL (operands[1]) & 31;
3564 operands[4] = GEN_INT (32 - shift - start - size);
3565 operands[1] = GEN_INT (start + size - 1);
3566 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3568 [(set_attr "type" "insert_word")])
3570 (define_insn "*insvsi_internal4"
3571 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3572 (match_operand:SI 1 "const_int_operand" "i")
3573 (match_operand:SI 2 "const_int_operand" "i"))
3574 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3575 (match_operand:SI 4 "const_int_operand" "i")
3576 (match_operand:SI 5 "const_int_operand" "i")))]
3577 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3580 int extract_start = INTVAL (operands[5]) & 31;
3581 int extract_size = INTVAL (operands[4]) & 31;
3582 int insert_start = INTVAL (operands[2]) & 31;
3583 int insert_size = INTVAL (operands[1]) & 31;
3585 /* Align extract field with insert field */
3586 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3587 operands[1] = GEN_INT (insert_start + insert_size - 1);
3588 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3590 [(set_attr "type" "insert_word")])
3592 ;; combine patterns for rlwimi
3593 (define_insn "*insvsi_internal5"
3594 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3595 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3596 (match_operand:SI 1 "mask_operand" "i"))
3597 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3598 (match_operand:SI 2 "const_int_operand" "i"))
3599 (match_operand:SI 5 "mask_operand" "i"))))]
3600 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3603 int me = extract_ME(operands[5]);
3604 int mb = extract_MB(operands[5]);
3605 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3606 operands[2] = GEN_INT(mb);
3607 operands[1] = GEN_INT(me);
3608 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3610 [(set_attr "type" "insert_word")])
3612 (define_insn "*insvsi_internal6"
3613 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3614 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3615 (match_operand:SI 2 "const_int_operand" "i"))
3616 (match_operand:SI 5 "mask_operand" "i"))
3617 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3618 (match_operand:SI 1 "mask_operand" "i"))))]
3619 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3622 int me = extract_ME(operands[5]);
3623 int mb = extract_MB(operands[5]);
3624 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3625 operands[2] = GEN_INT(mb);
3626 operands[1] = GEN_INT(me);
3627 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3629 [(set_attr "type" "insert_word")])
3631 (define_insn "insvdi"
3632 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3633 (match_operand:SI 1 "const_int_operand" "i")
3634 (match_operand:SI 2 "const_int_operand" "i"))
3635 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3639 int start = INTVAL (operands[2]) & 63;
3640 int size = INTVAL (operands[1]) & 63;
3642 operands[1] = GEN_INT (64 - start - size);
3643 return \"rldimi %0,%3,%H1,%H2\";
3645 [(set_attr "type" "insert_dword")])
3647 (define_insn "*insvdi_internal2"
3648 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3649 (match_operand:SI 1 "const_int_operand" "i")
3650 (match_operand:SI 2 "const_int_operand" "i"))
3651 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3652 (match_operand:SI 4 "const_int_operand" "i")))]
3654 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3657 int shift = INTVAL (operands[4]) & 63;
3658 int start = (INTVAL (operands[2]) & 63) - 32;
3659 int size = INTVAL (operands[1]) & 63;
3661 operands[4] = GEN_INT (64 - shift - start - size);
3662 operands[2] = GEN_INT (start);
3663 operands[1] = GEN_INT (start + size - 1);
3664 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3667 (define_insn "*insvdi_internal3"
3668 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3669 (match_operand:SI 1 "const_int_operand" "i")
3670 (match_operand:SI 2 "const_int_operand" "i"))
3671 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3672 (match_operand:SI 4 "const_int_operand" "i")))]
3674 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3677 int shift = INTVAL (operands[4]) & 63;
3678 int start = (INTVAL (operands[2]) & 63) - 32;
3679 int size = INTVAL (operands[1]) & 63;
3681 operands[4] = GEN_INT (64 - shift - start - size);
3682 operands[2] = GEN_INT (start);
3683 operands[1] = GEN_INT (start + size - 1);
3684 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3687 (define_expand "extzv"
3688 [(set (match_operand 0 "gpc_reg_operand" "")
3689 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3690 (match_operand:SI 2 "const_int_operand" "")
3691 (match_operand:SI 3 "const_int_operand" "")))]
3695 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3696 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3697 compiler if the address of the structure is taken later. */
3698 if (GET_CODE (operands[0]) == SUBREG
3699 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3702 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3703 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3705 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3709 (define_insn "extzvsi"
3710 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3711 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3712 (match_operand:SI 2 "const_int_operand" "i")
3713 (match_operand:SI 3 "const_int_operand" "i")))]
3717 int start = INTVAL (operands[3]) & 31;
3718 int size = INTVAL (operands[2]) & 31;
3720 if (start + size >= 32)
3721 operands[3] = const0_rtx;
3723 operands[3] = GEN_INT (start + size);
3724 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3727 (define_insn "*extzvsi_internal1"
3728 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3729 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3730 (match_operand:SI 2 "const_int_operand" "i,i")
3731 (match_operand:SI 3 "const_int_operand" "i,i"))
3733 (clobber (match_scratch:SI 4 "=r,r"))]
3737 int start = INTVAL (operands[3]) & 31;
3738 int size = INTVAL (operands[2]) & 31;
3740 /* Force split for non-cc0 compare. */
3741 if (which_alternative == 1)
3744 /* If the bit-field being tested fits in the upper or lower half of a
3745 word, it is possible to use andiu. or andil. to test it. This is
3746 useful because the condition register set-use delay is smaller for
3747 andi[ul]. than for rlinm. This doesn't work when the starting bit
3748 position is 0 because the LT and GT bits may be set wrong. */
3750 if ((start > 0 && start + size <= 16) || start >= 16)
3752 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3753 - (1 << (16 - (start & 15) - size))));
3755 return \"{andiu.|andis.} %4,%1,%3\";
3757 return \"{andil.|andi.} %4,%1,%3\";
3760 if (start + size >= 32)
3761 operands[3] = const0_rtx;
3763 operands[3] = GEN_INT (start + size);
3764 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3766 [(set_attr "type" "delayed_compare")
3767 (set_attr "length" "4,8")])
3770 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3771 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3772 (match_operand:SI 2 "const_int_operand" "")
3773 (match_operand:SI 3 "const_int_operand" ""))
3775 (clobber (match_scratch:SI 4 ""))]
3778 (zero_extract:SI (match_dup 1) (match_dup 2)
3781 (compare:CC (match_dup 4)
3785 (define_insn "*extzvsi_internal2"
3786 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3787 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3788 (match_operand:SI 2 "const_int_operand" "i,i")
3789 (match_operand:SI 3 "const_int_operand" "i,i"))
3791 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3792 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3796 int start = INTVAL (operands[3]) & 31;
3797 int size = INTVAL (operands[2]) & 31;
3799 /* Force split for non-cc0 compare. */
3800 if (which_alternative == 1)
3803 /* Since we are using the output value, we can't ignore any need for
3804 a shift. The bit-field must end at the LSB. */
3805 if (start >= 16 && start + size == 32)
3807 operands[3] = GEN_INT ((1 << size) - 1);
3808 return \"{andil.|andi.} %0,%1,%3\";
3811 if (start + size >= 32)
3812 operands[3] = const0_rtx;
3814 operands[3] = GEN_INT (start + size);
3815 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3817 [(set_attr "type" "delayed_compare")
3818 (set_attr "length" "4,8")])
3821 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3822 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3823 (match_operand:SI 2 "const_int_operand" "")
3824 (match_operand:SI 3 "const_int_operand" ""))
3826 (set (match_operand:SI 0 "gpc_reg_operand" "")
3827 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3830 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3832 (compare:CC (match_dup 0)
3836 (define_insn "extzvdi"
3837 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3838 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3839 (match_operand:SI 2 "const_int_operand" "i")
3840 (match_operand:SI 3 "const_int_operand" "i")))]
3844 int start = INTVAL (operands[3]) & 63;
3845 int size = INTVAL (operands[2]) & 63;
3847 if (start + size >= 64)
3848 operands[3] = const0_rtx;
3850 operands[3] = GEN_INT (start + size);
3851 operands[2] = GEN_INT (64 - size);
3852 return \"rldicl %0,%1,%3,%2\";
3855 (define_insn "*extzvdi_internal1"
3856 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3857 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3858 (match_operand:SI 2 "const_int_operand" "i")
3859 (match_operand:SI 3 "const_int_operand" "i"))
3861 (clobber (match_scratch:DI 4 "=r"))]
3865 int start = INTVAL (operands[3]) & 63;
3866 int size = INTVAL (operands[2]) & 63;
3868 if (start + size >= 64)
3869 operands[3] = const0_rtx;
3871 operands[3] = GEN_INT (start + size);
3872 operands[2] = GEN_INT (64 - size);
3873 return \"rldicl. %4,%1,%3,%2\";
3875 [(set_attr "type" "compare")])
3877 (define_insn "*extzvdi_internal2"
3878 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3879 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3880 (match_operand:SI 2 "const_int_operand" "i")
3881 (match_operand:SI 3 "const_int_operand" "i"))
3883 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3884 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3888 int start = INTVAL (operands[3]) & 63;
3889 int size = INTVAL (operands[2]) & 63;
3891 if (start + size >= 64)
3892 operands[3] = const0_rtx;
3894 operands[3] = GEN_INT (start + size);
3895 operands[2] = GEN_INT (64 - size);
3896 return \"rldicl. %0,%1,%3,%2\";
3898 [(set_attr "type" "compare")])
3900 (define_insn "rotlsi3"
3901 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3902 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3903 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3906 {rlnm|rlwnm} %0,%1,%2,0xffffffff
3907 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
3908 [(set_attr "type" "var_shift_rotate,integer")])
3910 (define_insn "*rotlsi3_internal2"
3911 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3918 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
3919 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
3922 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3923 (set_attr "length" "4,4,8,8")])
3926 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3927 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3928 (match_operand:SI 2 "reg_or_cint_operand" ""))
3930 (clobber (match_scratch:SI 3 ""))]
3933 (rotate:SI (match_dup 1) (match_dup 2)))
3935 (compare:CC (match_dup 3)
3939 (define_insn "*rotlsi3_internal3"
3940 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3941 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3942 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3944 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3945 (rotate:SI (match_dup 1) (match_dup 2)))]
3948 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
3949 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
3952 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3953 (set_attr "length" "4,4,8,8")])
3956 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3957 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3958 (match_operand:SI 2 "reg_or_cint_operand" ""))
3960 (set (match_operand:SI 0 "gpc_reg_operand" "")
3961 (rotate:SI (match_dup 1) (match_dup 2)))]
3964 (rotate:SI (match_dup 1) (match_dup 2)))
3966 (compare:CC (match_dup 0)
3970 (define_insn "*rotlsi3_internal4"
3971 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3972 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3973 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3974 (match_operand:SI 3 "mask_operand" "n,n")))]
3977 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
3978 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
3979 [(set_attr "type" "var_shift_rotate,integer")])
3981 (define_insn "*rotlsi3_internal5"
3982 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3984 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3985 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3986 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3988 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3991 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
3992 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3995 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3996 (set_attr "length" "4,4,8,8")])
3999 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4001 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4002 (match_operand:SI 2 "reg_or_cint_operand" ""))
4003 (match_operand:SI 3 "mask_operand" ""))
4005 (clobber (match_scratch:SI 4 ""))]
4008 (and:SI (rotate:SI (match_dup 1)
4012 (compare:CC (match_dup 4)
4016 (define_insn "*rotlsi3_internal6"
4017 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4019 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4020 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4021 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4023 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4024 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4027 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4028 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4031 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4032 (set_attr "length" "4,4,8,8")])
4035 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4037 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4038 (match_operand:SI 2 "reg_or_cint_operand" ""))
4039 (match_operand:SI 3 "mask_operand" ""))
4041 (set (match_operand:SI 0 "gpc_reg_operand" "")
4042 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4045 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4047 (compare:CC (match_dup 0)
4051 (define_insn "*rotlsi3_internal7"
4052 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4055 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4056 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4058 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4060 (define_insn "*rotlsi3_internal8"
4061 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4062 (compare:CC (zero_extend:SI
4064 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4065 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4067 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4070 {rlnm.|rlwnm.} %3,%1,%2,0xff
4071 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4074 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4075 (set_attr "length" "4,4,8,8")])
4078 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4079 (compare:CC (zero_extend:SI
4081 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4082 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4084 (clobber (match_scratch:SI 3 ""))]
4087 (zero_extend:SI (subreg:QI
4088 (rotate:SI (match_dup 1)
4091 (compare:CC (match_dup 3)
4095 (define_insn "*rotlsi3_internal9"
4096 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4097 (compare:CC (zero_extend:SI
4099 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4100 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4102 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4103 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4106 {rlnm.|rlwnm.} %0,%1,%2,0xff
4107 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4110 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4111 (set_attr "length" "4,4,8,8")])
4114 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4115 (compare:CC (zero_extend:SI
4117 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4118 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4120 (set (match_operand:SI 0 "gpc_reg_operand" "")
4121 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4124 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4126 (compare:CC (match_dup 0)
4130 (define_insn "*rotlsi3_internal10"
4131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4134 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4135 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4138 {rlnm|rlwnm} %0,%1,%2,0xffff
4139 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4140 [(set_attr "type" "var_shift_rotate,integer")])
4143 (define_insn "*rotlsi3_internal11"
4144 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4145 (compare:CC (zero_extend:SI
4147 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4148 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4150 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4153 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4154 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4157 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4158 (set_attr "length" "4,4,8,8")])
4161 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4162 (compare:CC (zero_extend:SI
4164 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4165 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4167 (clobber (match_scratch:SI 3 ""))]
4170 (zero_extend:SI (subreg:HI
4171 (rotate:SI (match_dup 1)
4174 (compare:CC (match_dup 3)
4178 (define_insn "*rotlsi3_internal12"
4179 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4180 (compare:CC (zero_extend:SI
4182 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4183 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4185 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4186 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4189 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4190 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4193 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4194 (set_attr "length" "4,4,8,8")])
4197 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4198 (compare:CC (zero_extend:SI
4200 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4201 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4203 (set (match_operand:SI 0 "gpc_reg_operand" "")
4204 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4207 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4209 (compare:CC (match_dup 0)
4213 ;; Note that we use "sle." instead of "sl." so that we can set
4214 ;; SHIFT_COUNT_TRUNCATED.
4216 (define_expand "ashlsi3"
4217 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4218 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4219 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4224 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4226 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4230 (define_insn "ashlsi3_power"
4231 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4232 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4233 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4234 (clobber (match_scratch:SI 3 "=q,X"))]
4238 {sli|slwi} %0,%1,%h2")
4240 (define_insn "ashlsi3_no_power"
4241 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4242 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4243 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4247 {sli|slwi} %0,%1,%h2"
4248 [(set_attr "type" "var_shift_rotate,shift")])
4251 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4252 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4253 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4255 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4256 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4260 {sli.|slwi.} %3,%1,%h2
4263 [(set_attr "type" "delayed_compare")
4264 (set_attr "length" "4,4,8,8")])
4267 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4268 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4269 (match_operand:SI 2 "reg_or_cint_operand" ""))
4271 (clobber (match_scratch:SI 3 ""))
4272 (clobber (match_scratch:SI 4 ""))]
4273 "TARGET_POWER && reload_completed"
4274 [(parallel [(set (match_dup 3)
4275 (ashift:SI (match_dup 1) (match_dup 2)))
4276 (clobber (match_dup 4))])
4278 (compare:CC (match_dup 3)
4283 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4288 "! TARGET_POWER && TARGET_32BIT"
4291 {sli.|slwi.} %3,%1,%h2
4294 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4295 (set_attr "length" "4,4,8,8")])
4298 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4299 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4300 (match_operand:SI 2 "reg_or_cint_operand" ""))
4302 (clobber (match_scratch:SI 3 ""))]
4303 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4305 (ashift:SI (match_dup 1) (match_dup 2)))
4307 (compare:CC (match_dup 3)
4312 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4313 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4314 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4316 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4317 (ashift:SI (match_dup 1) (match_dup 2)))
4318 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4322 {sli.|slwi.} %0,%1,%h2
4325 [(set_attr "type" "delayed_compare")
4326 (set_attr "length" "4,4,8,8")])
4329 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4330 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4331 (match_operand:SI 2 "reg_or_cint_operand" ""))
4333 (set (match_operand:SI 0 "gpc_reg_operand" "")
4334 (ashift:SI (match_dup 1) (match_dup 2)))
4335 (clobber (match_scratch:SI 4 ""))]
4336 "TARGET_POWER && reload_completed"
4337 [(parallel [(set (match_dup 0)
4338 (ashift:SI (match_dup 1) (match_dup 2)))
4339 (clobber (match_dup 4))])
4341 (compare:CC (match_dup 0)
4346 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4347 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4348 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4350 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4351 (ashift:SI (match_dup 1) (match_dup 2)))]
4352 "! TARGET_POWER && TARGET_32BIT"
4355 {sli.|slwi.} %0,%1,%h2
4358 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4359 (set_attr "length" "4,4,8,8")])
4362 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4363 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4364 (match_operand:SI 2 "reg_or_cint_operand" ""))
4366 (set (match_operand:SI 0 "gpc_reg_operand" "")
4367 (ashift:SI (match_dup 1) (match_dup 2)))]
4368 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4370 (ashift:SI (match_dup 1) (match_dup 2)))
4372 (compare:CC (match_dup 0)
4376 (define_insn "rlwinm"
4377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4378 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4379 (match_operand:SI 2 "const_int_operand" "i"))
4380 (match_operand:SI 3 "mask_operand" "n")))]
4381 "includes_lshift_p (operands[2], operands[3])"
4382 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4385 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4387 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4388 (match_operand:SI 2 "const_int_operand" "i,i"))
4389 (match_operand:SI 3 "mask_operand" "n,n"))
4391 (clobber (match_scratch:SI 4 "=r,r"))]
4392 "includes_lshift_p (operands[2], operands[3])"
4394 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4396 [(set_attr "type" "delayed_compare")
4397 (set_attr "length" "4,8")])
4400 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4402 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4403 (match_operand:SI 2 "const_int_operand" ""))
4404 (match_operand:SI 3 "mask_operand" ""))
4406 (clobber (match_scratch:SI 4 ""))]
4407 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4409 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4412 (compare:CC (match_dup 4)
4417 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4419 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4420 (match_operand:SI 2 "const_int_operand" "i,i"))
4421 (match_operand:SI 3 "mask_operand" "n,n"))
4423 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4424 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4425 "includes_lshift_p (operands[2], operands[3])"
4427 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4429 [(set_attr "type" "delayed_compare")
4430 (set_attr "length" "4,8")])
4433 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4435 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4436 (match_operand:SI 2 "const_int_operand" ""))
4437 (match_operand:SI 3 "mask_operand" ""))
4439 (set (match_operand:SI 0 "gpc_reg_operand" "")
4440 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4441 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4443 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4445 (compare:CC (match_dup 0)
4449 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4451 (define_expand "lshrsi3"
4452 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4453 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4454 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4459 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4461 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4465 (define_insn "lshrsi3_power"
4466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4467 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4468 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4469 (clobber (match_scratch:SI 3 "=q,X,X"))]
4474 {s%A2i|s%A2wi} %0,%1,%h2")
4476 (define_insn "lshrsi3_no_power"
4477 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4478 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4479 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4484 {sri|srwi} %0,%1,%h2"
4485 [(set_attr "type" "integer,var_shift_rotate,shift")])
4488 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4489 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4490 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4492 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4493 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4498 {s%A2i.|s%A2wi.} %3,%1,%h2
4502 [(set_attr "type" "delayed_compare")
4503 (set_attr "length" "4,4,4,8,8,8")])
4506 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4507 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4508 (match_operand:SI 2 "reg_or_cint_operand" ""))
4510 (clobber (match_scratch:SI 3 ""))
4511 (clobber (match_scratch:SI 4 ""))]
4512 "TARGET_POWER && reload_completed"
4513 [(parallel [(set (match_dup 3)
4514 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4515 (clobber (match_dup 4))])
4517 (compare:CC (match_dup 3)
4522 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4523 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4524 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4526 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4527 "! TARGET_POWER && TARGET_32BIT"
4531 {sri.|srwi.} %3,%1,%h2
4535 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4536 (set_attr "length" "4,4,4,8,8,8")])
4539 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4540 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4541 (match_operand:SI 2 "reg_or_cint_operand" ""))
4543 (clobber (match_scratch:SI 3 ""))]
4544 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4546 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4548 (compare:CC (match_dup 3)
4553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4554 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4555 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4557 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4558 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4559 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4564 {s%A2i.|s%A2wi.} %0,%1,%h2
4568 [(set_attr "type" "delayed_compare")
4569 (set_attr "length" "4,4,4,8,8,8")])
4572 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4573 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4574 (match_operand:SI 2 "reg_or_cint_operand" ""))
4576 (set (match_operand:SI 0 "gpc_reg_operand" "")
4577 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4578 (clobber (match_scratch:SI 4 ""))]
4579 "TARGET_POWER && reload_completed"
4580 [(parallel [(set (match_dup 0)
4581 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4582 (clobber (match_dup 4))])
4584 (compare:CC (match_dup 0)
4589 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4590 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4591 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4593 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4594 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4595 "! TARGET_POWER && TARGET_32BIT"
4599 {sri.|srwi.} %0,%1,%h2
4603 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4604 (set_attr "length" "4,4,4,8,8,8")])
4607 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4608 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4609 (match_operand:SI 2 "reg_or_cint_operand" ""))
4611 (set (match_operand:SI 0 "gpc_reg_operand" "")
4612 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4613 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4615 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4617 (compare:CC (match_dup 0)
4622 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4623 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4624 (match_operand:SI 2 "const_int_operand" "i"))
4625 (match_operand:SI 3 "mask_operand" "n")))]
4626 "includes_rshift_p (operands[2], operands[3])"
4627 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4630 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4632 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4633 (match_operand:SI 2 "const_int_operand" "i,i"))
4634 (match_operand:SI 3 "mask_operand" "n,n"))
4636 (clobber (match_scratch:SI 4 "=r,r"))]
4637 "includes_rshift_p (operands[2], operands[3])"
4639 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4641 [(set_attr "type" "delayed_compare")
4642 (set_attr "length" "4,8")])
4645 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4647 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4648 (match_operand:SI 2 "const_int_operand" ""))
4649 (match_operand:SI 3 "mask_operand" ""))
4651 (clobber (match_scratch:SI 4 ""))]
4652 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4654 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4657 (compare:CC (match_dup 4)
4662 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4664 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4665 (match_operand:SI 2 "const_int_operand" "i,i"))
4666 (match_operand:SI 3 "mask_operand" "n,n"))
4668 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4669 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4670 "includes_rshift_p (operands[2], operands[3])"
4672 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4674 [(set_attr "type" "delayed_compare")
4675 (set_attr "length" "4,8")])
4678 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4680 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4681 (match_operand:SI 2 "const_int_operand" ""))
4682 (match_operand:SI 3 "mask_operand" ""))
4684 (set (match_operand:SI 0 "gpc_reg_operand" "")
4685 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4686 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4688 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4690 (compare:CC (match_dup 0)
4695 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4698 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4699 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4700 "includes_rshift_p (operands[2], GEN_INT (255))"
4701 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4704 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4708 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4709 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4711 (clobber (match_scratch:SI 3 "=r,r"))]
4712 "includes_rshift_p (operands[2], GEN_INT (255))"
4714 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4716 [(set_attr "type" "delayed_compare")
4717 (set_attr "length" "4,8")])
4720 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4724 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4725 (match_operand:SI 2 "const_int_operand" "")) 0))
4727 (clobber (match_scratch:SI 3 ""))]
4728 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4730 (zero_extend:SI (subreg:QI
4731 (lshiftrt:SI (match_dup 1)
4734 (compare:CC (match_dup 3)
4739 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4743 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4744 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4746 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4747 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4748 "includes_rshift_p (operands[2], GEN_INT (255))"
4750 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4752 [(set_attr "type" "delayed_compare")
4753 (set_attr "length" "4,8")])
4756 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4760 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4761 (match_operand:SI 2 "const_int_operand" "")) 0))
4763 (set (match_operand:SI 0 "gpc_reg_operand" "")
4764 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4765 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4767 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4769 (compare:CC (match_dup 0)
4774 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4777 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4778 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4779 "includes_rshift_p (operands[2], GEN_INT (65535))"
4780 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4783 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4787 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4788 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4790 (clobber (match_scratch:SI 3 "=r,r"))]
4791 "includes_rshift_p (operands[2], GEN_INT (65535))"
4793 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4795 [(set_attr "type" "delayed_compare")
4796 (set_attr "length" "4,8")])
4799 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4803 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4804 (match_operand:SI 2 "const_int_operand" "")) 0))
4806 (clobber (match_scratch:SI 3 ""))]
4807 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4809 (zero_extend:SI (subreg:HI
4810 (lshiftrt:SI (match_dup 1)
4813 (compare:CC (match_dup 3)
4818 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4822 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4823 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4825 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4826 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4827 "includes_rshift_p (operands[2], GEN_INT (65535))"
4829 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4831 [(set_attr "type" "delayed_compare")
4832 (set_attr "length" "4,8")])
4835 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4839 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4840 (match_operand:SI 2 "const_int_operand" "")) 0))
4842 (set (match_operand:SI 0 "gpc_reg_operand" "")
4843 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4844 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4846 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4848 (compare:CC (match_dup 0)
4853 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4855 (match_operand:SI 1 "gpc_reg_operand" "r"))
4856 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4862 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4864 (match_operand:SI 1 "gpc_reg_operand" "r"))
4865 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4871 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4873 (match_operand:SI 1 "gpc_reg_operand" "r"))
4874 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4880 (define_expand "ashrsi3"
4881 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4882 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4883 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4888 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4890 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4894 (define_insn "ashrsi3_power"
4895 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4896 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4897 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4898 (clobber (match_scratch:SI 3 "=q,X"))]
4902 {srai|srawi} %0,%1,%h2"
4903 [(set_attr "type" "shift")])
4905 (define_insn "ashrsi3_no_power"
4906 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4907 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4908 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4912 {srai|srawi} %0,%1,%h2"
4913 [(set_attr "type" "var_shift_rotate,shift")])
4916 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4917 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4918 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4920 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4921 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4925 {srai.|srawi.} %3,%1,%h2
4928 [(set_attr "type" "delayed_compare")
4929 (set_attr "length" "4,4,8,8")])
4932 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4933 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4934 (match_operand:SI 2 "reg_or_cint_operand" ""))
4936 (clobber (match_scratch:SI 3 ""))
4937 (clobber (match_scratch:SI 4 ""))]
4938 "TARGET_POWER && reload_completed"
4939 [(parallel [(set (match_dup 3)
4940 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4941 (clobber (match_dup 4))])
4943 (compare:CC (match_dup 3)
4948 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4955 {sra.|sraw.} %3,%1,%2
4956 {srai.|srawi.} %3,%1,%h2
4959 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4960 (set_attr "length" "4,4,8,8")])
4963 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4964 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4965 (match_operand:SI 2 "reg_or_cint_operand" ""))
4967 (clobber (match_scratch:SI 3 ""))]
4968 "! TARGET_POWER && reload_completed"
4970 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4972 (compare:CC (match_dup 3)
4977 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4978 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4979 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4981 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4982 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4983 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4987 {srai.|srawi.} %0,%1,%h2
4990 [(set_attr "type" "delayed_compare")
4991 (set_attr "length" "4,4,8,8")])
4994 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4995 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4996 (match_operand:SI 2 "reg_or_cint_operand" ""))
4998 (set (match_operand:SI 0 "gpc_reg_operand" "")
4999 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5000 (clobber (match_scratch:SI 4 ""))]
5001 "TARGET_POWER && reload_completed"
5002 [(parallel [(set (match_dup 0)
5003 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5004 (clobber (match_dup 4))])
5006 (compare:CC (match_dup 0)
5011 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5012 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5013 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5015 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5016 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5019 {sra.|sraw.} %0,%1,%2
5020 {srai.|srawi.} %0,%1,%h2
5023 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5024 (set_attr "length" "4,4,8,8")])
5027 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5028 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5029 (match_operand:SI 2 "reg_or_cint_operand" ""))
5031 (set (match_operand:SI 0 "gpc_reg_operand" "")
5032 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5033 "! TARGET_POWER && reload_completed"
5035 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5037 (compare:CC (match_dup 0)
5041 ;; Floating-point insns, excluding normal data motion.
5043 ;; PowerPC has a full set of single-precision floating point instructions.
5045 ;; For the POWER architecture, we pretend that we have both SFmode and
5046 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5047 ;; The only conversions we will do will be when storing to memory. In that
5048 ;; case, we will use the "frsp" instruction before storing.
5050 ;; Note that when we store into a single-precision memory location, we need to
5051 ;; use the frsp insn first. If the register being stored isn't dead, we
5052 ;; need a scratch register for the frsp. But this is difficult when the store
5053 ;; is done by reload. It is not incorrect to do the frsp on the register in
5054 ;; this case, we just lose precision that we would have otherwise gotten but
5055 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5057 (define_expand "extendsfdf2"
5058 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5059 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5060 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5063 (define_insn_and_split "*extendsfdf2_fpr"
5064 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
5065 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5066 "TARGET_HARD_FLOAT && TARGET_FPRS"
5071 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5074 emit_note (NOTE_INSN_DELETED);
5077 [(set_attr "type" "fp,fp,fpload")])
5079 (define_expand "truncdfsf2"
5080 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5081 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5082 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5085 (define_insn "*truncdfsf2_fpr"
5086 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5087 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5088 "TARGET_HARD_FLOAT && TARGET_FPRS"
5090 [(set_attr "type" "fp")])
5092 (define_insn "aux_truncdfsf2"
5093 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5094 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5095 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5097 [(set_attr "type" "fp")])
5099 (define_expand "negsf2"
5100 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5101 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5105 (define_insn "*negsf2"
5106 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5107 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5108 "TARGET_HARD_FLOAT && TARGET_FPRS"
5110 [(set_attr "type" "fp")])
5112 (define_expand "abssf2"
5113 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5114 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5118 (define_insn "*abssf2"
5119 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5120 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5121 "TARGET_HARD_FLOAT && TARGET_FPRS"
5123 [(set_attr "type" "fp")])
5126 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5127 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5128 "TARGET_HARD_FLOAT && TARGET_FPRS"
5130 [(set_attr "type" "fp")])
5132 (define_expand "addsf3"
5133 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5134 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5135 (match_operand:SF 2 "gpc_reg_operand" "")))]
5140 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5141 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5142 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5143 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5145 [(set_attr "type" "fp")])
5148 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5149 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5150 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5151 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5152 "{fa|fadd} %0,%1,%2"
5153 [(set_attr "type" "fp")])
5155 (define_expand "subsf3"
5156 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5157 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5158 (match_operand:SF 2 "gpc_reg_operand" "")))]
5163 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5164 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5165 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5166 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5168 [(set_attr "type" "fp")])
5171 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5172 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5173 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5174 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5175 "{fs|fsub} %0,%1,%2"
5176 [(set_attr "type" "fp")])
5178 (define_expand "mulsf3"
5179 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5180 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5181 (match_operand:SF 2 "gpc_reg_operand" "")))]
5186 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5187 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5188 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5189 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5191 [(set_attr "type" "fp")])
5194 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5195 (mult: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"
5198 "{fm|fmul} %0,%1,%2"
5199 [(set_attr "type" "dmul")])
5201 (define_expand "divsf3"
5202 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5203 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5204 (match_operand:SF 2 "gpc_reg_operand" "")))]
5209 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5210 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5211 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5212 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5214 [(set_attr "type" "sdiv")])
5217 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5218 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5219 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5220 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5221 "{fd|fdiv} %0,%1,%2"
5222 [(set_attr "type" "ddiv")])
5224 (define_expand "recipsf3"
5225 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5226 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")
5227 (match_operand:SF 2 "gpc_reg_operand" "f")]
5229 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5230 && flag_finite_math_only && !flag_trapping_math"
5232 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
5237 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5238 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5239 "TARGET_PPC_GFXOPT && flag_finite_math_only"
5241 [(set_attr "type" "fp")])
5244 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5245 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5246 (match_operand:SF 2 "gpc_reg_operand" "f"))
5247 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5248 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5249 "fmadds %0,%1,%2,%3"
5250 [(set_attr "type" "fp")])
5253 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5254 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5255 (match_operand:SF 2 "gpc_reg_operand" "f"))
5256 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5257 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5258 "{fma|fmadd} %0,%1,%2,%3"
5259 [(set_attr "type" "dmul")])
5262 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5263 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5264 (match_operand:SF 2 "gpc_reg_operand" "f"))
5265 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5266 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5267 "fmsubs %0,%1,%2,%3"
5268 [(set_attr "type" "fp")])
5271 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5272 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5273 (match_operand:SF 2 "gpc_reg_operand" "f"))
5274 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5275 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5276 "{fms|fmsub} %0,%1,%2,%3"
5277 [(set_attr "type" "dmul")])
5280 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5281 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5282 (match_operand:SF 2 "gpc_reg_operand" "f"))
5283 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5284 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5285 && HONOR_SIGNED_ZEROS (SFmode)"
5286 "fnmadds %0,%1,%2,%3"
5287 [(set_attr "type" "fp")])
5290 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5291 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5292 (match_operand:SF 2 "gpc_reg_operand" "f"))
5293 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5294 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5295 && ! HONOR_SIGNED_ZEROS (SFmode)"
5296 "fnmadds %0,%1,%2,%3"
5297 [(set_attr "type" "fp")])
5300 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5301 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5302 (match_operand:SF 2 "gpc_reg_operand" "f"))
5303 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5304 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5305 "{fnma|fnmadd} %0,%1,%2,%3"
5306 [(set_attr "type" "dmul")])
5309 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5310 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5311 (match_operand:SF 2 "gpc_reg_operand" "f"))
5312 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5313 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5314 && ! HONOR_SIGNED_ZEROS (SFmode)"
5315 "{fnma|fnmadd} %0,%1,%2,%3"
5316 [(set_attr "type" "dmul")])
5319 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5320 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5321 (match_operand:SF 2 "gpc_reg_operand" "f"))
5322 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5323 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5324 && HONOR_SIGNED_ZEROS (SFmode)"
5325 "fnmsubs %0,%1,%2,%3"
5326 [(set_attr "type" "fp")])
5329 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5330 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5331 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5332 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5333 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5334 && ! HONOR_SIGNED_ZEROS (SFmode)"
5335 "fnmsubs %0,%1,%2,%3"
5336 [(set_attr "type" "fp")])
5339 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5340 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5341 (match_operand:SF 2 "gpc_reg_operand" "f"))
5342 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5343 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5344 "{fnms|fnmsub} %0,%1,%2,%3"
5345 [(set_attr "type" "dmul")])
5348 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5349 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5350 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5351 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5352 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5353 && ! HONOR_SIGNED_ZEROS (SFmode)"
5354 "{fnms|fnmsub} %0,%1,%2,%3"
5355 [(set_attr "type" "dmul")])
5357 (define_expand "sqrtsf2"
5358 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5359 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5360 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5364 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5365 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5366 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5368 [(set_attr "type" "ssqrt")])
5371 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5372 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5373 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5375 [(set_attr "type" "dsqrt")])
5377 (define_expand "rsqrtsf2"
5378 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5379 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5381 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT && !optimize_size
5382 && flag_finite_math_only && !flag_trapping_math"
5384 rs6000_emit_swrsqrtsf (operands[0], operands[1]);
5388 (define_insn "*rsqrt_internal1"
5389 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5390 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5392 "TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT"
5394 [(set_attr "type" "fp")])
5396 (define_expand "copysignsf3"
5398 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
5400 (neg:SF (abs:SF (match_dup 1))))
5401 (set (match_operand:SF 0 "gpc_reg_operand" "")
5402 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
5406 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5407 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
5409 operands[3] = gen_reg_rtx (SFmode);
5410 operands[4] = gen_reg_rtx (SFmode);
5411 operands[5] = CONST0_RTX (SFmode);
5414 (define_expand "copysigndf3"
5416 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
5418 (neg:DF (abs:DF (match_dup 1))))
5419 (set (match_operand:DF 0 "gpc_reg_operand" "")
5420 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
5424 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5425 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
5427 operands[3] = gen_reg_rtx (DFmode);
5428 operands[4] = gen_reg_rtx (DFmode);
5429 operands[5] = CONST0_RTX (DFmode);
5432 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5433 ;; fsel instruction and some auxiliary computations. Then we just have a
5434 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5436 (define_expand "smaxsf3"
5437 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5438 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5439 (match_operand:SF 2 "gpc_reg_operand" ""))
5442 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5443 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5445 (define_expand "sminsf3"
5446 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5447 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5448 (match_operand:SF 2 "gpc_reg_operand" ""))
5451 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5452 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5455 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5456 (match_operator:SF 3 "min_max_operator"
5457 [(match_operand:SF 1 "gpc_reg_operand" "")
5458 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5459 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5462 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5463 operands[1], operands[2]);
5467 (define_expand "movsicc"
5468 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5469 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5470 (match_operand:SI 2 "gpc_reg_operand" "")
5471 (match_operand:SI 3 "gpc_reg_operand" "")))]
5475 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5481 ;; We use the BASE_REGS for the isel input operands because, if rA is
5482 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5483 ;; because we may switch the operands and rB may end up being rA.
5485 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5486 ;; leave out the mode in operand 4 and use one pattern, but reload can
5487 ;; change the mode underneath our feet and then gets confused trying
5488 ;; to reload the value.
5489 (define_insn "isel_signed"
5490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5492 (match_operator 1 "comparison_operator"
5493 [(match_operand:CC 4 "cc_reg_operand" "y")
5495 (match_operand:SI 2 "gpc_reg_operand" "b")
5496 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5499 { return output_isel (operands); }"
5500 [(set_attr "length" "4")])
5502 (define_insn "isel_unsigned"
5503 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5505 (match_operator 1 "comparison_operator"
5506 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5508 (match_operand:SI 2 "gpc_reg_operand" "b")
5509 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5512 { return output_isel (operands); }"
5513 [(set_attr "length" "4")])
5515 (define_expand "movsfcc"
5516 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5517 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5518 (match_operand:SF 2 "gpc_reg_operand" "")
5519 (match_operand:SF 3 "gpc_reg_operand" "")))]
5520 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5523 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5529 (define_insn "*fselsfsf4"
5530 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5531 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5532 (match_operand:SF 4 "zero_fp_constant" "F"))
5533 (match_operand:SF 2 "gpc_reg_operand" "f")
5534 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5535 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5537 [(set_attr "type" "fp")])
5539 (define_insn "*fseldfsf4"
5540 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5541 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5542 (match_operand:DF 4 "zero_fp_constant" "F"))
5543 (match_operand:SF 2 "gpc_reg_operand" "f")
5544 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5545 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5547 [(set_attr "type" "fp")])
5549 (define_expand "negdf2"
5550 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5551 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5552 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5555 (define_insn "*negdf2_fpr"
5556 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5557 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5558 "TARGET_HARD_FLOAT && TARGET_FPRS"
5560 [(set_attr "type" "fp")])
5562 (define_expand "absdf2"
5563 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5564 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5565 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5568 (define_insn "*absdf2_fpr"
5569 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5570 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5571 "TARGET_HARD_FLOAT && TARGET_FPRS"
5573 [(set_attr "type" "fp")])
5575 (define_insn "*nabsdf2_fpr"
5576 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5577 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5578 "TARGET_HARD_FLOAT && TARGET_FPRS"
5580 [(set_attr "type" "fp")])
5582 (define_expand "adddf3"
5583 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5584 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5585 (match_operand:DF 2 "gpc_reg_operand" "")))]
5586 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5589 (define_insn "*adddf3_fpr"
5590 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5591 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5592 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5593 "TARGET_HARD_FLOAT && TARGET_FPRS"
5594 "{fa|fadd} %0,%1,%2"
5595 [(set_attr "type" "fp")])
5597 (define_expand "subdf3"
5598 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5599 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5600 (match_operand:DF 2 "gpc_reg_operand" "")))]
5601 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5604 (define_insn "*subdf3_fpr"
5605 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5606 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5607 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5608 "TARGET_HARD_FLOAT && TARGET_FPRS"
5609 "{fs|fsub} %0,%1,%2"
5610 [(set_attr "type" "fp")])
5612 (define_expand "muldf3"
5613 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5614 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5615 (match_operand:DF 2 "gpc_reg_operand" "")))]
5616 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5619 (define_insn "*muldf3_fpr"
5620 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5621 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5622 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5623 "TARGET_HARD_FLOAT && TARGET_FPRS"
5624 "{fm|fmul} %0,%1,%2"
5625 [(set_attr "type" "dmul")])
5627 (define_expand "divdf3"
5628 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5629 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5630 (match_operand:DF 2 "gpc_reg_operand" "")))]
5631 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5634 (define_insn "*divdf3_fpr"
5635 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5636 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5637 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5638 "TARGET_HARD_FLOAT && TARGET_FPRS"
5639 "{fd|fdiv} %0,%1,%2"
5640 [(set_attr "type" "ddiv")])
5642 (define_expand "recipdf3"
5643 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5644 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")
5645 (match_operand:DF 2 "gpc_reg_operand" "f")]
5647 "TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
5648 && flag_finite_math_only && !flag_trapping_math"
5650 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5655 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5656 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5657 "TARGET_POPCNTB && flag_finite_math_only"
5659 [(set_attr "type" "fp")])
5662 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5663 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5664 (match_operand:DF 2 "gpc_reg_operand" "f"))
5665 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5666 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5667 "{fma|fmadd} %0,%1,%2,%3"
5668 [(set_attr "type" "dmul")])
5671 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5672 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5673 (match_operand:DF 2 "gpc_reg_operand" "f"))
5674 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5675 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5676 "{fms|fmsub} %0,%1,%2,%3"
5677 [(set_attr "type" "dmul")])
5680 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5681 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5682 (match_operand:DF 2 "gpc_reg_operand" "f"))
5683 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5684 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5685 && HONOR_SIGNED_ZEROS (DFmode)"
5686 "{fnma|fnmadd} %0,%1,%2,%3"
5687 [(set_attr "type" "dmul")])
5690 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5691 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5692 (match_operand:DF 2 "gpc_reg_operand" "f"))
5693 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5694 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5695 && ! HONOR_SIGNED_ZEROS (DFmode)"
5696 "{fnma|fnmadd} %0,%1,%2,%3"
5697 [(set_attr "type" "dmul")])
5700 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5701 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5702 (match_operand:DF 2 "gpc_reg_operand" "f"))
5703 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5704 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5705 && HONOR_SIGNED_ZEROS (DFmode)"
5706 "{fnms|fnmsub} %0,%1,%2,%3"
5707 [(set_attr "type" "dmul")])
5710 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5711 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5712 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5713 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5714 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5715 && ! HONOR_SIGNED_ZEROS (DFmode)"
5716 "{fnms|fnmsub} %0,%1,%2,%3"
5717 [(set_attr "type" "dmul")])
5719 (define_insn "sqrtdf2"
5720 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5721 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5722 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5724 [(set_attr "type" "dsqrt")])
5726 ;; The conditional move instructions allow us to perform max and min
5727 ;; operations even when
5729 (define_expand "smaxdf3"
5730 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5731 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5732 (match_operand:DF 2 "gpc_reg_operand" ""))
5735 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5736 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5738 (define_expand "smindf3"
5739 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5740 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5741 (match_operand:DF 2 "gpc_reg_operand" ""))
5744 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5745 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5748 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5749 (match_operator:DF 3 "min_max_operator"
5750 [(match_operand:DF 1 "gpc_reg_operand" "")
5751 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5752 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5755 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5756 operands[1], operands[2]);
5760 (define_expand "movdfcc"
5761 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5762 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5763 (match_operand:DF 2 "gpc_reg_operand" "")
5764 (match_operand:DF 3 "gpc_reg_operand" "")))]
5765 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5768 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5774 (define_insn "*fseldfdf4"
5775 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5776 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5777 (match_operand:DF 4 "zero_fp_constant" "F"))
5778 (match_operand:DF 2 "gpc_reg_operand" "f")
5779 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5780 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5782 [(set_attr "type" "fp")])
5784 (define_insn "*fselsfdf4"
5785 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5786 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5787 (match_operand:SF 4 "zero_fp_constant" "F"))
5788 (match_operand:DF 2 "gpc_reg_operand" "f")
5789 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5792 [(set_attr "type" "fp")])
5794 ;; Conversions to and from floating-point.
5796 (define_expand "fixuns_truncsfsi2"
5797 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5798 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5799 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5802 (define_expand "fix_truncsfsi2"
5803 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5804 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5805 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5808 ; For each of these conversions, there is a define_expand, a define_insn
5809 ; with a '#' template, and a define_split (with C code). The idea is
5810 ; to allow constant folding with the template of the define_insn,
5811 ; then to have the insns split later (between sched1 and final).
5813 (define_expand "floatsidf2"
5814 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5815 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5818 (clobber (match_dup 4))
5819 (clobber (match_dup 5))
5820 (clobber (match_dup 6))])]
5821 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5824 if (TARGET_E500_DOUBLE)
5826 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5829 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS)
5831 rtx t1 = gen_reg_rtx (DImode);
5832 emit_insn (gen_floatsidf_ppc64_mfpgpr (operands[0], operands[1], t1));
5835 if (TARGET_POWERPC64)
5837 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5838 rtx t1 = gen_reg_rtx (DImode);
5839 rtx t2 = gen_reg_rtx (DImode);
5840 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5844 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5845 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5846 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5847 operands[5] = gen_reg_rtx (DFmode);
5848 operands[6] = gen_reg_rtx (SImode);
5851 (define_insn_and_split "*floatsidf2_internal"
5852 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5853 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5854 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5855 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5856 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5857 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5858 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5859 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5861 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5865 rtx lowword, highword;
5866 gcc_assert (MEM_P (operands[4]));
5867 highword = adjust_address (operands[4], SImode, 0);
5868 lowword = adjust_address (operands[4], SImode, 4);
5869 if (! WORDS_BIG_ENDIAN)
5872 tmp = highword; highword = lowword; lowword = tmp;
5875 emit_insn (gen_xorsi3 (operands[6], operands[1],
5876 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5877 emit_move_insn (lowword, operands[6]);
5878 emit_move_insn (highword, operands[2]);
5879 emit_move_insn (operands[5], operands[4]);
5880 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5883 [(set_attr "length" "24")])
5885 (define_expand "floatunssisf2"
5886 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5887 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5888 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5891 (define_expand "floatunssidf2"
5892 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5893 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5896 (clobber (match_dup 4))
5897 (clobber (match_dup 5))])]
5898 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5901 if (TARGET_E500_DOUBLE)
5903 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5906 if (TARGET_POWERPC64)
5908 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5909 rtx t1 = gen_reg_rtx (DImode);
5910 rtx t2 = gen_reg_rtx (DImode);
5911 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5916 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5917 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5918 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5919 operands[5] = gen_reg_rtx (DFmode);
5922 (define_insn_and_split "*floatunssidf2_internal"
5923 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5924 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5925 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5926 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5927 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5928 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5929 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5931 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
5935 rtx lowword, highword;
5936 gcc_assert (MEM_P (operands[4]));
5937 highword = adjust_address (operands[4], SImode, 0);
5938 lowword = adjust_address (operands[4], SImode, 4);
5939 if (! WORDS_BIG_ENDIAN)
5942 tmp = highword; highword = lowword; lowword = tmp;
5945 emit_move_insn (lowword, operands[1]);
5946 emit_move_insn (highword, operands[2]);
5947 emit_move_insn (operands[5], operands[4]);
5948 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5951 [(set_attr "length" "20")])
5953 (define_expand "fix_truncdfsi2"
5954 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5955 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5956 (clobber (match_dup 2))
5957 (clobber (match_dup 3))])]
5958 "(TARGET_POWER2 || TARGET_POWERPC)
5959 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5962 if (TARGET_E500_DOUBLE)
5964 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5967 operands[2] = gen_reg_rtx (DImode);
5968 if (TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
5969 && gpc_reg_operand(operands[0], GET_MODE (operands[0])))
5971 operands[3] = gen_reg_rtx (DImode);
5972 emit_insn (gen_fix_truncdfsi2_mfpgpr (operands[0], operands[1],
5973 operands[2], operands[3]));
5976 if (TARGET_PPC_GFXOPT)
5978 rtx orig_dest = operands[0];
5979 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5980 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5981 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5983 if (operands[0] != orig_dest)
5984 emit_move_insn (orig_dest, operands[0]);
5987 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5990 (define_insn_and_split "*fix_truncdfsi2_internal"
5991 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5992 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5993 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5994 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
5995 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5997 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[3]))"
6002 gcc_assert (MEM_P (operands[3]));
6003 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6005 emit_insn (gen_fctiwz (operands[2], operands[1]));
6006 emit_move_insn (operands[3], operands[2]);
6007 emit_move_insn (operands[0], lowword);
6010 [(set_attr "length" "16")])
6012 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
6013 [(set (match_operand:SI 0 "memory_operand" "=Z")
6014 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6015 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
6016 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6017 && TARGET_PPC_GFXOPT"
6023 emit_insn (gen_fctiwz (operands[2], operands[1]));
6024 emit_insn (gen_stfiwx (operands[0], operands[2]));
6027 [(set_attr "length" "16")])
6029 (define_insn_and_split "fix_truncdfsi2_mfpgpr"
6030 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6031 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
6032 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
6033 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
6034 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6037 [(set (match_dup 2) (unspec:DI [(fix:SI (match_dup 1))] UNSPEC_FCTIWZ))
6038 (set (match_dup 3) (match_dup 2))
6039 (set (match_dup 0) (subreg:SI (match_dup 3) 4))]
6041 [(set_attr "length" "12")])
6043 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6044 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6045 ; because the first makes it clear that operand 0 is not live
6046 ; before the instruction.
6047 (define_insn "fctiwz"
6048 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
6049 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
6051 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
6052 "{fcirz|fctiwz} %0,%1"
6053 [(set_attr "type" "fp")])
6055 (define_insn "btruncdf2"
6056 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6057 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6058 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6060 [(set_attr "type" "fp")])
6062 (define_insn "btruncsf2"
6063 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6064 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
6065 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6067 [(set_attr "type" "fp")])
6069 (define_insn "ceildf2"
6070 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6071 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6072 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6074 [(set_attr "type" "fp")])
6076 (define_insn "ceilsf2"
6077 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6078 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
6079 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6081 [(set_attr "type" "fp")])
6083 (define_insn "floordf2"
6084 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6085 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6086 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6088 [(set_attr "type" "fp")])
6090 (define_insn "floorsf2"
6091 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6092 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
6093 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6095 [(set_attr "type" "fp")])
6097 (define_insn "rounddf2"
6098 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6099 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6100 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6102 [(set_attr "type" "fp")])
6104 (define_insn "roundsf2"
6105 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6106 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
6107 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
6109 [(set_attr "type" "fp")])
6111 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6112 (define_insn "stfiwx"
6113 [(set (match_operand:SI 0 "memory_operand" "=Z")
6114 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
6118 [(set_attr "type" "fpstore")])
6120 (define_expand "floatsisf2"
6121 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6122 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
6123 "TARGET_HARD_FLOAT && !TARGET_FPRS"
6126 (define_insn "floatdidf2"
6127 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6128 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
6129 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6131 [(set_attr "type" "fp")])
6133 (define_insn_and_split "floatsidf_ppc64_mfpgpr"
6134 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6135 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6136 (clobber (match_operand:DI 2 "gpc_reg_operand" "=r"))]
6137 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6140 [(set (match_dup 2) (sign_extend:DI (match_dup 1)))
6141 (set (match_dup 0) (float:DF (match_dup 2)))]
6144 (define_insn_and_split "floatsidf_ppc64"
6145 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6146 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6147 (clobber (match_operand:DI 2 "offsettable_mem_operand" "=o"))
6148 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6149 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6150 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
6153 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
6154 (set (match_dup 2) (match_dup 3))
6155 (set (match_dup 4) (match_dup 2))
6156 (set (match_dup 0) (float:DF (match_dup 4)))]
6159 (define_insn_and_split "floatunssidf_ppc64"
6160 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6161 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6162 (clobber (match_operand:DI 2 "offsettable_mem_operand" "=o"))
6163 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
6164 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
6165 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6168 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
6169 (set (match_dup 2) (match_dup 3))
6170 (set (match_dup 4) (match_dup 2))
6171 (set (match_dup 0) (float:DF (match_dup 4)))]
6174 (define_insn "fix_truncdfdi2"
6175 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
6176 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
6177 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6179 [(set_attr "type" "fp")])
6181 (define_expand "floatdisf2"
6182 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6183 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6184 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6187 rtx val = operands[1];
6188 if (!flag_unsafe_math_optimizations)
6190 rtx label = gen_label_rtx ();
6191 val = gen_reg_rtx (DImode);
6192 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6195 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6199 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6200 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6201 ;; from double rounding.
6202 (define_insn_and_split "floatdisf2_internal1"
6203 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6204 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
6205 (clobber (match_scratch:DF 2 "=f"))]
6206 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6208 "&& reload_completed"
6210 (float:DF (match_dup 1)))
6212 (float_truncate:SF (match_dup 2)))]
6215 ;; Twiddles bits to avoid double rounding.
6216 ;; Bits that might be truncated when converting to DFmode are replaced
6217 ;; by a bit that won't be lost at that stage, but is below the SFmode
6218 ;; rounding position.
6219 (define_expand "floatdisf2_internal2"
6220 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6222 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6224 (clobber (scratch:CC))])
6225 (set (match_dup 3) (plus:DI (match_dup 3)
6227 (set (match_dup 0) (plus:DI (match_dup 0)
6229 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6231 (set (match_dup 0) (ior:DI (match_dup 0)
6233 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6235 (clobber (scratch:CC))])
6236 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6237 (label_ref (match_operand:DI 2 "" ""))
6239 (set (match_dup 0) (match_dup 1))]
6240 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6243 operands[3] = gen_reg_rtx (DImode);
6244 operands[4] = gen_reg_rtx (CCUNSmode);
6247 ;; Define the DImode operations that can be done in a small number
6248 ;; of instructions. The & constraints are to prevent the register
6249 ;; allocator from allocating registers that overlap with the inputs
6250 ;; (for example, having an input in 7,8 and an output in 6,7). We
6251 ;; also allow for the output being the same as one of the inputs.
6253 (define_insn "*adddi3_noppc64"
6254 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6255 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6256 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6257 "! TARGET_POWERPC64"
6260 if (WORDS_BIG_ENDIAN)
6261 return (GET_CODE (operands[2])) != CONST_INT
6262 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6263 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6265 return (GET_CODE (operands[2])) != CONST_INT
6266 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6267 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6269 [(set_attr "type" "two")
6270 (set_attr "length" "8")])
6272 (define_insn "*subdi3_noppc64"
6273 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6274 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6275 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6276 "! TARGET_POWERPC64"
6279 if (WORDS_BIG_ENDIAN)
6280 return (GET_CODE (operands[1]) != CONST_INT)
6281 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6282 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6284 return (GET_CODE (operands[1]) != CONST_INT)
6285 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6286 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6288 [(set_attr "type" "two")
6289 (set_attr "length" "8")])
6291 (define_insn "*negdi2_noppc64"
6292 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6293 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6294 "! TARGET_POWERPC64"
6297 return (WORDS_BIG_ENDIAN)
6298 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6299 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6301 [(set_attr "type" "two")
6302 (set_attr "length" "8")])
6304 (define_expand "mulsidi3"
6305 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6306 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6307 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6308 "! TARGET_POWERPC64"
6311 if (! TARGET_POWER && ! TARGET_POWERPC)
6313 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6314 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6315 emit_insn (gen_mull_call ());
6316 if (WORDS_BIG_ENDIAN)
6317 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6320 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6321 gen_rtx_REG (SImode, 3));
6322 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6323 gen_rtx_REG (SImode, 4));
6327 else if (TARGET_POWER)
6329 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6334 (define_insn "mulsidi3_mq"
6335 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6336 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6337 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6338 (clobber (match_scratch:SI 3 "=q"))]
6340 "mul %0,%1,%2\;mfmq %L0"
6341 [(set_attr "type" "imul")
6342 (set_attr "length" "8")])
6344 (define_insn "*mulsidi3_no_mq"
6345 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6346 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6347 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6348 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6351 return (WORDS_BIG_ENDIAN)
6352 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6353 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6355 [(set_attr "type" "imul")
6356 (set_attr "length" "8")])
6359 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6360 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6361 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6362 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6365 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6366 (sign_extend:DI (match_dup 2)))
6369 (mult:SI (match_dup 1)
6373 int endian = (WORDS_BIG_ENDIAN == 0);
6374 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6375 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6378 (define_expand "umulsidi3"
6379 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6380 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6381 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6382 "TARGET_POWERPC && ! TARGET_POWERPC64"
6387 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6392 (define_insn "umulsidi3_mq"
6393 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6394 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6395 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6396 (clobber (match_scratch:SI 3 "=q"))]
6397 "TARGET_POWERPC && TARGET_POWER"
6400 return (WORDS_BIG_ENDIAN)
6401 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6402 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6404 [(set_attr "type" "imul")
6405 (set_attr "length" "8")])
6407 (define_insn "*umulsidi3_no_mq"
6408 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6409 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6410 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6411 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6414 return (WORDS_BIG_ENDIAN)
6415 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6416 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6418 [(set_attr "type" "imul")
6419 (set_attr "length" "8")])
6422 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6423 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6424 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6425 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6428 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6429 (zero_extend:DI (match_dup 2)))
6432 (mult:SI (match_dup 1)
6436 int endian = (WORDS_BIG_ENDIAN == 0);
6437 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6438 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6441 (define_expand "smulsi3_highpart"
6442 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6444 (lshiftrt:DI (mult:DI (sign_extend:DI
6445 (match_operand:SI 1 "gpc_reg_operand" ""))
6447 (match_operand:SI 2 "gpc_reg_operand" "")))
6452 if (! TARGET_POWER && ! TARGET_POWERPC)
6454 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6455 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6456 emit_insn (gen_mulh_call ());
6457 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6460 else if (TARGET_POWER)
6462 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6467 (define_insn "smulsi3_highpart_mq"
6468 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6470 (lshiftrt:DI (mult:DI (sign_extend:DI
6471 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6473 (match_operand:SI 2 "gpc_reg_operand" "r")))
6475 (clobber (match_scratch:SI 3 "=q"))]
6478 [(set_attr "type" "imul")])
6480 (define_insn "*smulsi3_highpart_no_mq"
6481 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6483 (lshiftrt:DI (mult:DI (sign_extend:DI
6484 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6486 (match_operand:SI 2 "gpc_reg_operand" "r")))
6488 "TARGET_POWERPC && ! TARGET_POWER"
6490 [(set_attr "type" "imul")])
6492 (define_expand "umulsi3_highpart"
6493 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6495 (lshiftrt:DI (mult:DI (zero_extend:DI
6496 (match_operand:SI 1 "gpc_reg_operand" ""))
6498 (match_operand:SI 2 "gpc_reg_operand" "")))
6505 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6510 (define_insn "umulsi3_highpart_mq"
6511 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6513 (lshiftrt:DI (mult:DI (zero_extend:DI
6514 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6516 (match_operand:SI 2 "gpc_reg_operand" "r")))
6518 (clobber (match_scratch:SI 3 "=q"))]
6519 "TARGET_POWERPC && TARGET_POWER"
6521 [(set_attr "type" "imul")])
6523 (define_insn "*umulsi3_highpart_no_mq"
6524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6526 (lshiftrt:DI (mult:DI (zero_extend:DI
6527 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6529 (match_operand:SI 2 "gpc_reg_operand" "r")))
6531 "TARGET_POWERPC && ! TARGET_POWER"
6533 [(set_attr "type" "imul")])
6535 ;; If operands 0 and 2 are in the same register, we have a problem. But
6536 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6537 ;; why we have the strange constraints below.
6538 (define_insn "ashldi3_power"
6539 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6540 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6541 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6542 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6545 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6546 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6547 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6548 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6549 [(set_attr "length" "8")])
6551 (define_insn "lshrdi3_power"
6552 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6553 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6554 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6555 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6558 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6559 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6560 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6561 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6562 [(set_attr "length" "8")])
6564 ;; Shift by a variable amount is too complex to be worth open-coding. We
6565 ;; just handle shifts by constants.
6566 (define_insn "ashrdi3_power"
6567 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6568 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6569 (match_operand:SI 2 "const_int_operand" "M,i")))
6570 (clobber (match_scratch:SI 3 "=X,q"))]
6573 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6574 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6575 [(set_attr "type" "shift")
6576 (set_attr "length" "8")])
6578 (define_insn "ashrdi3_no_power"
6579 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6580 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6581 (match_operand:SI 2 "const_int_operand" "M,i")))]
6582 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
6584 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6585 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6586 [(set_attr "type" "two,three")
6587 (set_attr "length" "8,12")])
6589 (define_insn "*ashrdisi3_noppc64"
6590 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6591 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6592 (const_int 32)) 4))]
6593 "TARGET_32BIT && !TARGET_POWERPC64"
6596 if (REGNO (operands[0]) == REGNO (operands[1]))
6599 return \"mr %0,%1\";
6601 [(set_attr "length" "4")])
6604 ;; PowerPC64 DImode operations.
6606 (define_insn_and_split "absdi2"
6607 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6608 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6609 (clobber (match_scratch:DI 2 "=&r,&r"))]
6612 "&& reload_completed"
6613 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6614 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6615 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6618 (define_insn_and_split "*nabsdi2"
6619 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6620 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6621 (clobber (match_scratch:DI 2 "=&r,&r"))]
6624 "&& reload_completed"
6625 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6626 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6627 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6630 (define_insn "muldi3"
6631 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6632 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6633 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6639 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6640 (const_string "imul3")
6641 (match_operand:SI 2 "short_cint_operand" "")
6642 (const_string "imul2")]
6643 (const_string "lmul")))])
6645 (define_insn "*muldi3_internal1"
6646 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6647 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6648 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6650 (clobber (match_scratch:DI 3 "=r,r"))]
6655 [(set_attr "type" "lmul_compare")
6656 (set_attr "length" "4,8")])
6659 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6660 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6661 (match_operand:DI 2 "gpc_reg_operand" ""))
6663 (clobber (match_scratch:DI 3 ""))]
6664 "TARGET_POWERPC64 && reload_completed"
6666 (mult:DI (match_dup 1) (match_dup 2)))
6668 (compare:CC (match_dup 3)
6672 (define_insn "*muldi3_internal2"
6673 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6674 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6675 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6677 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6678 (mult:DI (match_dup 1) (match_dup 2)))]
6683 [(set_attr "type" "lmul_compare")
6684 (set_attr "length" "4,8")])
6687 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6688 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6689 (match_operand:DI 2 "gpc_reg_operand" ""))
6691 (set (match_operand:DI 0 "gpc_reg_operand" "")
6692 (mult:DI (match_dup 1) (match_dup 2)))]
6693 "TARGET_POWERPC64 && reload_completed"
6695 (mult:DI (match_dup 1) (match_dup 2)))
6697 (compare:CC (match_dup 0)
6701 (define_insn "smuldi3_highpart"
6702 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6704 (lshiftrt:TI (mult:TI (sign_extend:TI
6705 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6707 (match_operand:DI 2 "gpc_reg_operand" "r")))
6711 [(set_attr "type" "lmul")])
6713 (define_insn "umuldi3_highpart"
6714 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6716 (lshiftrt:TI (mult:TI (zero_extend:TI
6717 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6719 (match_operand:DI 2 "gpc_reg_operand" "r")))
6723 [(set_attr "type" "lmul")])
6725 (define_insn "rotldi3"
6726 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6727 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6728 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6733 [(set_attr "type" "var_shift_rotate,integer")])
6735 (define_insn "*rotldi3_internal2"
6736 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6737 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6738 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6740 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6747 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6748 (set_attr "length" "4,4,8,8")])
6751 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6752 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6753 (match_operand:DI 2 "reg_or_cint_operand" ""))
6755 (clobber (match_scratch:DI 3 ""))]
6756 "TARGET_POWERPC64 && reload_completed"
6758 (rotate:DI (match_dup 1) (match_dup 2)))
6760 (compare:CC (match_dup 3)
6764 (define_insn "*rotldi3_internal3"
6765 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6766 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6767 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6769 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6770 (rotate:DI (match_dup 1) (match_dup 2)))]
6777 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6778 (set_attr "length" "4,4,8,8")])
6781 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6782 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6783 (match_operand:DI 2 "reg_or_cint_operand" ""))
6785 (set (match_operand:DI 0 "gpc_reg_operand" "")
6786 (rotate:DI (match_dup 1) (match_dup 2)))]
6787 "TARGET_POWERPC64 && reload_completed"
6789 (rotate:DI (match_dup 1) (match_dup 2)))
6791 (compare:CC (match_dup 0)
6795 (define_insn "*rotldi3_internal4"
6796 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6797 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6798 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6799 (match_operand:DI 3 "mask64_operand" "n,n")))]
6802 rldc%B3 %0,%1,%2,%S3
6803 rldic%B3 %0,%1,%H2,%S3"
6804 [(set_attr "type" "var_shift_rotate,integer")])
6806 (define_insn "*rotldi3_internal5"
6807 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6809 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6810 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6811 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6813 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6816 rldc%B3. %4,%1,%2,%S3
6817 rldic%B3. %4,%1,%H2,%S3
6820 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6821 (set_attr "length" "4,4,8,8")])
6824 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6826 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6827 (match_operand:DI 2 "reg_or_cint_operand" ""))
6828 (match_operand:DI 3 "mask64_operand" ""))
6830 (clobber (match_scratch:DI 4 ""))]
6831 "TARGET_POWERPC64 && reload_completed"
6833 (and:DI (rotate:DI (match_dup 1)
6837 (compare:CC (match_dup 4)
6841 (define_insn "*rotldi3_internal6"
6842 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6844 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6845 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6846 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6848 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6849 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6852 rldc%B3. %0,%1,%2,%S3
6853 rldic%B3. %0,%1,%H2,%S3
6856 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6857 (set_attr "length" "4,4,8,8")])
6860 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6862 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6863 (match_operand:DI 2 "reg_or_cint_operand" ""))
6864 (match_operand:DI 3 "mask64_operand" ""))
6866 (set (match_operand:DI 0 "gpc_reg_operand" "")
6867 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6868 "TARGET_POWERPC64 && reload_completed"
6870 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6872 (compare:CC (match_dup 0)
6876 (define_insn "*rotldi3_internal7"
6877 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6880 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6881 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6885 rldicl %0,%1,%H2,56"
6886 [(set_attr "type" "var_shift_rotate,integer")])
6888 (define_insn "*rotldi3_internal8"
6889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6890 (compare:CC (zero_extend:DI
6892 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6893 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6895 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6899 rldicl. %3,%1,%H2,56
6902 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6903 (set_attr "length" "4,4,8,8")])
6906 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6907 (compare:CC (zero_extend:DI
6909 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6910 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6912 (clobber (match_scratch:DI 3 ""))]
6913 "TARGET_POWERPC64 && reload_completed"
6915 (zero_extend:DI (subreg:QI
6916 (rotate:DI (match_dup 1)
6919 (compare:CC (match_dup 3)
6923 (define_insn "*rotldi3_internal9"
6924 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6925 (compare:CC (zero_extend:DI
6927 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6928 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6930 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6931 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6935 rldicl. %0,%1,%H2,56
6938 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6939 (set_attr "length" "4,4,8,8")])
6942 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6943 (compare:CC (zero_extend:DI
6945 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6946 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6948 (set (match_operand:DI 0 "gpc_reg_operand" "")
6949 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6950 "TARGET_POWERPC64 && reload_completed"
6952 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6954 (compare:CC (match_dup 0)
6958 (define_insn "*rotldi3_internal10"
6959 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6962 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6963 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6967 rldicl %0,%1,%H2,48"
6968 [(set_attr "type" "var_shift_rotate,integer")])
6970 (define_insn "*rotldi3_internal11"
6971 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6972 (compare:CC (zero_extend:DI
6974 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6975 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6977 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6981 rldicl. %3,%1,%H2,48
6984 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6985 (set_attr "length" "4,4,8,8")])
6988 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6989 (compare:CC (zero_extend:DI
6991 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6992 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6994 (clobber (match_scratch:DI 3 ""))]
6995 "TARGET_POWERPC64 && reload_completed"
6997 (zero_extend:DI (subreg:HI
6998 (rotate:DI (match_dup 1)
7001 (compare:CC (match_dup 3)
7005 (define_insn "*rotldi3_internal12"
7006 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7007 (compare:CC (zero_extend:DI
7009 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7010 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7012 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7013 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7017 rldicl. %0,%1,%H2,48
7020 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7021 (set_attr "length" "4,4,8,8")])
7024 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7025 (compare:CC (zero_extend:DI
7027 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7028 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7030 (set (match_operand:DI 0 "gpc_reg_operand" "")
7031 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7032 "TARGET_POWERPC64 && reload_completed"
7034 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7036 (compare:CC (match_dup 0)
7040 (define_insn "*rotldi3_internal13"
7041 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7044 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7045 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7049 rldicl %0,%1,%H2,32"
7050 [(set_attr "type" "var_shift_rotate,integer")])
7052 (define_insn "*rotldi3_internal14"
7053 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7054 (compare:CC (zero_extend:DI
7056 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7057 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7059 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7063 rldicl. %3,%1,%H2,32
7066 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7067 (set_attr "length" "4,4,8,8")])
7070 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7071 (compare:CC (zero_extend:DI
7073 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7074 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7076 (clobber (match_scratch:DI 3 ""))]
7077 "TARGET_POWERPC64 && reload_completed"
7079 (zero_extend:DI (subreg:SI
7080 (rotate:DI (match_dup 1)
7083 (compare:CC (match_dup 3)
7087 (define_insn "*rotldi3_internal15"
7088 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7089 (compare:CC (zero_extend:DI
7091 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7092 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7094 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7095 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7099 rldicl. %0,%1,%H2,32
7102 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7103 (set_attr "length" "4,4,8,8")])
7106 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7107 (compare:CC (zero_extend:DI
7109 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7110 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7112 (set (match_operand:DI 0 "gpc_reg_operand" "")
7113 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7114 "TARGET_POWERPC64 && reload_completed"
7116 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7118 (compare:CC (match_dup 0)
7122 (define_expand "ashldi3"
7123 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7124 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7125 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7126 "TARGET_POWERPC64 || TARGET_POWER"
7129 if (TARGET_POWERPC64)
7131 else if (TARGET_POWER)
7133 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7140 (define_insn "*ashldi3_internal1"
7141 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7142 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7143 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7148 [(set_attr "type" "var_shift_rotate,shift")])
7150 (define_insn "*ashldi3_internal2"
7151 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7152 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7153 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7155 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7162 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7163 (set_attr "length" "4,4,8,8")])
7166 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7167 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7168 (match_operand:SI 2 "reg_or_cint_operand" ""))
7170 (clobber (match_scratch:DI 3 ""))]
7171 "TARGET_POWERPC64 && reload_completed"
7173 (ashift:DI (match_dup 1) (match_dup 2)))
7175 (compare:CC (match_dup 3)
7179 (define_insn "*ashldi3_internal3"
7180 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7181 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7182 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7184 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7185 (ashift:DI (match_dup 1) (match_dup 2)))]
7192 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7193 (set_attr "length" "4,4,8,8")])
7196 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7197 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7198 (match_operand:SI 2 "reg_or_cint_operand" ""))
7200 (set (match_operand:DI 0 "gpc_reg_operand" "")
7201 (ashift:DI (match_dup 1) (match_dup 2)))]
7202 "TARGET_POWERPC64 && reload_completed"
7204 (ashift:DI (match_dup 1) (match_dup 2)))
7206 (compare:CC (match_dup 0)
7210 (define_insn "*ashldi3_internal4"
7211 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7212 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7213 (match_operand:SI 2 "const_int_operand" "i"))
7214 (match_operand:DI 3 "const_int_operand" "n")))]
7215 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7216 "rldic %0,%1,%H2,%W3")
7218 (define_insn "ashldi3_internal5"
7219 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7221 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7222 (match_operand:SI 2 "const_int_operand" "i,i"))
7223 (match_operand:DI 3 "const_int_operand" "n,n"))
7225 (clobber (match_scratch:DI 4 "=r,r"))]
7226 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7228 rldic. %4,%1,%H2,%W3
7230 [(set_attr "type" "compare")
7231 (set_attr "length" "4,8")])
7234 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7236 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7237 (match_operand:SI 2 "const_int_operand" ""))
7238 (match_operand:DI 3 "const_int_operand" ""))
7240 (clobber (match_scratch:DI 4 ""))]
7241 "TARGET_POWERPC64 && reload_completed
7242 && includes_rldic_lshift_p (operands[2], operands[3])"
7244 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7247 (compare:CC (match_dup 4)
7251 (define_insn "*ashldi3_internal6"
7252 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7254 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7255 (match_operand:SI 2 "const_int_operand" "i,i"))
7256 (match_operand:DI 3 "const_int_operand" "n,n"))
7258 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7259 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7260 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7262 rldic. %0,%1,%H2,%W3
7264 [(set_attr "type" "compare")
7265 (set_attr "length" "4,8")])
7268 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7270 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7271 (match_operand:SI 2 "const_int_operand" ""))
7272 (match_operand:DI 3 "const_int_operand" ""))
7274 (set (match_operand:DI 0 "gpc_reg_operand" "")
7275 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7276 "TARGET_POWERPC64 && reload_completed
7277 && includes_rldic_lshift_p (operands[2], operands[3])"
7279 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7282 (compare:CC (match_dup 0)
7286 (define_insn "*ashldi3_internal7"
7287 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7288 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7289 (match_operand:SI 2 "const_int_operand" "i"))
7290 (match_operand:DI 3 "mask64_operand" "n")))]
7291 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7292 "rldicr %0,%1,%H2,%S3")
7294 (define_insn "ashldi3_internal8"
7295 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7297 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7298 (match_operand:SI 2 "const_int_operand" "i,i"))
7299 (match_operand:DI 3 "mask64_operand" "n,n"))
7301 (clobber (match_scratch:DI 4 "=r,r"))]
7302 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7304 rldicr. %4,%1,%H2,%S3
7306 [(set_attr "type" "compare")
7307 (set_attr "length" "4,8")])
7310 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7312 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7313 (match_operand:SI 2 "const_int_operand" ""))
7314 (match_operand:DI 3 "mask64_operand" ""))
7316 (clobber (match_scratch:DI 4 ""))]
7317 "TARGET_POWERPC64 && reload_completed
7318 && includes_rldicr_lshift_p (operands[2], operands[3])"
7320 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7323 (compare:CC (match_dup 4)
7327 (define_insn "*ashldi3_internal9"
7328 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7330 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7331 (match_operand:SI 2 "const_int_operand" "i,i"))
7332 (match_operand:DI 3 "mask64_operand" "n,n"))
7334 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7335 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7336 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7338 rldicr. %0,%1,%H2,%S3
7340 [(set_attr "type" "compare")
7341 (set_attr "length" "4,8")])
7344 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7346 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7347 (match_operand:SI 2 "const_int_operand" ""))
7348 (match_operand:DI 3 "mask64_operand" ""))
7350 (set (match_operand:DI 0 "gpc_reg_operand" "")
7351 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7352 "TARGET_POWERPC64 && reload_completed
7353 && includes_rldicr_lshift_p (operands[2], operands[3])"
7355 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7358 (compare:CC (match_dup 0)
7362 (define_expand "lshrdi3"
7363 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7364 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7365 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7366 "TARGET_POWERPC64 || TARGET_POWER"
7369 if (TARGET_POWERPC64)
7371 else if (TARGET_POWER)
7373 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7380 (define_insn "*lshrdi3_internal1"
7381 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7382 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7383 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7388 [(set_attr "type" "var_shift_rotate,shift")])
7390 (define_insn "*lshrdi3_internal2"
7391 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7392 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7393 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7395 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7402 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7403 (set_attr "length" "4,4,8,8")])
7406 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7407 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7408 (match_operand:SI 2 "reg_or_cint_operand" ""))
7410 (clobber (match_scratch:DI 3 ""))]
7411 "TARGET_POWERPC64 && reload_completed"
7413 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7415 (compare:CC (match_dup 3)
7419 (define_insn "*lshrdi3_internal3"
7420 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7421 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7422 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7424 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7425 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7432 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7433 (set_attr "length" "4,4,8,8")])
7436 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7437 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7438 (match_operand:SI 2 "reg_or_cint_operand" ""))
7440 (set (match_operand:DI 0 "gpc_reg_operand" "")
7441 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7442 "TARGET_POWERPC64 && reload_completed"
7444 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7446 (compare:CC (match_dup 0)
7450 (define_expand "ashrdi3"
7451 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7452 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7453 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7457 if (TARGET_POWERPC64)
7459 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7461 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7464 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7465 && WORDS_BIG_ENDIAN)
7467 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7474 (define_insn "*ashrdi3_internal1"
7475 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7476 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7477 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7482 [(set_attr "type" "var_shift_rotate,shift")])
7484 (define_insn "*ashrdi3_internal2"
7485 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7486 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7487 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7489 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7496 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7497 (set_attr "length" "4,4,8,8")])
7500 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7501 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7502 (match_operand:SI 2 "reg_or_cint_operand" ""))
7504 (clobber (match_scratch:DI 3 ""))]
7505 "TARGET_POWERPC64 && reload_completed"
7507 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7509 (compare:CC (match_dup 3)
7513 (define_insn "*ashrdi3_internal3"
7514 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7515 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7516 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7518 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7519 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7526 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7527 (set_attr "length" "4,4,8,8")])
7530 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7531 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7532 (match_operand:SI 2 "reg_or_cint_operand" ""))
7534 (set (match_operand:DI 0 "gpc_reg_operand" "")
7535 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7536 "TARGET_POWERPC64 && reload_completed"
7538 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7540 (compare:CC (match_dup 0)
7544 (define_insn "anddi3"
7545 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7546 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7547 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7548 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7552 rldic%B2 %0,%1,0,%S2
7553 rlwinm %0,%1,0,%m2,%M2
7557 [(set_attr "type" "*,*,*,compare,compare,*")
7558 (set_attr "length" "4,4,4,4,4,8")])
7561 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7562 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7563 (match_operand:DI 2 "mask64_2_operand" "")))
7564 (clobber (match_scratch:CC 3 ""))]
7566 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7567 && !mask_operand (operands[2], DImode)
7568 && !mask64_operand (operands[2], DImode)"
7570 (and:DI (rotate:DI (match_dup 1)
7574 (and:DI (rotate:DI (match_dup 0)
7578 build_mask64_2_operands (operands[2], &operands[4]);
7581 (define_insn "*anddi3_internal2"
7582 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7583 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7584 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7586 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7587 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7591 rldic%B2. %3,%1,0,%S2
7592 rlwinm. %3,%1,0,%m2,%M2
7602 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7603 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7606 [(set (match_operand:CC 0 "cc_reg_operand" "")
7607 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7608 (match_operand:DI 2 "mask64_2_operand" ""))
7610 (clobber (match_scratch:DI 3 ""))
7611 (clobber (match_scratch:CC 4 ""))]
7612 "TARGET_64BIT && reload_completed
7613 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7614 && !mask_operand (operands[2], DImode)
7615 && !mask64_operand (operands[2], DImode)"
7617 (and:DI (rotate:DI (match_dup 1)
7620 (parallel [(set (match_dup 0)
7621 (compare:CC (and:DI (rotate:DI (match_dup 3)
7625 (clobber (match_dup 3))])]
7628 build_mask64_2_operands (operands[2], &operands[5]);
7631 (define_insn "*anddi3_internal3"
7632 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7633 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7634 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7636 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7637 (and:DI (match_dup 1) (match_dup 2)))
7638 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7642 rldic%B2. %0,%1,0,%S2
7643 rlwinm. %0,%1,0,%m2,%M2
7653 [(set_attr "type" "compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare,compare,compare,compare")
7654 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7657 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7658 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7659 (match_operand:DI 2 "and64_2_operand" ""))
7661 (set (match_operand:DI 0 "gpc_reg_operand" "")
7662 (and:DI (match_dup 1) (match_dup 2)))
7663 (clobber (match_scratch:CC 4 ""))]
7664 "TARGET_64BIT && reload_completed"
7665 [(parallel [(set (match_dup 0)
7666 (and:DI (match_dup 1) (match_dup 2)))
7667 (clobber (match_dup 4))])
7669 (compare:CC (match_dup 0)
7674 [(set (match_operand:CC 3 "cc_reg_operand" "")
7675 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7676 (match_operand:DI 2 "mask64_2_operand" ""))
7678 (set (match_operand:DI 0 "gpc_reg_operand" "")
7679 (and:DI (match_dup 1) (match_dup 2)))
7680 (clobber (match_scratch:CC 4 ""))]
7681 "TARGET_64BIT && reload_completed
7682 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7683 && !mask_operand (operands[2], DImode)
7684 && !mask64_operand (operands[2], DImode)"
7686 (and:DI (rotate:DI (match_dup 1)
7689 (parallel [(set (match_dup 3)
7690 (compare:CC (and:DI (rotate:DI (match_dup 0)
7695 (and:DI (rotate:DI (match_dup 0)
7700 build_mask64_2_operands (operands[2], &operands[5]);
7703 (define_expand "iordi3"
7704 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7705 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7706 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7710 if (non_logical_cint_operand (operands[2], DImode))
7712 HOST_WIDE_INT value;
7713 rtx tmp = ((!can_create_pseudo_p ()
7714 || rtx_equal_p (operands[0], operands[1]))
7715 ? operands[0] : gen_reg_rtx (DImode));
7717 if (GET_CODE (operands[2]) == CONST_INT)
7719 value = INTVAL (operands[2]);
7720 emit_insn (gen_iordi3 (tmp, operands[1],
7721 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7725 value = CONST_DOUBLE_LOW (operands[2]);
7726 emit_insn (gen_iordi3 (tmp, operands[1],
7727 immed_double_const (value
7728 & (~ (HOST_WIDE_INT) 0xffff),
7732 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7737 (define_expand "xordi3"
7738 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7739 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7740 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7744 if (non_logical_cint_operand (operands[2], DImode))
7746 HOST_WIDE_INT value;
7747 rtx tmp = ((!can_create_pseudo_p ()
7748 || rtx_equal_p (operands[0], operands[1]))
7749 ? operands[0] : gen_reg_rtx (DImode));
7751 if (GET_CODE (operands[2]) == CONST_INT)
7753 value = INTVAL (operands[2]);
7754 emit_insn (gen_xordi3 (tmp, operands[1],
7755 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7759 value = CONST_DOUBLE_LOW (operands[2]);
7760 emit_insn (gen_xordi3 (tmp, operands[1],
7761 immed_double_const (value
7762 & (~ (HOST_WIDE_INT) 0xffff),
7766 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7771 (define_insn "*booldi3_internal1"
7772 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7773 (match_operator:DI 3 "boolean_or_operator"
7774 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7775 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7782 (define_insn "*booldi3_internal2"
7783 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7784 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7785 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7786 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7788 (clobber (match_scratch:DI 3 "=r,r"))]
7793 [(set_attr "type" "compare")
7794 (set_attr "length" "4,8")])
7797 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7798 (compare:CC (match_operator:DI 4 "boolean_operator"
7799 [(match_operand:DI 1 "gpc_reg_operand" "")
7800 (match_operand:DI 2 "gpc_reg_operand" "")])
7802 (clobber (match_scratch:DI 3 ""))]
7803 "TARGET_POWERPC64 && reload_completed"
7804 [(set (match_dup 3) (match_dup 4))
7806 (compare:CC (match_dup 3)
7810 (define_insn "*booldi3_internal3"
7811 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7812 (compare:CC (match_operator:DI 4 "boolean_operator"
7813 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7814 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7816 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7822 [(set_attr "type" "compare")
7823 (set_attr "length" "4,8")])
7826 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7827 (compare:CC (match_operator:DI 4 "boolean_operator"
7828 [(match_operand:DI 1 "gpc_reg_operand" "")
7829 (match_operand:DI 2 "gpc_reg_operand" "")])
7831 (set (match_operand:DI 0 "gpc_reg_operand" "")
7833 "TARGET_POWERPC64 && reload_completed"
7834 [(set (match_dup 0) (match_dup 4))
7836 (compare:CC (match_dup 0)
7840 ;; Split a logical operation that we can't do in one insn into two insns,
7841 ;; each of which does one 16-bit part. This is used by combine.
7844 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7845 (match_operator:DI 3 "boolean_or_operator"
7846 [(match_operand:DI 1 "gpc_reg_operand" "")
7847 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7849 [(set (match_dup 0) (match_dup 4))
7850 (set (match_dup 0) (match_dup 5))]
7855 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7857 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7858 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7860 i4 = GEN_INT (value & 0xffff);
7864 i3 = GEN_INT (INTVAL (operands[2])
7865 & (~ (HOST_WIDE_INT) 0xffff));
7866 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7868 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7870 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7874 (define_insn "*boolcdi3_internal1"
7875 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7876 (match_operator:DI 3 "boolean_operator"
7877 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7878 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7882 (define_insn "*boolcdi3_internal2"
7883 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7884 (compare:CC (match_operator:DI 4 "boolean_operator"
7885 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7886 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7888 (clobber (match_scratch:DI 3 "=r,r"))]
7893 [(set_attr "type" "compare")
7894 (set_attr "length" "4,8")])
7897 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7898 (compare:CC (match_operator:DI 4 "boolean_operator"
7899 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7900 (match_operand:DI 2 "gpc_reg_operand" "")])
7902 (clobber (match_scratch:DI 3 ""))]
7903 "TARGET_POWERPC64 && reload_completed"
7904 [(set (match_dup 3) (match_dup 4))
7906 (compare:CC (match_dup 3)
7910 (define_insn "*boolcdi3_internal3"
7911 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7912 (compare:CC (match_operator:DI 4 "boolean_operator"
7913 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7914 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7916 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7922 [(set_attr "type" "compare")
7923 (set_attr "length" "4,8")])
7926 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7927 (compare:CC (match_operator:DI 4 "boolean_operator"
7928 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7929 (match_operand:DI 2 "gpc_reg_operand" "")])
7931 (set (match_operand:DI 0 "gpc_reg_operand" "")
7933 "TARGET_POWERPC64 && reload_completed"
7934 [(set (match_dup 0) (match_dup 4))
7936 (compare:CC (match_dup 0)
7940 (define_insn "*boolccdi3_internal1"
7941 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7942 (match_operator:DI 3 "boolean_operator"
7943 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7944 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7948 (define_insn "*boolccdi3_internal2"
7949 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7950 (compare:CC (match_operator:DI 4 "boolean_operator"
7951 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7952 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7954 (clobber (match_scratch:DI 3 "=r,r"))]
7959 [(set_attr "type" "compare")
7960 (set_attr "length" "4,8")])
7963 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7964 (compare:CC (match_operator:DI 4 "boolean_operator"
7965 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7966 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7968 (clobber (match_scratch:DI 3 ""))]
7969 "TARGET_POWERPC64 && reload_completed"
7970 [(set (match_dup 3) (match_dup 4))
7972 (compare:CC (match_dup 3)
7976 (define_insn "*boolccdi3_internal3"
7977 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7978 (compare:CC (match_operator:DI 4 "boolean_operator"
7979 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7980 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7982 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7988 [(set_attr "type" "compare")
7989 (set_attr "length" "4,8")])
7992 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7993 (compare:CC (match_operator:DI 4 "boolean_operator"
7994 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7995 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7997 (set (match_operand:DI 0 "gpc_reg_operand" "")
7999 "TARGET_POWERPC64 && reload_completed"
8000 [(set (match_dup 0) (match_dup 4))
8002 (compare:CC (match_dup 0)
8006 ;; Now define ways of moving data around.
8008 ;; Set up a register with a value from the GOT table
8010 (define_expand "movsi_got"
8011 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8012 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8013 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8014 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8017 if (GET_CODE (operands[1]) == CONST)
8019 rtx offset = const0_rtx;
8020 HOST_WIDE_INT value;
8022 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8023 value = INTVAL (offset);
8026 rtx tmp = (!can_create_pseudo_p ()
8028 : gen_reg_rtx (Pmode));
8029 emit_insn (gen_movsi_got (tmp, operands[1]));
8030 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8035 operands[2] = rs6000_got_register (operands[1]);
8038 (define_insn "*movsi_got_internal"
8039 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8040 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8041 (match_operand:SI 2 "gpc_reg_operand" "b")]
8043 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8044 "{l|lwz} %0,%a1@got(%2)"
8045 [(set_attr "type" "load")])
8047 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8048 ;; didn't get allocated to a hard register.
8050 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8051 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8052 (match_operand:SI 2 "memory_operand" "")]
8054 "DEFAULT_ABI == ABI_V4
8056 && (reload_in_progress || reload_completed)"
8057 [(set (match_dup 0) (match_dup 2))
8058 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8062 ;; For SI, we special-case integers that can't be loaded in one insn. We
8063 ;; do the load 16-bits at a time. We could do this by loading from memory,
8064 ;; and this is even supposed to be faster, but it is simpler not to get
8065 ;; integers in the TOC.
8066 (define_insn "movsi_low"
8067 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8068 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8069 (match_operand 2 "" ""))))]
8070 "TARGET_MACHO && ! TARGET_64BIT"
8071 "{l|lwz} %0,lo16(%2)(%1)"
8072 [(set_attr "type" "load")
8073 (set_attr "length" "4")])
8075 (define_insn "*movsi_internal1"
8076 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8077 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8078 "gpc_reg_operand (operands[0], SImode)
8079 || gpc_reg_operand (operands[1], SImode)"
8083 {l%U1%X1|lwz%U1%X1} %0,%1
8084 {st%U0%X0|stw%U0%X0} %1,%0
8094 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
8095 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8097 ;; Split a load of a large constant into the appropriate two-insn
8101 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8102 (match_operand:SI 1 "const_int_operand" ""))]
8103 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8104 && (INTVAL (operands[1]) & 0xffff) != 0"
8108 (ior:SI (match_dup 0)
8111 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8113 if (tem == operands[0])
8119 (define_insn "*mov<mode>_internal2"
8120 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8121 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8123 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8126 {cmpi|cmp<wd>i} %2,%0,0
8129 [(set_attr "type" "cmp,compare,cmp")
8130 (set_attr "length" "4,4,8")])
8133 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8134 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8136 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8138 [(set (match_dup 0) (match_dup 1))
8140 (compare:CC (match_dup 0)
8144 (define_insn "*movhi_internal"
8145 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8146 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8147 "gpc_reg_operand (operands[0], HImode)
8148 || gpc_reg_operand (operands[1], HImode)"
8158 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8160 (define_expand "mov<mode>"
8161 [(set (match_operand:INT 0 "general_operand" "")
8162 (match_operand:INT 1 "any_operand" ""))]
8164 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8166 (define_insn "*movqi_internal"
8167 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8168 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8169 "gpc_reg_operand (operands[0], QImode)
8170 || gpc_reg_operand (operands[1], QImode)"
8180 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
8182 ;; Here is how to move condition codes around. When we store CC data in
8183 ;; an integer register or memory, we store just the high-order 4 bits.
8184 ;; This lets us not shift in the most common case of CR0.
8185 (define_expand "movcc"
8186 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8187 (match_operand:CC 1 "nonimmediate_operand" ""))]
8191 (define_insn "*movcc_internal1"
8192 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
8193 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
8194 "register_operand (operands[0], CCmode)
8195 || register_operand (operands[1], CCmode)"
8199 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8202 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8208 {l%U1%X1|lwz%U1%X1} %0,%1
8209 {st%U0%U1|stw%U0%U1} %1,%0"
8211 (cond [(eq_attr "alternative" "0,3")
8212 (const_string "cr_logical")
8213 (eq_attr "alternative" "1,2")
8214 (const_string "mtcr")
8215 (eq_attr "alternative" "6,7,9")
8216 (const_string "integer")
8217 (eq_attr "alternative" "8")
8218 (const_string "mfjmpr")
8219 (eq_attr "alternative" "10")
8220 (const_string "mtjmpr")
8221 (eq_attr "alternative" "11")
8222 (const_string "load")
8223 (eq_attr "alternative" "12")
8224 (const_string "store")
8225 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
8226 (const_string "mfcrf")
8228 (const_string "mfcr")))
8229 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
8231 ;; For floating-point, we normally deal with the floating-point registers
8232 ;; unless -msoft-float is used. The sole exception is that parameter passing
8233 ;; can produce floating-point values in fixed-point registers. Unless the
8234 ;; value is a simple constant or already in memory, we deal with this by
8235 ;; allocating memory and copying the value explicitly via that memory location.
8236 (define_expand "movsf"
8237 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8238 (match_operand:SF 1 "any_operand" ""))]
8240 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8243 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8244 (match_operand:SF 1 "const_double_operand" ""))]
8246 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8247 || (GET_CODE (operands[0]) == SUBREG
8248 && GET_CODE (SUBREG_REG (operands[0])) == REG
8249 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8250 [(set (match_dup 2) (match_dup 3))]
8256 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8257 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8259 if (! TARGET_POWERPC64)
8260 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8262 operands[2] = gen_lowpart (SImode, operands[0]);
8264 operands[3] = gen_int_mode (l, SImode);
8267 (define_insn "*movsf_hardfloat"
8268 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
8269 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
8270 "(gpc_reg_operand (operands[0], SFmode)
8271 || gpc_reg_operand (operands[1], SFmode))
8272 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8275 {l%U1%X1|lwz%U1%X1} %0,%1
8276 {st%U0%X0|stw%U0%X0} %1,%0
8286 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
8287 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
8289 (define_insn "*movsf_softfloat"
8290 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
8291 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
8292 "(gpc_reg_operand (operands[0], SFmode)
8293 || gpc_reg_operand (operands[1], SFmode))
8294 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8300 {l%U1%X1|lwz%U1%X1} %0,%1
8301 {st%U0%X0|stw%U0%X0} %1,%0
8308 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
8309 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
8312 (define_expand "movdf"
8313 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8314 (match_operand:DF 1 "any_operand" ""))]
8316 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8319 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8320 (match_operand:DF 1 "const_int_operand" ""))]
8321 "! TARGET_POWERPC64 && reload_completed
8322 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8323 || (GET_CODE (operands[0]) == SUBREG
8324 && GET_CODE (SUBREG_REG (operands[0])) == REG
8325 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8326 [(set (match_dup 2) (match_dup 4))
8327 (set (match_dup 3) (match_dup 1))]
8330 int endian = (WORDS_BIG_ENDIAN == 0);
8331 HOST_WIDE_INT value = INTVAL (operands[1]);
8333 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8334 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8335 #if HOST_BITS_PER_WIDE_INT == 32
8336 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8338 operands[4] = GEN_INT (value >> 32);
8339 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8344 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8345 (match_operand:DF 1 "const_double_operand" ""))]
8346 "! TARGET_POWERPC64 && reload_completed
8347 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8348 || (GET_CODE (operands[0]) == SUBREG
8349 && GET_CODE (SUBREG_REG (operands[0])) == REG
8350 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8351 [(set (match_dup 2) (match_dup 4))
8352 (set (match_dup 3) (match_dup 5))]
8355 int endian = (WORDS_BIG_ENDIAN == 0);
8359 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8360 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8362 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8363 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8364 operands[4] = gen_int_mode (l[endian], SImode);
8365 operands[5] = gen_int_mode (l[1 - endian], SImode);
8369 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8370 (match_operand:DF 1 "const_double_operand" ""))]
8371 "TARGET_POWERPC64 && reload_completed
8372 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8373 || (GET_CODE (operands[0]) == SUBREG
8374 && GET_CODE (SUBREG_REG (operands[0])) == REG
8375 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8376 [(set (match_dup 2) (match_dup 3))]
8379 int endian = (WORDS_BIG_ENDIAN == 0);
8382 #if HOST_BITS_PER_WIDE_INT >= 64
8386 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8387 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8389 operands[2] = gen_lowpart (DImode, operands[0]);
8390 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8391 #if HOST_BITS_PER_WIDE_INT >= 64
8392 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8393 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8395 operands[3] = gen_int_mode (val, DImode);
8397 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8401 ;; Don't have reload use general registers to load a constant. First,
8402 ;; it might not work if the output operand is the equivalent of
8403 ;; a non-offsettable memref, but also it is less efficient than loading
8404 ;; the constant into an FP register, since it will probably be used there.
8405 ;; The "??" is a kludge until we can figure out a more reasonable way
8406 ;; of handling these non-offsettable values.
8407 (define_insn "*movdf_hardfloat32"
8408 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8409 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8410 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8411 && (gpc_reg_operand (operands[0], DFmode)
8412 || gpc_reg_operand (operands[1], DFmode))"
8415 switch (which_alternative)
8420 /* We normally copy the low-numbered register first. However, if
8421 the first register operand 0 is the same as the second register
8422 of operand 1, we must copy in the opposite order. */
8423 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8424 return \"mr %L0,%L1\;mr %0,%1\";
8426 return \"mr %0,%1\;mr %L0,%L1\";
8428 if (rs6000_offsettable_memref_p (operands[1])
8429 || (GET_CODE (operands[1]) == MEM
8430 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8431 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8432 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC
8433 || GET_CODE (XEXP (operands[1], 0)) == PRE_MODIFY)))
8435 /* If the low-address word is used in the address, we must load
8436 it last. Otherwise, load it first. Note that we cannot have
8437 auto-increment in that case since the address register is
8438 known to be dead. */
8439 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8441 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8443 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8449 addreg = find_addr_reg (XEXP (operands[1], 0));
8450 if (refers_to_regno_p (REGNO (operands[0]),
8451 REGNO (operands[0]) + 1,
8454 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8455 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8456 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8457 return \"{l%X1|lwz%X1} %0,%1\";
8461 output_asm_insn (\"{l%X1|lwz%X1} %0,%1\", operands);
8462 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8463 output_asm_insn (\"{l%X1|lwz%X1} %L0,%1\", operands);
8464 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8469 if (rs6000_offsettable_memref_p (operands[0])
8470 || (GET_CODE (operands[0]) == MEM
8471 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8472 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8473 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
8474 || GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY)))
8475 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8480 addreg = find_addr_reg (XEXP (operands[0], 0));
8481 output_asm_insn (\"{st%X0|stw%X0} %1,%0\", operands);
8482 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8483 output_asm_insn (\"{st%X0|stw%X0} %L1,%0\", operands);
8484 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8488 return \"fmr %0,%1\";
8490 return \"lfd%U1%X1 %0,%1\";
8492 return \"stfd%U0%X0 %1,%0\";
8499 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
8500 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8502 (define_insn "*movdf_softfloat32"
8503 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8504 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8505 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8506 && (gpc_reg_operand (operands[0], DFmode)
8507 || gpc_reg_operand (operands[1], DFmode))"
8510 switch (which_alternative)
8515 /* We normally copy the low-numbered register first. However, if
8516 the first register operand 0 is the same as the second register of
8517 operand 1, we must copy in the opposite order. */
8518 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8519 return \"mr %L0,%L1\;mr %0,%1\";
8521 return \"mr %0,%1\;mr %L0,%L1\";
8523 /* If the low-address word is used in the address, we must load
8524 it last. Otherwise, load it first. Note that we cannot have
8525 auto-increment in that case since the address register is
8526 known to be dead. */
8527 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8529 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8531 return \"{l%U1%X1|lwz%U1%X1} %0,%1\;{l|lwz} %L0,%L1\";
8533 return \"{st%U0%X0|stw%U0%X0} %1,%0\;{st|stw} %L1,%L0\";
8540 [(set_attr "type" "two,load,store,*,*,*")
8541 (set_attr "length" "8,8,8,8,12,16")])
8543 ; ld/std require word-aligned displacements -> 'Y' constraint.
8544 ; List Y->r and r->Y before r->r for reload.
8545 (define_insn "*movdf_hardfloat64_mfpgpr"
8546 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
8547 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
8548 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8549 && (gpc_reg_operand (operands[0], DFmode)
8550 || gpc_reg_operand (operands[1], DFmode))"
8566 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
8567 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
8569 ; ld/std require word-aligned displacements -> 'Y' constraint.
8570 ; List Y->r and r->Y before r->r for reload.
8571 (define_insn "*movdf_hardfloat64"
8572 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
8573 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
8574 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8575 && (gpc_reg_operand (operands[0], DFmode)
8576 || gpc_reg_operand (operands[1], DFmode))"
8590 [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
8591 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
8593 (define_insn "*movdf_softfloat64"
8594 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
8595 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
8596 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8597 && (gpc_reg_operand (operands[0], DFmode)
8598 || gpc_reg_operand (operands[1], DFmode))"
8609 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
8610 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
8612 (define_expand "movtf"
8613 [(set (match_operand:TF 0 "general_operand" "")
8614 (match_operand:TF 1 "any_operand" ""))]
8615 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
8616 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8618 ; It's important to list the o->f and f->o moves before f->f because
8619 ; otherwise reload, given m->f, will try to pick f->f and reload it,
8620 ; which doesn't make progress. Likewise r->Y must be before r->r.
8621 (define_insn_and_split "*movtf_internal"
8622 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
8623 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
8625 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
8626 && (gpc_reg_operand (operands[0], TFmode)
8627 || gpc_reg_operand (operands[1], TFmode))"
8629 "&& reload_completed"
8631 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8632 [(set_attr "length" "8,8,8,20,20,16")])
8634 (define_insn_and_split "*movtf_softfloat"
8635 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
8636 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
8638 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
8639 && (gpc_reg_operand (operands[0], TFmode)
8640 || gpc_reg_operand (operands[1], TFmode))"
8642 "&& reload_completed"
8644 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
8645 [(set_attr "length" "20,20,16")])
8647 (define_expand "extenddftf2"
8648 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8649 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
8651 && TARGET_HARD_FLOAT
8652 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8653 && TARGET_LONG_DOUBLE_128"
8655 if (TARGET_E500_DOUBLE)
8656 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
8658 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
8662 (define_expand "extenddftf2_fprs"
8663 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
8664 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
8665 (use (match_dup 2))])]
8667 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8669 operands[2] = CONST0_RTX (DFmode);
8670 /* Generate GOT reference early for SVR4 PIC. */
8671 if (DEFAULT_ABI == ABI_V4 && flag_pic)
8672 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
8675 (define_insn_and_split "*extenddftf2_internal"
8676 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
8677 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
8678 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
8680 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8682 "&& reload_completed"
8685 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8686 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8687 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
8689 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
8694 (define_expand "extendsftf2"
8695 [(set (match_operand:TF 0 "nonimmediate_operand" "")
8696 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
8698 && TARGET_HARD_FLOAT
8699 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8700 && TARGET_LONG_DOUBLE_128"
8702 rtx tmp = gen_reg_rtx (DFmode);
8703 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
8704 emit_insn (gen_extenddftf2 (operands[0], tmp));
8708 (define_expand "trunctfdf2"
8709 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8710 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
8712 && TARGET_HARD_FLOAT
8713 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8714 && TARGET_LONG_DOUBLE_128"
8717 (define_insn_and_split "trunctfdf2_internal1"
8718 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
8719 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
8720 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
8721 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8725 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
8728 emit_note (NOTE_INSN_DELETED);
8731 [(set_attr "type" "fp")])
8733 (define_insn "trunctfdf2_internal2"
8734 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8735 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8736 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
8737 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8739 [(set_attr "type" "fp")])
8741 (define_expand "trunctfsf2"
8742 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8743 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
8745 && TARGET_HARD_FLOAT
8746 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8747 && TARGET_LONG_DOUBLE_128"
8749 if (TARGET_E500_DOUBLE)
8750 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
8752 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
8756 (define_insn_and_split "trunctfsf2_fprs"
8757 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8758 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8759 (clobber (match_scratch:DF 2 "=f"))]
8761 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8763 "&& reload_completed"
8765 (float_truncate:DF (match_dup 1)))
8767 (float_truncate:SF (match_dup 2)))]
8770 (define_expand "floatsitf2"
8771 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8772 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
8774 && TARGET_HARD_FLOAT
8775 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8776 && TARGET_LONG_DOUBLE_128"
8778 rtx tmp = gen_reg_rtx (DFmode);
8779 expand_float (tmp, operands[1], false);
8780 emit_insn (gen_extenddftf2 (operands[0], tmp));
8784 ; fadd, but rounding towards zero.
8785 ; This is probably not the optimal code sequence.
8786 (define_insn "fix_trunc_helper"
8787 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8788 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
8789 UNSPEC_FIX_TRUNC_TF))
8790 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
8791 "TARGET_HARD_FLOAT && TARGET_FPRS"
8792 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
8793 [(set_attr "type" "fp")
8794 (set_attr "length" "20")])
8796 (define_expand "fix_trunctfsi2"
8797 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8798 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
8800 && (TARGET_POWER2 || TARGET_POWERPC)
8801 && TARGET_HARD_FLOAT
8802 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8803 && TARGET_LONG_DOUBLE_128"
8805 if (TARGET_E500_DOUBLE)
8806 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
8808 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
8812 (define_expand "fix_trunctfsi2_fprs"
8813 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
8814 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
8815 (clobber (match_dup 2))
8816 (clobber (match_dup 3))
8817 (clobber (match_dup 4))
8818 (clobber (match_dup 5))])]
8820 && (TARGET_POWER2 || TARGET_POWERPC)
8821 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8823 operands[2] = gen_reg_rtx (DFmode);
8824 operands[3] = gen_reg_rtx (DFmode);
8825 operands[4] = gen_reg_rtx (DImode);
8826 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
8829 (define_insn_and_split "*fix_trunctfsi2_internal"
8830 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8831 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8832 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
8833 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
8834 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
8835 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
8837 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8839 "&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[5]))"
8843 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8845 gcc_assert (MEM_P (operands[5]));
8846 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8848 emit_insn (gen_fctiwz (operands[4], operands[2]));
8849 emit_move_insn (operands[5], operands[4]);
8850 emit_move_insn (operands[0], lowword);
8854 (define_expand "negtf2"
8855 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8856 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8858 && TARGET_HARD_FLOAT
8859 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8860 && TARGET_LONG_DOUBLE_128"
8863 (define_insn "negtf2_internal"
8864 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8865 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8867 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8870 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8871 return \"fneg %L0,%L1\;fneg %0,%1\";
8873 return \"fneg %0,%1\;fneg %L0,%L1\";
8875 [(set_attr "type" "fp")
8876 (set_attr "length" "8")])
8878 (define_expand "abstf2"
8879 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8880 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
8882 && TARGET_HARD_FLOAT
8883 && (TARGET_FPRS || TARGET_E500_DOUBLE)
8884 && TARGET_LONG_DOUBLE_128"
8887 rtx label = gen_label_rtx ();
8888 if (TARGET_E500_DOUBLE)
8890 if (flag_unsafe_math_optimizations)
8891 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
8893 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
8896 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8901 (define_expand "abstf2_internal"
8902 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8903 (match_operand:TF 1 "gpc_reg_operand" ""))
8904 (set (match_dup 3) (match_dup 5))
8905 (set (match_dup 5) (abs:DF (match_dup 5)))
8906 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8907 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8908 (label_ref (match_operand 2 "" ""))
8910 (set (match_dup 6) (neg:DF (match_dup 6)))]
8912 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8915 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8916 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8917 operands[3] = gen_reg_rtx (DFmode);
8918 operands[4] = gen_reg_rtx (CCFPmode);
8919 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8920 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8923 ;; Next come the multi-word integer load and store and the load and store
8926 ; List r->r after r->"o<>", otherwise reload will try to reload a
8927 ; non-offsettable address by using r->r which won't make progress.
8928 (define_insn "*movdi_internal32"
8929 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8930 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8932 && (gpc_reg_operand (operands[0], DImode)
8933 || gpc_reg_operand (operands[1], DImode))"
8942 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8945 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8946 (match_operand:DI 1 "const_int_operand" ""))]
8947 "! TARGET_POWERPC64 && reload_completed"
8948 [(set (match_dup 2) (match_dup 4))
8949 (set (match_dup 3) (match_dup 1))]
8952 HOST_WIDE_INT value = INTVAL (operands[1]);
8953 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8955 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8957 #if HOST_BITS_PER_WIDE_INT == 32
8958 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8960 operands[4] = GEN_INT (value >> 32);
8961 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8966 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "")
8967 (match_operand:DI 1 "input_operand" ""))]
8968 "reload_completed && !TARGET_POWERPC64
8969 && gpr_or_gpr_p (operands[0], operands[1])"
8971 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8973 (define_insn "*movdi_mfpgpr"
8974 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
8975 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
8976 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
8977 && (gpc_reg_operand (operands[0], DImode)
8978 || gpc_reg_operand (operands[1], DImode))"
8995 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
8996 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
8998 (define_insn "*movdi_internal64"
8999 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
9000 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
9001 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
9002 && (gpc_reg_operand (operands[0], DImode)
9003 || gpc_reg_operand (operands[1], DImode))"
9018 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
9019 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9021 ;; immediate value valid for a single instruction hiding in a const_double
9023 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9024 (match_operand:DI 1 "const_double_operand" "F"))]
9025 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9026 && GET_CODE (operands[1]) == CONST_DOUBLE
9027 && num_insns_constant (operands[1], DImode) == 1"
9030 return ((unsigned HOST_WIDE_INT)
9031 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9032 ? \"li %0,%1\" : \"lis %0,%v1\";
9035 ;; Generate all one-bits and clear left or right.
9036 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9038 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9039 (match_operand:DI 1 "mask64_operand" ""))]
9040 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9041 [(set (match_dup 0) (const_int -1))
9043 (and:DI (rotate:DI (match_dup 0)
9048 ;; Split a load of a large constant into the appropriate five-instruction
9049 ;; sequence. Handle anything in a constant number of insns.
9050 ;; When non-easy constants can go in the TOC, this should use
9051 ;; easy_fp_constant predicate.
9053 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9054 (match_operand:DI 1 "const_int_operand" ""))]
9055 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9056 [(set (match_dup 0) (match_dup 2))
9057 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9059 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9061 if (tem == operands[0])
9068 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9069 (match_operand:DI 1 "const_double_operand" ""))]
9070 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9071 [(set (match_dup 0) (match_dup 2))
9072 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9074 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9076 if (tem == operands[0])
9082 ;; TImode is similar, except that we usually want to compute the address into
9083 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9084 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9086 ;; We say that MQ is clobbered in the last alternative because the first
9087 ;; alternative would never get used otherwise since it would need a reload
9088 ;; while the 2nd alternative would not. We put memory cases first so they
9089 ;; are preferred. Otherwise, we'd try to reload the output instead of
9090 ;; giving the SCRATCH mq.
9092 (define_insn "*movti_power"
9093 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
9094 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
9095 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
9096 "TARGET_POWER && ! TARGET_POWERPC64
9097 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9100 switch (which_alternative)
9107 return \"{stsi|stswi} %1,%P0,16\";
9112 /* If the address is not used in the output, we can use lsi. Otherwise,
9113 fall through to generating four loads. */
9115 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9116 return \"{lsi|lswi} %0,%P1,16\";
9117 /* ... fall through ... */
9123 [(set_attr "type" "store,store,*,load,load,*")])
9125 (define_insn "*movti_string"
9126 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
9127 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
9128 "! TARGET_POWER && ! TARGET_POWERPC64
9129 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9132 switch (which_alternative)
9138 return \"{stsi|stswi} %1,%P0,16\";
9143 /* If the address is not used in the output, we can use lsi. Otherwise,
9144 fall through to generating four loads. */
9146 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9147 return \"{lsi|lswi} %0,%P1,16\";
9148 /* ... fall through ... */
9154 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")])
9156 (define_insn "*movti_ppc64"
9157 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
9158 (match_operand:TI 1 "input_operand" "r,r,m"))]
9159 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9160 || gpc_reg_operand (operands[1], TImode))"
9162 [(set_attr "type" "*,load,store")])
9165 [(set (match_operand:TI 0 "gpc_reg_operand" "")
9166 (match_operand:TI 1 "const_double_operand" ""))]
9168 [(set (match_dup 2) (match_dup 4))
9169 (set (match_dup 3) (match_dup 5))]
9172 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9174 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9176 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9178 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9179 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9181 else if (GET_CODE (operands[1]) == CONST_INT)
9183 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9184 operands[5] = operands[1];
9191 [(set (match_operand:TI 0 "nonimmediate_operand" "")
9192 (match_operand:TI 1 "input_operand" ""))]
9194 && gpr_or_gpr_p (operands[0], operands[1])"
9196 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9198 (define_expand "load_multiple"
9199 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9200 (match_operand:SI 1 "" ""))
9201 (use (match_operand:SI 2 "" ""))])]
9202 "TARGET_STRING && !TARGET_POWERPC64"
9210 /* Support only loading a constant number of fixed-point registers from
9211 memory and only bother with this if more than two; the machine
9212 doesn't support more than eight. */
9213 if (GET_CODE (operands[2]) != CONST_INT
9214 || INTVAL (operands[2]) <= 2
9215 || INTVAL (operands[2]) > 8
9216 || GET_CODE (operands[1]) != MEM
9217 || GET_CODE (operands[0]) != REG
9218 || REGNO (operands[0]) >= 32)
9221 count = INTVAL (operands[2]);
9222 regno = REGNO (operands[0]);
9224 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9225 op1 = replace_equiv_address (operands[1],
9226 force_reg (SImode, XEXP (operands[1], 0)));
9228 for (i = 0; i < count; i++)
9229 XVECEXP (operands[3], 0, i)
9230 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9231 adjust_address_nv (op1, SImode, i * 4));
9234 (define_insn "*ldmsi8"
9235 [(match_parallel 0 "load_multiple_operation"
9236 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9237 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9238 (set (match_operand:SI 3 "gpc_reg_operand" "")
9239 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9240 (set (match_operand:SI 4 "gpc_reg_operand" "")
9241 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9242 (set (match_operand:SI 5 "gpc_reg_operand" "")
9243 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9244 (set (match_operand:SI 6 "gpc_reg_operand" "")
9245 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9246 (set (match_operand:SI 7 "gpc_reg_operand" "")
9247 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9248 (set (match_operand:SI 8 "gpc_reg_operand" "")
9249 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9250 (set (match_operand:SI 9 "gpc_reg_operand" "")
9251 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9252 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9254 { return rs6000_output_load_multiple (operands); }"
9255 [(set_attr "type" "load_ux")
9256 (set_attr "length" "32")])
9258 (define_insn "*ldmsi7"
9259 [(match_parallel 0 "load_multiple_operation"
9260 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9261 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9262 (set (match_operand:SI 3 "gpc_reg_operand" "")
9263 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9264 (set (match_operand:SI 4 "gpc_reg_operand" "")
9265 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9266 (set (match_operand:SI 5 "gpc_reg_operand" "")
9267 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9268 (set (match_operand:SI 6 "gpc_reg_operand" "")
9269 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9270 (set (match_operand:SI 7 "gpc_reg_operand" "")
9271 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9272 (set (match_operand:SI 8 "gpc_reg_operand" "")
9273 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9274 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9276 { return rs6000_output_load_multiple (operands); }"
9277 [(set_attr "type" "load_ux")
9278 (set_attr "length" "32")])
9280 (define_insn "*ldmsi6"
9281 [(match_parallel 0 "load_multiple_operation"
9282 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9283 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9284 (set (match_operand:SI 3 "gpc_reg_operand" "")
9285 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9286 (set (match_operand:SI 4 "gpc_reg_operand" "")
9287 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9288 (set (match_operand:SI 5 "gpc_reg_operand" "")
9289 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9290 (set (match_operand:SI 6 "gpc_reg_operand" "")
9291 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9292 (set (match_operand:SI 7 "gpc_reg_operand" "")
9293 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9294 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9296 { return rs6000_output_load_multiple (operands); }"
9297 [(set_attr "type" "load_ux")
9298 (set_attr "length" "32")])
9300 (define_insn "*ldmsi5"
9301 [(match_parallel 0 "load_multiple_operation"
9302 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9303 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9304 (set (match_operand:SI 3 "gpc_reg_operand" "")
9305 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9306 (set (match_operand:SI 4 "gpc_reg_operand" "")
9307 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9308 (set (match_operand:SI 5 "gpc_reg_operand" "")
9309 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9310 (set (match_operand:SI 6 "gpc_reg_operand" "")
9311 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9312 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9314 { return rs6000_output_load_multiple (operands); }"
9315 [(set_attr "type" "load_ux")
9316 (set_attr "length" "32")])
9318 (define_insn "*ldmsi4"
9319 [(match_parallel 0 "load_multiple_operation"
9320 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9321 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9322 (set (match_operand:SI 3 "gpc_reg_operand" "")
9323 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9324 (set (match_operand:SI 4 "gpc_reg_operand" "")
9325 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9326 (set (match_operand:SI 5 "gpc_reg_operand" "")
9327 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9328 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9330 { return rs6000_output_load_multiple (operands); }"
9331 [(set_attr "type" "load_ux")
9332 (set_attr "length" "32")])
9334 (define_insn "*ldmsi3"
9335 [(match_parallel 0 "load_multiple_operation"
9336 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9337 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9338 (set (match_operand:SI 3 "gpc_reg_operand" "")
9339 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9340 (set (match_operand:SI 4 "gpc_reg_operand" "")
9341 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9342 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9344 { return rs6000_output_load_multiple (operands); }"
9345 [(set_attr "type" "load_ux")
9346 (set_attr "length" "32")])
9348 (define_expand "store_multiple"
9349 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9350 (match_operand:SI 1 "" ""))
9351 (clobber (scratch:SI))
9352 (use (match_operand:SI 2 "" ""))])]
9353 "TARGET_STRING && !TARGET_POWERPC64"
9362 /* Support only storing a constant number of fixed-point registers to
9363 memory and only bother with this if more than two; the machine
9364 doesn't support more than eight. */
9365 if (GET_CODE (operands[2]) != CONST_INT
9366 || INTVAL (operands[2]) <= 2
9367 || INTVAL (operands[2]) > 8
9368 || GET_CODE (operands[0]) != MEM
9369 || GET_CODE (operands[1]) != REG
9370 || REGNO (operands[1]) >= 32)
9373 count = INTVAL (operands[2]);
9374 regno = REGNO (operands[1]);
9376 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9377 to = force_reg (SImode, XEXP (operands[0], 0));
9378 op0 = replace_equiv_address (operands[0], to);
9380 XVECEXP (operands[3], 0, 0)
9381 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9382 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9383 gen_rtx_SCRATCH (SImode));
9385 for (i = 1; i < count; i++)
9386 XVECEXP (operands[3], 0, i + 1)
9387 = gen_rtx_SET (VOIDmode,
9388 adjust_address_nv (op0, SImode, i * 4),
9389 gen_rtx_REG (SImode, regno + i));
9392 (define_insn "*stmsi8"
9393 [(match_parallel 0 "store_multiple_operation"
9394 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9395 (match_operand:SI 2 "gpc_reg_operand" "r"))
9396 (clobber (match_scratch:SI 3 "=X"))
9397 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9398 (match_operand:SI 4 "gpc_reg_operand" "r"))
9399 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9400 (match_operand:SI 5 "gpc_reg_operand" "r"))
9401 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9402 (match_operand:SI 6 "gpc_reg_operand" "r"))
9403 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9404 (match_operand:SI 7 "gpc_reg_operand" "r"))
9405 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9406 (match_operand:SI 8 "gpc_reg_operand" "r"))
9407 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9408 (match_operand:SI 9 "gpc_reg_operand" "r"))
9409 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9410 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9411 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9412 "{stsi|stswi} %2,%1,%O0"
9413 [(set_attr "type" "store_ux")])
9415 (define_insn "*stmsi7"
9416 [(match_parallel 0 "store_multiple_operation"
9417 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9418 (match_operand:SI 2 "gpc_reg_operand" "r"))
9419 (clobber (match_scratch:SI 3 "=X"))
9420 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9421 (match_operand:SI 4 "gpc_reg_operand" "r"))
9422 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9423 (match_operand:SI 5 "gpc_reg_operand" "r"))
9424 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9425 (match_operand:SI 6 "gpc_reg_operand" "r"))
9426 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9427 (match_operand:SI 7 "gpc_reg_operand" "r"))
9428 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9429 (match_operand:SI 8 "gpc_reg_operand" "r"))
9430 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9431 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9432 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9433 "{stsi|stswi} %2,%1,%O0"
9434 [(set_attr "type" "store_ux")])
9436 (define_insn "*stmsi6"
9437 [(match_parallel 0 "store_multiple_operation"
9438 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9439 (match_operand:SI 2 "gpc_reg_operand" "r"))
9440 (clobber (match_scratch:SI 3 "=X"))
9441 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9442 (match_operand:SI 4 "gpc_reg_operand" "r"))
9443 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9444 (match_operand:SI 5 "gpc_reg_operand" "r"))
9445 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9446 (match_operand:SI 6 "gpc_reg_operand" "r"))
9447 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9448 (match_operand:SI 7 "gpc_reg_operand" "r"))
9449 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9450 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9451 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9452 "{stsi|stswi} %2,%1,%O0"
9453 [(set_attr "type" "store_ux")])
9455 (define_insn "*stmsi5"
9456 [(match_parallel 0 "store_multiple_operation"
9457 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9458 (match_operand:SI 2 "gpc_reg_operand" "r"))
9459 (clobber (match_scratch:SI 3 "=X"))
9460 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9461 (match_operand:SI 4 "gpc_reg_operand" "r"))
9462 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9463 (match_operand:SI 5 "gpc_reg_operand" "r"))
9464 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9465 (match_operand:SI 6 "gpc_reg_operand" "r"))
9466 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9467 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9468 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9469 "{stsi|stswi} %2,%1,%O0"
9470 [(set_attr "type" "store_ux")])
9472 (define_insn "*stmsi4"
9473 [(match_parallel 0 "store_multiple_operation"
9474 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9475 (match_operand:SI 2 "gpc_reg_operand" "r"))
9476 (clobber (match_scratch:SI 3 "=X"))
9477 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9478 (match_operand:SI 4 "gpc_reg_operand" "r"))
9479 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9480 (match_operand:SI 5 "gpc_reg_operand" "r"))
9481 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9482 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9483 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9484 "{stsi|stswi} %2,%1,%O0"
9485 [(set_attr "type" "store_ux")])
9487 (define_insn "*stmsi3"
9488 [(match_parallel 0 "store_multiple_operation"
9489 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9490 (match_operand:SI 2 "gpc_reg_operand" "r"))
9491 (clobber (match_scratch:SI 3 "=X"))
9492 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9493 (match_operand:SI 4 "gpc_reg_operand" "r"))
9494 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9495 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9496 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9497 "{stsi|stswi} %2,%1,%O0"
9498 [(set_attr "type" "store_ux")])
9500 (define_insn "*stmsi8_power"
9501 [(match_parallel 0 "store_multiple_operation"
9502 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9503 (match_operand:SI 2 "gpc_reg_operand" "r"))
9504 (clobber (match_scratch:SI 3 "=q"))
9505 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9506 (match_operand:SI 4 "gpc_reg_operand" "r"))
9507 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9508 (match_operand:SI 5 "gpc_reg_operand" "r"))
9509 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9510 (match_operand:SI 6 "gpc_reg_operand" "r"))
9511 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9512 (match_operand:SI 7 "gpc_reg_operand" "r"))
9513 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9514 (match_operand:SI 8 "gpc_reg_operand" "r"))
9515 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9516 (match_operand:SI 9 "gpc_reg_operand" "r"))
9517 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9518 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9519 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
9520 "{stsi|stswi} %2,%1,%O0"
9521 [(set_attr "type" "store_ux")])
9523 (define_insn "*stmsi7_power"
9524 [(match_parallel 0 "store_multiple_operation"
9525 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9526 (match_operand:SI 2 "gpc_reg_operand" "r"))
9527 (clobber (match_scratch:SI 3 "=q"))
9528 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9529 (match_operand:SI 4 "gpc_reg_operand" "r"))
9530 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9531 (match_operand:SI 5 "gpc_reg_operand" "r"))
9532 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9533 (match_operand:SI 6 "gpc_reg_operand" "r"))
9534 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9535 (match_operand:SI 7 "gpc_reg_operand" "r"))
9536 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9537 (match_operand:SI 8 "gpc_reg_operand" "r"))
9538 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9539 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9540 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
9541 "{stsi|stswi} %2,%1,%O0"
9542 [(set_attr "type" "store_ux")])
9544 (define_insn "*stmsi6_power"
9545 [(match_parallel 0 "store_multiple_operation"
9546 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9547 (match_operand:SI 2 "gpc_reg_operand" "r"))
9548 (clobber (match_scratch:SI 3 "=q"))
9549 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9550 (match_operand:SI 4 "gpc_reg_operand" "r"))
9551 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9552 (match_operand:SI 5 "gpc_reg_operand" "r"))
9553 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9554 (match_operand:SI 6 "gpc_reg_operand" "r"))
9555 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9556 (match_operand:SI 7 "gpc_reg_operand" "r"))
9557 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9558 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9559 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
9560 "{stsi|stswi} %2,%1,%O0"
9561 [(set_attr "type" "store_ux")])
9563 (define_insn "*stmsi5_power"
9564 [(match_parallel 0 "store_multiple_operation"
9565 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9566 (match_operand:SI 2 "gpc_reg_operand" "r"))
9567 (clobber (match_scratch:SI 3 "=q"))
9568 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9569 (match_operand:SI 4 "gpc_reg_operand" "r"))
9570 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9571 (match_operand:SI 5 "gpc_reg_operand" "r"))
9572 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9573 (match_operand:SI 6 "gpc_reg_operand" "r"))
9574 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9575 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9576 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
9577 "{stsi|stswi} %2,%1,%O0"
9578 [(set_attr "type" "store_ux")])
9580 (define_insn "*stmsi4_power"
9581 [(match_parallel 0 "store_multiple_operation"
9582 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9583 (match_operand:SI 2 "gpc_reg_operand" "r"))
9584 (clobber (match_scratch:SI 3 "=q"))
9585 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9586 (match_operand:SI 4 "gpc_reg_operand" "r"))
9587 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9588 (match_operand:SI 5 "gpc_reg_operand" "r"))
9589 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9590 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9591 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
9592 "{stsi|stswi} %2,%1,%O0"
9593 [(set_attr "type" "store_ux")])
9595 (define_insn "*stmsi3_power"
9596 [(match_parallel 0 "store_multiple_operation"
9597 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9598 (match_operand:SI 2 "gpc_reg_operand" "r"))
9599 (clobber (match_scratch:SI 3 "=q"))
9600 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9601 (match_operand:SI 4 "gpc_reg_operand" "r"))
9602 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9603 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9604 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
9605 "{stsi|stswi} %2,%1,%O0"
9606 [(set_attr "type" "store_ux")])
9608 (define_expand "setmemsi"
9609 [(parallel [(set (match_operand:BLK 0 "" "")
9610 (match_operand 2 "const_int_operand" ""))
9611 (use (match_operand:SI 1 "" ""))
9612 (use (match_operand:SI 3 "" ""))])]
9616 /* If value to set is not zero, use the library routine. */
9617 if (operands[2] != const0_rtx)
9620 if (expand_block_clear (operands))
9626 ;; String/block move insn.
9627 ;; Argument 0 is the destination
9628 ;; Argument 1 is the source
9629 ;; Argument 2 is the length
9630 ;; Argument 3 is the alignment
9632 (define_expand "movmemsi"
9633 [(parallel [(set (match_operand:BLK 0 "" "")
9634 (match_operand:BLK 1 "" ""))
9635 (use (match_operand:SI 2 "" ""))
9636 (use (match_operand:SI 3 "" ""))])]
9640 if (expand_block_move (operands))
9646 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9647 ;; register allocator doesn't have a clue about allocating 8 word registers.
9648 ;; rD/rS = r5 is preferred, efficient form.
9649 (define_expand "movmemsi_8reg"
9650 [(parallel [(set (match_operand 0 "" "")
9651 (match_operand 1 "" ""))
9652 (use (match_operand 2 "" ""))
9653 (use (match_operand 3 "" ""))
9654 (clobber (reg:SI 5))
9655 (clobber (reg:SI 6))
9656 (clobber (reg:SI 7))
9657 (clobber (reg:SI 8))
9658 (clobber (reg:SI 9))
9659 (clobber (reg:SI 10))
9660 (clobber (reg:SI 11))
9661 (clobber (reg:SI 12))
9662 (clobber (match_scratch:SI 4 ""))])]
9667 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9668 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9669 (use (match_operand:SI 2 "immediate_operand" "i"))
9670 (use (match_operand:SI 3 "immediate_operand" "i"))
9671 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9672 (clobber (reg:SI 6))
9673 (clobber (reg:SI 7))
9674 (clobber (reg:SI 8))
9675 (clobber (reg:SI 9))
9676 (clobber (reg:SI 10))
9677 (clobber (reg:SI 11))
9678 (clobber (reg:SI 12))
9679 (clobber (match_scratch:SI 5 "=q"))]
9680 "TARGET_STRING && TARGET_POWER
9681 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9682 || INTVAL (operands[2]) == 0)
9683 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9684 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9685 && REGNO (operands[4]) == 5"
9686 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9687 [(set_attr "type" "store_ux")
9688 (set_attr "length" "8")])
9691 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9692 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9693 (use (match_operand:SI 2 "immediate_operand" "i"))
9694 (use (match_operand:SI 3 "immediate_operand" "i"))
9695 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9696 (clobber (reg:SI 6))
9697 (clobber (reg:SI 7))
9698 (clobber (reg:SI 8))
9699 (clobber (reg:SI 9))
9700 (clobber (reg:SI 10))
9701 (clobber (reg:SI 11))
9702 (clobber (reg:SI 12))
9703 (clobber (match_scratch:SI 5 "=X"))]
9704 "TARGET_STRING && ! TARGET_POWER
9705 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9706 || INTVAL (operands[2]) == 0)
9707 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9708 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9709 && REGNO (operands[4]) == 5"
9710 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9711 [(set_attr "type" "store_ux")
9712 (set_attr "length" "8")])
9714 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9715 ;; register allocator doesn't have a clue about allocating 6 word registers.
9716 ;; rD/rS = r5 is preferred, efficient form.
9717 (define_expand "movmemsi_6reg"
9718 [(parallel [(set (match_operand 0 "" "")
9719 (match_operand 1 "" ""))
9720 (use (match_operand 2 "" ""))
9721 (use (match_operand 3 "" ""))
9722 (clobber (reg:SI 5))
9723 (clobber (reg:SI 6))
9724 (clobber (reg:SI 7))
9725 (clobber (reg:SI 8))
9726 (clobber (reg:SI 9))
9727 (clobber (reg:SI 10))
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 (reg:SI 9))
9742 (clobber (reg:SI 10))
9743 (clobber (match_scratch:SI 5 "=q"))]
9744 "TARGET_STRING && TARGET_POWER
9745 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9746 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9747 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9748 && REGNO (operands[4]) == 5"
9749 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9750 [(set_attr "type" "store_ux")
9751 (set_attr "length" "8")])
9754 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9755 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9756 (use (match_operand:SI 2 "immediate_operand" "i"))
9757 (use (match_operand:SI 3 "immediate_operand" "i"))
9758 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9759 (clobber (reg:SI 6))
9760 (clobber (reg:SI 7))
9761 (clobber (reg:SI 8))
9762 (clobber (reg:SI 9))
9763 (clobber (reg:SI 10))
9764 (clobber (match_scratch:SI 5 "=X"))]
9765 "TARGET_STRING && ! TARGET_POWER
9766 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9767 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9768 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9769 && REGNO (operands[4]) == 5"
9770 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9771 [(set_attr "type" "store_ux")
9772 (set_attr "length" "8")])
9774 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9775 ;; problems with TImode.
9776 ;; rD/rS = r5 is preferred, efficient form.
9777 (define_expand "movmemsi_4reg"
9778 [(parallel [(set (match_operand 0 "" "")
9779 (match_operand 1 "" ""))
9780 (use (match_operand 2 "" ""))
9781 (use (match_operand 3 "" ""))
9782 (clobber (reg:SI 5))
9783 (clobber (reg:SI 6))
9784 (clobber (reg:SI 7))
9785 (clobber (reg:SI 8))
9786 (clobber (match_scratch:SI 4 ""))])]
9791 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9792 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9793 (use (match_operand:SI 2 "immediate_operand" "i"))
9794 (use (match_operand:SI 3 "immediate_operand" "i"))
9795 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9796 (clobber (reg:SI 6))
9797 (clobber (reg:SI 7))
9798 (clobber (reg:SI 8))
9799 (clobber (match_scratch:SI 5 "=q"))]
9800 "TARGET_STRING && TARGET_POWER
9801 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9802 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9803 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9804 && REGNO (operands[4]) == 5"
9805 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9806 [(set_attr "type" "store_ux")
9807 (set_attr "length" "8")])
9810 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9811 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9812 (use (match_operand:SI 2 "immediate_operand" "i"))
9813 (use (match_operand:SI 3 "immediate_operand" "i"))
9814 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9815 (clobber (reg:SI 6))
9816 (clobber (reg:SI 7))
9817 (clobber (reg:SI 8))
9818 (clobber (match_scratch:SI 5 "=X"))]
9819 "TARGET_STRING && ! TARGET_POWER
9820 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9821 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9822 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9823 && REGNO (operands[4]) == 5"
9824 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9825 [(set_attr "type" "store_ux")
9826 (set_attr "length" "8")])
9828 ;; Move up to 8 bytes at a time.
9829 (define_expand "movmemsi_2reg"
9830 [(parallel [(set (match_operand 0 "" "")
9831 (match_operand 1 "" ""))
9832 (use (match_operand 2 "" ""))
9833 (use (match_operand 3 "" ""))
9834 (clobber (match_scratch:DI 4 ""))
9835 (clobber (match_scratch:SI 5 ""))])]
9836 "TARGET_STRING && ! TARGET_POWERPC64"
9840 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9841 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9842 (use (match_operand:SI 2 "immediate_operand" "i"))
9843 (use (match_operand:SI 3 "immediate_operand" "i"))
9844 (clobber (match_scratch:DI 4 "=&r"))
9845 (clobber (match_scratch:SI 5 "=q"))]
9846 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9847 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9848 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9849 [(set_attr "type" "store_ux")
9850 (set_attr "length" "8")])
9853 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9854 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9855 (use (match_operand:SI 2 "immediate_operand" "i"))
9856 (use (match_operand:SI 3 "immediate_operand" "i"))
9857 (clobber (match_scratch:DI 4 "=&r"))
9858 (clobber (match_scratch:SI 5 "=X"))]
9859 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9860 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9861 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9862 [(set_attr "type" "store_ux")
9863 (set_attr "length" "8")])
9865 ;; Move up to 4 bytes at a time.
9866 (define_expand "movmemsi_1reg"
9867 [(parallel [(set (match_operand 0 "" "")
9868 (match_operand 1 "" ""))
9869 (use (match_operand 2 "" ""))
9870 (use (match_operand 3 "" ""))
9871 (clobber (match_scratch:SI 4 ""))
9872 (clobber (match_scratch:SI 5 ""))])]
9877 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9878 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9879 (use (match_operand:SI 2 "immediate_operand" "i"))
9880 (use (match_operand:SI 3 "immediate_operand" "i"))
9881 (clobber (match_scratch:SI 4 "=&r"))
9882 (clobber (match_scratch:SI 5 "=q"))]
9883 "TARGET_STRING && TARGET_POWER
9884 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9885 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9886 [(set_attr "type" "store_ux")
9887 (set_attr "length" "8")])
9890 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
9891 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
9892 (use (match_operand:SI 2 "immediate_operand" "i"))
9893 (use (match_operand:SI 3 "immediate_operand" "i"))
9894 (clobber (match_scratch:SI 4 "=&r"))
9895 (clobber (match_scratch:SI 5 "=X"))]
9896 "TARGET_STRING && ! TARGET_POWER
9897 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9898 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9899 [(set_attr "type" "store_ux")
9900 (set_attr "length" "8")])
9902 ;; Define insns that do load or store with update. Some of these we can
9903 ;; get by using pre-decrement or pre-increment, but the hardware can also
9904 ;; do cases where the increment is not the size of the object.
9906 ;; In all these cases, we use operands 0 and 1 for the register being
9907 ;; incremented because those are the operands that local-alloc will
9908 ;; tie and these are the pair most likely to be tieable (and the ones
9909 ;; that will benefit the most).
9911 (define_insn "*movdi_update1"
9912 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9913 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9914 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9915 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9916 (plus:DI (match_dup 1) (match_dup 2)))]
9917 "TARGET_POWERPC64 && TARGET_UPDATE"
9921 [(set_attr "type" "load_ux,load_u")])
9923 (define_insn "movdi_<mode>_update"
9924 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
9925 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
9926 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9927 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
9928 (plus:P (match_dup 1) (match_dup 2)))]
9929 "TARGET_POWERPC64 && TARGET_UPDATE"
9933 [(set_attr "type" "store_ux,store_u")])
9935 (define_insn "*movsi_update1"
9936 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9937 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9938 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9939 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9940 (plus:SI (match_dup 1) (match_dup 2)))]
9943 {lux|lwzux} %3,%0,%2
9944 {lu|lwzu} %3,%2(%0)"
9945 [(set_attr "type" "load_ux,load_u")])
9947 (define_insn "*movsi_update2"
9948 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9950 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9951 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9952 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9953 (plus:DI (match_dup 1) (match_dup 2)))]
9956 [(set_attr "type" "load_ext_ux")])
9958 (define_insn "movsi_update"
9959 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9960 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9961 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9962 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9963 (plus:SI (match_dup 1) (match_dup 2)))]
9966 {stux|stwux} %3,%0,%2
9967 {stu|stwu} %3,%2(%0)"
9968 [(set_attr "type" "store_ux,store_u")])
9970 (define_insn "*movhi_update1"
9971 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9972 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9973 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9974 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9975 (plus:SI (match_dup 1) (match_dup 2)))]
9980 [(set_attr "type" "load_ux,load_u")])
9982 (define_insn "*movhi_update2"
9983 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9985 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9986 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9987 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9988 (plus:SI (match_dup 1) (match_dup 2)))]
9993 [(set_attr "type" "load_ux,load_u")])
9995 (define_insn "*movhi_update3"
9996 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9998 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9999 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10000 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10001 (plus:SI (match_dup 1) (match_dup 2)))]
10006 [(set_attr "type" "load_ext_ux,load_ext_u")])
10008 (define_insn "*movhi_update4"
10009 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10010 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10011 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10012 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10013 (plus:SI (match_dup 1) (match_dup 2)))]
10018 [(set_attr "type" "store_ux,store_u")])
10020 (define_insn "*movqi_update1"
10021 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10022 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10023 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10024 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10025 (plus:SI (match_dup 1) (match_dup 2)))]
10030 [(set_attr "type" "load_ux,load_u")])
10032 (define_insn "*movqi_update2"
10033 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10035 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10036 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10037 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10038 (plus:SI (match_dup 1) (match_dup 2)))]
10043 [(set_attr "type" "load_ux,load_u")])
10045 (define_insn "*movqi_update3"
10046 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10047 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10048 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10049 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10050 (plus:SI (match_dup 1) (match_dup 2)))]
10055 [(set_attr "type" "store_ux,store_u")])
10057 (define_insn "*movsf_update1"
10058 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10059 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10060 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10061 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10062 (plus:SI (match_dup 1) (match_dup 2)))]
10063 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10067 [(set_attr "type" "fpload_ux,fpload_u")])
10069 (define_insn "*movsf_update2"
10070 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10071 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10072 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10073 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10074 (plus:SI (match_dup 1) (match_dup 2)))]
10075 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10079 [(set_attr "type" "fpstore_ux,fpstore_u")])
10081 (define_insn "*movsf_update3"
10082 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10083 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10084 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10085 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10086 (plus:SI (match_dup 1) (match_dup 2)))]
10087 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10089 {lux|lwzux} %3,%0,%2
10090 {lu|lwzu} %3,%2(%0)"
10091 [(set_attr "type" "load_ux,load_u")])
10093 (define_insn "*movsf_update4"
10094 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10095 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10096 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10097 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10098 (plus:SI (match_dup 1) (match_dup 2)))]
10099 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10101 {stux|stwux} %3,%0,%2
10102 {stu|stwu} %3,%2(%0)"
10103 [(set_attr "type" "store_ux,store_u")])
10105 (define_insn "*movdf_update1"
10106 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10107 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10108 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10109 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10110 (plus:SI (match_dup 1) (match_dup 2)))]
10111 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10115 [(set_attr "type" "fpload_ux,fpload_u")])
10117 (define_insn "*movdf_update2"
10118 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10119 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10120 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10121 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10122 (plus:SI (match_dup 1) (match_dup 2)))]
10123 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10127 [(set_attr "type" "fpstore_ux,fpstore_u")])
10129 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10131 (define_insn "*lfq_power2"
10132 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
10133 (match_operand:V2DF 1 "memory_operand" ""))]
10135 && TARGET_HARD_FLOAT && TARGET_FPRS"
10139 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10140 (match_operand:DF 1 "memory_operand" ""))
10141 (set (match_operand:DF 2 "gpc_reg_operand" "")
10142 (match_operand:DF 3 "memory_operand" ""))]
10144 && TARGET_HARD_FLOAT && TARGET_FPRS
10145 && registers_ok_for_quad_peep (operands[0], operands[2])
10146 && mems_ok_for_quad_peep (operands[1], operands[3])"
10147 [(set (match_dup 0)
10149 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
10150 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
10152 (define_insn "*stfq_power2"
10153 [(set (match_operand:V2DF 0 "memory_operand" "")
10154 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
10156 && TARGET_HARD_FLOAT && TARGET_FPRS"
10157 "stfq%U0%X0 %1,%0")
10161 [(set (match_operand:DF 0 "memory_operand" "")
10162 (match_operand:DF 1 "gpc_reg_operand" ""))
10163 (set (match_operand:DF 2 "memory_operand" "")
10164 (match_operand:DF 3 "gpc_reg_operand" ""))]
10166 && TARGET_HARD_FLOAT && TARGET_FPRS
10167 && registers_ok_for_quad_peep (operands[1], operands[3])
10168 && mems_ok_for_quad_peep (operands[0], operands[2])"
10169 [(set (match_dup 0)
10171 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
10172 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
10174 ;; After inserting conditional returns we can sometimes have
10175 ;; unnecessary register moves. Unfortunately we cannot have a
10176 ;; modeless peephole here, because some single SImode sets have early
10177 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10178 ;; sequences, using get_attr_length here will smash the operands
10179 ;; array. Neither is there an early_cobbler_p predicate.
10180 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10182 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10183 (match_operand:DF 1 "any_operand" ""))
10184 (set (match_operand:DF 2 "gpc_reg_operand" "")
10186 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10187 && peep2_reg_dead_p (2, operands[0])"
10188 [(set (match_dup 2) (match_dup 1))])
10191 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10192 (match_operand:SF 1 "any_operand" ""))
10193 (set (match_operand:SF 2 "gpc_reg_operand" "")
10195 "peep2_reg_dead_p (2, operands[0])"
10196 [(set (match_dup 2) (match_dup 1))])
10201 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
10202 (define_insn "tls_gd_32"
10203 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10204 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10205 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10207 "HAVE_AS_TLS && !TARGET_64BIT"
10208 "addi %0,%1,%2@got@tlsgd")
10210 (define_insn "tls_gd_64"
10211 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10212 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10213 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10215 "HAVE_AS_TLS && TARGET_64BIT"
10216 "addi %0,%1,%2@got@tlsgd")
10218 (define_insn "tls_ld_32"
10219 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10220 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
10222 "HAVE_AS_TLS && !TARGET_64BIT"
10223 "addi %0,%1,%&@got@tlsld")
10225 (define_insn "tls_ld_64"
10226 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10227 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
10229 "HAVE_AS_TLS && TARGET_64BIT"
10230 "addi %0,%1,%&@got@tlsld")
10232 (define_insn "tls_dtprel_32"
10233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10234 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10235 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10236 UNSPEC_TLSDTPREL))]
10237 "HAVE_AS_TLS && !TARGET_64BIT"
10238 "addi %0,%1,%2@dtprel")
10240 (define_insn "tls_dtprel_64"
10241 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10242 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10243 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10244 UNSPEC_TLSDTPREL))]
10245 "HAVE_AS_TLS && TARGET_64BIT"
10246 "addi %0,%1,%2@dtprel")
10248 (define_insn "tls_dtprel_ha_32"
10249 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10250 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10251 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10252 UNSPEC_TLSDTPRELHA))]
10253 "HAVE_AS_TLS && !TARGET_64BIT"
10254 "addis %0,%1,%2@dtprel@ha")
10256 (define_insn "tls_dtprel_ha_64"
10257 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10258 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10259 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10260 UNSPEC_TLSDTPRELHA))]
10261 "HAVE_AS_TLS && TARGET_64BIT"
10262 "addis %0,%1,%2@dtprel@ha")
10264 (define_insn "tls_dtprel_lo_32"
10265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10266 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10267 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10268 UNSPEC_TLSDTPRELLO))]
10269 "HAVE_AS_TLS && !TARGET_64BIT"
10270 "addi %0,%1,%2@dtprel@l")
10272 (define_insn "tls_dtprel_lo_64"
10273 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10274 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10275 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10276 UNSPEC_TLSDTPRELLO))]
10277 "HAVE_AS_TLS && TARGET_64BIT"
10278 "addi %0,%1,%2@dtprel@l")
10280 (define_insn "tls_got_dtprel_32"
10281 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10282 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10283 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10284 UNSPEC_TLSGOTDTPREL))]
10285 "HAVE_AS_TLS && !TARGET_64BIT"
10286 "lwz %0,%2@got@dtprel(%1)")
10288 (define_insn "tls_got_dtprel_64"
10289 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10290 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10291 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10292 UNSPEC_TLSGOTDTPREL))]
10293 "HAVE_AS_TLS && TARGET_64BIT"
10294 "ld %0,%2@got@dtprel(%1)")
10296 (define_insn "tls_tprel_32"
10297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10298 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10299 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10301 "HAVE_AS_TLS && !TARGET_64BIT"
10302 "addi %0,%1,%2@tprel")
10304 (define_insn "tls_tprel_64"
10305 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10306 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10307 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10309 "HAVE_AS_TLS && TARGET_64BIT"
10310 "addi %0,%1,%2@tprel")
10312 (define_insn "tls_tprel_ha_32"
10313 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10314 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10315 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10316 UNSPEC_TLSTPRELHA))]
10317 "HAVE_AS_TLS && !TARGET_64BIT"
10318 "addis %0,%1,%2@tprel@ha")
10320 (define_insn "tls_tprel_ha_64"
10321 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10322 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10323 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10324 UNSPEC_TLSTPRELHA))]
10325 "HAVE_AS_TLS && TARGET_64BIT"
10326 "addis %0,%1,%2@tprel@ha")
10328 (define_insn "tls_tprel_lo_32"
10329 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10330 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10331 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10332 UNSPEC_TLSTPRELLO))]
10333 "HAVE_AS_TLS && !TARGET_64BIT"
10334 "addi %0,%1,%2@tprel@l")
10336 (define_insn "tls_tprel_lo_64"
10337 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10338 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10339 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10340 UNSPEC_TLSTPRELLO))]
10341 "HAVE_AS_TLS && TARGET_64BIT"
10342 "addi %0,%1,%2@tprel@l")
10344 ;; "b" output constraint here and on tls_tls input to support linker tls
10345 ;; optimization. The linker may edit the instructions emitted by a
10346 ;; tls_got_tprel/tls_tls pair to addis,addi.
10347 (define_insn "tls_got_tprel_32"
10348 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10349 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10350 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10351 UNSPEC_TLSGOTTPREL))]
10352 "HAVE_AS_TLS && !TARGET_64BIT"
10353 "lwz %0,%2@got@tprel(%1)")
10355 (define_insn "tls_got_tprel_64"
10356 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
10357 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10358 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10359 UNSPEC_TLSGOTTPREL))]
10360 "HAVE_AS_TLS && TARGET_64BIT"
10361 "ld %0,%2@got@tprel(%1)")
10363 (define_insn "tls_tls_32"
10364 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10365 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
10366 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
10368 "HAVE_AS_TLS && !TARGET_64BIT"
10369 "add %0,%1,%2@tls")
10371 (define_insn "tls_tls_64"
10372 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10373 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
10374 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
10376 "HAVE_AS_TLS && TARGET_64BIT"
10377 "add %0,%1,%2@tls")
10379 ;; Next come insns related to the calling sequence.
10381 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10382 ;; We move the back-chain and decrement the stack pointer.
10384 (define_expand "allocate_stack"
10385 [(set (match_operand 0 "gpc_reg_operand" "")
10386 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10388 (minus (reg 1) (match_dup 1)))]
10391 { rtx chain = gen_reg_rtx (Pmode);
10392 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10395 emit_move_insn (chain, stack_bot);
10397 /* Check stack bounds if necessary. */
10398 if (current_function_limit_stack)
10401 available = expand_binop (Pmode, sub_optab,
10402 stack_pointer_rtx, stack_limit_rtx,
10403 NULL_RTX, 1, OPTAB_WIDEN);
10404 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10407 if (GET_CODE (operands[1]) != CONST_INT
10408 || INTVAL (operands[1]) < -32767
10409 || INTVAL (operands[1]) > 32768)
10411 neg_op0 = gen_reg_rtx (Pmode);
10413 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10415 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10418 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10421 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
10422 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10426 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10427 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10428 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10431 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10435 ;; These patterns say how to save and restore the stack pointer. We need not
10436 ;; save the stack pointer at function level since we are careful to
10437 ;; preserve the backchain. At block level, we have to restore the backchain
10438 ;; when we restore the stack pointer.
10440 ;; For nonlocal gotos, we must save both the stack pointer and its
10441 ;; backchain and restore both. Note that in the nonlocal case, the
10442 ;; save area is a memory location.
10444 (define_expand "save_stack_function"
10445 [(match_operand 0 "any_operand" "")
10446 (match_operand 1 "any_operand" "")]
10450 (define_expand "restore_stack_function"
10451 [(match_operand 0 "any_operand" "")
10452 (match_operand 1 "any_operand" "")]
10456 ;; Adjust stack pointer (op0) to a new value (op1).
10457 ;; First copy old stack backchain to new location, and ensure that the
10458 ;; scheduler won't reorder the sp assignment before the backchain write.
10459 (define_expand "restore_stack_block"
10460 [(set (match_dup 2) (match_dup 3))
10461 (set (match_dup 4) (match_dup 2))
10462 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
10463 (set (match_operand 0 "register_operand" "")
10464 (match_operand 1 "register_operand" ""))]
10468 operands[2] = gen_reg_rtx (Pmode);
10469 operands[3] = gen_frame_mem (Pmode, operands[0]);
10470 operands[4] = gen_frame_mem (Pmode, operands[1]);
10471 operands[5] = gen_frame_mem (BLKmode, operands[0]);
10474 (define_expand "save_stack_nonlocal"
10475 [(set (match_dup 3) (match_dup 4))
10476 (set (match_operand 0 "memory_operand" "") (match_dup 3))
10477 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
10481 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10483 /* Copy the backchain to the first word, sp to the second. */
10484 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
10485 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
10486 operands[3] = gen_reg_rtx (Pmode);
10487 operands[4] = gen_frame_mem (Pmode, operands[1]);
10490 (define_expand "restore_stack_nonlocal"
10491 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
10492 (set (match_dup 3) (match_dup 4))
10493 (set (match_dup 5) (match_dup 2))
10494 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
10495 (set (match_operand 0 "register_operand" "") (match_dup 3))]
10499 int units_per_word = (TARGET_32BIT) ? 4 : 8;
10501 /* Restore the backchain from the first word, sp from the second. */
10502 operands[2] = gen_reg_rtx (Pmode);
10503 operands[3] = gen_reg_rtx (Pmode);
10504 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
10505 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
10506 operands[5] = gen_frame_mem (Pmode, operands[3]);
10507 operands[6] = gen_frame_mem (BLKmode, operands[0]);
10510 ;; TOC register handling.
10512 ;; Code to initialize the TOC register...
10514 (define_insn "load_toc_aix_si"
10515 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10516 (unspec:SI [(const_int 0)] UNSPEC_TOC))
10517 (use (reg:SI 2))])]
10518 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10522 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10523 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10524 operands[2] = gen_rtx_REG (Pmode, 2);
10525 return \"{l|lwz} %0,%1(%2)\";
10527 [(set_attr "type" "load")])
10529 (define_insn "load_toc_aix_di"
10530 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10531 (unspec:DI [(const_int 0)] UNSPEC_TOC))
10532 (use (reg:DI 2))])]
10533 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10537 #ifdef TARGET_RELOCATABLE
10538 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10539 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10541 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10544 strcat (buf, \"@toc\");
10545 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10546 operands[2] = gen_rtx_REG (Pmode, 2);
10547 return \"ld %0,%1(%2)\";
10549 [(set_attr "type" "load")])
10551 (define_insn "load_toc_v4_pic_si"
10552 [(set (reg:SI LR_REGNO)
10553 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
10554 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10555 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10556 [(set_attr "type" "branch")
10557 (set_attr "length" "4")])
10559 (define_insn "load_toc_v4_PIC_1"
10560 [(set (reg:SI LR_REGNO)
10561 (match_operand:SI 0 "immediate_operand" "s"))
10562 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
10563 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
10564 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
10565 "bcl 20,31,%0\\n%0:"
10566 [(set_attr "type" "branch")
10567 (set_attr "length" "4")])
10569 (define_insn "load_toc_v4_PIC_1b"
10570 [(set (reg:SI LR_REGNO)
10571 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")]
10573 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10574 "bcl 20,31,$+8\\n\\t.long %0-$"
10575 [(set_attr "type" "branch")
10576 (set_attr "length" "8")])
10578 (define_insn "load_toc_v4_PIC_2"
10579 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10580 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10581 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10582 (match_operand:SI 3 "immediate_operand" "s")))))]
10583 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10584 "{l|lwz} %0,%2-%3(%1)"
10585 [(set_attr "type" "load")])
10587 (define_insn "load_toc_v4_PIC_3b"
10588 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
10589 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10591 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10592 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
10593 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10594 "{cau|addis} %0,%1,%2-%3@ha")
10596 (define_insn "load_toc_v4_PIC_3c"
10597 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10598 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10599 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
10600 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
10601 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
10602 "{cal|addi} %0,%1,%2-%3@l")
10604 ;; If the TOC is shared over a translation unit, as happens with all
10605 ;; the kinds of PIC that we support, we need to restore the TOC
10606 ;; pointer only when jumping over units of translation.
10607 ;; On Darwin, we need to reload the picbase.
10609 (define_expand "builtin_setjmp_receiver"
10610 [(use (label_ref (match_operand 0 "" "")))]
10611 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10612 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10613 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10617 if (DEFAULT_ABI == ABI_DARWIN)
10619 const char *picbase = machopic_function_base_name ();
10620 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
10621 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10625 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10626 CODE_LABEL_NUMBER (operands[0]));
10627 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
10629 emit_insn (gen_load_macho_picbase (tmplabrtx));
10630 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
10631 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10635 rs6000_emit_load_toc_table (FALSE);
10639 ;; Elf specific ways of loading addresses for non-PIC code.
10640 ;; The output of this could be r0, but we make a very strong
10641 ;; preference for a base register because it will usually
10642 ;; be needed there.
10643 (define_insn "elf_high"
10644 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
10645 (high:SI (match_operand 1 "" "")))]
10646 "TARGET_ELF && ! TARGET_64BIT"
10647 "{liu|lis} %0,%1@ha")
10649 (define_insn "elf_low"
10650 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
10651 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
10652 (match_operand 2 "" "")))]
10653 "TARGET_ELF && ! TARGET_64BIT"
10655 {cal|la} %0,%2@l(%1)
10656 {ai|addic} %0,%1,%K2")
10658 ;; A function pointer under AIX is a pointer to a data area whose first word
10659 ;; contains the actual address of the function, whose second word contains a
10660 ;; pointer to its TOC, and whose third word contains a value to place in the
10661 ;; static chain register (r11). Note that if we load the static chain, our
10662 ;; "trampoline" need not have any executable code.
10664 (define_expand "call_indirect_aix32"
10665 [(set (match_dup 2)
10666 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10667 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10670 (mem:SI (plus:SI (match_dup 0)
10673 (mem:SI (plus:SI (match_dup 0)
10675 (parallel [(call (mem:SI (match_dup 2))
10676 (match_operand 1 "" ""))
10680 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10681 (clobber (reg:SI LR_REGNO))])]
10684 { operands[2] = gen_reg_rtx (SImode); }")
10686 (define_expand "call_indirect_aix64"
10687 [(set (match_dup 2)
10688 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10689 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10692 (mem:DI (plus:DI (match_dup 0)
10695 (mem:DI (plus:DI (match_dup 0)
10697 (parallel [(call (mem:SI (match_dup 2))
10698 (match_operand 1 "" ""))
10702 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10703 (clobber (reg:SI LR_REGNO))])]
10706 { operands[2] = gen_reg_rtx (DImode); }")
10708 (define_expand "call_value_indirect_aix32"
10709 [(set (match_dup 3)
10710 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10711 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10714 (mem:SI (plus:SI (match_dup 1)
10717 (mem:SI (plus:SI (match_dup 1)
10719 (parallel [(set (match_operand 0 "" "")
10720 (call (mem:SI (match_dup 3))
10721 (match_operand 2 "" "")))
10725 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10726 (clobber (reg:SI LR_REGNO))])]
10729 { operands[3] = gen_reg_rtx (SImode); }")
10731 (define_expand "call_value_indirect_aix64"
10732 [(set (match_dup 3)
10733 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10734 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10737 (mem:DI (plus:DI (match_dup 1)
10740 (mem:DI (plus:DI (match_dup 1)
10742 (parallel [(set (match_operand 0 "" "")
10743 (call (mem:SI (match_dup 3))
10744 (match_operand 2 "" "")))
10748 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10749 (clobber (reg:SI LR_REGNO))])]
10752 { operands[3] = gen_reg_rtx (DImode); }")
10754 ;; Now the definitions for the call and call_value insns
10755 (define_expand "call"
10756 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10757 (match_operand 1 "" ""))
10758 (use (match_operand 2 "" ""))
10759 (clobber (reg:SI LR_REGNO))])]
10764 if (MACHOPIC_INDIRECT)
10765 operands[0] = machopic_indirect_call_target (operands[0]);
10768 gcc_assert (GET_CODE (operands[0]) == MEM);
10769 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10771 operands[0] = XEXP (operands[0], 0);
10773 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10775 && GET_CODE (operands[0]) == SYMBOL_REF
10776 && !SYMBOL_REF_LOCAL_P (operands[0]))
10781 tmp = gen_rtvec (3,
10782 gen_rtx_CALL (VOIDmode,
10783 gen_rtx_MEM (SImode, operands[0]),
10785 gen_rtx_USE (VOIDmode, operands[2]),
10786 gen_rtx_CLOBBER (VOIDmode,
10787 gen_rtx_REG (Pmode, LR_REGNO)));
10788 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10789 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10793 if (GET_CODE (operands[0]) != SYMBOL_REF
10794 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
10795 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
10797 if (INTVAL (operands[2]) & CALL_LONG)
10798 operands[0] = rs6000_longcall_ref (operands[0]);
10800 switch (DEFAULT_ABI)
10804 operands[0] = force_reg (Pmode, operands[0]);
10808 /* AIX function pointers are really pointers to a three word
10810 emit_call_insn (TARGET_32BIT
10811 ? gen_call_indirect_aix32 (force_reg (SImode,
10814 : gen_call_indirect_aix64 (force_reg (DImode,
10820 gcc_unreachable ();
10825 (define_expand "call_value"
10826 [(parallel [(set (match_operand 0 "" "")
10827 (call (mem:SI (match_operand 1 "address_operand" ""))
10828 (match_operand 2 "" "")))
10829 (use (match_operand 3 "" ""))
10830 (clobber (reg:SI LR_REGNO))])]
10835 if (MACHOPIC_INDIRECT)
10836 operands[1] = machopic_indirect_call_target (operands[1]);
10839 gcc_assert (GET_CODE (operands[1]) == MEM);
10840 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10842 operands[1] = XEXP (operands[1], 0);
10844 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
10846 && GET_CODE (operands[1]) == SYMBOL_REF
10847 && !SYMBOL_REF_LOCAL_P (operands[1]))
10852 tmp = gen_rtvec (3,
10853 gen_rtx_SET (VOIDmode,
10855 gen_rtx_CALL (VOIDmode,
10856 gen_rtx_MEM (SImode,
10859 gen_rtx_USE (VOIDmode, operands[3]),
10860 gen_rtx_CLOBBER (VOIDmode,
10861 gen_rtx_REG (Pmode, LR_REGNO)));
10862 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
10863 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
10867 if (GET_CODE (operands[1]) != SYMBOL_REF
10868 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
10869 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
10871 if (INTVAL (operands[3]) & CALL_LONG)
10872 operands[1] = rs6000_longcall_ref (operands[1]);
10874 switch (DEFAULT_ABI)
10878 operands[1] = force_reg (Pmode, operands[1]);
10882 /* AIX function pointers are really pointers to a three word
10884 emit_call_insn (TARGET_32BIT
10885 ? gen_call_value_indirect_aix32 (operands[0],
10889 : gen_call_value_indirect_aix64 (operands[0],
10896 gcc_unreachable ();
10901 ;; Call to function in current module. No TOC pointer reload needed.
10902 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10903 ;; either the function was not prototyped, or it was prototyped as a
10904 ;; variable argument function. It is > 0 if FP registers were passed
10905 ;; and < 0 if they were not.
10907 (define_insn "*call_local32"
10908 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10909 (match_operand 1 "" "g,g"))
10910 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10911 (clobber (reg:SI LR_REGNO))]
10912 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10915 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10916 output_asm_insn (\"crxor 6,6,6\", operands);
10918 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10919 output_asm_insn (\"creqv 6,6,6\", operands);
10921 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10923 [(set_attr "type" "branch")
10924 (set_attr "length" "4,8")])
10926 (define_insn "*call_local64"
10927 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10928 (match_operand 1 "" "g,g"))
10929 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10930 (clobber (reg:SI LR_REGNO))]
10931 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10934 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10935 output_asm_insn (\"crxor 6,6,6\", operands);
10937 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10938 output_asm_insn (\"creqv 6,6,6\", operands);
10940 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10942 [(set_attr "type" "branch")
10943 (set_attr "length" "4,8")])
10945 (define_insn "*call_value_local32"
10946 [(set (match_operand 0 "" "")
10947 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10948 (match_operand 2 "" "g,g")))
10949 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10950 (clobber (reg:SI LR_REGNO))]
10951 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10954 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10955 output_asm_insn (\"crxor 6,6,6\", operands);
10957 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10958 output_asm_insn (\"creqv 6,6,6\", operands);
10960 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10962 [(set_attr "type" "branch")
10963 (set_attr "length" "4,8")])
10966 (define_insn "*call_value_local64"
10967 [(set (match_operand 0 "" "")
10968 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10969 (match_operand 2 "" "g,g")))
10970 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10971 (clobber (reg:SI LR_REGNO))]
10972 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10975 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10976 output_asm_insn (\"crxor 6,6,6\", operands);
10978 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10979 output_asm_insn (\"creqv 6,6,6\", operands);
10981 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10983 [(set_attr "type" "branch")
10984 (set_attr "length" "4,8")])
10986 ;; Call to function which may be in another module. Restore the TOC
10987 ;; pointer (r2) after the call unless this is System V.
10988 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10989 ;; either the function was not prototyped, or it was prototyped as a
10990 ;; variable argument function. It is > 0 if FP registers were passed
10991 ;; and < 0 if they were not.
10993 (define_insn "*call_indirect_nonlocal_aix32"
10994 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
10995 (match_operand 1 "" "g,g"))
10999 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11000 (clobber (reg:SI LR_REGNO))]
11001 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11002 "b%T0l\;{l|lwz} 2,20(1)"
11003 [(set_attr "type" "jmpreg")
11004 (set_attr "length" "8")])
11006 (define_insn "*call_nonlocal_aix32"
11007 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11008 (match_operand 1 "" "g"))
11009 (use (match_operand:SI 2 "immediate_operand" "O"))
11010 (clobber (reg:SI LR_REGNO))]
11012 && DEFAULT_ABI == ABI_AIX
11013 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11015 [(set_attr "type" "branch")
11016 (set_attr "length" "8")])
11018 (define_insn "*call_indirect_nonlocal_aix64"
11019 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
11020 (match_operand 1 "" "g,g"))
11024 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11025 (clobber (reg:SI LR_REGNO))]
11026 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11027 "b%T0l\;ld 2,40(1)"
11028 [(set_attr "type" "jmpreg")
11029 (set_attr "length" "8")])
11031 (define_insn "*call_nonlocal_aix64"
11032 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11033 (match_operand 1 "" "g"))
11034 (use (match_operand:SI 2 "immediate_operand" "O"))
11035 (clobber (reg:SI LR_REGNO))]
11037 && DEFAULT_ABI == ABI_AIX
11038 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11040 [(set_attr "type" "branch")
11041 (set_attr "length" "8")])
11043 (define_insn "*call_value_indirect_nonlocal_aix32"
11044 [(set (match_operand 0 "" "")
11045 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
11046 (match_operand 2 "" "g,g")))
11050 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
11051 (clobber (reg:SI LR_REGNO))]
11052 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
11053 "b%T1l\;{l|lwz} 2,20(1)"
11054 [(set_attr "type" "jmpreg")
11055 (set_attr "length" "8")])
11057 (define_insn "*call_value_nonlocal_aix32"
11058 [(set (match_operand 0 "" "")
11059 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11060 (match_operand 2 "" "g")))
11061 (use (match_operand:SI 3 "immediate_operand" "O"))
11062 (clobber (reg:SI LR_REGNO))]
11064 && DEFAULT_ABI == ABI_AIX
11065 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11067 [(set_attr "type" "branch")
11068 (set_attr "length" "8")])
11070 (define_insn "*call_value_indirect_nonlocal_aix64"
11071 [(set (match_operand 0 "" "")
11072 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
11073 (match_operand 2 "" "g,g")))
11077 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
11078 (clobber (reg:SI LR_REGNO))]
11079 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
11080 "b%T1l\;ld 2,40(1)"
11081 [(set_attr "type" "jmpreg")
11082 (set_attr "length" "8")])
11084 (define_insn "*call_value_nonlocal_aix64"
11085 [(set (match_operand 0 "" "")
11086 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11087 (match_operand 2 "" "g")))
11088 (use (match_operand:SI 3 "immediate_operand" "O"))
11089 (clobber (reg:SI LR_REGNO))]
11091 && DEFAULT_ABI == ABI_AIX
11092 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11094 [(set_attr "type" "branch")
11095 (set_attr "length" "8")])
11097 ;; A function pointer under System V is just a normal pointer
11098 ;; operands[0] is the function pointer
11099 ;; operands[1] is the stack size to clean up
11100 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11101 ;; which indicates how to set cr1
11103 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11104 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11105 (match_operand 1 "" "g,g,g,g"))
11106 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11107 (clobber (reg:SI LR_REGNO))]
11108 "DEFAULT_ABI == ABI_V4
11109 || DEFAULT_ABI == ABI_DARWIN"
11111 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11112 output_asm_insn ("crxor 6,6,6", operands);
11114 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11115 output_asm_insn ("creqv 6,6,6", operands);
11119 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11120 (set_attr "length" "4,4,8,8")])
11122 (define_insn "*call_nonlocal_sysv<mode>"
11123 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11124 (match_operand 1 "" "g,g"))
11125 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11126 (clobber (reg:SI LR_REGNO))]
11127 "(DEFAULT_ABI == ABI_DARWIN
11128 || (DEFAULT_ABI == ABI_V4
11129 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11131 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11132 output_asm_insn ("crxor 6,6,6", operands);
11134 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11135 output_asm_insn ("creqv 6,6,6", operands);
11138 return output_call(insn, operands, 0, 2);
11140 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11142 if (TARGET_SECURE_PLT && flag_pic == 2)
11143 /* The magic 32768 offset here and in the other sysv call insns
11144 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11145 See sysv4.h:toc_section. */
11146 return "bl %z0+32768@plt";
11148 return "bl %z0@plt";
11154 [(set_attr "type" "branch,branch")
11155 (set_attr "length" "4,8")])
11157 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11158 [(set (match_operand 0 "" "")
11159 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11160 (match_operand 2 "" "g,g,g,g")))
11161 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11162 (clobber (reg:SI LR_REGNO))]
11163 "DEFAULT_ABI == ABI_V4
11164 || DEFAULT_ABI == ABI_DARWIN"
11166 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11167 output_asm_insn ("crxor 6,6,6", operands);
11169 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11170 output_asm_insn ("creqv 6,6,6", operands);
11174 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11175 (set_attr "length" "4,4,8,8")])
11177 (define_insn "*call_value_nonlocal_sysv<mode>"
11178 [(set (match_operand 0 "" "")
11179 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11180 (match_operand 2 "" "g,g")))
11181 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11182 (clobber (reg:SI LR_REGNO))]
11183 "(DEFAULT_ABI == ABI_DARWIN
11184 || (DEFAULT_ABI == ABI_V4
11185 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11187 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11188 output_asm_insn ("crxor 6,6,6", operands);
11190 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11191 output_asm_insn ("creqv 6,6,6", operands);
11194 return output_call(insn, operands, 1, 3);
11196 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11198 if (TARGET_SECURE_PLT && flag_pic == 2)
11199 return "bl %z1+32768@plt";
11201 return "bl %z1@plt";
11207 [(set_attr "type" "branch,branch")
11208 (set_attr "length" "4,8")])
11210 ;; Call subroutine returning any type.
11211 (define_expand "untyped_call"
11212 [(parallel [(call (match_operand 0 "" "")
11214 (match_operand 1 "" "")
11215 (match_operand 2 "" "")])]
11221 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11223 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11225 rtx set = XVECEXP (operands[2], 0, i);
11226 emit_move_insn (SET_DEST (set), SET_SRC (set));
11229 /* The optimizer does not know that the call sets the function value
11230 registers we stored in the result block. We avoid problems by
11231 claiming that all hard registers are used and clobbered at this
11233 emit_insn (gen_blockage ());
11238 ;; sibling call patterns
11239 (define_expand "sibcall"
11240 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11241 (match_operand 1 "" ""))
11242 (use (match_operand 2 "" ""))
11243 (use (reg:SI LR_REGNO))
11249 if (MACHOPIC_INDIRECT)
11250 operands[0] = machopic_indirect_call_target (operands[0]);
11253 gcc_assert (GET_CODE (operands[0]) == MEM);
11254 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11256 operands[0] = XEXP (operands[0], 0);
11259 ;; this and similar patterns must be marked as using LR, otherwise
11260 ;; dataflow will try to delete the store into it. This is true
11261 ;; even when the actual reg to jump to is in CTR, when LR was
11262 ;; saved and restored around the PIC-setting BCL.
11263 (define_insn "*sibcall_local32"
11264 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11265 (match_operand 1 "" "g,g"))
11266 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11267 (use (reg:SI LR_REGNO))
11269 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11272 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11273 output_asm_insn (\"crxor 6,6,6\", operands);
11275 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11276 output_asm_insn (\"creqv 6,6,6\", operands);
11278 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11280 [(set_attr "type" "branch")
11281 (set_attr "length" "4,8")])
11283 (define_insn "*sibcall_local64"
11284 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11285 (match_operand 1 "" "g,g"))
11286 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11287 (use (reg:SI LR_REGNO))
11289 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11292 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11293 output_asm_insn (\"crxor 6,6,6\", operands);
11295 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11296 output_asm_insn (\"creqv 6,6,6\", operands);
11298 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11300 [(set_attr "type" "branch")
11301 (set_attr "length" "4,8")])
11303 (define_insn "*sibcall_value_local32"
11304 [(set (match_operand 0 "" "")
11305 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11306 (match_operand 2 "" "g,g")))
11307 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11308 (use (reg:SI LR_REGNO))
11310 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11313 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11314 output_asm_insn (\"crxor 6,6,6\", operands);
11316 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11317 output_asm_insn (\"creqv 6,6,6\", operands);
11319 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11321 [(set_attr "type" "branch")
11322 (set_attr "length" "4,8")])
11325 (define_insn "*sibcall_value_local64"
11326 [(set (match_operand 0 "" "")
11327 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11328 (match_operand 2 "" "g,g")))
11329 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11330 (use (reg:SI LR_REGNO))
11332 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11335 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11336 output_asm_insn (\"crxor 6,6,6\", operands);
11338 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11339 output_asm_insn (\"creqv 6,6,6\", operands);
11341 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11343 [(set_attr "type" "branch")
11344 (set_attr "length" "4,8")])
11346 (define_insn "*sibcall_nonlocal_aix32"
11347 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11348 (match_operand 1 "" "g"))
11349 (use (match_operand:SI 2 "immediate_operand" "O"))
11350 (use (reg:SI LR_REGNO))
11353 && DEFAULT_ABI == ABI_AIX
11354 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11356 [(set_attr "type" "branch")
11357 (set_attr "length" "4")])
11359 (define_insn "*sibcall_nonlocal_aix64"
11360 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11361 (match_operand 1 "" "g"))
11362 (use (match_operand:SI 2 "immediate_operand" "O"))
11363 (use (reg:SI LR_REGNO))
11366 && DEFAULT_ABI == ABI_AIX
11367 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11369 [(set_attr "type" "branch")
11370 (set_attr "length" "4")])
11372 (define_insn "*sibcall_value_nonlocal_aix32"
11373 [(set (match_operand 0 "" "")
11374 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11375 (match_operand 2 "" "g")))
11376 (use (match_operand:SI 3 "immediate_operand" "O"))
11377 (use (reg:SI LR_REGNO))
11380 && DEFAULT_ABI == ABI_AIX
11381 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11383 [(set_attr "type" "branch")
11384 (set_attr "length" "4")])
11386 (define_insn "*sibcall_value_nonlocal_aix64"
11387 [(set (match_operand 0 "" "")
11388 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11389 (match_operand 2 "" "g")))
11390 (use (match_operand:SI 3 "immediate_operand" "O"))
11391 (use (reg:SI LR_REGNO))
11394 && DEFAULT_ABI == ABI_AIX
11395 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11397 [(set_attr "type" "branch")
11398 (set_attr "length" "4")])
11400 (define_insn "*sibcall_nonlocal_sysv<mode>"
11401 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11402 (match_operand 1 "" ""))
11403 (use (match_operand 2 "immediate_operand" "O,n"))
11404 (use (reg:SI LR_REGNO))
11406 "(DEFAULT_ABI == ABI_DARWIN
11407 || DEFAULT_ABI == ABI_V4)
11408 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11411 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11412 output_asm_insn (\"crxor 6,6,6\", operands);
11414 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11415 output_asm_insn (\"creqv 6,6,6\", operands);
11417 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11419 if (TARGET_SECURE_PLT && flag_pic == 2)
11420 return \"b %z0+32768@plt\";
11422 return \"b %z0@plt\";
11427 [(set_attr "type" "branch,branch")
11428 (set_attr "length" "4,8")])
11430 (define_expand "sibcall_value"
11431 [(parallel [(set (match_operand 0 "register_operand" "")
11432 (call (mem:SI (match_operand 1 "address_operand" ""))
11433 (match_operand 2 "" "")))
11434 (use (match_operand 3 "" ""))
11435 (use (reg:SI LR_REGNO))
11441 if (MACHOPIC_INDIRECT)
11442 operands[1] = machopic_indirect_call_target (operands[1]);
11445 gcc_assert (GET_CODE (operands[1]) == MEM);
11446 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11448 operands[1] = XEXP (operands[1], 0);
11451 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
11452 [(set (match_operand 0 "" "")
11453 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11454 (match_operand 2 "" "")))
11455 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11456 (use (reg:SI LR_REGNO))
11458 "(DEFAULT_ABI == ABI_DARWIN
11459 || DEFAULT_ABI == ABI_V4)
11460 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11463 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11464 output_asm_insn (\"crxor 6,6,6\", operands);
11466 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11467 output_asm_insn (\"creqv 6,6,6\", operands);
11469 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11471 if (TARGET_SECURE_PLT && flag_pic == 2)
11472 return \"b %z1+32768@plt\";
11474 return \"b %z1@plt\";
11479 [(set_attr "type" "branch,branch")
11480 (set_attr "length" "4,8")])
11482 (define_expand "sibcall_epilogue"
11483 [(use (const_int 0))]
11484 "TARGET_SCHED_PROLOG"
11487 rs6000_emit_epilogue (TRUE);
11491 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11492 ;; all of memory. This blocks insns from being moved across this point.
11494 (define_insn "blockage"
11495 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
11499 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11500 ;; signed & unsigned, and one type of branch.
11502 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11503 ;; insns, and branches. We store the operands of compares until we see
11505 (define_expand "cmp<mode>"
11507 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
11508 (match_operand:GPR 1 "reg_or_short_operand" "")))]
11512 /* Take care of the possibility that operands[1] might be negative but
11513 this might be a logical operation. That insn doesn't exist. */
11514 if (GET_CODE (operands[1]) == CONST_INT
11515 && INTVAL (operands[1]) < 0)
11516 operands[1] = force_reg (<MODE>mode, operands[1]);
11518 rs6000_compare_op0 = operands[0];
11519 rs6000_compare_op1 = operands[1];
11520 rs6000_compare_fp_p = 0;
11524 (define_expand "cmp<mode>"
11525 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
11526 (match_operand:FP 1 "gpc_reg_operand" "")))]
11530 rs6000_compare_op0 = operands[0];
11531 rs6000_compare_op1 = operands[1];
11532 rs6000_compare_fp_p = 1;
11536 (define_expand "beq"
11537 [(use (match_operand 0 "" ""))]
11539 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11541 (define_expand "bne"
11542 [(use (match_operand 0 "" ""))]
11544 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11546 (define_expand "bge"
11547 [(use (match_operand 0 "" ""))]
11549 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11551 (define_expand "bgt"
11552 [(use (match_operand 0 "" ""))]
11554 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11556 (define_expand "ble"
11557 [(use (match_operand 0 "" ""))]
11559 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11561 (define_expand "blt"
11562 [(use (match_operand 0 "" ""))]
11564 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11566 (define_expand "bgeu"
11567 [(use (match_operand 0 "" ""))]
11569 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11571 (define_expand "bgtu"
11572 [(use (match_operand 0 "" ""))]
11574 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11576 (define_expand "bleu"
11577 [(use (match_operand 0 "" ""))]
11579 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11581 (define_expand "bltu"
11582 [(use (match_operand 0 "" ""))]
11584 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11586 (define_expand "bunordered"
11587 [(use (match_operand 0 "" ""))]
11588 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11589 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11591 (define_expand "bordered"
11592 [(use (match_operand 0 "" ""))]
11593 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11594 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11596 (define_expand "buneq"
11597 [(use (match_operand 0 "" ""))]
11598 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11599 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11601 (define_expand "bunge"
11602 [(use (match_operand 0 "" ""))]
11603 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11604 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11606 (define_expand "bungt"
11607 [(use (match_operand 0 "" ""))]
11608 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11609 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11611 (define_expand "bunle"
11612 [(use (match_operand 0 "" ""))]
11613 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11614 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11616 (define_expand "bunlt"
11617 [(use (match_operand 0 "" ""))]
11618 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11619 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11621 (define_expand "bltgt"
11622 [(use (match_operand 0 "" ""))]
11624 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11626 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11627 ;; For SEQ, likewise, except that comparisons with zero should be done
11628 ;; with an scc insns. However, due to the order that combine see the
11629 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11630 ;; the cases we don't want to handle.
11631 (define_expand "seq"
11632 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11634 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11636 (define_expand "sne"
11637 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11641 if (! rs6000_compare_fp_p)
11644 rs6000_emit_sCOND (NE, operands[0]);
11648 ;; A >= 0 is best done the portable way for A an integer.
11649 (define_expand "sge"
11650 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11654 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11657 rs6000_emit_sCOND (GE, operands[0]);
11661 ;; A > 0 is best done using the portable sequence, so fail in that case.
11662 (define_expand "sgt"
11663 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11667 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11670 rs6000_emit_sCOND (GT, operands[0]);
11674 ;; A <= 0 is best done the portable way for A an integer.
11675 (define_expand "sle"
11676 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11680 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11683 rs6000_emit_sCOND (LE, operands[0]);
11687 ;; A < 0 is best done in the portable way for A an integer.
11688 (define_expand "slt"
11689 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11693 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11696 rs6000_emit_sCOND (LT, operands[0]);
11700 (define_expand "sgeu"
11701 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11703 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11705 (define_expand "sgtu"
11706 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11708 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11710 (define_expand "sleu"
11711 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11713 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11715 (define_expand "sltu"
11716 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11718 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11720 (define_expand "sunordered"
11721 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11722 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11723 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
11725 (define_expand "sordered"
11726 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11727 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11728 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
11730 (define_expand "suneq"
11731 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11732 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11733 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
11735 (define_expand "sunge"
11736 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11737 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11738 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
11740 (define_expand "sungt"
11741 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11742 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11743 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
11745 (define_expand "sunle"
11746 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11747 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11748 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
11750 (define_expand "sunlt"
11751 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11752 "! (TARGET_HARD_FLOAT && !TARGET_FPRS)"
11753 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
11755 (define_expand "sltgt"
11756 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11758 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
11760 (define_expand "stack_protect_set"
11761 [(match_operand 0 "memory_operand" "")
11762 (match_operand 1 "memory_operand" "")]
11765 #ifdef TARGET_THREAD_SSP_OFFSET
11766 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11767 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11768 operands[1] = gen_rtx_MEM (Pmode, addr);
11771 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
11773 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
11777 (define_insn "stack_protect_setsi"
11778 [(set (match_operand:SI 0 "memory_operand" "=m")
11779 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11780 (set (match_scratch:SI 2 "=&r") (const_int 0))]
11782 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
11783 [(set_attr "type" "three")
11784 (set_attr "length" "12")])
11786 (define_insn "stack_protect_setdi"
11787 [(set (match_operand:DI 0 "memory_operand" "=m")
11788 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
11789 (set (match_scratch:DI 2 "=&r") (const_int 0))]
11791 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
11792 [(set_attr "type" "three")
11793 (set_attr "length" "12")])
11795 (define_expand "stack_protect_test"
11796 [(match_operand 0 "memory_operand" "")
11797 (match_operand 1 "memory_operand" "")
11798 (match_operand 2 "" "")]
11801 #ifdef TARGET_THREAD_SSP_OFFSET
11802 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
11803 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
11804 operands[1] = gen_rtx_MEM (Pmode, addr);
11806 rs6000_compare_op0 = operands[0];
11807 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
11809 rs6000_compare_fp_p = 0;
11810 emit_jump_insn (gen_beq (operands[2]));
11814 (define_insn "stack_protect_testsi"
11815 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11816 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
11817 (match_operand:SI 2 "memory_operand" "m,m")]
11819 (set (match_scratch:SI 4 "=r,r") (const_int 0))
11820 (clobber (match_scratch:SI 3 "=&r,&r"))]
11823 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11824 {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"
11825 [(set_attr "length" "16,20")])
11827 (define_insn "stack_protect_testdi"
11828 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
11829 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
11830 (match_operand:DI 2 "memory_operand" "m,m")]
11832 (set (match_scratch:DI 4 "=r,r") (const_int 0))
11833 (clobber (match_scratch:DI 3 "=&r,&r"))]
11836 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
11837 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
11838 [(set_attr "length" "16,20")])
11841 ;; Here are the actual compare insns.
11842 (define_insn "*cmp<mode>_internal1"
11843 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11844 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
11845 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
11847 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
11848 [(set_attr "type" "cmp")])
11850 ;; If we are comparing a register for equality with a large constant,
11851 ;; we can do this with an XOR followed by a compare. But this is profitable
11852 ;; only if the large constant is only used for the comparison (and in this
11853 ;; case we already have a register to reuse as scratch).
11855 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
11856 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
11859 [(set (match_operand:SI 0 "register_operand")
11860 (match_operand:SI 1 "logical_const_operand" ""))
11861 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
11863 (match_operand:SI 2 "logical_const_operand" "")]))
11864 (set (match_operand:CC 4 "cc_reg_operand" "")
11865 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
11868 (if_then_else (match_operator 6 "equality_operator"
11869 [(match_dup 4) (const_int 0)])
11870 (match_operand 7 "" "")
11871 (match_operand 8 "" "")))]
11872 "peep2_reg_dead_p (3, operands[0])
11873 && peep2_reg_dead_p (4, operands[4])"
11874 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
11875 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
11876 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
11879 /* Get the constant we are comparing against, and see what it looks like
11880 when sign-extended from 16 to 32 bits. Then see what constant we could
11881 XOR with SEXTC to get the sign-extended value. */
11882 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
11884 operands[1], operands[2]);
11885 HOST_WIDE_INT c = INTVAL (cnst);
11886 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11887 HOST_WIDE_INT xorv = c ^ sextc;
11889 operands[9] = GEN_INT (xorv);
11890 operands[10] = GEN_INT (sextc);
11893 (define_insn "*cmpsi_internal2"
11894 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11895 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11896 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11898 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11899 [(set_attr "type" "cmp")])
11901 (define_insn "*cmpdi_internal2"
11902 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11903 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11904 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11906 "cmpld%I2 %0,%1,%b2"
11907 [(set_attr "type" "cmp")])
11909 ;; The following two insns don't exist as single insns, but if we provide
11910 ;; them, we can swap an add and compare, which will enable us to overlap more
11911 ;; of the required delay between a compare and branch. We generate code for
11912 ;; them by splitting.
11915 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11916 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11917 (match_operand:SI 2 "short_cint_operand" "i")))
11918 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11919 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11922 [(set_attr "length" "8")])
11925 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11926 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11927 (match_operand:SI 2 "u_short_cint_operand" "i")))
11928 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11929 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11932 [(set_attr "length" "8")])
11935 [(set (match_operand:CC 3 "cc_reg_operand" "")
11936 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11937 (match_operand:SI 2 "short_cint_operand" "")))
11938 (set (match_operand:SI 0 "gpc_reg_operand" "")
11939 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11941 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11942 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11945 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11946 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11947 (match_operand:SI 2 "u_short_cint_operand" "")))
11948 (set (match_operand:SI 0 "gpc_reg_operand" "")
11949 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11951 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11952 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11954 (define_insn "*cmpsf_internal1"
11955 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11956 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11957 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11958 "TARGET_HARD_FLOAT && TARGET_FPRS"
11960 [(set_attr "type" "fpcompare")])
11962 (define_insn "*cmpdf_internal1"
11963 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11964 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11965 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11966 "TARGET_HARD_FLOAT && TARGET_FPRS"
11968 [(set_attr "type" "fpcompare")])
11970 ;; Only need to compare second words if first words equal
11971 (define_insn "*cmptf_internal1"
11972 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11973 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11974 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11975 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
11976 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11977 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
11978 [(set_attr "type" "fpcompare")
11979 (set_attr "length" "12")])
11981 (define_insn_and_split "*cmptf_internal2"
11982 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11983 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11984 (match_operand:TF 2 "gpc_reg_operand" "f")))
11985 (clobber (match_scratch:DF 3 "=f"))
11986 (clobber (match_scratch:DF 4 "=f"))
11987 (clobber (match_scratch:DF 5 "=f"))
11988 (clobber (match_scratch:DF 6 "=f"))
11989 (clobber (match_scratch:DF 7 "=f"))
11990 (clobber (match_scratch:DF 8 "=f"))
11991 (clobber (match_scratch:DF 9 "=f"))
11992 (clobber (match_scratch:DF 10 "=f"))]
11993 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
11994 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11996 "&& reload_completed"
11997 [(set (match_dup 3) (match_dup 13))
11998 (set (match_dup 4) (match_dup 14))
11999 (set (match_dup 9) (abs:DF (match_dup 5)))
12000 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12001 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12002 (label_ref (match_dup 11))
12004 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12005 (set (pc) (label_ref (match_dup 12)))
12007 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12008 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12009 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12010 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
12013 REAL_VALUE_TYPE rv;
12014 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12015 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12017 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12018 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12019 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12020 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12021 operands[11] = gen_label_rtx ();
12022 operands[12] = gen_label_rtx ();
12024 operands[13] = force_const_mem (DFmode,
12025 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12026 operands[14] = force_const_mem (DFmode,
12027 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12031 operands[13] = gen_const_mem (DFmode,
12032 create_TOC_reference (XEXP (operands[13], 0)));
12033 operands[14] = gen_const_mem (DFmode,
12034 create_TOC_reference (XEXP (operands[14], 0)));
12035 set_mem_alias_set (operands[13], get_TOC_alias_set ());
12036 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12040 ;; Now we have the scc insns. We can do some combinations because of the
12041 ;; way the machine works.
12043 ;; Note that this is probably faster if we can put an insn between the
12044 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12045 ;; cases the insns below which don't use an intermediate CR field will
12046 ;; be used instead.
12048 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12049 (match_operator:SI 1 "scc_comparison_operator"
12050 [(match_operand 2 "cc_reg_operand" "y")
12053 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12054 [(set (attr "type")
12055 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12056 (const_string "mfcrf")
12058 (const_string "mfcr")))
12059 (set_attr "length" "8")])
12061 ;; Same as above, but get the GT bit.
12062 (define_insn "move_from_CR_gt_bit"
12063 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12064 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12066 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
12067 [(set_attr "type" "mfcr")
12068 (set_attr "length" "8")])
12070 ;; Same as above, but get the OV/ORDERED bit.
12071 (define_insn "move_from_CR_ov_bit"
12072 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12073 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
12075 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
12076 [(set_attr "type" "mfcr")
12077 (set_attr "length" "8")])
12080 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12081 (match_operator:DI 1 "scc_comparison_operator"
12082 [(match_operand 2 "cc_reg_operand" "y")
12085 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
12086 [(set (attr "type")
12087 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12088 (const_string "mfcrf")
12090 (const_string "mfcr")))
12091 (set_attr "length" "8")])
12094 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12095 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12096 [(match_operand 2 "cc_reg_operand" "y,y")
12099 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12100 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12103 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
12105 [(set_attr "type" "delayed_compare")
12106 (set_attr "length" "8,16")])
12109 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12110 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12111 [(match_operand 2 "cc_reg_operand" "")
12114 (set (match_operand:SI 3 "gpc_reg_operand" "")
12115 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12116 "TARGET_32BIT && reload_completed"
12117 [(set (match_dup 3)
12118 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12120 (compare:CC (match_dup 3)
12125 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12126 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12127 [(match_operand 2 "cc_reg_operand" "y")
12129 (match_operand:SI 3 "const_int_operand" "n")))]
12133 int is_bit = ccr_bit (operands[1], 1);
12134 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12137 if (is_bit >= put_bit)
12138 count = is_bit - put_bit;
12140 count = 32 - (put_bit - is_bit);
12142 operands[4] = GEN_INT (count);
12143 operands[5] = GEN_INT (put_bit);
12145 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
12147 [(set (attr "type")
12148 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
12149 (const_string "mfcrf")
12151 (const_string "mfcr")))
12152 (set_attr "length" "8")])
12155 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12157 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12158 [(match_operand 2 "cc_reg_operand" "y,y")
12160 (match_operand:SI 3 "const_int_operand" "n,n"))
12162 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12163 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12168 int is_bit = ccr_bit (operands[1], 1);
12169 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12172 /* Force split for non-cc0 compare. */
12173 if (which_alternative == 1)
12176 if (is_bit >= put_bit)
12177 count = is_bit - put_bit;
12179 count = 32 - (put_bit - is_bit);
12181 operands[5] = GEN_INT (count);
12182 operands[6] = GEN_INT (put_bit);
12184 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
12186 [(set_attr "type" "delayed_compare")
12187 (set_attr "length" "8,16")])
12190 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12192 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12193 [(match_operand 2 "cc_reg_operand" "")
12195 (match_operand:SI 3 "const_int_operand" ""))
12197 (set (match_operand:SI 4 "gpc_reg_operand" "")
12198 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12201 [(set (match_dup 4)
12202 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12205 (compare:CC (match_dup 4)
12209 ;; There is a 3 cycle delay between consecutive mfcr instructions
12210 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12213 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12214 (match_operator:SI 1 "scc_comparison_operator"
12215 [(match_operand 2 "cc_reg_operand" "y")
12217 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12218 (match_operator:SI 4 "scc_comparison_operator"
12219 [(match_operand 5 "cc_reg_operand" "y")
12221 "REGNO (operands[2]) != REGNO (operands[5])"
12222 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12223 [(set_attr "type" "mfcr")
12224 (set_attr "length" "12")])
12227 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12228 (match_operator:DI 1 "scc_comparison_operator"
12229 [(match_operand 2 "cc_reg_operand" "y")
12231 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12232 (match_operator:DI 4 "scc_comparison_operator"
12233 [(match_operand 5 "cc_reg_operand" "y")
12235 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12236 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
12237 [(set_attr "type" "mfcr")
12238 (set_attr "length" "12")])
12240 ;; There are some scc insns that can be done directly, without a compare.
12241 ;; These are faster because they don't involve the communications between
12242 ;; the FXU and branch units. In fact, we will be replacing all of the
12243 ;; integer scc insns here or in the portable methods in emit_store_flag.
12245 ;; Also support (neg (scc ..)) since that construct is used to replace
12246 ;; branches, (plus (scc ..) ..) since that construct is common and
12247 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12248 ;; cases where it is no more expensive than (neg (scc ..)).
12250 ;; Have reload force a constant into a register for the simple insns that
12251 ;; otherwise won't accept constants. We do this because it is faster than
12252 ;; the cmp/mfcr sequence we would otherwise generate.
12254 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12257 (define_insn_and_split "*eq<mode>"
12258 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12259 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12260 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12264 [(set (match_dup 0)
12265 (clz:GPR (match_dup 3)))
12267 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12269 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12271 /* Use output operand as intermediate. */
12272 operands[3] = operands[0];
12274 if (logical_operand (operands[2], <MODE>mode))
12275 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12276 gen_rtx_XOR (<MODE>mode,
12277 operands[1], operands[2])));
12279 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12280 gen_rtx_PLUS (<MODE>mode, operands[1],
12281 negate_rtx (<MODE>mode,
12285 operands[3] = operands[1];
12287 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12290 (define_insn_and_split "*eq<mode>_compare"
12291 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12293 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12294 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12296 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12297 (eq:P (match_dup 1) (match_dup 2)))]
12298 "!TARGET_POWER && optimize_size"
12300 "!TARGET_POWER && optimize_size"
12301 [(set (match_dup 0)
12302 (clz:P (match_dup 4)))
12303 (parallel [(set (match_dup 3)
12304 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12307 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12309 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12311 /* Use output operand as intermediate. */
12312 operands[4] = operands[0];
12314 if (logical_operand (operands[2], <MODE>mode))
12315 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12316 gen_rtx_XOR (<MODE>mode,
12317 operands[1], operands[2])));
12319 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12320 gen_rtx_PLUS (<MODE>mode, operands[1],
12321 negate_rtx (<MODE>mode,
12325 operands[4] = operands[1];
12327 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12330 (define_insn "*eqsi_power"
12331 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12332 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12333 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
12334 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
12337 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12338 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
12339 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12340 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
12341 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
12342 [(set_attr "type" "three,two,three,three,three")
12343 (set_attr "length" "12,8,12,12,12")])
12345 ;; We have insns of the form shown by the first define_insn below. If
12346 ;; there is something inside the comparison operation, we must split it.
12348 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12349 (plus:SI (match_operator 1 "comparison_operator"
12350 [(match_operand:SI 2 "" "")
12351 (match_operand:SI 3
12352 "reg_or_cint_operand" "")])
12353 (match_operand:SI 4 "gpc_reg_operand" "")))
12354 (clobber (match_operand:SI 5 "register_operand" ""))]
12355 "! gpc_reg_operand (operands[2], SImode)"
12356 [(set (match_dup 5) (match_dup 2))
12357 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
12360 (define_insn "*plus_eqsi"
12361 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12362 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12363 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12364 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12367 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12368 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
12369 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12370 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12371 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12372 [(set_attr "type" "three,two,three,three,three")
12373 (set_attr "length" "12,8,12,12,12")])
12375 (define_insn "*compare_plus_eqsi"
12376 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12379 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12380 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12381 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12383 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12384 "TARGET_32BIT && optimize_size"
12386 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12387 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12388 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12389 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12390 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12396 [(set_attr "type" "compare")
12397 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12400 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12403 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12404 (match_operand:SI 2 "scc_eq_operand" ""))
12405 (match_operand:SI 3 "gpc_reg_operand" ""))
12407 (clobber (match_scratch:SI 4 ""))]
12408 "TARGET_32BIT && optimize_size && reload_completed"
12409 [(set (match_dup 4)
12410 (plus:SI (eq:SI (match_dup 1)
12414 (compare:CC (match_dup 4)
12418 (define_insn "*plus_eqsi_compare"
12419 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12422 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12423 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12424 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12426 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12427 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12428 "TARGET_32BIT && optimize_size"
12430 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12431 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12432 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12433 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12434 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12440 [(set_attr "type" "compare")
12441 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12444 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12447 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12448 (match_operand:SI 2 "scc_eq_operand" ""))
12449 (match_operand:SI 3 "gpc_reg_operand" ""))
12451 (set (match_operand:SI 0 "gpc_reg_operand" "")
12452 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12453 "TARGET_32BIT && optimize_size && reload_completed"
12454 [(set (match_dup 0)
12455 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12457 (compare:CC (match_dup 0)
12461 (define_insn "*neg_eq0<mode>"
12462 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12463 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12466 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
12467 [(set_attr "type" "two")
12468 (set_attr "length" "8")])
12470 (define_insn_and_split "*neg_eq<mode>"
12471 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12472 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12473 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12477 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12479 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12481 /* Use output operand as intermediate. */
12482 operands[3] = operands[0];
12484 if (logical_operand (operands[2], <MODE>mode))
12485 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12486 gen_rtx_XOR (<MODE>mode,
12487 operands[1], operands[2])));
12489 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12490 gen_rtx_PLUS (<MODE>mode, operands[1],
12491 negate_rtx (<MODE>mode,
12495 operands[3] = operands[1];
12498 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12499 ;; since it nabs/sr is just as fast.
12500 (define_insn "*ne0si"
12501 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12502 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12504 (clobber (match_scratch:SI 2 "=&r"))]
12505 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
12506 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12507 [(set_attr "type" "two")
12508 (set_attr "length" "8")])
12510 (define_insn "*ne0di"
12511 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12512 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12514 (clobber (match_scratch:DI 2 "=&r"))]
12516 "addic %2,%1,-1\;subfe %0,%2,%1"
12517 [(set_attr "type" "two")
12518 (set_attr "length" "8")])
12520 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12521 (define_insn "*plus_ne0si"
12522 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12523 (plus:SI (lshiftrt:SI
12524 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12526 (match_operand:SI 2 "gpc_reg_operand" "r")))
12527 (clobber (match_scratch:SI 3 "=&r"))]
12529 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12530 [(set_attr "type" "two")
12531 (set_attr "length" "8")])
12533 (define_insn "*plus_ne0di"
12534 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12535 (plus:DI (lshiftrt:DI
12536 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12538 (match_operand:DI 2 "gpc_reg_operand" "r")))
12539 (clobber (match_scratch:DI 3 "=&r"))]
12541 "addic %3,%1,-1\;addze %0,%2"
12542 [(set_attr "type" "two")
12543 (set_attr "length" "8")])
12545 (define_insn "*compare_plus_ne0si"
12546 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12548 (plus:SI (lshiftrt:SI
12549 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12551 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12553 (clobber (match_scratch:SI 3 "=&r,&r"))
12554 (clobber (match_scratch:SI 4 "=X,&r"))]
12557 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12559 [(set_attr "type" "compare")
12560 (set_attr "length" "8,12")])
12563 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12565 (plus:SI (lshiftrt:SI
12566 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12568 (match_operand:SI 2 "gpc_reg_operand" ""))
12570 (clobber (match_scratch:SI 3 ""))
12571 (clobber (match_scratch:SI 4 ""))]
12572 "TARGET_32BIT && reload_completed"
12573 [(parallel [(set (match_dup 3)
12574 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12577 (clobber (match_dup 4))])
12579 (compare:CC (match_dup 3)
12583 (define_insn "*compare_plus_ne0di"
12584 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12586 (plus:DI (lshiftrt:DI
12587 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12589 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12591 (clobber (match_scratch:DI 3 "=&r,&r"))]
12594 addic %3,%1,-1\;addze. %3,%2
12596 [(set_attr "type" "compare")
12597 (set_attr "length" "8,12")])
12600 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12602 (plus:DI (lshiftrt:DI
12603 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12605 (match_operand:DI 2 "gpc_reg_operand" ""))
12607 (clobber (match_scratch:DI 3 ""))]
12608 "TARGET_64BIT && reload_completed"
12609 [(set (match_dup 3)
12610 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12614 (compare:CC (match_dup 3)
12618 (define_insn "*plus_ne0si_compare"
12619 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12621 (plus:SI (lshiftrt:SI
12622 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12624 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12626 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12627 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12629 (clobber (match_scratch:SI 3 "=&r,&r"))]
12632 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12634 [(set_attr "type" "compare")
12635 (set_attr "length" "8,12")])
12638 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12640 (plus:SI (lshiftrt:SI
12641 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12643 (match_operand:SI 2 "gpc_reg_operand" ""))
12645 (set (match_operand:SI 0 "gpc_reg_operand" "")
12646 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12648 (clobber (match_scratch:SI 3 ""))]
12649 "TARGET_32BIT && reload_completed"
12650 [(parallel [(set (match_dup 0)
12651 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12653 (clobber (match_dup 3))])
12655 (compare:CC (match_dup 0)
12659 (define_insn "*plus_ne0di_compare"
12660 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12662 (plus:DI (lshiftrt:DI
12663 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12665 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12667 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12668 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12670 (clobber (match_scratch:DI 3 "=&r,&r"))]
12673 addic %3,%1,-1\;addze. %0,%2
12675 [(set_attr "type" "compare")
12676 (set_attr "length" "8,12")])
12679 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12681 (plus:DI (lshiftrt:DI
12682 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12684 (match_operand:DI 2 "gpc_reg_operand" ""))
12686 (set (match_operand:DI 0 "gpc_reg_operand" "")
12687 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12689 (clobber (match_scratch:DI 3 ""))]
12690 "TARGET_64BIT && reload_completed"
12691 [(parallel [(set (match_dup 0)
12692 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12694 (clobber (match_dup 3))])
12696 (compare:CC (match_dup 0)
12701 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12702 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12703 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12704 (clobber (match_scratch:SI 3 "=r,X"))]
12707 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12708 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12709 [(set_attr "length" "12")])
12712 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12714 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12715 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12717 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12718 (le:SI (match_dup 1) (match_dup 2)))
12719 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12722 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12723 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12726 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12727 (set_attr "length" "12,12,16,16")])
12730 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12732 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12733 (match_operand:SI 2 "reg_or_short_operand" ""))
12735 (set (match_operand:SI 0 "gpc_reg_operand" "")
12736 (le:SI (match_dup 1) (match_dup 2)))
12737 (clobber (match_scratch:SI 3 ""))]
12738 "TARGET_POWER && reload_completed"
12739 [(parallel [(set (match_dup 0)
12740 (le:SI (match_dup 1) (match_dup 2)))
12741 (clobber (match_dup 3))])
12743 (compare:CC (match_dup 0)
12748 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12749 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12750 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12751 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12754 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12755 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12756 [(set_attr "length" "12")])
12759 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12761 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12762 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12763 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12765 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12768 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12769 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12772 [(set_attr "type" "compare")
12773 (set_attr "length" "12,12,16,16")])
12776 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12778 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12779 (match_operand:SI 2 "reg_or_short_operand" ""))
12780 (match_operand:SI 3 "gpc_reg_operand" ""))
12782 (clobber (match_scratch:SI 4 ""))]
12783 "TARGET_POWER && reload_completed"
12784 [(set (match_dup 4)
12785 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12788 (compare:CC (match_dup 4)
12793 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12795 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12796 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12797 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12799 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12800 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12803 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12804 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12807 [(set_attr "type" "compare")
12808 (set_attr "length" "12,12,16,16")])
12811 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12813 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12814 (match_operand:SI 2 "reg_or_short_operand" ""))
12815 (match_operand:SI 3 "gpc_reg_operand" ""))
12817 (set (match_operand:SI 0 "gpc_reg_operand" "")
12818 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12819 "TARGET_POWER && reload_completed"
12820 [(set (match_dup 0)
12821 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12823 (compare:CC (match_dup 0)
12828 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12829 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12830 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12833 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12834 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12835 [(set_attr "length" "12")])
12837 (define_insn "*leu<mode>"
12838 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12839 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12840 (match_operand:P 2 "reg_or_short_operand" "rI")))]
12842 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12843 [(set_attr "type" "three")
12844 (set_attr "length" "12")])
12846 (define_insn "*leu<mode>_compare"
12847 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12849 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
12850 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
12852 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
12853 (leu:P (match_dup 1) (match_dup 2)))]
12856 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12858 [(set_attr "type" "compare")
12859 (set_attr "length" "12,16")])
12862 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12864 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
12865 (match_operand:P 2 "reg_or_short_operand" ""))
12867 (set (match_operand:P 0 "gpc_reg_operand" "")
12868 (leu:P (match_dup 1) (match_dup 2)))]
12870 [(set (match_dup 0)
12871 (leu:P (match_dup 1) (match_dup 2)))
12873 (compare:CC (match_dup 0)
12877 (define_insn "*plus_leu<mode>"
12878 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12879 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12880 (match_operand:P 2 "reg_or_short_operand" "rI"))
12881 (match_operand:P 3 "gpc_reg_operand" "r")))]
12883 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12884 [(set_attr "type" "two")
12885 (set_attr "length" "8")])
12888 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12890 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12891 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12892 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12894 (clobber (match_scratch:SI 4 "=&r,&r"))]
12897 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12899 [(set_attr "type" "compare")
12900 (set_attr "length" "8,12")])
12903 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12905 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12906 (match_operand:SI 2 "reg_or_short_operand" ""))
12907 (match_operand:SI 3 "gpc_reg_operand" ""))
12909 (clobber (match_scratch:SI 4 ""))]
12910 "TARGET_32BIT && reload_completed"
12911 [(set (match_dup 4)
12912 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12915 (compare:CC (match_dup 4)
12920 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12922 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12923 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12924 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12926 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12927 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12930 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12932 [(set_attr "type" "compare")
12933 (set_attr "length" "8,12")])
12936 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12938 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12939 (match_operand:SI 2 "reg_or_short_operand" ""))
12940 (match_operand:SI 3 "gpc_reg_operand" ""))
12942 (set (match_operand:SI 0 "gpc_reg_operand" "")
12943 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12944 "TARGET_32BIT && reload_completed"
12945 [(set (match_dup 0)
12946 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12948 (compare:CC (match_dup 0)
12952 (define_insn "*neg_leu<mode>"
12953 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12954 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12955 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
12957 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12958 [(set_attr "type" "three")
12959 (set_attr "length" "12")])
12961 (define_insn "*and_neg_leu<mode>"
12962 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
12964 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
12965 (match_operand:P 2 "reg_or_short_operand" "rI")))
12966 (match_operand:P 3 "gpc_reg_operand" "r")))]
12968 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12969 [(set_attr "type" "three")
12970 (set_attr "length" "12")])
12973 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12976 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12977 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12978 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12980 (clobber (match_scratch:SI 4 "=&r,&r"))]
12983 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12985 [(set_attr "type" "compare")
12986 (set_attr "length" "12,16")])
12989 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12992 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12993 (match_operand:SI 2 "reg_or_short_operand" "")))
12994 (match_operand:SI 3 "gpc_reg_operand" ""))
12996 (clobber (match_scratch:SI 4 ""))]
12997 "TARGET_32BIT && reload_completed"
12998 [(set (match_dup 4)
12999 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13002 (compare:CC (match_dup 4)
13007 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13010 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13011 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13012 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13014 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13015 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13018 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13020 [(set_attr "type" "compare")
13021 (set_attr "length" "12,16")])
13024 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13027 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13028 (match_operand:SI 2 "reg_or_short_operand" "")))
13029 (match_operand:SI 3 "gpc_reg_operand" ""))
13031 (set (match_operand:SI 0 "gpc_reg_operand" "")
13032 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13033 "TARGET_32BIT && reload_completed"
13034 [(set (match_dup 0)
13035 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13038 (compare:CC (match_dup 0)
13043 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13044 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13045 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13047 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13048 [(set_attr "length" "12")])
13051 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13053 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13054 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13056 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13057 (lt:SI (match_dup 1) (match_dup 2)))]
13060 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13062 [(set_attr "type" "delayed_compare")
13063 (set_attr "length" "12,16")])
13066 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13068 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13069 (match_operand:SI 2 "reg_or_short_operand" ""))
13071 (set (match_operand:SI 0 "gpc_reg_operand" "")
13072 (lt:SI (match_dup 1) (match_dup 2)))]
13073 "TARGET_POWER && reload_completed"
13074 [(set (match_dup 0)
13075 (lt:SI (match_dup 1) (match_dup 2)))
13077 (compare:CC (match_dup 0)
13082 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13083 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13084 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13085 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13087 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13088 [(set_attr "length" "12")])
13091 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13093 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13094 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13095 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13097 (clobber (match_scratch:SI 4 "=&r,&r"))]
13100 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13102 [(set_attr "type" "compare")
13103 (set_attr "length" "12,16")])
13106 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13108 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13109 (match_operand:SI 2 "reg_or_short_operand" ""))
13110 (match_operand:SI 3 "gpc_reg_operand" ""))
13112 (clobber (match_scratch:SI 4 ""))]
13113 "TARGET_POWER && reload_completed"
13114 [(set (match_dup 4)
13115 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
13118 (compare:CC (match_dup 4)
13123 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13125 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13126 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13127 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13129 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13130 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13133 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13135 [(set_attr "type" "compare")
13136 (set_attr "length" "12,16")])
13139 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13141 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13142 (match_operand:SI 2 "reg_or_short_operand" ""))
13143 (match_operand:SI 3 "gpc_reg_operand" ""))
13145 (set (match_operand:SI 0 "gpc_reg_operand" "")
13146 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13147 "TARGET_POWER && reload_completed"
13148 [(set (match_dup 0)
13149 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13151 (compare:CC (match_dup 0)
13156 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13157 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13158 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13160 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13161 [(set_attr "length" "12")])
13163 (define_insn_and_split "*ltu<mode>"
13164 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13165 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13166 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13170 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13171 (set (match_dup 0) (neg:P (match_dup 0)))]
13174 (define_insn_and_split "*ltu<mode>_compare"
13175 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13177 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13178 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13180 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13181 (ltu:P (match_dup 1) (match_dup 2)))]
13185 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13186 (parallel [(set (match_dup 3)
13187 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13188 (set (match_dup 0) (neg:P (match_dup 0)))])]
13191 (define_insn_and_split "*plus_ltu<mode>"
13192 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13193 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13194 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13195 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13198 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13199 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13200 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13203 (define_insn_and_split "*plus_ltu<mode>_compare"
13204 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13206 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13207 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13208 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13210 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13211 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13214 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13215 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13216 (parallel [(set (match_dup 4)
13217 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13219 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13222 (define_insn "*neg_ltu<mode>"
13223 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13224 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13225 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13228 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
13229 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
13230 [(set_attr "type" "two")
13231 (set_attr "length" "8")])
13234 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13235 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13236 (match_operand:SI 2 "reg_or_short_operand" "rI")))
13237 (clobber (match_scratch:SI 3 "=r"))]
13239 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
13240 [(set_attr "length" "12")])
13243 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13245 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13246 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13248 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13249 (ge:SI (match_dup 1) (match_dup 2)))
13250 (clobber (match_scratch:SI 3 "=r,r"))]
13253 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
13255 [(set_attr "type" "compare")
13256 (set_attr "length" "12,16")])
13259 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13261 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13262 (match_operand:SI 2 "reg_or_short_operand" ""))
13264 (set (match_operand:SI 0 "gpc_reg_operand" "")
13265 (ge:SI (match_dup 1) (match_dup 2)))
13266 (clobber (match_scratch:SI 3 ""))]
13267 "TARGET_POWER && reload_completed"
13268 [(parallel [(set (match_dup 0)
13269 (ge:SI (match_dup 1) (match_dup 2)))
13270 (clobber (match_dup 3))])
13272 (compare:CC (match_dup 0)
13277 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13278 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13279 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13280 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13282 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13283 [(set_attr "length" "12")])
13286 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13288 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13289 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13290 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13292 (clobber (match_scratch:SI 4 "=&r,&r"))]
13295 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13297 [(set_attr "type" "compare")
13298 (set_attr "length" "12,16")])
13301 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13303 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13304 (match_operand:SI 2 "reg_or_short_operand" ""))
13305 (match_operand:SI 3 "gpc_reg_operand" ""))
13307 (clobber (match_scratch:SI 4 ""))]
13308 "TARGET_POWER && reload_completed"
13309 [(set (match_dup 4)
13310 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13313 (compare:CC (match_dup 4)
13318 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13320 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13321 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13322 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13324 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13325 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13328 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13330 [(set_attr "type" "compare")
13331 (set_attr "length" "12,16")])
13334 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13336 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13337 (match_operand:SI 2 "reg_or_short_operand" ""))
13338 (match_operand:SI 3 "gpc_reg_operand" ""))
13340 (set (match_operand:SI 0 "gpc_reg_operand" "")
13341 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13342 "TARGET_POWER && reload_completed"
13343 [(set (match_dup 0)
13344 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13346 (compare:CC (match_dup 0)
13351 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13352 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13353 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13355 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13356 [(set_attr "length" "12")])
13358 (define_insn "*geu<mode>"
13359 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13360 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13361 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13364 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13365 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13366 [(set_attr "type" "three")
13367 (set_attr "length" "12")])
13369 (define_insn "*geu<mode>_compare"
13370 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13372 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13373 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13375 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13376 (geu:P (match_dup 1) (match_dup 2)))]
13379 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13380 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13383 [(set_attr "type" "compare")
13384 (set_attr "length" "12,12,16,16")])
13387 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13389 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13390 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13392 (set (match_operand:P 0 "gpc_reg_operand" "")
13393 (geu:P (match_dup 1) (match_dup 2)))]
13395 [(set (match_dup 0)
13396 (geu:P (match_dup 1) (match_dup 2)))
13398 (compare:CC (match_dup 0)
13402 (define_insn "*plus_geu<mode>"
13403 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13404 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13405 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13406 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13409 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13410 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13411 [(set_attr "type" "two")
13412 (set_attr "length" "8")])
13415 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13417 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13418 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13419 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13421 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13424 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13425 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13428 [(set_attr "type" "compare")
13429 (set_attr "length" "8,8,12,12")])
13432 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13434 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13435 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13436 (match_operand:SI 3 "gpc_reg_operand" ""))
13438 (clobber (match_scratch:SI 4 ""))]
13439 "TARGET_32BIT && reload_completed"
13440 [(set (match_dup 4)
13441 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13444 (compare:CC (match_dup 4)
13449 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13451 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13452 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13453 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13455 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13456 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13459 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13460 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13463 [(set_attr "type" "compare")
13464 (set_attr "length" "8,8,12,12")])
13467 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13469 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13470 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13471 (match_operand:SI 3 "gpc_reg_operand" ""))
13473 (set (match_operand:SI 0 "gpc_reg_operand" "")
13474 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13475 "TARGET_32BIT && reload_completed"
13476 [(set (match_dup 0)
13477 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13479 (compare:CC (match_dup 0)
13483 (define_insn "*neg_geu<mode>"
13484 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13485 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13486 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13489 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13490 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13491 [(set_attr "type" "three")
13492 (set_attr "length" "12")])
13494 (define_insn "*and_neg_geu<mode>"
13495 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13497 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13498 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13499 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13502 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13503 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13504 [(set_attr "type" "three")
13505 (set_attr "length" "12")])
13508 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13511 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13512 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13513 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13515 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13518 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13519 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13522 [(set_attr "type" "compare")
13523 (set_attr "length" "12,12,16,16")])
13526 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13529 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13530 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13531 (match_operand:SI 3 "gpc_reg_operand" ""))
13533 (clobber (match_scratch:SI 4 ""))]
13534 "TARGET_32BIT && reload_completed"
13535 [(set (match_dup 4)
13536 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13539 (compare:CC (match_dup 4)
13544 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13547 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13548 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13549 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13551 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13552 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13555 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13556 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13559 [(set_attr "type" "compare")
13560 (set_attr "length" "12,12,16,16")])
13563 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13566 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13567 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13568 (match_operand:SI 3 "gpc_reg_operand" ""))
13570 (set (match_operand:SI 0 "gpc_reg_operand" "")
13571 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13572 "TARGET_32BIT && reload_completed"
13573 [(set (match_dup 0)
13574 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13576 (compare:CC (match_dup 0)
13581 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13582 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13583 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13585 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13586 [(set_attr "length" "12")])
13589 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13591 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13592 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13594 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13595 (gt:SI (match_dup 1) (match_dup 2)))]
13598 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13600 [(set_attr "type" "delayed_compare")
13601 (set_attr "length" "12,16")])
13604 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13606 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13607 (match_operand:SI 2 "reg_or_short_operand" ""))
13609 (set (match_operand:SI 0 "gpc_reg_operand" "")
13610 (gt:SI (match_dup 1) (match_dup 2)))]
13611 "TARGET_POWER && reload_completed"
13612 [(set (match_dup 0)
13613 (gt:SI (match_dup 1) (match_dup 2)))
13615 (compare:CC (match_dup 0)
13619 (define_insn "*plus_gt0<mode>"
13620 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13621 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13623 (match_operand:P 2 "gpc_reg_operand" "r")))]
13625 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13626 [(set_attr "type" "three")
13627 (set_attr "length" "12")])
13630 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13632 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13634 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13636 (clobber (match_scratch:SI 3 "=&r,&r"))]
13639 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13641 [(set_attr "type" "compare")
13642 (set_attr "length" "12,16")])
13645 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13647 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13649 (match_operand:SI 2 "gpc_reg_operand" ""))
13651 (clobber (match_scratch:SI 3 ""))]
13652 "TARGET_32BIT && reload_completed"
13653 [(set (match_dup 3)
13654 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13657 (compare:CC (match_dup 3)
13662 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13664 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13666 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13668 (clobber (match_scratch:DI 3 "=&r,&r"))]
13671 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13673 [(set_attr "type" "compare")
13674 (set_attr "length" "12,16")])
13677 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13679 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13681 (match_operand:DI 2 "gpc_reg_operand" ""))
13683 (clobber (match_scratch:DI 3 ""))]
13684 "TARGET_64BIT && reload_completed"
13685 [(set (match_dup 3)
13686 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13689 (compare:CC (match_dup 3)
13694 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13696 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13698 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13700 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13701 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13704 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13706 [(set_attr "type" "compare")
13707 (set_attr "length" "12,16")])
13710 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13712 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13714 (match_operand:SI 2 "gpc_reg_operand" ""))
13716 (set (match_operand:SI 0 "gpc_reg_operand" "")
13717 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13718 "TARGET_32BIT && reload_completed"
13719 [(set (match_dup 0)
13720 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13722 (compare:CC (match_dup 0)
13727 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13729 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13731 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13733 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13734 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13737 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13739 [(set_attr "type" "compare")
13740 (set_attr "length" "12,16")])
13743 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13745 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13747 (match_operand:DI 2 "gpc_reg_operand" ""))
13749 (set (match_operand:DI 0 "gpc_reg_operand" "")
13750 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13751 "TARGET_64BIT && reload_completed"
13752 [(set (match_dup 0)
13753 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13755 (compare:CC (match_dup 0)
13760 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13761 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13762 (match_operand:SI 2 "reg_or_short_operand" "r"))
13763 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13765 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13766 [(set_attr "length" "12")])
13769 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13771 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13772 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13773 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13775 (clobber (match_scratch:SI 4 "=&r,&r"))]
13778 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13780 [(set_attr "type" "compare")
13781 (set_attr "length" "12,16")])
13784 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13786 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13787 (match_operand:SI 2 "reg_or_short_operand" ""))
13788 (match_operand:SI 3 "gpc_reg_operand" ""))
13790 (clobber (match_scratch:SI 4 ""))]
13791 "TARGET_POWER && reload_completed"
13792 [(set (match_dup 4)
13793 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13795 (compare:CC (match_dup 4)
13800 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13802 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13803 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13804 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13806 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13807 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13810 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13812 [(set_attr "type" "compare")
13813 (set_attr "length" "12,16")])
13816 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13818 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13819 (match_operand:SI 2 "reg_or_short_operand" ""))
13820 (match_operand:SI 3 "gpc_reg_operand" ""))
13822 (set (match_operand:SI 0 "gpc_reg_operand" "")
13823 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13824 "TARGET_POWER && reload_completed"
13825 [(set (match_dup 0)
13826 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13828 (compare:CC (match_dup 0)
13833 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13834 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13835 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13837 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13838 [(set_attr "length" "12")])
13840 (define_insn_and_split "*gtu<mode>"
13841 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13842 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13843 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13847 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13848 (set (match_dup 0) (neg:P (match_dup 0)))]
13851 (define_insn_and_split "*gtu<mode>_compare"
13852 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13854 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13855 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13857 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13858 (gtu:P (match_dup 1) (match_dup 2)))]
13862 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13863 (parallel [(set (match_dup 3)
13864 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13865 (set (match_dup 0) (neg:P (match_dup 0)))])]
13868 (define_insn_and_split "*plus_gtu<mode>"
13869 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13870 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13871 (match_operand:P 2 "reg_or_short_operand" "rI"))
13872 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13875 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13876 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13877 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13880 (define_insn_and_split "*plus_gtu<mode>_compare"
13881 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13883 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13884 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13885 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13887 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13888 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13891 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13892 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13893 (parallel [(set (match_dup 4)
13894 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13896 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13899 (define_insn "*neg_gtu<mode>"
13900 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13901 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13902 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13904 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13905 [(set_attr "type" "two")
13906 (set_attr "length" "8")])
13909 ;; Define both directions of branch and return. If we need a reload
13910 ;; register, we'd rather use CR0 since it is much easier to copy a
13911 ;; register CC value to there.
13915 (if_then_else (match_operator 1 "branch_comparison_operator"
13917 "cc_reg_operand" "y")
13919 (label_ref (match_operand 0 "" ""))
13924 return output_cbranch (operands[1], \"%l0\", 0, insn);
13926 [(set_attr "type" "branch")])
13930 (if_then_else (match_operator 0 "branch_comparison_operator"
13932 "cc_reg_operand" "y")
13939 return output_cbranch (operands[0], NULL, 0, insn);
13941 [(set_attr "type" "jmpreg")
13942 (set_attr "length" "4")])
13946 (if_then_else (match_operator 1 "branch_comparison_operator"
13948 "cc_reg_operand" "y")
13951 (label_ref (match_operand 0 "" ""))))]
13955 return output_cbranch (operands[1], \"%l0\", 1, insn);
13957 [(set_attr "type" "branch")])
13961 (if_then_else (match_operator 0 "branch_comparison_operator"
13963 "cc_reg_operand" "y")
13970 return output_cbranch (operands[0], NULL, 1, insn);
13972 [(set_attr "type" "jmpreg")
13973 (set_attr "length" "4")])
13975 ;; Logic on condition register values.
13977 ; This pattern matches things like
13978 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13979 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13981 ; which are generated by the branch logic.
13982 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13984 (define_insn "*cceq_ior_compare"
13985 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13986 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13987 [(match_operator:SI 2
13988 "branch_positive_comparison_operator"
13990 "cc_reg_operand" "y,y")
13992 (match_operator:SI 4
13993 "branch_positive_comparison_operator"
13995 "cc_reg_operand" "0,y")
13999 "cr%q1 %E0,%j2,%j4"
14000 [(set_attr "type" "cr_logical,delayed_cr")])
14002 ; Why is the constant -1 here, but 1 in the previous pattern?
14003 ; Because ~1 has all but the low bit set.
14005 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14006 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14007 [(not:SI (match_operator:SI 2
14008 "branch_positive_comparison_operator"
14010 "cc_reg_operand" "y,y")
14012 (match_operator:SI 4
14013 "branch_positive_comparison_operator"
14015 "cc_reg_operand" "0,y")
14019 "cr%q1 %E0,%j2,%j4"
14020 [(set_attr "type" "cr_logical,delayed_cr")])
14022 (define_insn "*cceq_rev_compare"
14023 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
14024 (compare:CCEQ (match_operator:SI 1
14025 "branch_positive_comparison_operator"
14027 "cc_reg_operand" "0,y")
14031 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14032 [(set_attr "type" "cr_logical,delayed_cr")])
14034 ;; If we are comparing the result of two comparisons, this can be done
14035 ;; using creqv or crxor.
14037 (define_insn_and_split ""
14038 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14039 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14040 [(match_operand 2 "cc_reg_operand" "y")
14042 (match_operator 3 "branch_comparison_operator"
14043 [(match_operand 4 "cc_reg_operand" "y")
14048 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14052 int positive_1, positive_2;
14054 positive_1 = branch_positive_comparison_operator (operands[1],
14055 GET_MODE (operands[1]));
14056 positive_2 = branch_positive_comparison_operator (operands[3],
14057 GET_MODE (operands[3]));
14060 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14061 GET_CODE (operands[1])),
14063 operands[2], const0_rtx);
14064 else if (GET_MODE (operands[1]) != SImode)
14065 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14066 operands[2], const0_rtx);
14069 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14070 GET_CODE (operands[3])),
14072 operands[4], const0_rtx);
14073 else if (GET_MODE (operands[3]) != SImode)
14074 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14075 operands[4], const0_rtx);
14077 if (positive_1 == positive_2)
14079 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14080 operands[5] = constm1_rtx;
14084 operands[5] = const1_rtx;
14088 ;; Unconditional branch and return.
14090 (define_insn "jump"
14092 (label_ref (match_operand 0 "" "")))]
14095 [(set_attr "type" "branch")])
14097 (define_insn "return"
14101 [(set_attr "type" "jmpreg")])
14103 (define_expand "indirect_jump"
14104 [(set (pc) (match_operand 0 "register_operand" ""))])
14106 (define_insn "*indirect_jump<mode>"
14107 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14112 [(set_attr "type" "jmpreg")])
14114 ;; Table jump for switch statements:
14115 (define_expand "tablejump"
14116 [(use (match_operand 0 "" ""))
14117 (use (label_ref (match_operand 1 "" "")))]
14122 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14124 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14128 (define_expand "tablejumpsi"
14129 [(set (match_dup 3)
14130 (plus:SI (match_operand:SI 0 "" "")
14132 (parallel [(set (pc) (match_dup 3))
14133 (use (label_ref (match_operand 1 "" "")))])]
14136 { operands[0] = force_reg (SImode, operands[0]);
14137 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14138 operands[3] = gen_reg_rtx (SImode);
14141 (define_expand "tablejumpdi"
14142 [(set (match_dup 4)
14143 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14145 (plus:DI (match_dup 4)
14147 (parallel [(set (pc) (match_dup 3))
14148 (use (label_ref (match_operand 1 "" "")))])]
14151 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14152 operands[3] = gen_reg_rtx (DImode);
14153 operands[4] = gen_reg_rtx (DImode);
14156 (define_insn "*tablejump<mode>_internal1"
14158 (match_operand:P 0 "register_operand" "c,*l"))
14159 (use (label_ref (match_operand 1 "" "")))]
14164 [(set_attr "type" "jmpreg")])
14169 "{cror 0,0,0|nop}")
14171 ;; Define the subtract-one-and-jump insns, starting with the template
14172 ;; so loop.c knows what to generate.
14174 (define_expand "doloop_end"
14175 [(use (match_operand 0 "" "")) ; loop pseudo
14176 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14177 (use (match_operand 2 "" "")) ; max iterations
14178 (use (match_operand 3 "" "")) ; loop level
14179 (use (match_operand 4 "" ""))] ; label
14183 /* Only use this on innermost loops. */
14184 if (INTVAL (operands[3]) > 1)
14188 if (GET_MODE (operands[0]) != DImode)
14190 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14194 if (GET_MODE (operands[0]) != SImode)
14196 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14201 (define_expand "ctr<mode>"
14202 [(parallel [(set (pc)
14203 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14205 (label_ref (match_operand 1 "" ""))
14208 (plus:P (match_dup 0)
14210 (clobber (match_scratch:CC 2 ""))
14211 (clobber (match_scratch:P 3 ""))])]
14215 ;; We need to be able to do this for any operand, including MEM, or we
14216 ;; will cause reload to blow up since we don't allow output reloads on
14218 ;; For the length attribute to be calculated correctly, the
14219 ;; label MUST be operand 0.
14221 (define_insn "*ctr<mode>_internal1"
14223 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14225 (label_ref (match_operand 0 "" ""))
14227 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14228 (plus:P (match_dup 1)
14230 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14231 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14235 if (which_alternative != 0)
14237 else if (get_attr_length (insn) == 4)
14238 return \"{bdn|bdnz} %l0\";
14240 return \"bdz $+8\;b %l0\";
14242 [(set_attr "type" "branch")
14243 (set_attr "length" "*,12,16,16")])
14245 (define_insn "*ctr<mode>_internal2"
14247 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14250 (label_ref (match_operand 0 "" ""))))
14251 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14252 (plus:P (match_dup 1)
14254 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14255 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14259 if (which_alternative != 0)
14261 else if (get_attr_length (insn) == 4)
14262 return \"bdz %l0\";
14264 return \"{bdn|bdnz} $+8\;b %l0\";
14266 [(set_attr "type" "branch")
14267 (set_attr "length" "*,12,16,16")])
14269 ;; Similar but use EQ
14271 (define_insn "*ctr<mode>_internal5"
14273 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14275 (label_ref (match_operand 0 "" ""))
14277 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14278 (plus:P (match_dup 1)
14280 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14281 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14285 if (which_alternative != 0)
14287 else if (get_attr_length (insn) == 4)
14288 return \"bdz %l0\";
14290 return \"{bdn|bdnz} $+8\;b %l0\";
14292 [(set_attr "type" "branch")
14293 (set_attr "length" "*,12,16,16")])
14295 (define_insn "*ctr<mode>_internal6"
14297 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14300 (label_ref (match_operand 0 "" ""))))
14301 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
14302 (plus:P (match_dup 1)
14304 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14305 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14309 if (which_alternative != 0)
14311 else if (get_attr_length (insn) == 4)
14312 return \"{bdn|bdnz} %l0\";
14314 return \"bdz $+8\;b %l0\";
14316 [(set_attr "type" "branch")
14317 (set_attr "length" "*,12,16,16")])
14319 ;; Now the splitters if we could not allocate the CTR register
14323 (if_then_else (match_operator 2 "comparison_operator"
14324 [(match_operand:P 1 "gpc_reg_operand" "")
14326 (match_operand 5 "" "")
14327 (match_operand 6 "" "")))
14328 (set (match_operand:P 0 "gpc_reg_operand" "")
14329 (plus:P (match_dup 1) (const_int -1)))
14330 (clobber (match_scratch:CC 3 ""))
14331 (clobber (match_scratch:P 4 ""))]
14333 [(parallel [(set (match_dup 3)
14334 (compare:CC (plus:P (match_dup 1)
14338 (plus:P (match_dup 1)
14340 (set (pc) (if_then_else (match_dup 7)
14344 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14345 operands[3], const0_rtx); }")
14349 (if_then_else (match_operator 2 "comparison_operator"
14350 [(match_operand:P 1 "gpc_reg_operand" "")
14352 (match_operand 5 "" "")
14353 (match_operand 6 "" "")))
14354 (set (match_operand:P 0 "nonimmediate_operand" "")
14355 (plus:P (match_dup 1) (const_int -1)))
14356 (clobber (match_scratch:CC 3 ""))
14357 (clobber (match_scratch:P 4 ""))]
14358 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14359 [(parallel [(set (match_dup 3)
14360 (compare:CC (plus:P (match_dup 1)
14364 (plus:P (match_dup 1)
14368 (set (pc) (if_then_else (match_dup 7)
14372 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14373 operands[3], const0_rtx); }")
14375 (define_insn "trap"
14376 [(trap_if (const_int 1) (const_int 0))]
14379 [(set_attr "type" "trap")])
14381 (define_expand "conditional_trap"
14382 [(trap_if (match_operator 0 "trap_comparison_operator"
14383 [(match_dup 2) (match_dup 3)])
14384 (match_operand 1 "const_int_operand" ""))]
14386 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14387 operands[2] = rs6000_compare_op0;
14388 operands[3] = rs6000_compare_op1;")
14391 [(trap_if (match_operator 0 "trap_comparison_operator"
14392 [(match_operand:GPR 1 "register_operand" "r")
14393 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14396 "{t|t<wd>}%V0%I2 %1,%2"
14397 [(set_attr "type" "trap")])
14399 ;; Insns related to generating the function prologue and epilogue.
14401 (define_expand "prologue"
14402 [(use (const_int 0))]
14403 "TARGET_SCHED_PROLOG"
14406 rs6000_emit_prologue ();
14410 (define_insn "*movesi_from_cr_one"
14411 [(match_parallel 0 "mfcr_operation"
14412 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14413 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14414 (match_operand 3 "immediate_operand" "n")]
14415 UNSPEC_MOVESI_FROM_CR))])]
14421 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14423 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14424 operands[4] = GEN_INT (mask);
14425 output_asm_insn (\"mfcr %1,%4\", operands);
14429 [(set_attr "type" "mfcrf")])
14431 (define_insn "movesi_from_cr"
14432 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14433 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14434 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14435 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14436 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14437 UNSPEC_MOVESI_FROM_CR))]
14440 [(set_attr "type" "mfcr")])
14442 (define_insn "*stmw"
14443 [(match_parallel 0 "stmw_operation"
14444 [(set (match_operand:SI 1 "memory_operand" "=m")
14445 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14448 [(set_attr "type" "store_ux")])
14450 (define_insn "*save_fpregs_<mode>"
14451 [(match_parallel 0 "any_parallel_operand"
14452 [(clobber (reg:P 65))
14453 (use (match_operand:P 1 "call_operand" "s"))
14454 (set (match_operand:DF 2 "memory_operand" "=m")
14455 (match_operand:DF 3 "gpc_reg_operand" "f"))])]
14458 [(set_attr "type" "branch")
14459 (set_attr "length" "4")])
14461 ; These are to explain that changes to the stack pointer should
14462 ; not be moved over stores to stack memory.
14463 (define_insn "stack_tie"
14464 [(set (match_operand:BLK 0 "memory_operand" "+m")
14465 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
14468 [(set_attr "length" "0")])
14471 (define_expand "epilogue"
14472 [(use (const_int 0))]
14473 "TARGET_SCHED_PROLOG"
14476 rs6000_emit_epilogue (FALSE);
14480 ; On some processors, doing the mtcrf one CC register at a time is
14481 ; faster (like on the 604e). On others, doing them all at once is
14482 ; faster; for instance, on the 601 and 750.
14484 (define_expand "movsi_to_cr_one"
14485 [(set (match_operand:CC 0 "cc_reg_operand" "")
14486 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14487 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14489 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14491 (define_insn "*movsi_to_cr"
14492 [(match_parallel 0 "mtcrf_operation"
14493 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14494 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14495 (match_operand 3 "immediate_operand" "n")]
14496 UNSPEC_MOVESI_TO_CR))])]
14502 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14503 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14504 operands[4] = GEN_INT (mask);
14505 return \"mtcrf %4,%2\";
14507 [(set_attr "type" "mtcr")])
14509 (define_insn "*mtcrfsi"
14510 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14511 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14512 (match_operand 2 "immediate_operand" "n")]
14513 UNSPEC_MOVESI_TO_CR))]
14514 "GET_CODE (operands[0]) == REG
14515 && CR_REGNO_P (REGNO (operands[0]))
14516 && GET_CODE (operands[2]) == CONST_INT
14517 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14519 [(set_attr "type" "mtcr")])
14521 ; The load-multiple instructions have similar properties.
14522 ; Note that "load_multiple" is a name known to the machine-independent
14523 ; code that actually corresponds to the PowerPC load-string.
14525 (define_insn "*lmw"
14526 [(match_parallel 0 "lmw_operation"
14527 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14528 (match_operand:SI 2 "memory_operand" "m"))])]
14531 [(set_attr "type" "load_ux")])
14533 (define_insn "*return_internal_<mode>"
14535 (use (match_operand:P 0 "register_operand" "lc"))]
14538 [(set_attr "type" "jmpreg")])
14540 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14541 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14543 (define_insn "*return_and_restore_fpregs_<mode>"
14544 [(match_parallel 0 "any_parallel_operand"
14547 (use (match_operand:P 1 "call_operand" "s"))
14548 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
14549 (match_operand:DF 3 "memory_operand" "m"))])]
14553 ; This is used in compiling the unwind routines.
14554 (define_expand "eh_return"
14555 [(use (match_operand 0 "general_operand" ""))]
14560 emit_insn (gen_eh_set_lr_si (operands[0]));
14562 emit_insn (gen_eh_set_lr_di (operands[0]));
14566 ; We can't expand this before we know where the link register is stored.
14567 (define_insn "eh_set_lr_<mode>"
14568 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14570 (clobber (match_scratch:P 1 "=&b"))]
14575 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14576 (clobber (match_scratch 1 ""))]
14581 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14585 (define_insn "prefetch"
14586 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14587 (match_operand:SI 1 "const_int_operand" "n")
14588 (match_operand:SI 2 "const_int_operand" "n"))]
14592 if (GET_CODE (operands[0]) == REG)
14593 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14594 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14596 [(set_attr "type" "load")])
14599 (include "sync.md")
14600 (include "altivec.md")
14603 (include "paired.md")