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, 2008, 2009, 2010, 2011
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)
56 (define_c_enum "unspec"
57 [UNSPEC_FRSP ; frsp for POWER machines
58 UNSPEC_PROBE_STACK ; probe stack memory reference
59 UNSPEC_TIE ; tie stack contents and stack pointer
60 UNSPEC_TOCPTR ; address of a word pointing to the TOC
61 UNSPEC_TOC ; address of the TOC (more-or-less)
63 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
69 UNSPEC_LD_MPIC ; load_macho_picbase
70 UNSPEC_MPIC_CORRECT ; macho_correct_pic
84 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
85 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
102 UNSPEC_MACHOPIC_OFFSET
114 ;; UNSPEC_VOLATILE usage
117 (define_c_enum "unspecv"
119 UNSPECV_LL ; load-locked
120 UNSPECV_SC ; store-conditional
121 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
122 UNSPECV_EH_RR ; eh_reg_restore
123 UNSPECV_ISYNC ; isync instruction
124 UNSPECV_LWSYNC ; lwsync
128 ;; Define an insn type attribute. This is used in function unit delay
130 (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,isel"
131 (const_string "integer"))
133 ;; Define floating point instruction sub-types for use with Xfpu.md
134 (define_attr "fp_type" "fp_default,fp_addsub_s,fp_addsub_d,fp_mul_s,fp_mul_d,fp_div_s,fp_div_d,fp_maddsub_s,fp_maddsub_d,fp_sqrt_s,fp_sqrt_d" (const_string "fp_default"))
136 ;; Length (in bytes).
137 ; '(pc)' in the following doesn't include the instruction itself; it is
138 ; calculated as if the instruction had zero size.
139 (define_attr "length" ""
140 (if_then_else (eq_attr "type" "branch")
141 (if_then_else (and (ge (minus (match_dup 0) (pc))
143 (lt (minus (match_dup 0) (pc))
149 ;; Processor type -- this attribute must exactly match the processor_type
150 ;; enumeration in rs6000.h.
152 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,power4,power5,power6,power7,cell,ppca2,titan"
153 (const (symbol_ref "rs6000_cpu_attr")))
156 ;; If this instruction is microcoded on the CELL processor
157 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
158 (define_attr "cell_micro" "not,conditional,always"
159 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
160 (const_string "always")
161 (const_string "not")))
163 (automata_option "ndfa")
177 (include "e300c2c3.md")
178 (include "e500mc.md")
179 (include "e500mc64.md")
180 (include "power4.md")
181 (include "power5.md")
182 (include "power6.md")
183 (include "power7.md")
189 (include "predicates.md")
190 (include "constraints.md")
192 (include "darwin.md")
197 ; This mode iterator allows :GPR to be used to indicate the allowable size
198 ; of whole values in GPRs.
199 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
201 ; Any supported integer mode.
202 (define_mode_iterator INT [QI HI SI DI TI])
204 ; Any supported integer mode that fits in one register.
205 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
207 ; extend modes for DImode
208 (define_mode_iterator QHSI [QI HI SI])
210 ; SImode or DImode, even if DImode doesn't fit in GPRs.
211 (define_mode_iterator SDI [SI DI])
213 ; The size of a pointer. Also, the size of the value that a record-condition
214 ; (one with a '.') will compare; and the size used for arithmetic carries.
215 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
217 ; Any hardware-supported floating-point mode
218 (define_mode_iterator FP [
219 (SF "TARGET_HARD_FLOAT
220 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
221 (DF "TARGET_HARD_FLOAT
222 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
223 (TF "!TARGET_IEEEQUAD
225 && (TARGET_FPRS || TARGET_E500_DOUBLE)
226 && TARGET_LONG_DOUBLE_128")
230 ; Any fma capable floating-point mode.
231 (define_mode_iterator FMA_F [
232 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
233 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
234 || VECTOR_UNIT_VSX_P (DFmode)")
235 (V2SF "TARGET_PAIRED_FLOAT")
236 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
237 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
240 ; These modes do not fit in integer registers in 32-bit mode.
241 ; but on e500v2, the gpr are 64 bit registers
242 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
244 ; Iterator for reciprocal estimate instructions
245 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
247 ; Iterator for just SF/DF
248 (define_mode_iterator SFDF [SF DF])
250 ; Various instructions that come in SI and DI forms.
251 ; A generic w/d attribute, for things like cmpw/cmpd.
252 (define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
255 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
257 ;; ISEL/ISEL64 target selection
258 (define_mode_attr sel [(SI "") (DI "64")])
260 ;; Suffix for reload patterns
261 (define_mode_attr ptrsize [(SI "32bit")
264 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
265 (DI "TARGET_64BIT")])
267 (define_mode_attr mptrsize [(SI "si")
270 (define_mode_attr rreg [(SF "f")
275 (define_mode_attr rreg2 [(SF "f")
278 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
279 (DF "TARGET_FCFID")])
281 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
282 (DF "TARGET_E500_DOUBLE")])
284 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
285 (DF "TARGET_DOUBLE_FLOAT")])
287 ;; Start with fixed-point load and store insns. Here we put only the more
288 ;; complex forms. Basic data transfer is done later.
290 (define_expand "zero_extend<mode>di2"
291 [(set (match_operand:DI 0 "gpc_reg_operand" "")
292 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
296 (define_insn "*zero_extend<mode>di2_internal1"
297 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
298 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
302 rldicl %0,%1,0,<dbits>"
303 [(set_attr "type" "load,*")])
305 (define_insn "*zero_extend<mode>di2_internal2"
306 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
307 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
309 (clobber (match_scratch:DI 2 "=r,r"))]
312 rldicl. %2,%1,0,<dbits>
314 [(set_attr "type" "compare")
315 (set_attr "length" "4,8")])
318 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
319 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
321 (clobber (match_scratch:DI 2 ""))]
322 "TARGET_POWERPC64 && reload_completed"
324 (zero_extend:DI (match_dup 1)))
326 (compare:CC (match_dup 2)
330 (define_insn "*zero_extend<mode>di2_internal3"
331 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
332 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
334 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
335 (zero_extend:DI (match_dup 1)))]
338 rldicl. %0,%1,0,<dbits>
340 [(set_attr "type" "compare")
341 (set_attr "length" "4,8")])
344 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
345 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
347 (set (match_operand:DI 0 "gpc_reg_operand" "")
348 (zero_extend:DI (match_dup 1)))]
349 "TARGET_POWERPC64 && reload_completed"
351 (zero_extend:DI (match_dup 1)))
353 (compare:CC (match_dup 0)
357 (define_insn "extendqidi2"
358 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
359 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
362 [(set_attr "type" "exts")])
365 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
366 (compare:CC (sign_extend:DI (match_operand:QI 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_micro_cr0_operand" "")
378 (compare:CC (sign_extend:DI (match_operand:QI 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:QI 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_micro_cr0_operand" "")
404 (compare:CC (sign_extend:DI (match_operand:QI 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 "extendhidi2"
417 [(set (match_operand:DI 0 "gpc_reg_operand" "")
418 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
423 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
424 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
425 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
429 [(set_attr "type" "load_ext,exts")])
432 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
433 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
434 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
436 [(set_attr "type" "exts")])
439 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
440 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
442 (clobber (match_scratch:DI 2 "=r,r"))]
447 [(set_attr "type" "compare")
448 (set_attr "length" "4,8")])
451 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
452 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
454 (clobber (match_scratch:DI 2 ""))]
455 "TARGET_POWERPC64 && reload_completed"
457 (sign_extend:DI (match_dup 1)))
459 (compare:CC (match_dup 2)
464 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
465 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
467 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
468 (sign_extend:DI (match_dup 1)))]
473 [(set_attr "type" "compare")
474 (set_attr "length" "4,8")])
477 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
478 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
480 (set (match_operand:DI 0 "gpc_reg_operand" "")
481 (sign_extend:DI (match_dup 1)))]
482 "TARGET_POWERPC64 && reload_completed"
484 (sign_extend:DI (match_dup 1)))
486 (compare:CC (match_dup 0)
490 (define_expand "extendsidi2"
491 [(set (match_operand:DI 0 "gpc_reg_operand" "")
492 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
497 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
498 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
499 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
503 [(set_attr "type" "load_ext,exts")])
506 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
507 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
508 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
510 [(set_attr "type" "exts")])
513 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
514 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
516 (clobber (match_scratch:DI 2 "=r,r"))]
521 [(set_attr "type" "compare")
522 (set_attr "length" "4,8")])
525 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
526 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
528 (clobber (match_scratch:DI 2 ""))]
529 "TARGET_POWERPC64 && reload_completed"
531 (sign_extend:DI (match_dup 1)))
533 (compare:CC (match_dup 2)
538 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
539 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
541 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
542 (sign_extend:DI (match_dup 1)))]
547 [(set_attr "type" "compare")
548 (set_attr "length" "4,8")])
551 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
552 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
554 (set (match_operand:DI 0 "gpc_reg_operand" "")
555 (sign_extend:DI (match_dup 1)))]
556 "TARGET_POWERPC64 && reload_completed"
558 (sign_extend:DI (match_dup 1)))
560 (compare:CC (match_dup 0)
564 (define_expand "zero_extendqisi2"
565 [(set (match_operand:SI 0 "gpc_reg_operand" "")
566 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
571 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
572 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
576 {rlinm|rlwinm} %0,%1,0,0xff"
577 [(set_attr "type" "load,*")])
580 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
581 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
583 (clobber (match_scratch:SI 2 "=r,r"))]
586 {andil.|andi.} %2,%1,0xff
588 [(set_attr "type" "fast_compare,compare")
589 (set_attr "length" "4,8")])
592 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
593 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
595 (clobber (match_scratch:SI 2 ""))]
598 (zero_extend:SI (match_dup 1)))
600 (compare:CC (match_dup 2)
605 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
606 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
608 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
609 (zero_extend:SI (match_dup 1)))]
612 {andil.|andi.} %0,%1,0xff
614 [(set_attr "type" "fast_compare,compare")
615 (set_attr "length" "4,8")])
618 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
619 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
621 (set (match_operand:SI 0 "gpc_reg_operand" "")
622 (zero_extend:SI (match_dup 1)))]
625 (zero_extend:SI (match_dup 1)))
627 (compare:CC (match_dup 0)
631 (define_expand "extendqisi2"
632 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
633 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
638 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
639 else if (TARGET_POWER)
640 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
642 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
646 (define_insn "extendqisi2_ppc"
647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
648 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
651 [(set_attr "type" "exts")])
654 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
655 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
657 (clobber (match_scratch:SI 2 "=r,r"))]
662 [(set_attr "type" "compare")
663 (set_attr "length" "4,8")])
666 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
667 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
669 (clobber (match_scratch:SI 2 ""))]
670 "TARGET_POWERPC && reload_completed"
672 (sign_extend:SI (match_dup 1)))
674 (compare:CC (match_dup 2)
679 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
680 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
682 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
683 (sign_extend:SI (match_dup 1)))]
688 [(set_attr "type" "compare")
689 (set_attr "length" "4,8")])
692 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
693 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
695 (set (match_operand:SI 0 "gpc_reg_operand" "")
696 (sign_extend:SI (match_dup 1)))]
697 "TARGET_POWERPC && reload_completed"
699 (sign_extend:SI (match_dup 1)))
701 (compare:CC (match_dup 0)
705 (define_expand "extendqisi2_power"
706 [(parallel [(set (match_dup 2)
707 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
709 (clobber (scratch:SI))])
710 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
711 (ashiftrt:SI (match_dup 2)
713 (clobber (scratch:SI))])]
716 { operands[1] = gen_lowpart (SImode, operands[1]);
717 operands[2] = gen_reg_rtx (SImode); }")
719 (define_expand "extendqisi2_no_power"
721 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
723 (set (match_operand:SI 0 "gpc_reg_operand" "")
724 (ashiftrt:SI (match_dup 2)
726 "! TARGET_POWER && ! TARGET_POWERPC"
728 { operands[1] = gen_lowpart (SImode, operands[1]);
729 operands[2] = gen_reg_rtx (SImode); }")
731 (define_expand "zero_extendqihi2"
732 [(set (match_operand:HI 0 "gpc_reg_operand" "")
733 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
738 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
739 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
743 {rlinm|rlwinm} %0,%1,0,0xff"
744 [(set_attr "type" "load,*")])
747 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
748 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
750 (clobber (match_scratch:HI 2 "=r,r"))]
753 {andil.|andi.} %2,%1,0xff
755 [(set_attr "type" "fast_compare,compare")
756 (set_attr "length" "4,8")])
759 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
760 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
762 (clobber (match_scratch:HI 2 ""))]
765 (zero_extend:HI (match_dup 1)))
767 (compare:CC (match_dup 2)
772 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
773 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
775 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
776 (zero_extend:HI (match_dup 1)))]
779 {andil.|andi.} %0,%1,0xff
781 [(set_attr "type" "fast_compare,compare")
782 (set_attr "length" "4,8")])
785 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
786 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
788 (set (match_operand:HI 0 "gpc_reg_operand" "")
789 (zero_extend:HI (match_dup 1)))]
792 (zero_extend:HI (match_dup 1)))
794 (compare:CC (match_dup 0)
798 (define_expand "extendqihi2"
799 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
800 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
805 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
806 else if (TARGET_POWER)
807 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
809 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
813 (define_insn "extendqihi2_ppc"
814 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
815 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
818 [(set_attr "type" "exts")])
821 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
822 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
824 (clobber (match_scratch:HI 2 "=r,r"))]
829 [(set_attr "type" "compare")
830 (set_attr "length" "4,8")])
833 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
834 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
836 (clobber (match_scratch:HI 2 ""))]
837 "TARGET_POWERPC && reload_completed"
839 (sign_extend:HI (match_dup 1)))
841 (compare:CC (match_dup 2)
846 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
847 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
849 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
850 (sign_extend:HI (match_dup 1)))]
855 [(set_attr "type" "compare")
856 (set_attr "length" "4,8")])
859 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
860 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
862 (set (match_operand:HI 0 "gpc_reg_operand" "")
863 (sign_extend:HI (match_dup 1)))]
864 "TARGET_POWERPC && reload_completed"
866 (sign_extend:HI (match_dup 1)))
868 (compare:CC (match_dup 0)
872 (define_expand "extendqihi2_power"
873 [(parallel [(set (match_dup 2)
874 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
876 (clobber (scratch:SI))])
877 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
878 (ashiftrt:SI (match_dup 2)
880 (clobber (scratch:SI))])]
883 { operands[0] = gen_lowpart (SImode, operands[0]);
884 operands[1] = gen_lowpart (SImode, operands[1]);
885 operands[2] = gen_reg_rtx (SImode); }")
887 (define_expand "extendqihi2_no_power"
889 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
891 (set (match_operand:HI 0 "gpc_reg_operand" "")
892 (ashiftrt:SI (match_dup 2)
894 "! TARGET_POWER && ! TARGET_POWERPC"
896 { operands[0] = gen_lowpart (SImode, operands[0]);
897 operands[1] = gen_lowpart (SImode, operands[1]);
898 operands[2] = gen_reg_rtx (SImode); }")
900 (define_expand "zero_extendhisi2"
901 [(set (match_operand:SI 0 "gpc_reg_operand" "")
902 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
907 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
908 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
912 {rlinm|rlwinm} %0,%1,0,0xffff"
913 [(set_attr "type" "load,*")])
916 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
917 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
919 (clobber (match_scratch:SI 2 "=r,r"))]
922 {andil.|andi.} %2,%1,0xffff
924 [(set_attr "type" "fast_compare,compare")
925 (set_attr "length" "4,8")])
928 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
929 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
931 (clobber (match_scratch:SI 2 ""))]
934 (zero_extend:SI (match_dup 1)))
936 (compare:CC (match_dup 2)
941 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
942 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
944 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
945 (zero_extend:SI (match_dup 1)))]
948 {andil.|andi.} %0,%1,0xffff
950 [(set_attr "type" "fast_compare,compare")
951 (set_attr "length" "4,8")])
954 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
955 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
957 (set (match_operand:SI 0 "gpc_reg_operand" "")
958 (zero_extend:SI (match_dup 1)))]
961 (zero_extend:SI (match_dup 1)))
963 (compare:CC (match_dup 0)
967 (define_expand "extendhisi2"
968 [(set (match_operand:SI 0 "gpc_reg_operand" "")
969 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
974 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
975 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
976 "rs6000_gen_cell_microcode"
980 [(set_attr "type" "load_ext,exts")])
983 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
984 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
985 "!rs6000_gen_cell_microcode"
987 [(set_attr "type" "exts")])
990 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
991 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
993 (clobber (match_scratch:SI 2 "=r,r"))]
998 [(set_attr "type" "compare")
999 (set_attr "length" "4,8")])
1002 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1003 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1005 (clobber (match_scratch:SI 2 ""))]
1008 (sign_extend:SI (match_dup 1)))
1010 (compare:CC (match_dup 2)
1015 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1016 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1018 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1019 (sign_extend:SI (match_dup 1)))]
1022 {exts.|extsh.} %0,%1
1024 [(set_attr "type" "compare")
1025 (set_attr "length" "4,8")])
1027 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1029 (define_insn "*macchwc"
1030 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1031 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1032 (match_operand:SI 2 "gpc_reg_operand" "r")
1035 (match_operand:HI 1 "gpc_reg_operand" "r")))
1036 (match_operand:SI 4 "gpc_reg_operand" "0"))
1038 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1039 (plus:SI (mult:SI (ashiftrt:SI
1046 "macchw. %0, %1, %2"
1047 [(set_attr "type" "imul3")])
1049 (define_insn "*macchw"
1050 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1051 (plus:SI (mult:SI (ashiftrt:SI
1052 (match_operand:SI 2 "gpc_reg_operand" "r")
1055 (match_operand:HI 1 "gpc_reg_operand" "r")))
1056 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1059 [(set_attr "type" "imul3")])
1061 (define_insn "*macchwuc"
1062 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1063 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1064 (match_operand:SI 2 "gpc_reg_operand" "r")
1067 (match_operand:HI 1 "gpc_reg_operand" "r")))
1068 (match_operand:SI 4 "gpc_reg_operand" "0"))
1070 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1071 (plus:SI (mult:SI (lshiftrt:SI
1078 "macchwu. %0, %1, %2"
1079 [(set_attr "type" "imul3")])
1081 (define_insn "*macchwu"
1082 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1083 (plus:SI (mult:SI (lshiftrt:SI
1084 (match_operand:SI 2 "gpc_reg_operand" "r")
1087 (match_operand:HI 1 "gpc_reg_operand" "r")))
1088 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1090 "macchwu %0, %1, %2"
1091 [(set_attr "type" "imul3")])
1093 (define_insn "*machhwc"
1094 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1095 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1096 (match_operand:SI 1 "gpc_reg_operand" "%r")
1099 (match_operand:SI 2 "gpc_reg_operand" "r")
1101 (match_operand:SI 4 "gpc_reg_operand" "0"))
1103 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1104 (plus:SI (mult:SI (ashiftrt:SI
1112 "machhw. %0, %1, %2"
1113 [(set_attr "type" "imul3")])
1115 (define_insn "*machhw"
1116 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1117 (plus:SI (mult:SI (ashiftrt:SI
1118 (match_operand:SI 1 "gpc_reg_operand" "%r")
1121 (match_operand:SI 2 "gpc_reg_operand" "r")
1123 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1126 [(set_attr "type" "imul3")])
1128 (define_insn "*machhwuc"
1129 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1130 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1131 (match_operand:SI 1 "gpc_reg_operand" "%r")
1134 (match_operand:SI 2 "gpc_reg_operand" "r")
1136 (match_operand:SI 4 "gpc_reg_operand" "0"))
1138 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1139 (plus:SI (mult:SI (lshiftrt:SI
1147 "machhwu. %0, %1, %2"
1148 [(set_attr "type" "imul3")])
1150 (define_insn "*machhwu"
1151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1152 (plus:SI (mult:SI (lshiftrt:SI
1153 (match_operand:SI 1 "gpc_reg_operand" "%r")
1156 (match_operand:SI 2 "gpc_reg_operand" "r")
1158 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1160 "machhwu %0, %1, %2"
1161 [(set_attr "type" "imul3")])
1163 (define_insn "*maclhwc"
1164 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1165 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1166 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1168 (match_operand:HI 2 "gpc_reg_operand" "r")))
1169 (match_operand:SI 4 "gpc_reg_operand" "0"))
1171 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1172 (plus:SI (mult:SI (sign_extend:SI
1178 "maclhw. %0, %1, %2"
1179 [(set_attr "type" "imul3")])
1181 (define_insn "*maclhw"
1182 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1183 (plus:SI (mult:SI (sign_extend:SI
1184 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1186 (match_operand:HI 2 "gpc_reg_operand" "r")))
1187 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1190 [(set_attr "type" "imul3")])
1192 (define_insn "*maclhwuc"
1193 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1194 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1195 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1197 (match_operand:HI 2 "gpc_reg_operand" "r")))
1198 (match_operand:SI 4 "gpc_reg_operand" "0"))
1200 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1201 (plus:SI (mult:SI (zero_extend:SI
1207 "maclhwu. %0, %1, %2"
1208 [(set_attr "type" "imul3")])
1210 (define_insn "*maclhwu"
1211 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1212 (plus:SI (mult:SI (zero_extend:SI
1213 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1215 (match_operand:HI 2 "gpc_reg_operand" "r")))
1216 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1218 "maclhwu %0, %1, %2"
1219 [(set_attr "type" "imul3")])
1221 (define_insn "*nmacchwc"
1222 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1223 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1224 (mult:SI (ashiftrt:SI
1225 (match_operand:SI 2 "gpc_reg_operand" "r")
1228 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1230 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1231 (minus:SI (match_dup 4)
1232 (mult:SI (ashiftrt:SI
1238 "nmacchw. %0, %1, %2"
1239 [(set_attr "type" "imul3")])
1241 (define_insn "*nmacchw"
1242 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1243 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1244 (mult:SI (ashiftrt:SI
1245 (match_operand:SI 2 "gpc_reg_operand" "r")
1248 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1250 "nmacchw %0, %1, %2"
1251 [(set_attr "type" "imul3")])
1253 (define_insn "*nmachhwc"
1254 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1255 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1256 (mult:SI (ashiftrt:SI
1257 (match_operand:SI 1 "gpc_reg_operand" "%r")
1260 (match_operand:SI 2 "gpc_reg_operand" "r")
1263 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1264 (minus:SI (match_dup 4)
1265 (mult:SI (ashiftrt:SI
1272 "nmachhw. %0, %1, %2"
1273 [(set_attr "type" "imul3")])
1275 (define_insn "*nmachhw"
1276 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1277 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1278 (mult:SI (ashiftrt:SI
1279 (match_operand:SI 1 "gpc_reg_operand" "%r")
1282 (match_operand:SI 2 "gpc_reg_operand" "r")
1285 "nmachhw %0, %1, %2"
1286 [(set_attr "type" "imul3")])
1288 (define_insn "*nmaclhwc"
1289 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1290 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1291 (mult:SI (sign_extend:SI
1292 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1294 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1296 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1297 (minus:SI (match_dup 4)
1298 (mult:SI (sign_extend:SI
1303 "nmaclhw. %0, %1, %2"
1304 [(set_attr "type" "imul3")])
1306 (define_insn "*nmaclhw"
1307 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1308 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1309 (mult:SI (sign_extend:SI
1310 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1312 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1314 "nmaclhw %0, %1, %2"
1315 [(set_attr "type" "imul3")])
1317 (define_insn "*mulchwc"
1318 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1319 (compare:CC (mult:SI (ashiftrt:SI
1320 (match_operand:SI 2 "gpc_reg_operand" "r")
1323 (match_operand:HI 1 "gpc_reg_operand" "r")))
1325 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1326 (mult:SI (ashiftrt:SI
1332 "mulchw. %0, %1, %2"
1333 [(set_attr "type" "imul3")])
1335 (define_insn "*mulchw"
1336 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1337 (mult:SI (ashiftrt:SI
1338 (match_operand:SI 2 "gpc_reg_operand" "r")
1341 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1344 [(set_attr "type" "imul3")])
1346 (define_insn "*mulchwuc"
1347 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1348 (compare:CC (mult:SI (lshiftrt:SI
1349 (match_operand:SI 2 "gpc_reg_operand" "r")
1352 (match_operand:HI 1 "gpc_reg_operand" "r")))
1354 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1355 (mult:SI (lshiftrt:SI
1361 "mulchwu. %0, %1, %2"
1362 [(set_attr "type" "imul3")])
1364 (define_insn "*mulchwu"
1365 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1366 (mult:SI (lshiftrt:SI
1367 (match_operand:SI 2 "gpc_reg_operand" "r")
1370 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1372 "mulchwu %0, %1, %2"
1373 [(set_attr "type" "imul3")])
1375 (define_insn "*mulhhwc"
1376 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1377 (compare:CC (mult:SI (ashiftrt:SI
1378 (match_operand:SI 1 "gpc_reg_operand" "%r")
1381 (match_operand:SI 2 "gpc_reg_operand" "r")
1384 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1385 (mult:SI (ashiftrt:SI
1392 "mulhhw. %0, %1, %2"
1393 [(set_attr "type" "imul3")])
1395 (define_insn "*mulhhw"
1396 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1397 (mult:SI (ashiftrt:SI
1398 (match_operand:SI 1 "gpc_reg_operand" "%r")
1401 (match_operand:SI 2 "gpc_reg_operand" "r")
1405 [(set_attr "type" "imul3")])
1407 (define_insn "*mulhhwuc"
1408 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1409 (compare:CC (mult:SI (lshiftrt:SI
1410 (match_operand:SI 1 "gpc_reg_operand" "%r")
1413 (match_operand:SI 2 "gpc_reg_operand" "r")
1416 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1417 (mult:SI (lshiftrt:SI
1424 "mulhhwu. %0, %1, %2"
1425 [(set_attr "type" "imul3")])
1427 (define_insn "*mulhhwu"
1428 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1429 (mult:SI (lshiftrt:SI
1430 (match_operand:SI 1 "gpc_reg_operand" "%r")
1433 (match_operand:SI 2 "gpc_reg_operand" "r")
1436 "mulhhwu %0, %1, %2"
1437 [(set_attr "type" "imul3")])
1439 (define_insn "*mullhwc"
1440 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1441 (compare:CC (mult:SI (sign_extend:SI
1442 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1444 (match_operand:HI 2 "gpc_reg_operand" "r")))
1446 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1447 (mult:SI (sign_extend:SI
1452 "mullhw. %0, %1, %2"
1453 [(set_attr "type" "imul3")])
1455 (define_insn "*mullhw"
1456 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1457 (mult:SI (sign_extend:SI
1458 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1460 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1463 [(set_attr "type" "imul3")])
1465 (define_insn "*mullhwuc"
1466 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1467 (compare:CC (mult:SI (zero_extend:SI
1468 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1470 (match_operand:HI 2 "gpc_reg_operand" "r")))
1472 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1473 (mult:SI (zero_extend:SI
1478 "mullhwu. %0, %1, %2"
1479 [(set_attr "type" "imul3")])
1481 (define_insn "*mullhwu"
1482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1483 (mult:SI (zero_extend:SI
1484 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1486 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1488 "mullhwu %0, %1, %2"
1489 [(set_attr "type" "imul3")])
1491 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1492 (define_insn "dlmzb"
1493 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1494 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1495 (match_operand:SI 2 "gpc_reg_operand" "r")]
1497 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1498 (unspec:SI [(match_dup 1)
1502 "dlmzb. %0, %1, %2")
1504 (define_expand "strlensi"
1505 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1506 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1507 (match_operand:QI 2 "const_int_operand" "")
1508 (match_operand 3 "const_int_operand" "")]
1509 UNSPEC_DLMZB_STRLEN))
1510 (clobber (match_scratch:CC 4 "=x"))]
1511 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1513 rtx result = operands[0];
1514 rtx src = operands[1];
1515 rtx search_char = operands[2];
1516 rtx align = operands[3];
1517 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1518 rtx loop_label, end_label, mem, cr0, cond;
1519 if (search_char != const0_rtx
1520 || GET_CODE (align) != CONST_INT
1521 || INTVAL (align) < 8)
1523 word1 = gen_reg_rtx (SImode);
1524 word2 = gen_reg_rtx (SImode);
1525 scratch_dlmzb = gen_reg_rtx (SImode);
1526 scratch_string = gen_reg_rtx (Pmode);
1527 loop_label = gen_label_rtx ();
1528 end_label = gen_label_rtx ();
1529 addr = force_reg (Pmode, XEXP (src, 0));
1530 emit_move_insn (scratch_string, addr);
1531 emit_label (loop_label);
1532 mem = change_address (src, SImode, scratch_string);
1533 emit_move_insn (word1, mem);
1534 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1535 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1536 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1537 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1538 emit_jump_insn (gen_rtx_SET (VOIDmode,
1540 gen_rtx_IF_THEN_ELSE (VOIDmode,
1546 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1547 emit_jump_insn (gen_rtx_SET (VOIDmode,
1549 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1551 emit_label (end_label);
1552 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1553 emit_insn (gen_subsi3 (result, scratch_string, addr));
1554 emit_insn (gen_subsi3 (result, result, const1_rtx));
1559 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1560 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1562 (set (match_operand:SI 0 "gpc_reg_operand" "")
1563 (sign_extend:SI (match_dup 1)))]
1566 (sign_extend:SI (match_dup 1)))
1568 (compare:CC (match_dup 0)
1572 ;; Fixed-point arithmetic insns.
1574 (define_expand "add<mode>3"
1575 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1576 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1577 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1580 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1582 if (non_short_cint_operand (operands[2], DImode))
1585 else if (GET_CODE (operands[2]) == CONST_INT
1586 && ! add_operand (operands[2], <MODE>mode))
1588 rtx tmp = ((!can_create_pseudo_p ()
1589 || rtx_equal_p (operands[0], operands[1]))
1590 ? operands[0] : gen_reg_rtx (<MODE>mode));
1592 HOST_WIDE_INT val = INTVAL (operands[2]);
1593 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1594 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1596 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1599 /* The ordering here is important for the prolog expander.
1600 When space is allocated from the stack, adding 'low' first may
1601 produce a temporary deallocation (which would be bad). */
1602 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1603 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1608 ;; Discourage ai/addic because of carry but provide it in an alternative
1609 ;; allowing register zero as source.
1610 (define_insn "*add<mode>3_internal1"
1611 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1612 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1613 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1614 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1617 {cal %0,%2(%1)|addi %0,%1,%2}
1619 {cau|addis} %0,%1,%v2"
1620 [(set_attr "length" "4,4,4,4")])
1622 (define_insn "addsi3_high"
1623 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1624 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1625 (high:SI (match_operand 2 "" ""))))]
1626 "TARGET_MACHO && !TARGET_64BIT"
1627 "{cau|addis} %0,%1,ha16(%2)"
1628 [(set_attr "length" "4")])
1630 (define_insn "*add<mode>3_internal2"
1631 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1632 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1633 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1635 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1638 {cax.|add.} %3,%1,%2
1639 {ai.|addic.} %3,%1,%2
1642 [(set_attr "type" "fast_compare,compare,compare,compare")
1643 (set_attr "length" "4,4,8,8")])
1646 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1647 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1648 (match_operand:GPR 2 "reg_or_short_operand" ""))
1650 (clobber (match_scratch:GPR 3 ""))]
1653 (plus:GPR (match_dup 1)
1656 (compare:CC (match_dup 3)
1660 (define_insn "*add<mode>3_internal3"
1661 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1662 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1663 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1665 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1666 (plus:P (match_dup 1)
1670 {cax.|add.} %0,%1,%2
1671 {ai.|addic.} %0,%1,%2
1674 [(set_attr "type" "fast_compare,compare,compare,compare")
1675 (set_attr "length" "4,4,8,8")])
1678 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1679 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1680 (match_operand:P 2 "reg_or_short_operand" ""))
1682 (set (match_operand:P 0 "gpc_reg_operand" "")
1683 (plus:P (match_dup 1) (match_dup 2)))]
1686 (plus:P (match_dup 1)
1689 (compare:CC (match_dup 0)
1693 ;; Split an add that we can't do in one insn into two insns, each of which
1694 ;; does one 16-bit part. This is used by combine. Note that the low-order
1695 ;; add should be last in case the result gets used in an address.
1698 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1699 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1700 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1702 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1703 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1705 HOST_WIDE_INT val = INTVAL (operands[2]);
1706 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1707 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1709 operands[4] = GEN_INT (low);
1710 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1711 operands[3] = GEN_INT (rest);
1712 else if (can_create_pseudo_p ())
1714 operands[3] = gen_reg_rtx (DImode);
1715 emit_move_insn (operands[3], operands[2]);
1716 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1723 (define_insn "one_cmpl<mode>2"
1724 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1725 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1730 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1731 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1733 (clobber (match_scratch:P 2 "=r,r"))]
1738 [(set_attr "type" "fast_compare,compare")
1739 (set_attr "length" "4,8")])
1742 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1743 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1745 (clobber (match_scratch:P 2 ""))]
1748 (not:P (match_dup 1)))
1750 (compare:CC (match_dup 2)
1755 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1756 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1758 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1759 (not:P (match_dup 1)))]
1764 [(set_attr "type" "fast_compare,compare")
1765 (set_attr "length" "4,8")])
1768 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1769 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1771 (set (match_operand:P 0 "gpc_reg_operand" "")
1772 (not:P (match_dup 1)))]
1775 (not:P (match_dup 1)))
1777 (compare:CC (match_dup 0)
1782 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1783 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1784 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1786 "{sf%I1|subf%I1c} %0,%2,%1")
1789 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1790 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1791 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1798 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1799 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1800 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1802 (clobber (match_scratch:SI 3 "=r,r"))]
1805 {sf.|subfc.} %3,%2,%1
1807 [(set_attr "type" "compare")
1808 (set_attr "length" "4,8")])
1811 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1812 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1813 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1815 (clobber (match_scratch:P 3 "=r,r"))]
1820 [(set_attr "type" "fast_compare")
1821 (set_attr "length" "4,8")])
1824 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1825 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1826 (match_operand:P 2 "gpc_reg_operand" ""))
1828 (clobber (match_scratch:P 3 ""))]
1831 (minus:P (match_dup 1)
1834 (compare:CC (match_dup 3)
1839 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1840 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1841 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1843 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1844 (minus:SI (match_dup 1) (match_dup 2)))]
1847 {sf.|subfc.} %0,%2,%1
1849 [(set_attr "type" "compare")
1850 (set_attr "length" "4,8")])
1853 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1854 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1855 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1857 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1858 (minus:P (match_dup 1)
1864 [(set_attr "type" "fast_compare")
1865 (set_attr "length" "4,8")])
1868 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1869 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1870 (match_operand:P 2 "gpc_reg_operand" ""))
1872 (set (match_operand:P 0 "gpc_reg_operand" "")
1873 (minus:P (match_dup 1)
1877 (minus:P (match_dup 1)
1880 (compare:CC (match_dup 0)
1884 (define_expand "sub<mode>3"
1885 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1886 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1887 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1891 if (GET_CODE (operands[2]) == CONST_INT)
1893 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1894 negate_rtx (<MODE>mode, operands[2])));
1899 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1900 ;; instruction and some auxiliary computations. Then we just have a single
1901 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1904 (define_expand "sminsi3"
1906 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1907 (match_operand:SI 2 "reg_or_short_operand" ""))
1909 (minus:SI (match_dup 2) (match_dup 1))))
1910 (set (match_operand:SI 0 "gpc_reg_operand" "")
1911 (minus:SI (match_dup 2) (match_dup 3)))]
1912 "TARGET_POWER || TARGET_ISEL"
1917 operands[2] = force_reg (SImode, operands[2]);
1918 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1922 operands[3] = gen_reg_rtx (SImode);
1926 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1927 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1928 (match_operand:SI 2 "reg_or_short_operand" "")))
1929 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1932 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1934 (minus:SI (match_dup 2) (match_dup 1))))
1935 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1938 (define_expand "smaxsi3"
1940 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1941 (match_operand:SI 2 "reg_or_short_operand" ""))
1943 (minus:SI (match_dup 2) (match_dup 1))))
1944 (set (match_operand:SI 0 "gpc_reg_operand" "")
1945 (plus:SI (match_dup 3) (match_dup 1)))]
1946 "TARGET_POWER || TARGET_ISEL"
1951 operands[2] = force_reg (SImode, operands[2]);
1952 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1955 operands[3] = gen_reg_rtx (SImode);
1959 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1960 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1961 (match_operand:SI 2 "reg_or_short_operand" "")))
1962 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1965 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1967 (minus:SI (match_dup 2) (match_dup 1))))
1968 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1971 (define_expand "uminsi3"
1972 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1974 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1976 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1978 (minus:SI (match_dup 4) (match_dup 3))))
1979 (set (match_operand:SI 0 "gpc_reg_operand" "")
1980 (minus:SI (match_dup 2) (match_dup 3)))]
1981 "TARGET_POWER || TARGET_ISEL"
1986 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1989 operands[3] = gen_reg_rtx (SImode);
1990 operands[4] = gen_reg_rtx (SImode);
1991 operands[5] = GEN_INT (-2147483647 - 1);
1994 (define_expand "umaxsi3"
1995 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1997 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1999 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2001 (minus:SI (match_dup 4) (match_dup 3))))
2002 (set (match_operand:SI 0 "gpc_reg_operand" "")
2003 (plus:SI (match_dup 3) (match_dup 1)))]
2004 "TARGET_POWER || TARGET_ISEL"
2009 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
2012 operands[3] = gen_reg_rtx (SImode);
2013 operands[4] = gen_reg_rtx (SImode);
2014 operands[5] = GEN_INT (-2147483647 - 1);
2018 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2019 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2020 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2022 (minus:SI (match_dup 2) (match_dup 1))))]
2027 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2029 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2030 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2032 (minus:SI (match_dup 2) (match_dup 1)))
2034 (clobber (match_scratch:SI 3 "=r,r"))]
2039 [(set_attr "type" "delayed_compare")
2040 (set_attr "length" "4,8")])
2043 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2045 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2046 (match_operand:SI 2 "reg_or_short_operand" ""))
2048 (minus:SI (match_dup 2) (match_dup 1)))
2050 (clobber (match_scratch:SI 3 ""))]
2051 "TARGET_POWER && reload_completed"
2053 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2055 (minus:SI (match_dup 2) (match_dup 1))))
2057 (compare:CC (match_dup 3)
2062 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2064 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2065 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2067 (minus:SI (match_dup 2) (match_dup 1)))
2069 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2070 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2072 (minus:SI (match_dup 2) (match_dup 1))))]
2077 [(set_attr "type" "delayed_compare")
2078 (set_attr "length" "4,8")])
2081 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2083 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2084 (match_operand:SI 2 "reg_or_short_operand" ""))
2086 (minus:SI (match_dup 2) (match_dup 1)))
2088 (set (match_operand:SI 0 "gpc_reg_operand" "")
2089 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2091 (minus:SI (match_dup 2) (match_dup 1))))]
2092 "TARGET_POWER && reload_completed"
2094 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2096 (minus:SI (match_dup 2) (match_dup 1))))
2098 (compare:CC (match_dup 0)
2102 ;; We don't need abs with condition code because such comparisons should
2104 (define_expand "abssi2"
2105 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2106 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2112 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2115 else if (! TARGET_POWER)
2117 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2122 (define_insn "*abssi2_power"
2123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2124 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2128 (define_insn_and_split "abs<mode>2_isel"
2129 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2130 (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b")))
2131 (clobber (match_scratch:GPR 2 "=&b"))
2132 (clobber (match_scratch:CC 3 "=y"))]
2135 "&& reload_completed"
2136 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2138 (compare:CC (match_dup 1)
2141 (if_then_else:GPR (lt (match_dup 3)
2147 (define_insn_and_split "nabs<mode>2_isel"
2148 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2149 (neg:GPR (abs:GPR (match_operand:GPR 1 "gpc_reg_operand" "b"))))
2150 (clobber (match_scratch:GPR 2 "=&b"))
2151 (clobber (match_scratch:CC 3 "=y"))]
2154 "&& reload_completed"
2155 [(set (match_dup 2) (neg:GPR (match_dup 1)))
2157 (compare:CC (match_dup 1)
2160 (if_then_else:GPR (lt (match_dup 3)
2166 (define_insn_and_split "abssi2_nopower"
2167 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2168 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2169 (clobber (match_scratch:SI 2 "=&r,&r"))]
2170 "! TARGET_POWER && ! TARGET_ISEL"
2172 "&& reload_completed"
2173 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2174 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2175 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2178 (define_insn "*nabs_power"
2179 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2180 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2184 (define_insn_and_split "*nabs_nopower"
2185 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2186 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2187 (clobber (match_scratch:SI 2 "=&r,&r"))]
2190 "&& reload_completed"
2191 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2192 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2193 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2196 (define_expand "neg<mode>2"
2197 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
2198 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
2202 (define_insn "*neg<mode>2_internal"
2203 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2204 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2209 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2210 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2212 (clobber (match_scratch:P 2 "=r,r"))]
2217 [(set_attr "type" "fast_compare")
2218 (set_attr "length" "4,8")])
2221 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2222 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2224 (clobber (match_scratch:P 2 ""))]
2227 (neg:P (match_dup 1)))
2229 (compare:CC (match_dup 2)
2234 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2235 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
2237 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2238 (neg:P (match_dup 1)))]
2243 [(set_attr "type" "fast_compare")
2244 (set_attr "length" "4,8")])
2247 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2248 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
2250 (set (match_operand:P 0 "gpc_reg_operand" "")
2251 (neg:P (match_dup 1)))]
2254 (neg:P (match_dup 1)))
2256 (compare:CC (match_dup 0)
2260 (define_insn "clz<mode>2"
2261 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2262 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2264 "{cntlz|cntlz<wd>} %0,%1"
2265 [(set_attr "type" "cntlz")])
2267 (define_expand "ctz<mode>2"
2269 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2270 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2272 (clobber (scratch:CC))])
2273 (set (match_dup 4) (clz:GPR (match_dup 3)))
2274 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2275 (minus:GPR (match_dup 5) (match_dup 4)))]
2278 operands[2] = gen_reg_rtx (<MODE>mode);
2279 operands[3] = gen_reg_rtx (<MODE>mode);
2280 operands[4] = gen_reg_rtx (<MODE>mode);
2281 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
2284 (define_expand "ffs<mode>2"
2286 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
2287 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
2289 (clobber (scratch:CC))])
2290 (set (match_dup 4) (clz:GPR (match_dup 3)))
2291 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2292 (minus:GPR (match_dup 5) (match_dup 4)))]
2295 operands[2] = gen_reg_rtx (<MODE>mode);
2296 operands[3] = gen_reg_rtx (<MODE>mode);
2297 operands[4] = gen_reg_rtx (<MODE>mode);
2298 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2301 (define_insn "popcntb<mode>2"
2302 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2303 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2308 (define_insn "popcntd<mode>2"
2309 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2310 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2314 (define_expand "popcount<mode>2"
2315 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2316 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2317 "TARGET_POPCNTB || TARGET_POPCNTD"
2319 rs6000_emit_popcount (operands[0], operands[1]);
2323 (define_insn "parity<mode>2_cmpb"
2324 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2325 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2326 "TARGET_CMPB && TARGET_POPCNTB"
2329 (define_expand "parity<mode>2"
2330 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2331 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2334 rs6000_emit_parity (operands[0], operands[1]);
2338 ;; Since the hardware zeros the upper part of the register, save generating the
2339 ;; AND immediate if we are converting to unsigned
2340 (define_insn "*bswaphi2_extenddi"
2341 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2343 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2346 [(set_attr "length" "4")
2347 (set_attr "type" "load")])
2349 (define_insn "*bswaphi2_extendsi"
2350 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2352 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2355 [(set_attr "length" "4")
2356 (set_attr "type" "load")])
2358 (define_expand "bswaphi2"
2359 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2361 (match_operand:HI 1 "reg_or_mem_operand" "")))
2362 (clobber (match_scratch:SI 2 ""))])]
2365 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2366 operands[1] = force_reg (HImode, operands[1]);
2369 (define_insn "bswaphi2_internal"
2370 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2372 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2373 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2379 [(set_attr "length" "4,4,12")
2380 (set_attr "type" "load,store,*")])
2383 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2384 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2385 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2386 "TARGET_POWERPC && reload_completed"
2388 (zero_extract:SI (match_dup 4)
2392 (and:SI (ashift:SI (match_dup 4)
2394 (const_int 65280))) ;; 0xff00
2396 (ior:SI (match_dup 3)
2400 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2401 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2404 (define_insn "*bswapsi2_extenddi"
2405 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2407 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2410 [(set_attr "length" "4")
2411 (set_attr "type" "load")])
2413 (define_expand "bswapsi2"
2414 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2416 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2419 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2420 operands[1] = force_reg (SImode, operands[1]);
2423 (define_insn "*bswapsi2_internal"
2424 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2426 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2430 {stbrx|stwbrx} %1,%y0
2432 [(set_attr "length" "4,4,12")
2433 (set_attr "type" "load,store,*")])
2436 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2437 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2440 (rotate:SI (match_dup 1) (const_int 8)))
2441 (set (zero_extract:SI (match_dup 0)
2445 (set (zero_extract:SI (match_dup 0)
2448 (rotate:SI (match_dup 1)
2452 (define_expand "bswapdi2"
2453 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2455 (match_operand:DI 1 "reg_or_mem_operand" "")))
2456 (clobber (match_scratch:DI 2 ""))
2457 (clobber (match_scratch:DI 3 ""))
2458 (clobber (match_scratch:DI 4 ""))])]
2461 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2462 operands[1] = force_reg (DImode, operands[1]);
2464 if (!TARGET_POWERPC64)
2466 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2467 that uses 64-bit registers needs the same scratch registers as 64-bit
2469 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2474 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2475 (define_insn "*bswapdi2_ldbrx"
2476 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2477 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2478 (clobber (match_scratch:DI 2 "=X,X,&r"))
2479 (clobber (match_scratch:DI 3 "=X,X,&r"))
2480 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2481 "TARGET_POWERPC64 && TARGET_LDBRX
2482 && (REG_P (operands[0]) || REG_P (operands[1]))"
2487 [(set_attr "length" "4,4,36")
2488 (set_attr "type" "load,store,*")])
2490 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2491 (define_insn "*bswapdi2_64bit"
2492 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2493 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2494 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2495 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2496 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2497 "TARGET_POWERPC64 && !TARGET_LDBRX
2498 && (REG_P (operands[0]) || REG_P (operands[1]))"
2500 [(set_attr "length" "16,12,36")])
2503 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2504 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2505 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2506 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2507 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2508 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2512 rtx dest = operands[0];
2513 rtx src = operands[1];
2514 rtx op2 = operands[2];
2515 rtx op3 = operands[3];
2516 rtx op4 = operands[4];
2517 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
2518 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
2524 addr1 = XEXP (src, 0);
2525 if (GET_CODE (addr1) == PLUS)
2527 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2528 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2532 emit_move_insn (op2, GEN_INT (4));
2533 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2536 if (BYTES_BIG_ENDIAN)
2538 word_high = change_address (src, SImode, addr1);
2539 word_low = change_address (src, SImode, addr2);
2543 word_high = change_address (src, SImode, addr2);
2544 word_low = change_address (src, SImode, addr1);
2547 emit_insn (gen_bswapsi2 (op3_32, word_low));
2548 emit_insn (gen_bswapsi2 (op4_32, word_high));
2549 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2550 emit_insn (gen_iordi3 (dest, dest, op4));
2554 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2555 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2556 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2557 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2558 (clobber (match_operand:DI 4 "" ""))]
2559 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2563 rtx dest = operands[0];
2564 rtx src = operands[1];
2565 rtx op2 = operands[2];
2566 rtx op3 = operands[3];
2567 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2568 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2574 addr1 = XEXP (dest, 0);
2575 if (GET_CODE (addr1) == PLUS)
2577 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2578 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2582 emit_move_insn (op2, GEN_INT (4));
2583 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2586 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2587 if (BYTES_BIG_ENDIAN)
2589 word_high = change_address (dest, SImode, addr1);
2590 word_low = change_address (dest, SImode, addr2);
2591 emit_insn (gen_bswapsi2 (word_high, src_si));
2592 emit_insn (gen_bswapsi2 (word_low, op3_si));
2596 word_high = change_address (dest, SImode, addr2);
2597 word_low = change_address (dest, SImode, addr1);
2598 emit_insn (gen_bswapsi2 (word_low, src_si));
2599 emit_insn (gen_bswapsi2 (word_high, op3_si));
2604 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2605 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2606 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2607 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2608 (clobber (match_operand:DI 4 "" ""))]
2609 "TARGET_POWERPC64 && reload_completed"
2613 rtx dest = operands[0];
2614 rtx src = operands[1];
2615 rtx op2 = operands[2];
2616 rtx op3 = operands[3];
2617 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
2618 rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
2619 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, 4);
2620 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
2622 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2623 emit_insn (gen_bswapsi2 (dest_si, src_si));
2624 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2625 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2626 emit_insn (gen_iordi3 (dest, dest, op3));
2629 (define_insn "bswapdi2_32bit"
2630 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2631 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2632 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2633 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2635 [(set_attr "length" "16,12,36")])
2638 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2639 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2640 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2641 "!TARGET_POWERPC64 && reload_completed"
2645 rtx dest = operands[0];
2646 rtx src = operands[1];
2647 rtx op2 = operands[2];
2648 rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
2649 rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
2655 addr1 = XEXP (src, 0);
2656 if (GET_CODE (addr1) == PLUS)
2658 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2659 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2663 emit_move_insn (op2, GEN_INT (4));
2664 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2667 if (BYTES_BIG_ENDIAN)
2669 word_high = change_address (src, SImode, addr1);
2670 word_low = change_address (src, SImode, addr2);
2674 word_high = change_address (src, SImode, addr2);
2675 word_low = change_address (src, SImode, addr1);
2678 emit_insn (gen_bswapsi2 (dest_hi, word_low));
2679 emit_insn (gen_bswapsi2 (dest_lo, word_high));
2683 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2684 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2685 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2686 "!TARGET_POWERPC64 && reload_completed"
2690 rtx dest = operands[0];
2691 rtx src = operands[1];
2692 rtx op2 = operands[2];
2693 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2694 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2700 addr1 = XEXP (dest, 0);
2701 if (GET_CODE (addr1) == PLUS)
2703 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2704 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2708 emit_move_insn (op2, GEN_INT (4));
2709 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2712 if (BYTES_BIG_ENDIAN)
2714 word_high = change_address (dest, SImode, addr1);
2715 word_low = change_address (dest, SImode, addr2);
2719 word_high = change_address (dest, SImode, addr2);
2720 word_low = change_address (dest, SImode, addr1);
2723 emit_insn (gen_bswapsi2 (word_high, src_low));
2724 emit_insn (gen_bswapsi2 (word_low, src_high));
2728 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2729 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2730 (clobber (match_operand:SI 2 "" ""))]
2731 "!TARGET_POWERPC64 && reload_completed"
2735 rtx dest = operands[0];
2736 rtx src = operands[1];
2737 rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
2738 rtx src_low = simplify_gen_subreg (SImode, src, DImode, 4);
2739 rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
2740 rtx dest_low = simplify_gen_subreg (SImode, dest, DImode, 4);
2742 emit_insn (gen_bswapsi2 (dest_high, src_low));
2743 emit_insn (gen_bswapsi2 (dest_low, src_high));
2746 (define_expand "mulsi3"
2747 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2748 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2749 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2754 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2756 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2760 (define_insn "mulsi3_mq"
2761 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2762 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2763 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2764 (clobber (match_scratch:SI 3 "=q,q"))]
2767 {muls|mullw} %0,%1,%2
2768 {muli|mulli} %0,%1,%2"
2770 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2771 (const_string "imul3")
2772 (match_operand:SI 2 "short_cint_operand" "")
2773 (const_string "imul2")]
2774 (const_string "imul")))])
2776 (define_insn "mulsi3_no_mq"
2777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2778 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2779 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2782 {muls|mullw} %0,%1,%2
2783 {muli|mulli} %0,%1,%2"
2785 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2786 (const_string "imul3")
2787 (match_operand:SI 2 "short_cint_operand" "")
2788 (const_string "imul2")]
2789 (const_string "imul")))])
2791 (define_insn "*mulsi3_mq_internal1"
2792 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2793 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2794 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2796 (clobber (match_scratch:SI 3 "=r,r"))
2797 (clobber (match_scratch:SI 4 "=q,q"))]
2800 {muls.|mullw.} %3,%1,%2
2802 [(set_attr "type" "imul_compare")
2803 (set_attr "length" "4,8")])
2806 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2807 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2808 (match_operand:SI 2 "gpc_reg_operand" ""))
2810 (clobber (match_scratch:SI 3 ""))
2811 (clobber (match_scratch:SI 4 ""))]
2812 "TARGET_POWER && reload_completed"
2813 [(parallel [(set (match_dup 3)
2814 (mult:SI (match_dup 1) (match_dup 2)))
2815 (clobber (match_dup 4))])
2817 (compare:CC (match_dup 3)
2821 (define_insn "*mulsi3_no_mq_internal1"
2822 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2823 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2824 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2826 (clobber (match_scratch:SI 3 "=r,r"))]
2829 {muls.|mullw.} %3,%1,%2
2831 [(set_attr "type" "imul_compare")
2832 (set_attr "length" "4,8")])
2835 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2836 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2837 (match_operand:SI 2 "gpc_reg_operand" ""))
2839 (clobber (match_scratch:SI 3 ""))]
2840 "! TARGET_POWER && reload_completed"
2842 (mult:SI (match_dup 1) (match_dup 2)))
2844 (compare:CC (match_dup 3)
2848 (define_insn "*mulsi3_mq_internal2"
2849 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2850 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2851 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2853 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2854 (mult:SI (match_dup 1) (match_dup 2)))
2855 (clobber (match_scratch:SI 4 "=q,q"))]
2858 {muls.|mullw.} %0,%1,%2
2860 [(set_attr "type" "imul_compare")
2861 (set_attr "length" "4,8")])
2864 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2865 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2866 (match_operand:SI 2 "gpc_reg_operand" ""))
2868 (set (match_operand:SI 0 "gpc_reg_operand" "")
2869 (mult:SI (match_dup 1) (match_dup 2)))
2870 (clobber (match_scratch:SI 4 ""))]
2871 "TARGET_POWER && reload_completed"
2872 [(parallel [(set (match_dup 0)
2873 (mult:SI (match_dup 1) (match_dup 2)))
2874 (clobber (match_dup 4))])
2876 (compare:CC (match_dup 0)
2880 (define_insn "*mulsi3_no_mq_internal2"
2881 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2882 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2883 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2885 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2886 (mult:SI (match_dup 1) (match_dup 2)))]
2889 {muls.|mullw.} %0,%1,%2
2891 [(set_attr "type" "imul_compare")
2892 (set_attr "length" "4,8")])
2895 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2896 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2897 (match_operand:SI 2 "gpc_reg_operand" ""))
2899 (set (match_operand:SI 0 "gpc_reg_operand" "")
2900 (mult:SI (match_dup 1) (match_dup 2)))]
2901 "! TARGET_POWER && reload_completed"
2903 (mult:SI (match_dup 1) (match_dup 2)))
2905 (compare:CC (match_dup 0)
2909 ;; Operand 1 is divided by operand 2; quotient goes to operand
2910 ;; 0 and remainder to operand 3.
2911 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2913 (define_expand "divmodsi4"
2914 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2915 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2916 (match_operand:SI 2 "gpc_reg_operand" "")))
2917 (set (match_operand:SI 3 "register_operand" "")
2918 (mod:SI (match_dup 1) (match_dup 2)))])]
2919 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2922 if (! TARGET_POWER && ! TARGET_POWERPC)
2924 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2925 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2926 emit_insn (gen_divss_call ());
2927 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2928 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2933 (define_insn "*divmodsi4_internal"
2934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2935 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2936 (match_operand:SI 2 "gpc_reg_operand" "r")))
2937 (set (match_operand:SI 3 "register_operand" "=q")
2938 (mod:SI (match_dup 1) (match_dup 2)))]
2941 [(set_attr "type" "idiv")])
2943 (define_expand "udiv<mode>3"
2944 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2945 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2946 (match_operand:GPR 2 "gpc_reg_operand" "")))]
2947 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2950 if (! TARGET_POWER && ! TARGET_POWERPC)
2952 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2953 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2954 emit_insn (gen_quous_call ());
2955 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2958 else if (TARGET_POWER)
2960 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2965 (define_insn "udivsi3_mq"
2966 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2967 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2968 (match_operand:SI 2 "gpc_reg_operand" "r")))
2969 (clobber (match_scratch:SI 3 "=q"))]
2970 "TARGET_POWERPC && TARGET_POWER"
2972 [(set_attr "type" "idiv")])
2974 (define_insn "*udivsi3_no_mq"
2975 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2976 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2977 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2978 "TARGET_POWERPC && ! TARGET_POWER"
2981 (cond [(match_operand:SI 0 "" "")
2982 (const_string "idiv")]
2983 (const_string "ldiv")))])
2986 ;; For powers of two we can do srai/aze for divide and then adjust for
2987 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2988 ;; used; for PowerPC, force operands into register and do a normal divide;
2989 ;; for AIX common-mode, use quoss call on register operands.
2990 (define_expand "div<mode>3"
2991 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2992 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2993 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2997 if (GET_CODE (operands[2]) == CONST_INT
2998 && INTVAL (operands[2]) > 0
2999 && exact_log2 (INTVAL (operands[2])) >= 0)
3001 else if (TARGET_POWERPC)
3003 operands[2] = force_reg (<MODE>mode, operands[2]);
3006 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
3010 else if (TARGET_POWER)
3014 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3015 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3016 emit_insn (gen_quoss_call ());
3017 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3022 (define_insn "divsi3_mq"
3023 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3024 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3025 (match_operand:SI 2 "gpc_reg_operand" "r")))
3026 (clobber (match_scratch:SI 3 "=q"))]
3027 "TARGET_POWERPC && TARGET_POWER"
3029 [(set_attr "type" "idiv")])
3031 (define_insn "*div<mode>3_no_mq"
3032 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3033 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3034 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
3035 "TARGET_POWERPC && ! TARGET_POWER"
3038 (cond [(match_operand:SI 0 "" "")
3039 (const_string "idiv")]
3040 (const_string "ldiv")))])
3042 (define_expand "mod<mode>3"
3043 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
3044 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
3045 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
3053 if (GET_CODE (operands[2]) != CONST_INT
3054 || INTVAL (operands[2]) <= 0
3055 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
3058 temp1 = gen_reg_rtx (<MODE>mode);
3059 temp2 = gen_reg_rtx (<MODE>mode);
3061 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
3062 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
3063 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
3068 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
3069 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
3070 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
3072 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
3073 [(set_attr "type" "two")
3074 (set_attr "length" "8")])
3077 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3078 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3079 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3081 (clobber (match_scratch:P 3 "=r,r"))]
3084 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
3086 [(set_attr "type" "compare")
3087 (set_attr "length" "8,12")
3088 (set_attr "cell_micro" "not")])
3091 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3092 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3093 (match_operand:GPR 2 "exact_log2_cint_operand"
3096 (clobber (match_scratch:GPR 3 ""))]
3099 (div:<MODE> (match_dup 1) (match_dup 2)))
3101 (compare:CC (match_dup 3)
3106 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3107 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
3108 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
3110 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
3111 (div:P (match_dup 1) (match_dup 2)))]
3114 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
3116 [(set_attr "type" "compare")
3117 (set_attr "length" "8,12")
3118 (set_attr "cell_micro" "not")])
3121 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3122 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3123 (match_operand:GPR 2 "exact_log2_cint_operand"
3126 (set (match_operand:GPR 0 "gpc_reg_operand" "")
3127 (div:GPR (match_dup 1) (match_dup 2)))]
3130 (div:<MODE> (match_dup 1) (match_dup 2)))
3132 (compare:CC (match_dup 0)
3137 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3140 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3142 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
3143 (match_operand:SI 3 "gpc_reg_operand" "r")))
3144 (set (match_operand:SI 2 "register_operand" "=*q")
3147 (zero_extend:DI (match_dup 1)) (const_int 32))
3148 (zero_extend:DI (match_dup 4)))
3152 [(set_attr "type" "idiv")])
3154 ;; To do unsigned divide we handle the cases of the divisor looking like a
3155 ;; negative number. If it is a constant that is less than 2**31, we don't
3156 ;; have to worry about the branches. So make a few subroutines here.
3158 ;; First comes the normal case.
3159 (define_expand "udivmodsi4_normal"
3160 [(set (match_dup 4) (const_int 0))
3161 (parallel [(set (match_operand:SI 0 "" "")
3162 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3164 (zero_extend:DI (match_operand:SI 1 "" "")))
3165 (match_operand:SI 2 "" "")))
3166 (set (match_operand:SI 3 "" "")
3167 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
3169 (zero_extend:DI (match_dup 1)))
3173 { operands[4] = gen_reg_rtx (SImode); }")
3175 ;; This handles the branches.
3176 (define_expand "udivmodsi4_tests"
3177 [(set (match_operand:SI 0 "" "") (const_int 0))
3178 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
3179 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
3180 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
3181 (label_ref (match_operand:SI 4 "" "")) (pc)))
3182 (set (match_dup 0) (const_int 1))
3183 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
3184 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
3185 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
3186 (label_ref (match_dup 4)) (pc)))]
3189 { operands[5] = gen_reg_rtx (CCUNSmode);
3190 operands[6] = gen_reg_rtx (CCmode);
3193 (define_expand "udivmodsi4"
3194 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3195 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
3196 (match_operand:SI 2 "reg_or_cint_operand" "")))
3197 (set (match_operand:SI 3 "gpc_reg_operand" "")
3198 (umod:SI (match_dup 1) (match_dup 2)))])]
3206 if (! TARGET_POWERPC)
3208 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
3209 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
3210 emit_insn (gen_divus_call ());
3211 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
3212 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
3219 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
3221 operands[2] = force_reg (SImode, operands[2]);
3222 label = gen_label_rtx ();
3223 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
3224 operands[3], label));
3227 operands[2] = force_reg (SImode, operands[2]);
3229 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
3237 ;; AIX architecture-independent common-mode multiply (DImode),
3238 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
3239 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
3240 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
3241 ;; assumed unused if generating common-mode, so ignore.
3242 (define_insn "mulh_call"
3245 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
3246 (sign_extend:DI (reg:SI 4)))
3248 (clobber (reg:SI LR_REGNO))]
3249 "! TARGET_POWER && ! TARGET_POWERPC"
3251 [(set_attr "type" "imul")])
3253 (define_insn "mull_call"
3255 (mult:DI (sign_extend:DI (reg:SI 3))
3256 (sign_extend:DI (reg:SI 4))))
3257 (clobber (reg:SI LR_REGNO))
3258 (clobber (reg:SI 0))]
3259 "! TARGET_POWER && ! TARGET_POWERPC"
3261 [(set_attr "type" "imul")])
3263 (define_insn "divss_call"
3265 (div:SI (reg:SI 3) (reg:SI 4)))
3267 (mod:SI (reg:SI 3) (reg:SI 4)))
3268 (clobber (reg:SI LR_REGNO))
3269 (clobber (reg:SI 0))]
3270 "! TARGET_POWER && ! TARGET_POWERPC"
3272 [(set_attr "type" "idiv")])
3274 (define_insn "divus_call"
3276 (udiv:SI (reg:SI 3) (reg:SI 4)))
3278 (umod:SI (reg:SI 3) (reg:SI 4)))
3279 (clobber (reg:SI LR_REGNO))
3280 (clobber (reg:SI 0))
3281 (clobber (match_scratch:CC 0 "=x"))
3282 (clobber (reg:CC CR1_REGNO))]
3283 "! TARGET_POWER && ! TARGET_POWERPC"
3285 [(set_attr "type" "idiv")])
3287 (define_insn "quoss_call"
3289 (div:SI (reg:SI 3) (reg:SI 4)))
3290 (clobber (reg:SI LR_REGNO))]
3291 "! TARGET_POWER && ! TARGET_POWERPC"
3293 [(set_attr "type" "idiv")])
3295 (define_insn "quous_call"
3297 (udiv:SI (reg:SI 3) (reg:SI 4)))
3298 (clobber (reg:SI LR_REGNO))
3299 (clobber (reg:SI 0))
3300 (clobber (match_scratch:CC 0 "=x"))
3301 (clobber (reg:CC CR1_REGNO))]
3302 "! TARGET_POWER && ! TARGET_POWERPC"
3304 [(set_attr "type" "idiv")])
3306 ;; Logical instructions
3307 ;; The logical instructions are mostly combined by using match_operator,
3308 ;; but the plain AND insns are somewhat different because there is no
3309 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
3310 ;; those rotate-and-mask operations. Thus, the AND insns come first.
3312 (define_expand "andsi3"
3314 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3315 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3316 (match_operand:SI 2 "and_operand" "")))
3317 (clobber (match_scratch:CC 3 ""))])]
3321 (define_insn "andsi3_mc"
3322 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3323 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
3324 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
3325 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
3326 "rs6000_gen_cell_microcode"
3329 {rlinm|rlwinm} %0,%1,0,%m2,%M2
3330 {andil.|andi.} %0,%1,%b2
3331 {andiu.|andis.} %0,%1,%u2"
3332 [(set_attr "type" "*,*,fast_compare,fast_compare")])
3334 (define_insn "andsi3_nomc"
3335 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3336 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3337 (match_operand:SI 2 "and_operand" "?r,T")))
3338 (clobber (match_scratch:CC 3 "=X,X"))]
3339 "!rs6000_gen_cell_microcode"
3342 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3344 (define_insn "andsi3_internal0_nomc"
3345 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3346 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
3347 (match_operand:SI 2 "and_operand" "?r,T")))]
3348 "!rs6000_gen_cell_microcode"
3351 {rlinm|rlwinm} %0,%1,0,%m2,%M2")
3354 ;; Note to set cr's other than cr0 we do the and immediate and then
3355 ;; the test again -- this avoids a mfcr which on the higher end
3356 ;; machines causes an execution serialization
3358 (define_insn "*andsi3_internal2_mc"
3359 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3360 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3361 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3363 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3364 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3365 "TARGET_32BIT && rs6000_gen_cell_microcode"
3368 {andil.|andi.} %3,%1,%b2
3369 {andiu.|andis.} %3,%1,%u2
3370 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3375 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3376 compare,compare,compare,compare")
3377 (set_attr "length" "4,4,4,4,8,8,8,8")])
3379 (define_insn "*andsi3_internal3_mc"
3380 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3381 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3382 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3384 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
3385 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3386 "TARGET_64BIT && rs6000_gen_cell_microcode"
3389 {andil.|andi.} %3,%1,%b2
3390 {andiu.|andis.} %3,%1,%u2
3391 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
3396 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3397 compare,compare,compare")
3398 (set_attr "length" "8,4,4,4,8,8,8,8")])
3401 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3402 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
3403 (match_operand:GPR 2 "and_operand" ""))
3405 (clobber (match_scratch:GPR 3 ""))
3406 (clobber (match_scratch:CC 4 ""))]
3408 [(parallel [(set (match_dup 3)
3409 (and:<MODE> (match_dup 1)
3411 (clobber (match_dup 4))])
3413 (compare:CC (match_dup 3)
3417 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3418 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3421 [(set (match_operand:CC 0 "cc_reg_operand" "")
3422 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3423 (match_operand:SI 2 "gpc_reg_operand" ""))
3425 (clobber (match_scratch:SI 3 ""))
3426 (clobber (match_scratch:CC 4 ""))]
3427 "TARGET_POWERPC64 && reload_completed"
3428 [(parallel [(set (match_dup 3)
3429 (and:SI (match_dup 1)
3431 (clobber (match_dup 4))])
3433 (compare:CC (match_dup 3)
3437 (define_insn "*andsi3_internal4"
3438 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3439 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3440 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3442 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3443 (and:SI (match_dup 1)
3445 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3446 "TARGET_32BIT && rs6000_gen_cell_microcode"
3449 {andil.|andi.} %0,%1,%b2
3450 {andiu.|andis.} %0,%1,%u2
3451 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3456 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
3457 compare,compare,compare,compare")
3458 (set_attr "length" "4,4,4,4,8,8,8,8")])
3460 (define_insn "*andsi3_internal5_mc"
3461 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3462 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3463 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3465 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3466 (and:SI (match_dup 1)
3468 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3469 "TARGET_64BIT && rs6000_gen_cell_microcode"
3472 {andil.|andi.} %0,%1,%b2
3473 {andiu.|andis.} %0,%1,%u2
3474 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3479 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
3480 compare,compare,compare")
3481 (set_attr "length" "8,4,4,4,8,8,8,8")])
3484 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3485 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3486 (match_operand:SI 2 "and_operand" ""))
3488 (set (match_operand:SI 0 "gpc_reg_operand" "")
3489 (and:SI (match_dup 1)
3491 (clobber (match_scratch:CC 4 ""))]
3493 [(parallel [(set (match_dup 0)
3494 (and:SI (match_dup 1)
3496 (clobber (match_dup 4))])
3498 (compare:CC (match_dup 0)
3503 [(set (match_operand:CC 3 "cc_reg_operand" "")
3504 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3505 (match_operand:SI 2 "gpc_reg_operand" ""))
3507 (set (match_operand:SI 0 "gpc_reg_operand" "")
3508 (and:SI (match_dup 1)
3510 (clobber (match_scratch:CC 4 ""))]
3511 "TARGET_POWERPC64 && reload_completed"
3512 [(parallel [(set (match_dup 0)
3513 (and:SI (match_dup 1)
3515 (clobber (match_dup 4))])
3517 (compare:CC (match_dup 0)
3521 ;; Handle the PowerPC64 rlwinm corner case
3523 (define_insn_and_split "*andsi3_internal6"
3524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3525 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3526 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3531 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3534 (rotate:SI (match_dup 0) (match_dup 5)))]
3537 int mb = extract_MB (operands[2]);
3538 int me = extract_ME (operands[2]);
3539 operands[3] = GEN_INT (me + 1);
3540 operands[5] = GEN_INT (32 - (me + 1));
3541 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3543 [(set_attr "length" "8")])
3545 (define_expand "iorsi3"
3546 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3547 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3548 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3552 if (GET_CODE (operands[2]) == CONST_INT
3553 && ! logical_operand (operands[2], SImode))
3555 HOST_WIDE_INT value = INTVAL (operands[2]);
3556 rtx tmp = ((!can_create_pseudo_p ()
3557 || rtx_equal_p (operands[0], operands[1]))
3558 ? operands[0] : gen_reg_rtx (SImode));
3560 emit_insn (gen_iorsi3 (tmp, operands[1],
3561 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3562 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3567 (define_expand "xorsi3"
3568 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3569 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3570 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3574 if (GET_CODE (operands[2]) == CONST_INT
3575 && ! logical_operand (operands[2], SImode))
3577 HOST_WIDE_INT value = INTVAL (operands[2]);
3578 rtx tmp = ((!can_create_pseudo_p ()
3579 || rtx_equal_p (operands[0], operands[1]))
3580 ? operands[0] : gen_reg_rtx (SImode));
3582 emit_insn (gen_xorsi3 (tmp, operands[1],
3583 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3584 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3589 (define_insn "*boolsi3_internal1"
3590 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3591 (match_operator:SI 3 "boolean_or_operator"
3592 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3593 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3597 {%q3il|%q3i} %0,%1,%b2
3598 {%q3iu|%q3is} %0,%1,%u2")
3600 (define_insn "*boolsi3_internal2"
3601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3602 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3603 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3604 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3606 (clobber (match_scratch:SI 3 "=r,r"))]
3611 [(set_attr "type" "fast_compare,compare")
3612 (set_attr "length" "4,8")])
3615 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3616 (compare:CC (match_operator:SI 4 "boolean_operator"
3617 [(match_operand:SI 1 "gpc_reg_operand" "")
3618 (match_operand:SI 2 "gpc_reg_operand" "")])
3620 (clobber (match_scratch:SI 3 ""))]
3621 "TARGET_32BIT && reload_completed"
3622 [(set (match_dup 3) (match_dup 4))
3624 (compare:CC (match_dup 3)
3628 (define_insn "*boolsi3_internal3"
3629 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3630 (compare:CC (match_operator:SI 4 "boolean_operator"
3631 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3632 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3634 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3640 [(set_attr "type" "fast_compare,compare")
3641 (set_attr "length" "4,8")])
3644 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3645 (compare:CC (match_operator:SI 4 "boolean_operator"
3646 [(match_operand:SI 1 "gpc_reg_operand" "")
3647 (match_operand:SI 2 "gpc_reg_operand" "")])
3649 (set (match_operand:SI 0 "gpc_reg_operand" "")
3651 "TARGET_32BIT && reload_completed"
3652 [(set (match_dup 0) (match_dup 4))
3654 (compare:CC (match_dup 0)
3658 ;; Split a logical operation that we can't do in one insn into two insns,
3659 ;; each of which does one 16-bit part. This is used by combine.
3662 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3663 (match_operator:SI 3 "boolean_or_operator"
3664 [(match_operand:SI 1 "gpc_reg_operand" "")
3665 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3667 [(set (match_dup 0) (match_dup 4))
3668 (set (match_dup 0) (match_dup 5))]
3672 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3673 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3675 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3676 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3680 (define_insn "*boolcsi3_internal1"
3681 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3682 (match_operator:SI 3 "boolean_operator"
3683 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3684 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3688 (define_insn "*boolcsi3_internal2"
3689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3690 (compare:CC (match_operator:SI 4 "boolean_operator"
3691 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3692 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3694 (clobber (match_scratch:SI 3 "=r,r"))]
3699 [(set_attr "type" "compare")
3700 (set_attr "length" "4,8")])
3703 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3704 (compare:CC (match_operator:SI 4 "boolean_operator"
3705 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3706 (match_operand:SI 2 "gpc_reg_operand" "")])
3708 (clobber (match_scratch:SI 3 ""))]
3709 "TARGET_32BIT && reload_completed"
3710 [(set (match_dup 3) (match_dup 4))
3712 (compare:CC (match_dup 3)
3716 (define_insn "*boolcsi3_internal3"
3717 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3718 (compare:CC (match_operator:SI 4 "boolean_operator"
3719 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3720 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3722 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3728 [(set_attr "type" "compare")
3729 (set_attr "length" "4,8")])
3732 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3733 (compare:CC (match_operator:SI 4 "boolean_operator"
3734 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3735 (match_operand:SI 2 "gpc_reg_operand" "")])
3737 (set (match_operand:SI 0 "gpc_reg_operand" "")
3739 "TARGET_32BIT && reload_completed"
3740 [(set (match_dup 0) (match_dup 4))
3742 (compare:CC (match_dup 0)
3746 (define_insn "*boolccsi3_internal1"
3747 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3748 (match_operator:SI 3 "boolean_operator"
3749 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3750 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3754 (define_insn "*boolccsi3_internal2"
3755 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3756 (compare:CC (match_operator:SI 4 "boolean_operator"
3757 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3758 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3760 (clobber (match_scratch:SI 3 "=r,r"))]
3765 [(set_attr "type" "fast_compare,compare")
3766 (set_attr "length" "4,8")])
3769 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3770 (compare:CC (match_operator:SI 4 "boolean_operator"
3771 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3772 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3774 (clobber (match_scratch:SI 3 ""))]
3775 "TARGET_32BIT && reload_completed"
3776 [(set (match_dup 3) (match_dup 4))
3778 (compare:CC (match_dup 3)
3782 (define_insn "*boolccsi3_internal3"
3783 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3784 (compare:CC (match_operator:SI 4 "boolean_operator"
3785 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3786 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3788 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3794 [(set_attr "type" "fast_compare,compare")
3795 (set_attr "length" "4,8")])
3798 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3799 (compare:CC (match_operator:SI 4 "boolean_operator"
3800 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3801 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3803 (set (match_operand:SI 0 "gpc_reg_operand" "")
3805 "TARGET_32BIT && reload_completed"
3806 [(set (match_dup 0) (match_dup 4))
3808 (compare:CC (match_dup 0)
3812 ;; maskir insn. We need four forms because things might be in arbitrary
3813 ;; orders. Don't define forms that only set CR fields because these
3814 ;; would modify an input register.
3816 (define_insn "*maskir_internal1"
3817 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3818 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3819 (match_operand:SI 1 "gpc_reg_operand" "0"))
3820 (and:SI (match_dup 2)
3821 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3825 (define_insn "*maskir_internal2"
3826 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3827 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3828 (match_operand:SI 1 "gpc_reg_operand" "0"))
3829 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3834 (define_insn "*maskir_internal3"
3835 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3836 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3837 (match_operand:SI 3 "gpc_reg_operand" "r"))
3838 (and:SI (not:SI (match_dup 2))
3839 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3843 (define_insn "*maskir_internal4"
3844 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3845 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3846 (match_operand:SI 2 "gpc_reg_operand" "r"))
3847 (and:SI (not:SI (match_dup 2))
3848 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3852 (define_insn "*maskir_internal5"
3853 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3855 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3856 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3857 (and:SI (match_dup 2)
3858 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3860 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3861 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3862 (and:SI (match_dup 2) (match_dup 3))))]
3867 [(set_attr "type" "compare")
3868 (set_attr "length" "4,8")])
3871 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3873 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3874 (match_operand:SI 1 "gpc_reg_operand" ""))
3875 (and:SI (match_dup 2)
3876 (match_operand:SI 3 "gpc_reg_operand" "")))
3878 (set (match_operand:SI 0 "gpc_reg_operand" "")
3879 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3880 (and:SI (match_dup 2) (match_dup 3))))]
3881 "TARGET_POWER && reload_completed"
3883 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3884 (and:SI (match_dup 2) (match_dup 3))))
3886 (compare:CC (match_dup 0)
3890 (define_insn "*maskir_internal6"
3891 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3893 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3894 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3895 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3898 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3899 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3900 (and:SI (match_dup 3) (match_dup 2))))]
3905 [(set_attr "type" "compare")
3906 (set_attr "length" "4,8")])
3909 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3911 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3912 (match_operand:SI 1 "gpc_reg_operand" ""))
3913 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3916 (set (match_operand:SI 0 "gpc_reg_operand" "")
3917 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3918 (and:SI (match_dup 3) (match_dup 2))))]
3919 "TARGET_POWER && reload_completed"
3921 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3922 (and:SI (match_dup 3) (match_dup 2))))
3924 (compare:CC (match_dup 0)
3928 (define_insn "*maskir_internal7"
3929 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3931 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3932 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3933 (and:SI (not:SI (match_dup 2))
3934 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3936 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3937 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3938 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3943 [(set_attr "type" "compare")
3944 (set_attr "length" "4,8")])
3947 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3949 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3950 (match_operand:SI 3 "gpc_reg_operand" ""))
3951 (and:SI (not:SI (match_dup 2))
3952 (match_operand:SI 1 "gpc_reg_operand" "")))
3954 (set (match_operand:SI 0 "gpc_reg_operand" "")
3955 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3956 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3957 "TARGET_POWER && reload_completed"
3959 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3960 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3962 (compare:CC (match_dup 0)
3966 (define_insn "*maskir_internal8"
3967 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3969 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3970 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3971 (and:SI (not:SI (match_dup 2))
3972 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3974 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3975 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3976 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3981 [(set_attr "type" "compare")
3982 (set_attr "length" "4,8")])
3985 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3987 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3988 (match_operand:SI 2 "gpc_reg_operand" ""))
3989 (and:SI (not:SI (match_dup 2))
3990 (match_operand:SI 1 "gpc_reg_operand" "")))
3992 (set (match_operand:SI 0 "gpc_reg_operand" "")
3993 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3994 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3995 "TARGET_POWER && reload_completed"
3997 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3998 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
4000 (compare:CC (match_dup 0)
4004 ;; Rotate and shift insns, in all their variants. These support shifts,
4005 ;; field inserts and extracts, and various combinations thereof.
4006 (define_expand "insv"
4007 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
4008 (match_operand:SI 1 "const_int_operand" "")
4009 (match_operand:SI 2 "const_int_operand" ""))
4010 (match_operand 3 "gpc_reg_operand" ""))]
4014 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4015 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4016 compiler if the address of the structure is taken later. Likewise, do
4017 not handle invalid E500 subregs. */
4018 if (GET_CODE (operands[0]) == SUBREG
4019 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
4020 || ((TARGET_E500_DOUBLE || TARGET_SPE)
4021 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
4024 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
4025 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
4027 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
4031 (define_insn "insvsi"
4032 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4033 (match_operand:SI 1 "const_int_operand" "i")
4034 (match_operand:SI 2 "const_int_operand" "i"))
4035 (match_operand:SI 3 "gpc_reg_operand" "r"))]
4039 int start = INTVAL (operands[2]) & 31;
4040 int size = INTVAL (operands[1]) & 31;
4042 operands[4] = GEN_INT (32 - start - size);
4043 operands[1] = GEN_INT (start + size - 1);
4044 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4046 [(set_attr "type" "insert_word")])
4048 (define_insn "*insvsi_internal1"
4049 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4050 (match_operand:SI 1 "const_int_operand" "i")
4051 (match_operand:SI 2 "const_int_operand" "i"))
4052 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4053 (match_operand:SI 4 "const_int_operand" "i")))]
4054 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4057 int shift = INTVAL (operands[4]) & 31;
4058 int start = INTVAL (operands[2]) & 31;
4059 int size = INTVAL (operands[1]) & 31;
4061 operands[4] = GEN_INT (shift - start - size);
4062 operands[1] = GEN_INT (start + size - 1);
4063 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4065 [(set_attr "type" "insert_word")])
4067 (define_insn "*insvsi_internal2"
4068 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4069 (match_operand:SI 1 "const_int_operand" "i")
4070 (match_operand:SI 2 "const_int_operand" "i"))
4071 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4072 (match_operand:SI 4 "const_int_operand" "i")))]
4073 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4076 int shift = INTVAL (operands[4]) & 31;
4077 int start = INTVAL (operands[2]) & 31;
4078 int size = INTVAL (operands[1]) & 31;
4080 operands[4] = GEN_INT (32 - shift - start - size);
4081 operands[1] = GEN_INT (start + size - 1);
4082 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4084 [(set_attr "type" "insert_word")])
4086 (define_insn "*insvsi_internal3"
4087 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4088 (match_operand:SI 1 "const_int_operand" "i")
4089 (match_operand:SI 2 "const_int_operand" "i"))
4090 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4091 (match_operand:SI 4 "const_int_operand" "i")))]
4092 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
4095 int shift = INTVAL (operands[4]) & 31;
4096 int start = INTVAL (operands[2]) & 31;
4097 int size = INTVAL (operands[1]) & 31;
4099 operands[4] = GEN_INT (32 - shift - start - size);
4100 operands[1] = GEN_INT (start + size - 1);
4101 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4103 [(set_attr "type" "insert_word")])
4105 (define_insn "*insvsi_internal4"
4106 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4107 (match_operand:SI 1 "const_int_operand" "i")
4108 (match_operand:SI 2 "const_int_operand" "i"))
4109 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4110 (match_operand:SI 4 "const_int_operand" "i")
4111 (match_operand:SI 5 "const_int_operand" "i")))]
4112 "INTVAL (operands[4]) >= INTVAL (operands[1])"
4115 int extract_start = INTVAL (operands[5]) & 31;
4116 int extract_size = INTVAL (operands[4]) & 31;
4117 int insert_start = INTVAL (operands[2]) & 31;
4118 int insert_size = INTVAL (operands[1]) & 31;
4120 /* Align extract field with insert field */
4121 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
4122 operands[1] = GEN_INT (insert_start + insert_size - 1);
4123 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
4125 [(set_attr "type" "insert_word")])
4127 ;; combine patterns for rlwimi
4128 (define_insn "*insvsi_internal5"
4129 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4130 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4131 (match_operand:SI 1 "mask_operand" "i"))
4132 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4133 (match_operand:SI 2 "const_int_operand" "i"))
4134 (match_operand:SI 5 "mask_operand" "i"))))]
4135 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4138 int me = extract_ME(operands[5]);
4139 int mb = extract_MB(operands[5]);
4140 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4141 operands[2] = GEN_INT(mb);
4142 operands[1] = GEN_INT(me);
4143 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4145 [(set_attr "type" "insert_word")])
4147 (define_insn "*insvsi_internal6"
4148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4149 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
4150 (match_operand:SI 2 "const_int_operand" "i"))
4151 (match_operand:SI 5 "mask_operand" "i"))
4152 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
4153 (match_operand:SI 1 "mask_operand" "i"))))]
4154 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
4157 int me = extract_ME(operands[5]);
4158 int mb = extract_MB(operands[5]);
4159 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
4160 operands[2] = GEN_INT(mb);
4161 operands[1] = GEN_INT(me);
4162 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
4164 [(set_attr "type" "insert_word")])
4166 (define_insn "insvdi"
4167 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4168 (match_operand:SI 1 "const_int_operand" "i")
4169 (match_operand:SI 2 "const_int_operand" "i"))
4170 (match_operand:DI 3 "gpc_reg_operand" "r"))]
4174 int start = INTVAL (operands[2]) & 63;
4175 int size = INTVAL (operands[1]) & 63;
4177 operands[1] = GEN_INT (64 - start - size);
4178 return \"rldimi %0,%3,%H1,%H2\";
4180 [(set_attr "type" "insert_dword")])
4182 (define_insn "*insvdi_internal2"
4183 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4184 (match_operand:SI 1 "const_int_operand" "i")
4185 (match_operand:SI 2 "const_int_operand" "i"))
4186 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4187 (match_operand:SI 4 "const_int_operand" "i")))]
4189 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4192 int shift = INTVAL (operands[4]) & 63;
4193 int start = (INTVAL (operands[2]) & 63) - 32;
4194 int size = INTVAL (operands[1]) & 63;
4196 operands[4] = GEN_INT (64 - shift - start - size);
4197 operands[2] = GEN_INT (start);
4198 operands[1] = GEN_INT (start + size - 1);
4199 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4202 (define_insn "*insvdi_internal3"
4203 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
4204 (match_operand:SI 1 "const_int_operand" "i")
4205 (match_operand:SI 2 "const_int_operand" "i"))
4206 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
4207 (match_operand:SI 4 "const_int_operand" "i")))]
4209 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
4212 int shift = INTVAL (operands[4]) & 63;
4213 int start = (INTVAL (operands[2]) & 63) - 32;
4214 int size = INTVAL (operands[1]) & 63;
4216 operands[4] = GEN_INT (64 - shift - start - size);
4217 operands[2] = GEN_INT (start);
4218 operands[1] = GEN_INT (start + size - 1);
4219 return \"rlwimi %0,%3,%h4,%h2,%h1\";
4222 (define_expand "extzv"
4223 [(set (match_operand 0 "gpc_reg_operand" "")
4224 (zero_extract (match_operand 1 "gpc_reg_operand" "")
4225 (match_operand:SI 2 "const_int_operand" "")
4226 (match_operand:SI 3 "const_int_operand" "")))]
4230 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
4231 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
4232 compiler if the address of the structure is taken later. */
4233 if (GET_CODE (operands[0]) == SUBREG
4234 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
4237 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
4238 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
4240 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
4244 (define_insn "extzvsi"
4245 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4246 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4247 (match_operand:SI 2 "const_int_operand" "i")
4248 (match_operand:SI 3 "const_int_operand" "i")))]
4252 int start = INTVAL (operands[3]) & 31;
4253 int size = INTVAL (operands[2]) & 31;
4255 if (start + size >= 32)
4256 operands[3] = const0_rtx;
4258 operands[3] = GEN_INT (start + size);
4259 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
4262 (define_insn "*extzvsi_internal1"
4263 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4264 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4265 (match_operand:SI 2 "const_int_operand" "i,i")
4266 (match_operand:SI 3 "const_int_operand" "i,i"))
4268 (clobber (match_scratch:SI 4 "=r,r"))]
4272 int start = INTVAL (operands[3]) & 31;
4273 int size = INTVAL (operands[2]) & 31;
4275 /* Force split for non-cc0 compare. */
4276 if (which_alternative == 1)
4279 /* If the bit-field being tested fits in the upper or lower half of a
4280 word, it is possible to use andiu. or andil. to test it. This is
4281 useful because the condition register set-use delay is smaller for
4282 andi[ul]. than for rlinm. This doesn't work when the starting bit
4283 position is 0 because the LT and GT bits may be set wrong. */
4285 if ((start > 0 && start + size <= 16) || start >= 16)
4287 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
4288 - (1 << (16 - (start & 15) - size))));
4290 return \"{andiu.|andis.} %4,%1,%3\";
4292 return \"{andil.|andi.} %4,%1,%3\";
4295 if (start + size >= 32)
4296 operands[3] = const0_rtx;
4298 operands[3] = GEN_INT (start + size);
4299 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
4301 [(set_attr "type" "delayed_compare")
4302 (set_attr "length" "4,8")])
4305 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4306 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4307 (match_operand:SI 2 "const_int_operand" "")
4308 (match_operand:SI 3 "const_int_operand" ""))
4310 (clobber (match_scratch:SI 4 ""))]
4313 (zero_extract:SI (match_dup 1) (match_dup 2)
4316 (compare:CC (match_dup 4)
4320 (define_insn "*extzvsi_internal2"
4321 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4322 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4323 (match_operand:SI 2 "const_int_operand" "i,i")
4324 (match_operand:SI 3 "const_int_operand" "i,i"))
4326 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4327 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4331 int start = INTVAL (operands[3]) & 31;
4332 int size = INTVAL (operands[2]) & 31;
4334 /* Force split for non-cc0 compare. */
4335 if (which_alternative == 1)
4338 /* Since we are using the output value, we can't ignore any need for
4339 a shift. The bit-field must end at the LSB. */
4340 if (start >= 16 && start + size == 32)
4342 operands[3] = GEN_INT ((1 << size) - 1);
4343 return \"{andil.|andi.} %0,%1,%3\";
4346 if (start + size >= 32)
4347 operands[3] = const0_rtx;
4349 operands[3] = GEN_INT (start + size);
4350 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
4352 [(set_attr "type" "delayed_compare")
4353 (set_attr "length" "4,8")])
4356 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4357 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
4358 (match_operand:SI 2 "const_int_operand" "")
4359 (match_operand:SI 3 "const_int_operand" ""))
4361 (set (match_operand:SI 0 "gpc_reg_operand" "")
4362 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
4365 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
4367 (compare:CC (match_dup 0)
4371 (define_insn "extzvdi"
4372 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4373 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4374 (match_operand:SI 2 "const_int_operand" "i")
4375 (match_operand:SI 3 "const_int_operand" "i")))]
4379 int start = INTVAL (operands[3]) & 63;
4380 int size = INTVAL (operands[2]) & 63;
4382 if (start + size >= 64)
4383 operands[3] = const0_rtx;
4385 operands[3] = GEN_INT (start + size);
4386 operands[2] = GEN_INT (64 - size);
4387 return \"rldicl %0,%1,%3,%2\";
4390 (define_insn "*extzvdi_internal1"
4391 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
4392 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4393 (match_operand:SI 2 "const_int_operand" "i")
4394 (match_operand:SI 3 "const_int_operand" "i"))
4396 (clobber (match_scratch:DI 4 "=r"))]
4397 "TARGET_64BIT && rs6000_gen_cell_microcode"
4400 int start = INTVAL (operands[3]) & 63;
4401 int size = INTVAL (operands[2]) & 63;
4403 if (start + size >= 64)
4404 operands[3] = const0_rtx;
4406 operands[3] = GEN_INT (start + size);
4407 operands[2] = GEN_INT (64 - size);
4408 return \"rldicl. %4,%1,%3,%2\";
4410 [(set_attr "type" "compare")])
4412 (define_insn "*extzvdi_internal2"
4413 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
4414 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4415 (match_operand:SI 2 "const_int_operand" "i")
4416 (match_operand:SI 3 "const_int_operand" "i"))
4418 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4419 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
4420 "TARGET_64BIT && rs6000_gen_cell_microcode"
4423 int start = INTVAL (operands[3]) & 63;
4424 int size = INTVAL (operands[2]) & 63;
4426 if (start + size >= 64)
4427 operands[3] = const0_rtx;
4429 operands[3] = GEN_INT (start + size);
4430 operands[2] = GEN_INT (64 - size);
4431 return \"rldicl. %0,%1,%3,%2\";
4433 [(set_attr "type" "compare")])
4435 (define_insn "rotlsi3"
4436 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4437 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4438 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4441 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4442 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4443 [(set_attr "type" "var_shift_rotate,integer")])
4445 (define_insn "*rotlsi3_64"
4446 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4448 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4449 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4452 {rlnm|rlwnm} %0,%1,%2,0xffffffff
4453 {rlinm|rlwinm} %0,%1,%h2,0xffffffff"
4454 [(set_attr "type" "var_shift_rotate,integer")])
4456 (define_insn "*rotlsi3_internal2"
4457 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4458 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4459 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4461 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4464 {rlnm.|rlwnm.} %3,%1,%2,0xffffffff
4465 {rlinm.|rlwinm.} %3,%1,%h2,0xffffffff
4468 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4469 (set_attr "length" "4,4,8,8")])
4472 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4473 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4474 (match_operand:SI 2 "reg_or_cint_operand" ""))
4476 (clobber (match_scratch:SI 3 ""))]
4479 (rotate:SI (match_dup 1) (match_dup 2)))
4481 (compare:CC (match_dup 3)
4485 (define_insn "*rotlsi3_internal3"
4486 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4487 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4488 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4490 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4491 (rotate:SI (match_dup 1) (match_dup 2)))]
4494 {rlnm.|rlwnm.} %0,%1,%2,0xffffffff
4495 {rlinm.|rlwinm.} %0,%1,%h2,0xffffffff
4498 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4499 (set_attr "length" "4,4,8,8")])
4502 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4503 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4504 (match_operand:SI 2 "reg_or_cint_operand" ""))
4506 (set (match_operand:SI 0 "gpc_reg_operand" "")
4507 (rotate:SI (match_dup 1) (match_dup 2)))]
4510 (rotate:SI (match_dup 1) (match_dup 2)))
4512 (compare:CC (match_dup 0)
4516 (define_insn "*rotlsi3_internal4"
4517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4518 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4519 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
4520 (match_operand:SI 3 "mask_operand" "n,n")))]
4523 {rlnm|rlwnm} %0,%1,%2,%m3,%M3
4524 {rlinm|rlwinm} %0,%1,%h2,%m3,%M3"
4525 [(set_attr "type" "var_shift_rotate,integer")])
4527 (define_insn "*rotlsi3_internal5"
4528 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4530 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4531 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4532 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4534 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
4537 {rlnm.|rlwnm.} %4,%1,%2,%m3,%M3
4538 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4541 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4542 (set_attr "length" "4,4,8,8")])
4545 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4547 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4548 (match_operand:SI 2 "reg_or_cint_operand" ""))
4549 (match_operand:SI 3 "mask_operand" ""))
4551 (clobber (match_scratch:SI 4 ""))]
4554 (and:SI (rotate:SI (match_dup 1)
4558 (compare:CC (match_dup 4)
4562 (define_insn "*rotlsi3_internal6"
4563 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
4565 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4566 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4567 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
4569 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4570 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4573 {rlnm.|rlwnm.} %0,%1,%2,%m3,%M3
4574 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4577 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4578 (set_attr "length" "4,4,8,8")])
4581 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4583 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4584 (match_operand:SI 2 "reg_or_cint_operand" ""))
4585 (match_operand:SI 3 "mask_operand" ""))
4587 (set (match_operand:SI 0 "gpc_reg_operand" "")
4588 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4591 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4593 (compare:CC (match_dup 0)
4597 (define_insn "*rotlsi3_internal7"
4598 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4601 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4602 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4604 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff"
4605 [(set (attr "cell_micro")
4606 (if_then_else (match_operand:SI 2 "const_int_operand" "")
4607 (const_string "not")
4608 (const_string "always")))])
4610 (define_insn "*rotlsi3_internal8"
4611 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4612 (compare:CC (zero_extend:SI
4614 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4615 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4617 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4620 {rlnm.|rlwnm.} %3,%1,%2,0xff
4621 {rlinm.|rlwinm.} %3,%1,%h2,0xff
4624 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4625 (set_attr "length" "4,4,8,8")])
4628 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4629 (compare:CC (zero_extend:SI
4631 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4632 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4634 (clobber (match_scratch:SI 3 ""))]
4637 (zero_extend:SI (subreg:QI
4638 (rotate:SI (match_dup 1)
4641 (compare:CC (match_dup 3)
4645 (define_insn "*rotlsi3_internal9"
4646 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4647 (compare:CC (zero_extend:SI
4649 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4650 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4652 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4653 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4656 {rlnm.|rlwnm.} %0,%1,%2,0xff
4657 {rlinm.|rlwinm.} %0,%1,%h2,0xff
4660 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4661 (set_attr "length" "4,4,8,8")])
4664 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4665 (compare:CC (zero_extend:SI
4667 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4668 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4670 (set (match_operand:SI 0 "gpc_reg_operand" "")
4671 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4674 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4676 (compare:CC (match_dup 0)
4680 (define_insn "*rotlsi3_internal10"
4681 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4684 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4685 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
4688 {rlnm|rlwnm} %0,%1,%2,0xffff
4689 {rlinm|rlwinm} %0,%1,%h2,0xffff"
4690 [(set_attr "type" "var_shift_rotate,integer")])
4693 (define_insn "*rotlsi3_internal11"
4694 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4695 (compare:CC (zero_extend:SI
4697 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4698 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4700 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4703 {rlnm.|rlwnm.} %3,%1,%2,0xffff
4704 {rlinm.|rlwinm.} %3,%1,%h2,0xffff
4707 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4708 (set_attr "length" "4,4,8,8")])
4711 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4712 (compare:CC (zero_extend:SI
4714 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4715 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4717 (clobber (match_scratch:SI 3 ""))]
4720 (zero_extend:SI (subreg:HI
4721 (rotate:SI (match_dup 1)
4724 (compare:CC (match_dup 3)
4728 (define_insn "*rotlsi3_internal12"
4729 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4730 (compare:CC (zero_extend:SI
4732 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4733 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4735 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4736 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4739 {rlnm.|rlwnm.} %0,%1,%2,0xffff
4740 {rlinm.|rlwinm.} %0,%1,%h2,0xffff
4743 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4744 (set_attr "length" "4,4,8,8")])
4747 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4748 (compare:CC (zero_extend:SI
4750 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4751 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4753 (set (match_operand:SI 0 "gpc_reg_operand" "")
4754 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4757 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4759 (compare:CC (match_dup 0)
4763 ;; Note that we use "sle." instead of "sl." so that we can set
4764 ;; SHIFT_COUNT_TRUNCATED.
4766 (define_expand "ashlsi3"
4767 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4768 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4769 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4774 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4776 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4780 (define_insn "ashlsi3_power"
4781 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4782 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4783 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4784 (clobber (match_scratch:SI 3 "=q,X"))]
4788 {sli|slwi} %0,%1,%h2")
4790 (define_insn "ashlsi3_no_power"
4791 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4792 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4793 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4797 {sli|slwi} %0,%1,%h2"
4798 [(set_attr "type" "var_shift_rotate,shift")])
4800 (define_insn "*ashlsi3_64"
4801 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4803 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4804 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4808 {sli|slwi} %0,%1,%h2"
4809 [(set_attr "type" "var_shift_rotate,shift")])
4812 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4813 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4814 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4816 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4817 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4821 {sli.|slwi.} %3,%1,%h2
4824 [(set_attr "type" "delayed_compare")
4825 (set_attr "length" "4,4,8,8")])
4828 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4829 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4830 (match_operand:SI 2 "reg_or_cint_operand" ""))
4832 (clobber (match_scratch:SI 3 ""))
4833 (clobber (match_scratch:SI 4 ""))]
4834 "TARGET_POWER && reload_completed"
4835 [(parallel [(set (match_dup 3)
4836 (ashift:SI (match_dup 1) (match_dup 2)))
4837 (clobber (match_dup 4))])
4839 (compare:CC (match_dup 3)
4844 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4845 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4846 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4848 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4849 "! TARGET_POWER && TARGET_32BIT"
4852 {sli.|slwi.} %3,%1,%h2
4855 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4856 (set_attr "length" "4,4,8,8")])
4859 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4860 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4861 (match_operand:SI 2 "reg_or_cint_operand" ""))
4863 (clobber (match_scratch:SI 3 ""))]
4864 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4866 (ashift:SI (match_dup 1) (match_dup 2)))
4868 (compare:CC (match_dup 3)
4873 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4874 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4875 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4877 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4878 (ashift:SI (match_dup 1) (match_dup 2)))
4879 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4883 {sli.|slwi.} %0,%1,%h2
4886 [(set_attr "type" "delayed_compare")
4887 (set_attr "length" "4,4,8,8")])
4890 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4891 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4892 (match_operand:SI 2 "reg_or_cint_operand" ""))
4894 (set (match_operand:SI 0 "gpc_reg_operand" "")
4895 (ashift:SI (match_dup 1) (match_dup 2)))
4896 (clobber (match_scratch:SI 4 ""))]
4897 "TARGET_POWER && reload_completed"
4898 [(parallel [(set (match_dup 0)
4899 (ashift:SI (match_dup 1) (match_dup 2)))
4900 (clobber (match_dup 4))])
4902 (compare:CC (match_dup 0)
4907 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4908 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4909 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4911 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4912 (ashift:SI (match_dup 1) (match_dup 2)))]
4913 "! TARGET_POWER && TARGET_32BIT"
4916 {sli.|slwi.} %0,%1,%h2
4919 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4920 (set_attr "length" "4,4,8,8")])
4923 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4924 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4925 (match_operand:SI 2 "reg_or_cint_operand" ""))
4927 (set (match_operand:SI 0 "gpc_reg_operand" "")
4928 (ashift:SI (match_dup 1) (match_dup 2)))]
4929 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4931 (ashift:SI (match_dup 1) (match_dup 2)))
4933 (compare:CC (match_dup 0)
4937 (define_insn "rlwinm"
4938 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4939 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4940 (match_operand:SI 2 "const_int_operand" "i"))
4941 (match_operand:SI 3 "mask_operand" "n")))]
4942 "includes_lshift_p (operands[2], operands[3])"
4943 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4946 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4948 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4949 (match_operand:SI 2 "const_int_operand" "i,i"))
4950 (match_operand:SI 3 "mask_operand" "n,n"))
4952 (clobber (match_scratch:SI 4 "=r,r"))]
4953 "includes_lshift_p (operands[2], operands[3])"
4955 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4957 [(set_attr "type" "delayed_compare")
4958 (set_attr "length" "4,8")])
4961 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4963 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4964 (match_operand:SI 2 "const_int_operand" ""))
4965 (match_operand:SI 3 "mask_operand" ""))
4967 (clobber (match_scratch:SI 4 ""))]
4968 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4970 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4973 (compare:CC (match_dup 4)
4978 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4980 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4981 (match_operand:SI 2 "const_int_operand" "i,i"))
4982 (match_operand:SI 3 "mask_operand" "n,n"))
4984 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4985 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4986 "includes_lshift_p (operands[2], operands[3])"
4988 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4990 [(set_attr "type" "delayed_compare")
4991 (set_attr "length" "4,8")])
4994 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4996 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4997 (match_operand:SI 2 "const_int_operand" ""))
4998 (match_operand:SI 3 "mask_operand" ""))
5000 (set (match_operand:SI 0 "gpc_reg_operand" "")
5001 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5002 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
5004 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5006 (compare:CC (match_dup 0)
5010 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
5012 (define_expand "lshrsi3"
5013 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
5014 (use (match_operand:SI 1 "gpc_reg_operand" ""))
5015 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
5020 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
5022 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
5026 (define_insn "lshrsi3_power"
5027 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5028 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5029 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
5030 (clobber (match_scratch:SI 3 "=q,X,X"))]
5035 {s%A2i|s%A2wi} %0,%1,%h2")
5037 (define_insn "lshrsi3_no_power"
5038 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
5039 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
5040 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
5045 {sri|srwi} %0,%1,%h2"
5046 [(set_attr "type" "integer,var_shift_rotate,shift")])
5048 (define_insn "*lshrsi3_64"
5049 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5051 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5052 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5056 {sri|srwi} %0,%1,%h2"
5057 [(set_attr "type" "var_shift_rotate,shift")])
5060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5061 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5062 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5064 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
5065 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5070 {s%A2i.|s%A2wi.} %3,%1,%h2
5074 [(set_attr "type" "delayed_compare")
5075 (set_attr "length" "4,4,4,8,8,8")])
5078 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5079 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5080 (match_operand:SI 2 "reg_or_cint_operand" ""))
5082 (clobber (match_scratch:SI 3 ""))
5083 (clobber (match_scratch:SI 4 ""))]
5084 "TARGET_POWER && reload_completed"
5085 [(parallel [(set (match_dup 3)
5086 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5087 (clobber (match_dup 4))])
5089 (compare:CC (match_dup 3)
5094 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5095 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5096 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5098 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
5099 "! TARGET_POWER && TARGET_32BIT"
5103 {sri.|srwi.} %3,%1,%h2
5107 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5108 (set_attr "length" "4,4,4,8,8,8")])
5111 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5112 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5113 (match_operand:SI 2 "reg_or_cint_operand" ""))
5115 (clobber (match_scratch:SI 3 ""))]
5116 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5118 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5120 (compare:CC (match_dup 3)
5125 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5126 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5127 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
5129 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5130 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5131 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
5136 {s%A2i.|s%A2wi.} %0,%1,%h2
5140 [(set_attr "type" "delayed_compare")
5141 (set_attr "length" "4,4,4,8,8,8")])
5144 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5145 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5146 (match_operand:SI 2 "reg_or_cint_operand" ""))
5148 (set (match_operand:SI 0 "gpc_reg_operand" "")
5149 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5150 (clobber (match_scratch:SI 4 ""))]
5151 "TARGET_POWER && reload_completed"
5152 [(parallel [(set (match_dup 0)
5153 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5154 (clobber (match_dup 4))])
5156 (compare:CC (match_dup 0)
5161 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
5162 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
5163 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
5165 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
5166 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5167 "! TARGET_POWER && TARGET_32BIT"
5171 {sri.|srwi.} %0,%1,%h2
5175 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5176 (set_attr "length" "4,4,4,8,8,8")])
5179 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5180 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5181 (match_operand:SI 2 "reg_or_cint_operand" ""))
5183 (set (match_operand:SI 0 "gpc_reg_operand" "")
5184 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
5185 "! TARGET_POWER && TARGET_32BIT && reload_completed"
5187 (lshiftrt:SI (match_dup 1) (match_dup 2)))
5189 (compare:CC (match_dup 0)
5194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5195 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5196 (match_operand:SI 2 "const_int_operand" "i"))
5197 (match_operand:SI 3 "mask_operand" "n")))]
5198 "includes_rshift_p (operands[2], operands[3])"
5199 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
5202 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5204 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5205 (match_operand:SI 2 "const_int_operand" "i,i"))
5206 (match_operand:SI 3 "mask_operand" "n,n"))
5208 (clobber (match_scratch:SI 4 "=r,r"))]
5209 "includes_rshift_p (operands[2], operands[3])"
5211 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
5213 [(set_attr "type" "delayed_compare")
5214 (set_attr "length" "4,8")])
5217 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5219 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5220 (match_operand:SI 2 "const_int_operand" ""))
5221 (match_operand:SI 3 "mask_operand" ""))
5223 (clobber (match_scratch:SI 4 ""))]
5224 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5226 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
5229 (compare:CC (match_dup 4)
5234 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
5236 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5237 (match_operand:SI 2 "const_int_operand" "i,i"))
5238 (match_operand:SI 3 "mask_operand" "n,n"))
5240 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5241 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5242 "includes_rshift_p (operands[2], operands[3])"
5244 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
5246 [(set_attr "type" "delayed_compare")
5247 (set_attr "length" "4,8")])
5250 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
5252 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5253 (match_operand:SI 2 "const_int_operand" ""))
5254 (match_operand:SI 3 "mask_operand" ""))
5256 (set (match_operand:SI 0 "gpc_reg_operand" "")
5257 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
5258 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
5260 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
5262 (compare:CC (match_dup 0)
5267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5270 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5271 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5272 "includes_rshift_p (operands[2], GEN_INT (255))"
5273 "{rlinm|rlwinm} %0,%1,%s2,0xff")
5276 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5280 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5281 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5283 (clobber (match_scratch:SI 3 "=r,r"))]
5284 "includes_rshift_p (operands[2], GEN_INT (255))"
5286 {rlinm.|rlwinm.} %3,%1,%s2,0xff
5288 [(set_attr "type" "delayed_compare")
5289 (set_attr "length" "4,8")])
5292 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5296 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5297 (match_operand:SI 2 "const_int_operand" "")) 0))
5299 (clobber (match_scratch:SI 3 ""))]
5300 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5302 (zero_extend:SI (subreg:QI
5303 (lshiftrt:SI (match_dup 1)
5306 (compare:CC (match_dup 3)
5311 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5315 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5316 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5318 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5319 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5320 "includes_rshift_p (operands[2], GEN_INT (255))"
5322 {rlinm.|rlwinm.} %0,%1,%s2,0xff
5324 [(set_attr "type" "delayed_compare")
5325 (set_attr "length" "4,8")])
5328 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5332 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5333 (match_operand:SI 2 "const_int_operand" "")) 0))
5335 (set (match_operand:SI 0 "gpc_reg_operand" "")
5336 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5337 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
5339 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5341 (compare:CC (match_dup 0)
5346 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5349 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
5350 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
5351 "includes_rshift_p (operands[2], GEN_INT (65535))"
5352 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
5355 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5359 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5360 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5362 (clobber (match_scratch:SI 3 "=r,r"))]
5363 "includes_rshift_p (operands[2], GEN_INT (65535))"
5365 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
5367 [(set_attr "type" "delayed_compare")
5368 (set_attr "length" "4,8")])
5371 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5375 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5376 (match_operand:SI 2 "const_int_operand" "")) 0))
5378 (clobber (match_scratch:SI 3 ""))]
5379 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5381 (zero_extend:SI (subreg:HI
5382 (lshiftrt:SI (match_dup 1)
5385 (compare:CC (match_dup 3)
5390 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5394 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5395 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
5397 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5398 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5399 "includes_rshift_p (operands[2], GEN_INT (65535))"
5401 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
5403 [(set_attr "type" "delayed_compare")
5404 (set_attr "length" "4,8")])
5407 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5411 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5412 (match_operand:SI 2 "const_int_operand" "")) 0))
5414 (set (match_operand:SI 0 "gpc_reg_operand" "")
5415 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
5416 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
5418 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
5420 (compare:CC (match_dup 0)
5425 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5427 (match_operand:SI 1 "gpc_reg_operand" "r"))
5428 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5434 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5436 (match_operand:SI 1 "gpc_reg_operand" "r"))
5437 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5443 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
5445 (match_operand:SI 1 "gpc_reg_operand" "r"))
5446 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
5452 (define_expand "ashrsi3"
5453 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5454 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5455 (match_operand:SI 2 "reg_or_cint_operand" "")))]
5460 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
5462 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
5466 (define_insn "ashrsi3_power"
5467 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5468 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5469 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
5470 (clobber (match_scratch:SI 3 "=q,X"))]
5474 {srai|srawi} %0,%1,%h2"
5475 [(set_attr "type" "shift")])
5477 (define_insn "ashrsi3_no_power"
5478 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5479 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5480 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
5484 {srai|srawi} %0,%1,%h2"
5485 [(set_attr "type" "var_shift_rotate,shift")])
5487 (define_insn "*ashrsi3_64"
5488 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5490 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5491 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
5495 {srai|srawi} %0,%1,%h2"
5496 [(set_attr "type" "var_shift_rotate,shift")])
5499 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5500 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5501 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5503 (clobber (match_scratch:SI 3 "=r,r,r,r"))
5504 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5508 {srai.|srawi.} %3,%1,%h2
5511 [(set_attr "type" "delayed_compare")
5512 (set_attr "length" "4,4,8,8")])
5515 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5516 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5517 (match_operand:SI 2 "reg_or_cint_operand" ""))
5519 (clobber (match_scratch:SI 3 ""))
5520 (clobber (match_scratch:SI 4 ""))]
5521 "TARGET_POWER && reload_completed"
5522 [(parallel [(set (match_dup 3)
5523 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5524 (clobber (match_dup 4))])
5526 (compare:CC (match_dup 3)
5531 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5532 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5533 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5535 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
5538 {sra.|sraw.} %3,%1,%2
5539 {srai.|srawi.} %3,%1,%h2
5542 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5543 (set_attr "length" "4,4,8,8")])
5546 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
5547 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5548 (match_operand:SI 2 "reg_or_cint_operand" ""))
5550 (clobber (match_scratch:SI 3 ""))]
5551 "! TARGET_POWER && reload_completed"
5553 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5555 (compare:CC (match_dup 3)
5560 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5561 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5562 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5564 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5565 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5566 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5570 {srai.|srawi.} %0,%1,%h2
5573 [(set_attr "type" "delayed_compare")
5574 (set_attr "length" "4,4,8,8")])
5577 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5578 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5579 (match_operand:SI 2 "reg_or_cint_operand" ""))
5581 (set (match_operand:SI 0 "gpc_reg_operand" "")
5582 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5583 (clobber (match_scratch:SI 4 ""))]
5584 "TARGET_POWER && reload_completed"
5585 [(parallel [(set (match_dup 0)
5586 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5587 (clobber (match_dup 4))])
5589 (compare:CC (match_dup 0)
5594 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5595 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5596 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5598 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5599 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5602 {sra.|sraw.} %0,%1,%2
5603 {srai.|srawi.} %0,%1,%h2
5606 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
5607 (set_attr "length" "4,4,8,8")])
5609 ;; Builtins to replace a division to generate FRE reciprocal estimate
5610 ;; instructions and the necessary fixup instructions
5611 (define_expand "recip<mode>3"
5612 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5613 (match_operand:RECIPF 1 "gpc_reg_operand" "")
5614 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
5615 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
5617 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
5621 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
5622 ;; hardware division. This is only done before register allocation and with
5623 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
5625 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
5626 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
5627 (match_operand 2 "gpc_reg_operand" "")))]
5628 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
5629 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
5630 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
5633 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
5637 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
5638 ;; appropriate fixup.
5639 (define_expand "rsqrt<mode>2"
5640 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
5641 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
5642 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
5644 rs6000_emit_swrsqrt (operands[0], operands[1]);
5649 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
5650 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5651 (match_operand:SI 2 "reg_or_cint_operand" ""))
5653 (set (match_operand:SI 0 "gpc_reg_operand" "")
5654 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5655 "! TARGET_POWER && reload_completed"
5657 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5659 (compare:CC (match_dup 0)
5663 ;; Floating-point insns, excluding normal data motion.
5665 ;; PowerPC has a full set of single-precision floating point instructions.
5667 ;; For the POWER architecture, we pretend that we have both SFmode and
5668 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5669 ;; The only conversions we will do will be when storing to memory. In that
5670 ;; case, we will use the "frsp" instruction before storing.
5672 ;; Note that when we store into a single-precision memory location, we need to
5673 ;; use the frsp insn first. If the register being stored isn't dead, we
5674 ;; need a scratch register for the frsp. But this is difficult when the store
5675 ;; is done by reload. It is not incorrect to do the frsp on the register in
5676 ;; this case, we just lose precision that we would have otherwise gotten but
5677 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5679 (define_expand "extendsfdf2"
5680 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5681 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
5682 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5685 (define_insn_and_split "*extendsfdf2_fpr"
5686 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
5687 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
5688 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5693 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
5696 emit_note (NOTE_INSN_DELETED);
5699 [(set_attr "type" "fp,fp,fpload")])
5701 (define_expand "truncdfsf2"
5702 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5703 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
5704 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5707 (define_insn "*truncdfsf2_fpr"
5708 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5709 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5710 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5712 [(set_attr "type" "fp")])
5714 (define_insn "aux_truncdfsf2"
5715 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5716 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
5717 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5719 [(set_attr "type" "fp")])
5721 (define_expand "negsf2"
5722 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5723 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5724 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5727 (define_insn "*negsf2"
5728 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5729 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5730 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5732 [(set_attr "type" "fp")])
5734 (define_expand "abssf2"
5735 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5736 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5737 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5740 (define_insn "*abssf2"
5741 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5742 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5743 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5745 [(set_attr "type" "fp")])
5748 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5749 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5750 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5752 [(set_attr "type" "fp")])
5754 (define_expand "addsf3"
5755 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5756 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5757 (match_operand:SF 2 "gpc_reg_operand" "")))]
5758 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5762 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5763 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5764 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5765 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5767 [(set_attr "type" "fp")
5768 (set_attr "fp_type" "fp_addsub_s")])
5771 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5772 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5773 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5774 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5775 "{fa|fadd} %0,%1,%2"
5776 [(set_attr "type" "fp")])
5778 (define_expand "subsf3"
5779 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5780 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5781 (match_operand:SF 2 "gpc_reg_operand" "")))]
5782 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5786 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5787 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5788 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5789 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5791 [(set_attr "type" "fp")
5792 (set_attr "fp_type" "fp_addsub_s")])
5795 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5796 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5797 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5798 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5799 "{fs|fsub} %0,%1,%2"
5800 [(set_attr "type" "fp")])
5802 (define_expand "mulsf3"
5803 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5804 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5805 (match_operand:SF 2 "gpc_reg_operand" "")))]
5806 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5810 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5811 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5812 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5813 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5815 [(set_attr "type" "fp")
5816 (set_attr "fp_type" "fp_mul_s")])
5819 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5820 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5821 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5822 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5823 "{fm|fmul} %0,%1,%2"
5824 [(set_attr "type" "dmul")])
5826 (define_expand "divsf3"
5827 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5828 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5829 (match_operand:SF 2 "gpc_reg_operand" "")))]
5830 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5834 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5835 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5836 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5837 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5838 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5840 [(set_attr "type" "sdiv")])
5843 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5844 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5845 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5846 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS
5847 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5848 "{fd|fdiv} %0,%1,%2"
5849 [(set_attr "type" "ddiv")])
5852 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5853 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5856 [(set_attr "type" "fp")])
5858 ; builtin fmaf support
5859 (define_insn "*fmasf4_fpr"
5860 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5861 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5862 (match_operand:SF 2 "gpc_reg_operand" "f")
5863 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5864 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5866 return (TARGET_POWERPC
5867 ? "fmadds %0,%1,%2,%3"
5868 : "{fma|fmadd} %0,%1,%2,%3");
5870 [(set_attr "type" "fp")
5871 (set_attr "fp_type" "fp_maddsub_s")])
5873 (define_insn "*fmssf4_fpr"
5874 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5875 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5876 (match_operand:SF 2 "gpc_reg_operand" "f")
5877 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5878 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5880 return (TARGET_POWERPC
5881 ? "fmsubs %0,%1,%2,%3"
5882 : "{fms|fmsub} %0,%1,%2,%3");
5884 [(set_attr "type" "fp")
5885 (set_attr "fp_type" "fp_maddsub_s")])
5887 (define_insn "*nfmasf4_fpr"
5888 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5889 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5890 (match_operand:SF 2 "gpc_reg_operand" "f")
5891 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5892 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5894 return (TARGET_POWERPC
5895 ? "fnmadds %0,%1,%2,%3"
5896 : "{fnma|fnmadd} %0,%1,%2,%3");
5898 [(set_attr "type" "fp")
5899 (set_attr "fp_type" "fp_maddsub_s")])
5901 (define_insn "*nfmssf4_fpr"
5902 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5903 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5904 (match_operand:SF 2 "gpc_reg_operand" "f")
5905 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5906 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5908 return (TARGET_POWERPC
5909 ? "fnmsubs %0,%1,%2,%3"
5910 : "{fnms|fnmsub} %0,%1,%2,%3");
5912 [(set_attr "type" "fp")
5913 (set_attr "fp_type" "fp_maddsub_s")])
5915 (define_expand "sqrtsf2"
5916 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5917 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5918 "(TARGET_PPC_GPOPT || TARGET_POWER2 || TARGET_XILINX_FPU)
5919 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5920 && !TARGET_SIMPLE_FPU"
5924 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5925 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5926 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5927 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5929 [(set_attr "type" "ssqrt")])
5932 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5933 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5934 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS
5935 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5937 [(set_attr "type" "dsqrt")])
5939 (define_insn "*rsqrtsf_internal1"
5940 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5941 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5945 [(set_attr "type" "fp")])
5947 (define_expand "copysign<mode>3"
5949 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5951 (neg:SFDF (abs:SFDF (match_dup 1))))
5952 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5953 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5957 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5958 && ((TARGET_PPC_GFXOPT
5959 && !HONOR_NANS (<MODE>mode)
5960 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5962 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5964 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5966 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5971 operands[3] = gen_reg_rtx (<MODE>mode);
5972 operands[4] = gen_reg_rtx (<MODE>mode);
5973 operands[5] = CONST0_RTX (<MODE>mode);
5976 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5977 ;; compiler from optimizing -0.0
5978 (define_insn "copysign<mode>3_fcpsgn"
5979 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5980 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
5981 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
5983 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5985 [(set_attr "type" "fp")])
5987 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5988 ;; fsel instruction and some auxiliary computations. Then we just have a
5989 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5991 (define_expand "smaxsf3"
5992 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5993 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5994 (match_operand:SF 2 "gpc_reg_operand" ""))
5997 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5998 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5999 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6001 (define_expand "sminsf3"
6002 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6003 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
6004 (match_operand:SF 2 "gpc_reg_operand" ""))
6007 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6008 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6009 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6012 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6013 (match_operator:SF 3 "min_max_operator"
6014 [(match_operand:SF 1 "gpc_reg_operand" "")
6015 (match_operand:SF 2 "gpc_reg_operand" "")]))]
6016 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
6017 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
6020 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6021 operands[1], operands[2]);
6025 (define_expand "mov<mode>cc"
6026 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
6027 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
6028 (match_operand:GPR 2 "gpc_reg_operand" "")
6029 (match_operand:GPR 3 "gpc_reg_operand" "")))]
6033 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6039 ;; We use the BASE_REGS for the isel input operands because, if rA is
6040 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
6041 ;; because we may switch the operands and rB may end up being rA.
6043 ;; We need 2 patterns: an unsigned and a signed pattern. We could
6044 ;; leave out the mode in operand 4 and use one pattern, but reload can
6045 ;; change the mode underneath our feet and then gets confused trying
6046 ;; to reload the value.
6047 (define_insn "isel_signed_<mode>"
6048 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6050 (match_operator 1 "scc_comparison_operator"
6051 [(match_operand:CC 4 "cc_reg_operand" "y,y")
6053 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6054 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6057 { return output_isel (operands); }"
6058 [(set_attr "type" "isel")
6059 (set_attr "length" "4")])
6061 (define_insn "isel_unsigned_<mode>"
6062 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
6064 (match_operator 1 "scc_comparison_operator"
6065 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
6067 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
6068 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
6071 { return output_isel (operands); }"
6072 [(set_attr "type" "isel")
6073 (set_attr "length" "4")])
6075 ;; These patterns can be useful for combine; they let combine know that
6076 ;; isel can handle reversed comparisons so long as the operands are
6079 (define_insn "*isel_reversed_signed_<mode>"
6080 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6082 (match_operator 1 "scc_rev_comparison_operator"
6083 [(match_operand:CC 4 "cc_reg_operand" "y")
6085 (match_operand:GPR 2 "gpc_reg_operand" "b")
6086 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6089 { return output_isel (operands); }"
6090 [(set_attr "type" "isel")
6091 (set_attr "length" "4")])
6093 (define_insn "*isel_reversed_unsigned_<mode>"
6094 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
6096 (match_operator 1 "scc_rev_comparison_operator"
6097 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
6099 (match_operand:GPR 2 "gpc_reg_operand" "b")
6100 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
6103 { return output_isel (operands); }"
6104 [(set_attr "type" "isel")
6105 (set_attr "length" "4")])
6107 (define_expand "movsfcc"
6108 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6109 (if_then_else:SF (match_operand 1 "comparison_operator" "")
6110 (match_operand:SF 2 "gpc_reg_operand" "")
6111 (match_operand:SF 3 "gpc_reg_operand" "")))]
6112 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6115 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6121 (define_insn "*fselsfsf4"
6122 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6123 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6124 (match_operand:SF 4 "zero_fp_constant" "F"))
6125 (match_operand:SF 2 "gpc_reg_operand" "f")
6126 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6127 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6129 [(set_attr "type" "fp")])
6131 (define_insn "*fseldfsf4"
6132 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6133 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6134 (match_operand:DF 4 "zero_fp_constant" "F"))
6135 (match_operand:SF 2 "gpc_reg_operand" "f")
6136 (match_operand:SF 3 "gpc_reg_operand" "f")))]
6137 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6139 [(set_attr "type" "fp")])
6141 (define_expand "negdf2"
6142 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6143 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6144 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6147 (define_insn "*negdf2_fpr"
6148 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6149 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6150 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6151 && !VECTOR_UNIT_VSX_P (DFmode)"
6153 [(set_attr "type" "fp")])
6155 (define_expand "absdf2"
6156 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6157 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6158 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6161 (define_insn "*absdf2_fpr"
6162 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6163 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6164 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6165 && !VECTOR_UNIT_VSX_P (DFmode)"
6167 [(set_attr "type" "fp")])
6169 (define_insn "*nabsdf2_fpr"
6170 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6171 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6172 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6173 && !VECTOR_UNIT_VSX_P (DFmode)"
6175 [(set_attr "type" "fp")])
6177 (define_expand "adddf3"
6178 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6179 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6180 (match_operand:DF 2 "gpc_reg_operand" "")))]
6181 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6184 (define_insn "*adddf3_fpr"
6185 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6186 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6187 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6188 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6189 && !VECTOR_UNIT_VSX_P (DFmode)"
6190 "{fa|fadd} %0,%1,%2"
6191 [(set_attr "type" "fp")
6192 (set_attr "fp_type" "fp_addsub_d")])
6194 (define_expand "subdf3"
6195 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6196 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
6197 (match_operand:DF 2 "gpc_reg_operand" "")))]
6198 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6201 (define_insn "*subdf3_fpr"
6202 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6203 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6204 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6205 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6206 && !VECTOR_UNIT_VSX_P (DFmode)"
6207 "{fs|fsub} %0,%1,%2"
6208 [(set_attr "type" "fp")
6209 (set_attr "fp_type" "fp_addsub_d")])
6211 (define_expand "muldf3"
6212 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6213 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
6214 (match_operand:DF 2 "gpc_reg_operand" "")))]
6215 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6218 (define_insn "*muldf3_fpr"
6219 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6220 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
6221 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6222 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6223 && !VECTOR_UNIT_VSX_P (DFmode)"
6224 "{fm|fmul} %0,%1,%2"
6225 [(set_attr "type" "dmul")
6226 (set_attr "fp_type" "fp_mul_d")])
6228 (define_expand "divdf3"
6229 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6230 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
6231 (match_operand:DF 2 "gpc_reg_operand" "")))]
6233 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
6234 && !TARGET_SIMPLE_FPU"
6237 (define_insn "*divdf3_fpr"
6238 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6239 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
6240 (match_operand:DF 2 "gpc_reg_operand" "d")))]
6241 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
6242 && !VECTOR_UNIT_VSX_P (DFmode)"
6243 "{fd|fdiv} %0,%1,%2"
6244 [(set_attr "type" "ddiv")])
6246 (define_insn "*fred_fpr"
6247 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6248 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
6249 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
6251 [(set_attr "type" "fp")])
6253 (define_insn "*rsqrtdf_internal1"
6254 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6255 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
6257 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
6259 [(set_attr "type" "fp")])
6261 ; builtin fma support
6262 (define_insn "*fmadf4_fpr"
6263 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6264 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6265 (match_operand:DF 2 "gpc_reg_operand" "f")
6266 (match_operand:DF 3 "gpc_reg_operand" "f")))]
6267 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6268 && VECTOR_UNIT_NONE_P (DFmode)"
6269 "{fma|fmadd} %0,%1,%2,%3"
6270 [(set_attr "type" "fp")
6271 (set_attr "fp_type" "fp_maddsub_s")])
6273 (define_insn "*fmsdf4_fpr"
6274 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6275 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6276 (match_operand:DF 2 "gpc_reg_operand" "f")
6277 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6278 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6279 && VECTOR_UNIT_NONE_P (DFmode)"
6280 "{fms|fmsub} %0,%1,%2,%3"
6281 [(set_attr "type" "fp")
6282 (set_attr "fp_type" "fp_maddsub_s")])
6284 (define_insn "*nfmadf4_fpr"
6285 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6286 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6287 (match_operand:DF 2 "gpc_reg_operand" "f")
6288 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
6289 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6290 && VECTOR_UNIT_NONE_P (DFmode)"
6291 "{fnma|fnmadd} %0,%1,%2,%3"
6292 [(set_attr "type" "fp")
6293 (set_attr "fp_type" "fp_maddsub_s")])
6295 (define_insn "*nfmsdf4_fpr"
6296 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6297 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
6298 (match_operand:DF 2 "gpc_reg_operand" "f")
6299 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
6300 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6301 && VECTOR_UNIT_NONE_P (DFmode)"
6302 "{fnms|fnmsub} %0,%1,%2,%3"
6303 [(set_attr "type" "fp")
6304 (set_attr "fp_type" "fp_maddsub_s")])
6306 (define_expand "sqrtdf2"
6307 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6308 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
6309 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6310 && TARGET_DOUBLE_FLOAT"
6313 (define_insn "*sqrtdf2_fpr"
6314 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6315 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
6316 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
6317 && TARGET_DOUBLE_FLOAT
6318 && !VECTOR_UNIT_VSX_P (DFmode)"
6320 [(set_attr "type" "dsqrt")])
6322 ;; The conditional move instructions allow us to perform max and min
6323 ;; operations even when
6325 (define_expand "smaxdf3"
6326 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6327 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6328 (match_operand:DF 2 "gpc_reg_operand" ""))
6331 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6332 && !flag_trapping_math"
6333 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
6335 (define_expand "smindf3"
6336 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6337 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
6338 (match_operand:DF 2 "gpc_reg_operand" ""))
6341 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6342 && !flag_trapping_math"
6343 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
6346 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6347 (match_operator:DF 3 "min_max_operator"
6348 [(match_operand:DF 1 "gpc_reg_operand" "")
6349 (match_operand:DF 2 "gpc_reg_operand" "")]))]
6350 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6351 && !flag_trapping_math"
6354 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
6355 operands[1], operands[2]);
6359 (define_expand "movdfcc"
6360 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6361 (if_then_else:DF (match_operand 1 "comparison_operator" "")
6362 (match_operand:DF 2 "gpc_reg_operand" "")
6363 (match_operand:DF 3 "gpc_reg_operand" "")))]
6364 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6367 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
6373 (define_insn "*fseldfdf4"
6374 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6375 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
6376 (match_operand:DF 4 "zero_fp_constant" "F"))
6377 (match_operand:DF 2 "gpc_reg_operand" "d")
6378 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6379 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6381 [(set_attr "type" "fp")])
6383 (define_insn "*fselsfdf4"
6384 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6385 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
6386 (match_operand:SF 4 "zero_fp_constant" "F"))
6387 (match_operand:DF 2 "gpc_reg_operand" "d")
6388 (match_operand:DF 3 "gpc_reg_operand" "d")))]
6389 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
6391 [(set_attr "type" "fp")])
6393 ;; Conversions to and from floating-point.
6395 ; We don't define lfiwax/lfiwzx with the normal definition, because we
6396 ; don't want to support putting SImode in FPR registers.
6397 (define_insn "lfiwax"
6398 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6399 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6401 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
6403 [(set_attr "type" "fpload")])
6405 ; This split must be run before register allocation because it allocates the
6406 ; memory slot that is needed to move values to/from the FPR. We don't allocate
6407 ; it earlier to allow for the combiner to merge insns together where it might
6408 ; not be needed and also in case the insns are deleted as dead code.
6410 (define_insn_and_split "floatsi<mode>2_lfiwax"
6411 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6412 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6413 (clobber (match_scratch:DI 2 "=d"))]
6414 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6415 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
6421 rtx dest = operands[0];
6422 rtx src = operands[1];
6425 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6426 tmp = convert_to_mode (DImode, src, false);
6430 if (GET_CODE (tmp) == SCRATCH)
6431 tmp = gen_reg_rtx (DImode);
6434 src = rs6000_address_for_fpconvert (src);
6435 emit_insn (gen_lfiwax (tmp, src));
6439 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6440 emit_move_insn (stack, src);
6441 emit_insn (gen_lfiwax (tmp, stack));
6444 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6447 [(set_attr "length" "12")
6448 (set_attr "type" "fpload")])
6450 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
6451 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6454 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6455 (clobber (match_scratch:DI 2 "=0,d"))]
6456 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
6463 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6464 if (GET_CODE (operands[2]) == SCRATCH)
6465 operands[2] = gen_reg_rtx (DImode);
6466 emit_insn (gen_lfiwax (operands[2], operands[1]));
6467 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6470 [(set_attr "length" "8")
6471 (set_attr "type" "fpload")])
6473 (define_insn "lfiwzx"
6474 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6475 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
6477 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
6479 [(set_attr "type" "fpload")])
6481 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
6482 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6483 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
6484 (clobber (match_scratch:DI 2 "=d"))]
6485 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6492 rtx dest = operands[0];
6493 rtx src = operands[1];
6496 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
6497 tmp = convert_to_mode (DImode, src, true);
6501 if (GET_CODE (tmp) == SCRATCH)
6502 tmp = gen_reg_rtx (DImode);
6505 src = rs6000_address_for_fpconvert (src);
6506 emit_insn (gen_lfiwzx (tmp, src));
6510 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6511 emit_move_insn (stack, src);
6512 emit_insn (gen_lfiwzx (tmp, stack));
6515 emit_insn (gen_floatdi<mode>2 (dest, tmp));
6518 [(set_attr "length" "12")
6519 (set_attr "type" "fpload")])
6521 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
6522 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
6523 (unsigned_float:SFDF
6525 (match_operand:SI 1 "memory_operand" "Z,Z"))))
6526 (clobber (match_scratch:DI 2 "=0,d"))]
6527 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
6534 operands[1] = rs6000_address_for_fpconvert (operands[1]);
6535 if (GET_CODE (operands[2]) == SCRATCH)
6536 operands[2] = gen_reg_rtx (DImode);
6537 emit_insn (gen_lfiwzx (operands[2], operands[1]));
6538 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
6541 [(set_attr "length" "8")
6542 (set_attr "type" "fpload")])
6544 ; For each of these conversions, there is a define_expand, a define_insn
6545 ; with a '#' template, and a define_split (with C code). The idea is
6546 ; to allow constant folding with the template of the define_insn,
6547 ; then to have the insns split later (between sched1 and final).
6549 (define_expand "floatsidf2"
6550 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6551 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6554 (clobber (match_dup 4))
6555 (clobber (match_dup 5))
6556 (clobber (match_dup 6))])]
6558 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6561 if (TARGET_E500_DOUBLE)
6563 if (!REG_P (operands[1]))
6564 operands[1] = force_reg (SImode, operands[1]);
6565 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
6568 else if (TARGET_LFIWAX && TARGET_FCFID)
6570 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
6573 else if (TARGET_FCFID)
6575 rtx dreg = operands[1];
6577 dreg = force_reg (SImode, dreg);
6578 dreg = convert_to_mode (DImode, dreg, false);
6579 emit_insn (gen_floatdidf2 (operands[0], dreg));
6583 if (!REG_P (operands[1]))
6584 operands[1] = force_reg (SImode, operands[1]);
6585 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6586 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
6587 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6588 operands[5] = gen_reg_rtx (DFmode);
6589 operands[6] = gen_reg_rtx (SImode);
6592 (define_insn_and_split "*floatsidf2_internal"
6593 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6594 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6595 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6596 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6597 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6598 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
6599 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
6600 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6606 rtx lowword, highword;
6607 gcc_assert (MEM_P (operands[4]));
6608 highword = adjust_address (operands[4], SImode, 0);
6609 lowword = adjust_address (operands[4], SImode, 4);
6610 if (! WORDS_BIG_ENDIAN)
6613 tmp = highword; highword = lowword; lowword = tmp;
6616 emit_insn (gen_xorsi3 (operands[6], operands[1],
6617 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
6618 emit_move_insn (lowword, operands[6]);
6619 emit_move_insn (highword, operands[2]);
6620 emit_move_insn (operands[5], operands[4]);
6621 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6624 [(set_attr "length" "24")
6625 (set_attr "type" "fp")])
6627 ;; If we don't have a direct conversion to single precision, don't enable this
6628 ;; conversion for 32-bit without fast math, because we don't have the insn to
6629 ;; generate the fixup swizzle to avoid double rounding problems.
6630 (define_expand "floatunssisf2"
6631 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6632 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6633 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6636 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
6637 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6638 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6643 if (!REG_P (operands[1]))
6644 operands[1] = force_reg (SImode, operands[1]);
6646 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
6648 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
6653 rtx dreg = operands[1];
6655 dreg = force_reg (SImode, dreg);
6656 dreg = convert_to_mode (DImode, dreg, true);
6657 emit_insn (gen_floatdisf2 (operands[0], dreg));
6662 (define_expand "floatunssidf2"
6663 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
6664 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
6667 (clobber (match_dup 4))
6668 (clobber (match_dup 5))])]
6670 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
6673 if (TARGET_E500_DOUBLE)
6675 if (!REG_P (operands[1]))
6676 operands[1] = force_reg (SImode, operands[1]);
6677 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
6680 else if (TARGET_LFIWZX && TARGET_FCFID)
6682 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
6685 else if (TARGET_FCFID)
6687 rtx dreg = operands[1];
6689 dreg = force_reg (SImode, dreg);
6690 dreg = convert_to_mode (DImode, dreg, true);
6691 emit_insn (gen_floatdidf2 (operands[0], dreg));
6695 if (!REG_P (operands[1]))
6696 operands[1] = force_reg (SImode, operands[1]);
6697 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
6698 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
6699 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
6700 operands[5] = gen_reg_rtx (DFmode);
6703 (define_insn_and_split "*floatunssidf2_internal"
6704 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
6705 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
6706 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
6707 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
6708 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
6709 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
6710 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6711 && !(TARGET_FCFID && TARGET_POWERPC64)"
6717 rtx lowword, highword;
6718 gcc_assert (MEM_P (operands[4]));
6719 highword = adjust_address (operands[4], SImode, 0);
6720 lowword = adjust_address (operands[4], SImode, 4);
6721 if (! WORDS_BIG_ENDIAN)
6724 tmp = highword; highword = lowword; lowword = tmp;
6727 emit_move_insn (lowword, operands[1]);
6728 emit_move_insn (highword, operands[2]);
6729 emit_move_insn (operands[5], operands[4]);
6730 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
6733 [(set_attr "length" "20")
6734 (set_attr "type" "fp")])
6736 (define_expand "fix_trunc<mode>si2"
6737 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6738 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6739 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT
6740 && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
6743 if (!<E500_CONVERT>)
6748 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6751 tmp = gen_reg_rtx (DImode);
6752 stack = rs6000_allocate_stack_temp (DImode, true, false);
6753 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
6760 ; Like the convert to float patterns, this insn must be split before
6761 ; register allocation so that it can allocate the memory slot if it
6763 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
6764 [(set (match_operand:SI 0 "general_operand" "=rm")
6765 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6766 (clobber (match_scratch:DI 2 "=d"))]
6767 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6768 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
6769 && TARGET_STFIWX && can_create_pseudo_p ()"
6774 rtx dest = operands[0];
6775 rtx src = operands[1];
6776 rtx tmp = operands[2];
6778 if (GET_CODE (tmp) == SCRATCH)
6779 tmp = gen_reg_rtx (DImode);
6781 emit_insn (gen_fctiwz_<mode> (tmp, src));
6784 dest = rs6000_address_for_fpconvert (dest);
6785 emit_insn (gen_stfiwx (dest, tmp));
6788 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6790 dest = gen_lowpart (DImode, dest);
6791 emit_move_insn (dest, tmp);
6796 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6797 emit_insn (gen_stfiwx (stack, tmp));
6798 emit_move_insn (dest, stack);
6802 [(set_attr "length" "12")
6803 (set_attr "type" "fp")])
6805 (define_insn_and_split "fix_trunc<mode>si2_internal"
6806 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
6807 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
6808 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
6809 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
6810 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6811 && TARGET_DOUBLE_FLOAT"
6818 gcc_assert (MEM_P (operands[3]));
6819 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
6821 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
6822 emit_move_insn (operands[3], operands[2]);
6823 emit_move_insn (operands[0], lowword);
6826 [(set_attr "length" "16")
6827 (set_attr "type" "fp")])
6829 (define_expand "fix_trunc<mode>di2"
6830 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6831 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6832 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6836 (define_insn "*fix_trunc<mode>di2_fctidz"
6837 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6838 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6839 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6840 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6842 [(set_attr "type" "fp")])
6844 (define_expand "fixuns_trunc<mode>si2"
6845 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6846 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6848 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6852 if (!<E500_CONVERT>)
6854 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6859 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6860 [(set (match_operand:SI 0 "general_operand" "=rm")
6861 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6862 (clobber (match_scratch:DI 2 "=d"))]
6863 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6864 && TARGET_STFIWX && can_create_pseudo_p ()"
6869 rtx dest = operands[0];
6870 rtx src = operands[1];
6871 rtx tmp = operands[2];
6873 if (GET_CODE (tmp) == SCRATCH)
6874 tmp = gen_reg_rtx (DImode);
6876 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6879 dest = rs6000_address_for_fpconvert (dest);
6880 emit_insn (gen_stfiwx (dest, tmp));
6883 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6885 dest = gen_lowpart (DImode, dest);
6886 emit_move_insn (dest, tmp);
6891 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6892 emit_insn (gen_stfiwx (stack, tmp));
6893 emit_move_insn (dest, stack);
6897 [(set_attr "length" "12")
6898 (set_attr "type" "fp")])
6900 (define_expand "fixuns_trunc<mode>di2"
6901 [(set (match_operand:DI 0 "register_operand" "")
6902 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6903 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6906 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6907 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6908 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6909 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6910 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6912 [(set_attr "type" "fp")])
6914 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6915 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6916 ; because the first makes it clear that operand 0 is not live
6917 ; before the instruction.
6918 (define_insn "fctiwz_<mode>"
6919 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6920 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6922 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
6923 && TARGET_DOUBLE_FLOAT"
6924 "{fcirz|fctiwz} %0,%1"
6925 [(set_attr "type" "fp")])
6927 (define_insn "fctiwuz_<mode>"
6928 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6929 (unspec:DI [(unsigned_fix:SI
6930 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6932 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6934 [(set_attr "type" "fp")])
6936 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6937 ;; since the friz instruction does not truncate the value if the floating
6938 ;; point value is < LONG_MIN or > LONG_MAX.
6939 (define_insn "*friz"
6940 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6941 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6942 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6943 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6944 && !flag_trapping_math && TARGET_FRIZ"
6946 [(set_attr "type" "fp")])
6948 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6949 ;; load to properly sign extend the value, but at least doing a store, load
6950 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6951 ;; if we have 32-bit memory ops
6952 (define_insn_and_split "*round32<mode>2_fprs"
6953 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6955 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6956 (clobber (match_scratch:DI 2 "=d"))
6957 (clobber (match_scratch:DI 3 "=d"))]
6958 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6959 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6960 && can_create_pseudo_p ()"
6965 rtx dest = operands[0];
6966 rtx src = operands[1];
6967 rtx tmp1 = operands[2];
6968 rtx tmp2 = operands[3];
6969 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6971 if (GET_CODE (tmp1) == SCRATCH)
6972 tmp1 = gen_reg_rtx (DImode);
6973 if (GET_CODE (tmp2) == SCRATCH)
6974 tmp2 = gen_reg_rtx (DImode);
6976 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6977 emit_insn (gen_stfiwx (stack, tmp1));
6978 emit_insn (gen_lfiwax (tmp2, stack));
6979 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6982 [(set_attr "type" "fpload")
6983 (set_attr "length" "16")])
6985 (define_insn_and_split "*roundu32<mode>2_fprs"
6986 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6987 (unsigned_float:SFDF
6988 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6989 (clobber (match_scratch:DI 2 "=d"))
6990 (clobber (match_scratch:DI 3 "=d"))]
6991 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6992 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6993 && can_create_pseudo_p ()"
6998 rtx dest = operands[0];
6999 rtx src = operands[1];
7000 rtx tmp1 = operands[2];
7001 rtx tmp2 = operands[3];
7002 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
7004 if (GET_CODE (tmp1) == SCRATCH)
7005 tmp1 = gen_reg_rtx (DImode);
7006 if (GET_CODE (tmp2) == SCRATCH)
7007 tmp2 = gen_reg_rtx (DImode);
7009 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
7010 emit_insn (gen_stfiwx (stack, tmp1));
7011 emit_insn (gen_lfiwzx (tmp2, stack));
7012 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
7015 [(set_attr "type" "fpload")
7016 (set_attr "length" "16")])
7018 ;; No VSX equivalent to fctid
7019 (define_insn "lrint<mode>di2"
7020 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
7021 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7023 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7025 [(set_attr "type" "fp")])
7027 (define_expand "btrunc<mode>2"
7028 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7029 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7031 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7034 (define_insn "*btrunc<mode>2_fpr"
7035 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7036 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7038 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7039 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7041 [(set_attr "type" "fp")])
7043 (define_expand "ceil<mode>2"
7044 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7045 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7047 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7050 (define_insn "*ceil<mode>2_fpr"
7051 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7052 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7054 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7055 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7057 [(set_attr "type" "fp")])
7059 (define_expand "floor<mode>2"
7060 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
7061 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
7063 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7066 (define_insn "*floor<mode>2_fpr"
7067 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7068 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7070 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
7071 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
7073 [(set_attr "type" "fp")])
7075 ;; No VSX equivalent to frin
7076 (define_insn "round<mode>2"
7077 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
7078 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
7080 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
7082 [(set_attr "type" "fp")])
7084 ; An UNSPEC is used so we don't have to support SImode in FP registers.
7085 (define_insn "stfiwx"
7086 [(set (match_operand:SI 0 "memory_operand" "=Z")
7087 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
7091 [(set_attr "type" "fpstore")])
7093 ;; If we don't have a direct conversion to single precision, don't enable this
7094 ;; conversion for 32-bit without fast math, because we don't have the insn to
7095 ;; generate the fixup swizzle to avoid double rounding problems.
7096 (define_expand "floatsisf2"
7097 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7098 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
7099 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
7102 && ((TARGET_FCFIDS && TARGET_LFIWAX)
7103 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
7104 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
7109 if (!REG_P (operands[1]))
7110 operands[1] = force_reg (SImode, operands[1]);
7112 else if (TARGET_FCFIDS && TARGET_LFIWAX)
7114 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
7117 else if (TARGET_FCFID && TARGET_LFIWAX)
7119 rtx dfreg = gen_reg_rtx (DFmode);
7120 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
7121 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
7126 rtx dreg = operands[1];
7128 dreg = force_reg (SImode, dreg);
7129 dreg = convert_to_mode (DImode, dreg, false);
7130 emit_insn (gen_floatdisf2 (operands[0], dreg));
7135 (define_expand "floatdidf2"
7136 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7137 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
7138 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
7141 (define_insn "*floatdidf2_fpr"
7142 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7143 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7144 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
7145 && !VECTOR_UNIT_VSX_P (DFmode)"
7147 [(set_attr "type" "fp")])
7149 ; Allow the combiner to merge source memory operands to the conversion so that
7150 ; the optimizer/register allocator doesn't try to load the value too early in a
7151 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
7152 ; hit. We will split after reload to avoid the trip through the GPRs
7154 (define_insn_and_split "*floatdidf2_mem"
7155 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7156 (float:DF (match_operand:DI 1 "memory_operand" "m")))
7157 (clobber (match_scratch:DI 2 "=d"))]
7158 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
7160 "&& reload_completed"
7161 [(set (match_dup 2) (match_dup 1))
7162 (set (match_dup 0) (float:DF (match_dup 2)))]
7164 [(set_attr "length" "8")
7165 (set_attr "type" "fpload")])
7167 (define_expand "floatunsdidf2"
7168 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7170 (match_operand:DI 1 "gpc_reg_operand" "")))]
7171 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7174 (define_insn "*floatunsdidf2_fcfidu"
7175 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7176 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7177 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
7179 [(set_attr "type" "fp")
7180 (set_attr "length" "4")])
7182 (define_insn_and_split "*floatunsdidf2_mem"
7183 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
7184 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
7185 (clobber (match_scratch:DI 2 "=d"))]
7186 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
7188 "&& reload_completed"
7189 [(set (match_dup 2) (match_dup 1))
7190 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
7192 [(set_attr "length" "8")
7193 (set_attr "type" "fpload")])
7195 (define_expand "floatdisf2"
7196 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7197 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7198 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7199 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
7204 rtx val = operands[1];
7205 if (!flag_unsafe_math_optimizations)
7207 rtx label = gen_label_rtx ();
7208 val = gen_reg_rtx (DImode);
7209 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
7212 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
7217 (define_insn "floatdisf2_fcfids"
7218 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7219 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7220 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7221 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7223 [(set_attr "type" "fp")])
7225 (define_insn_and_split "*floatdisf2_mem"
7226 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7227 (float:SF (match_operand:DI 1 "memory_operand" "m")))
7228 (clobber (match_scratch:DI 2 "=f"))]
7229 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7230 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
7232 "&& reload_completed"
7236 emit_move_insn (operands[2], operands[1]);
7237 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
7240 [(set_attr "length" "8")])
7242 ;; This is not IEEE compliant if rounding mode is "round to nearest".
7243 ;; If the DI->DF conversion is inexact, then it's possible to suffer
7244 ;; from double rounding.
7245 ;; Instead of creating a new cpu type for two FP operations, just use fp
7246 (define_insn_and_split "floatdisf2_internal1"
7247 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7248 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
7249 (clobber (match_scratch:DF 2 "=d"))]
7250 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7252 "&& reload_completed"
7254 (float:DF (match_dup 1)))
7256 (float_truncate:SF (match_dup 2)))]
7258 [(set_attr "length" "8")
7259 (set_attr "type" "fp")])
7261 ;; Twiddles bits to avoid double rounding.
7262 ;; Bits that might be truncated when converting to DFmode are replaced
7263 ;; by a bit that won't be lost at that stage, but is below the SFmode
7264 ;; rounding position.
7265 (define_expand "floatdisf2_internal2"
7266 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
7268 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
7270 (clobber (scratch:CC))])
7271 (set (match_dup 3) (plus:DI (match_dup 3)
7273 (set (match_dup 0) (plus:DI (match_dup 0)
7275 (set (match_dup 4) (compare:CCUNS (match_dup 3)
7277 (set (match_dup 0) (ior:DI (match_dup 0)
7279 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
7281 (clobber (scratch:CC))])
7282 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
7283 (label_ref (match_operand:DI 2 "" ""))
7285 (set (match_dup 0) (match_dup 1))]
7286 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
7289 operands[3] = gen_reg_rtx (DImode);
7290 operands[4] = gen_reg_rtx (CCUNSmode);
7293 (define_expand "floatunsdisf2"
7294 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7295 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
7296 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7297 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7300 (define_insn "floatunsdisf2_fcfidus"
7301 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7302 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
7303 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7304 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7306 [(set_attr "type" "fp")])
7308 (define_insn_and_split "*floatunsdisf2_mem"
7309 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7310 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
7311 (clobber (match_scratch:DI 2 "=f"))]
7312 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
7313 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
7315 "&& reload_completed"
7319 emit_move_insn (operands[2], operands[1]);
7320 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
7323 [(set_attr "length" "8")
7324 (set_attr "type" "fpload")])
7326 ;; Define the DImode operations that can be done in a small number
7327 ;; of instructions. The & constraints are to prevent the register
7328 ;; allocator from allocating registers that overlap with the inputs
7329 ;; (for example, having an input in 7,8 and an output in 6,7). We
7330 ;; also allow for the output being the same as one of the inputs.
7332 (define_insn "*adddi3_noppc64"
7333 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
7334 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
7335 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
7336 "! TARGET_POWERPC64"
7339 if (WORDS_BIG_ENDIAN)
7340 return (GET_CODE (operands[2])) != CONST_INT
7341 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
7342 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
7344 return (GET_CODE (operands[2])) != CONST_INT
7345 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
7346 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
7348 [(set_attr "type" "two")
7349 (set_attr "length" "8")])
7351 (define_insn "*subdi3_noppc64"
7352 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
7353 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
7354 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
7355 "! TARGET_POWERPC64"
7358 if (WORDS_BIG_ENDIAN)
7359 return (GET_CODE (operands[1]) != CONST_INT)
7360 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
7361 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
7363 return (GET_CODE (operands[1]) != CONST_INT)
7364 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
7365 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
7367 [(set_attr "type" "two")
7368 (set_attr "length" "8")])
7370 (define_insn "*negdi2_noppc64"
7371 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7372 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
7373 "! TARGET_POWERPC64"
7376 return (WORDS_BIG_ENDIAN)
7377 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
7378 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
7380 [(set_attr "type" "two")
7381 (set_attr "length" "8")])
7383 (define_expand "mulsidi3"
7384 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7385 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7386 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7387 "! TARGET_POWERPC64"
7390 if (! TARGET_POWER && ! TARGET_POWERPC)
7392 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7393 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7394 emit_insn (gen_mull_call ());
7395 if (WORDS_BIG_ENDIAN)
7396 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
7399 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
7400 gen_rtx_REG (SImode, 3));
7401 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
7402 gen_rtx_REG (SImode, 4));
7406 else if (TARGET_POWER)
7408 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
7413 (define_insn "mulsidi3_mq"
7414 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7415 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7416 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7417 (clobber (match_scratch:SI 3 "=q"))]
7419 "mul %0,%1,%2\;mfmq %L0"
7420 [(set_attr "type" "imul")
7421 (set_attr "length" "8")])
7423 (define_insn "*mulsidi3_no_mq"
7424 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7425 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7426 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7427 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7430 return (WORDS_BIG_ENDIAN)
7431 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
7432 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
7434 [(set_attr "type" "imul")
7435 (set_attr "length" "8")])
7438 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7439 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7440 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7441 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7444 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
7445 (sign_extend:DI (match_dup 2)))
7448 (mult:SI (match_dup 1)
7452 int endian = (WORDS_BIG_ENDIAN == 0);
7453 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7454 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7457 (define_expand "umulsidi3"
7458 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7459 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7460 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7461 "TARGET_POWERPC && ! TARGET_POWERPC64"
7466 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
7471 (define_insn "umulsidi3_mq"
7472 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7473 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7474 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
7475 (clobber (match_scratch:SI 3 "=q"))]
7476 "TARGET_POWERPC && TARGET_POWER"
7479 return (WORDS_BIG_ENDIAN)
7480 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7481 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7483 [(set_attr "type" "imul")
7484 (set_attr "length" "8")])
7486 (define_insn "*umulsidi3_no_mq"
7487 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
7488 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
7489 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
7490 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
7493 return (WORDS_BIG_ENDIAN)
7494 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
7495 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
7497 [(set_attr "type" "imul")
7498 (set_attr "length" "8")])
7501 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7502 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
7503 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
7504 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
7507 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
7508 (zero_extend:DI (match_dup 2)))
7511 (mult:SI (match_dup 1)
7515 int endian = (WORDS_BIG_ENDIAN == 0);
7516 operands[3] = operand_subword (operands[0], endian, 0, DImode);
7517 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
7520 (define_expand "smulsi3_highpart"
7521 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7523 (lshiftrt:DI (mult:DI (sign_extend:DI
7524 (match_operand:SI 1 "gpc_reg_operand" ""))
7526 (match_operand:SI 2 "gpc_reg_operand" "")))
7531 if (! TARGET_POWER && ! TARGET_POWERPC)
7533 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
7534 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
7535 emit_insn (gen_mulh_call ());
7536 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
7539 else if (TARGET_POWER)
7541 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7546 (define_insn "smulsi3_highpart_mq"
7547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7549 (lshiftrt:DI (mult:DI (sign_extend:DI
7550 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7552 (match_operand:SI 2 "gpc_reg_operand" "r")))
7554 (clobber (match_scratch:SI 3 "=q"))]
7557 [(set_attr "type" "imul")])
7559 (define_insn "*smulsi3_highpart_no_mq"
7560 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7562 (lshiftrt:DI (mult:DI (sign_extend:DI
7563 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7565 (match_operand:SI 2 "gpc_reg_operand" "r")))
7567 "TARGET_POWERPC && ! TARGET_POWER"
7569 [(set_attr "type" "imul")])
7571 (define_expand "umulsi3_highpart"
7572 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7574 (lshiftrt:DI (mult:DI (zero_extend:DI
7575 (match_operand:SI 1 "gpc_reg_operand" ""))
7577 (match_operand:SI 2 "gpc_reg_operand" "")))
7584 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
7589 (define_insn "umulsi3_highpart_mq"
7590 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7592 (lshiftrt:DI (mult:DI (zero_extend:DI
7593 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7595 (match_operand:SI 2 "gpc_reg_operand" "r")))
7597 (clobber (match_scratch:SI 3 "=q"))]
7598 "TARGET_POWERPC && TARGET_POWER"
7600 [(set_attr "type" "imul")])
7602 (define_insn "*umulsi3_highpart_no_mq"
7603 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7605 (lshiftrt:DI (mult:DI (zero_extend:DI
7606 (match_operand:SI 1 "gpc_reg_operand" "%r"))
7608 (match_operand:SI 2 "gpc_reg_operand" "r")))
7610 "TARGET_POWERPC && ! TARGET_POWER"
7612 [(set_attr "type" "imul")])
7614 ;; If operands 0 and 2 are in the same register, we have a problem. But
7615 ;; operands 0 and 1 (the usual case) can be in the same register. That's
7616 ;; why we have the strange constraints below.
7617 (define_insn "ashldi3_power"
7618 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7619 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7620 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7621 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7624 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
7625 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7626 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
7627 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
7628 [(set_attr "length" "8")])
7630 (define_insn "lshrdi3_power"
7631 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
7632 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
7633 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
7634 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
7637 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
7638 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7639 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
7640 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
7641 [(set_attr "length" "8")])
7643 ;; Shift by a variable amount is too complex to be worth open-coding. We
7644 ;; just handle shifts by constants.
7645 (define_insn "ashrdi3_power"
7646 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7647 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7648 (match_operand:SI 2 "const_int_operand" "M,i")))
7649 (clobber (match_scratch:SI 3 "=X,q"))]
7652 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7653 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
7654 [(set_attr "type" "shift")
7655 (set_attr "length" "8")])
7657 (define_insn "ashrdi3_no_power"
7658 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
7659 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7660 (match_operand:SI 2 "const_int_operand" "M,i")))]
7661 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
7663 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
7664 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
7665 [(set_attr "type" "two,three")
7666 (set_attr "length" "8,12")])
7668 (define_insn "*ashrdisi3_noppc64"
7669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7670 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7671 (const_int 32)) 4))]
7672 "TARGET_32BIT && !TARGET_POWERPC64"
7675 if (REGNO (operands[0]) == REGNO (operands[1]))
7678 return \"mr %0,%1\";
7680 [(set_attr "length" "4")])
7683 ;; PowerPC64 DImode operations.
7685 (define_expand "absdi2"
7686 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7687 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
7692 emit_insn (gen_absdi2_isel (operands[0], operands[1]));
7694 emit_insn (gen_absdi2_internal (operands[0], operands[1]));
7698 (define_insn_and_split "absdi2_internal"
7699 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7700 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
7701 (clobber (match_scratch:DI 2 "=&r,&r"))]
7702 "TARGET_POWERPC64 && !TARGET_ISEL"
7704 "&& reload_completed"
7705 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7706 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7707 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
7710 (define_insn_and_split "*nabsdi2"
7711 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
7712 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
7713 (clobber (match_scratch:DI 2 "=&r,&r"))]
7714 "TARGET_POWERPC64 && !TARGET_ISEL"
7716 "&& reload_completed"
7717 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
7718 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
7719 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
7722 (define_insn "muldi3"
7723 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7724 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7725 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
7731 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
7732 (const_string "imul3")
7733 (match_operand:SI 2 "short_cint_operand" "")
7734 (const_string "imul2")]
7735 (const_string "lmul")))])
7737 (define_insn "*muldi3_internal1"
7738 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7739 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7740 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7742 (clobber (match_scratch:DI 3 "=r,r"))]
7747 [(set_attr "type" "lmul_compare")
7748 (set_attr "length" "4,8")])
7751 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7752 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7753 (match_operand:DI 2 "gpc_reg_operand" ""))
7755 (clobber (match_scratch:DI 3 ""))]
7756 "TARGET_POWERPC64 && reload_completed"
7758 (mult:DI (match_dup 1) (match_dup 2)))
7760 (compare:CC (match_dup 3)
7764 (define_insn "*muldi3_internal2"
7765 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7766 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
7767 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7769 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7770 (mult:DI (match_dup 1) (match_dup 2)))]
7775 [(set_attr "type" "lmul_compare")
7776 (set_attr "length" "4,8")])
7779 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7780 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
7781 (match_operand:DI 2 "gpc_reg_operand" ""))
7783 (set (match_operand:DI 0 "gpc_reg_operand" "")
7784 (mult:DI (match_dup 1) (match_dup 2)))]
7785 "TARGET_POWERPC64 && reload_completed"
7787 (mult:DI (match_dup 1) (match_dup 2)))
7789 (compare:CC (match_dup 0)
7793 (define_insn "smuldi3_highpart"
7794 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7796 (lshiftrt:TI (mult:TI (sign_extend:TI
7797 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7799 (match_operand:DI 2 "gpc_reg_operand" "r")))
7803 [(set_attr "type" "lmul")])
7805 (define_insn "umuldi3_highpart"
7806 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7808 (lshiftrt:TI (mult:TI (zero_extend:TI
7809 (match_operand:DI 1 "gpc_reg_operand" "%r"))
7811 (match_operand:DI 2 "gpc_reg_operand" "r")))
7815 [(set_attr "type" "lmul")])
7817 (define_insn "rotldi3"
7818 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7819 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7820 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
7825 [(set_attr "type" "var_shift_rotate,integer")])
7827 (define_insn "*rotldi3_internal2"
7828 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7829 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7830 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7832 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7839 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7840 (set_attr "length" "4,4,8,8")])
7843 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7844 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7845 (match_operand:DI 2 "reg_or_cint_operand" ""))
7847 (clobber (match_scratch:DI 3 ""))]
7848 "TARGET_POWERPC64 && reload_completed"
7850 (rotate:DI (match_dup 1) (match_dup 2)))
7852 (compare:CC (match_dup 3)
7856 (define_insn "*rotldi3_internal3"
7857 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7858 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7859 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7861 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7862 (rotate:DI (match_dup 1) (match_dup 2)))]
7869 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7870 (set_attr "length" "4,4,8,8")])
7873 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7874 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7875 (match_operand:DI 2 "reg_or_cint_operand" ""))
7877 (set (match_operand:DI 0 "gpc_reg_operand" "")
7878 (rotate:DI (match_dup 1) (match_dup 2)))]
7879 "TARGET_POWERPC64 && reload_completed"
7881 (rotate:DI (match_dup 1) (match_dup 2)))
7883 (compare:CC (match_dup 0)
7887 (define_insn "*rotldi3_internal4"
7888 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7889 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7890 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
7891 (match_operand:DI 3 "mask64_operand" "n,n")))]
7894 rldc%B3 %0,%1,%2,%S3
7895 rldic%B3 %0,%1,%H2,%S3"
7896 [(set_attr "type" "var_shift_rotate,integer")])
7898 (define_insn "*rotldi3_internal5"
7899 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7901 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7902 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7903 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7905 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
7908 rldc%B3. %4,%1,%2,%S3
7909 rldic%B3. %4,%1,%H2,%S3
7912 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7913 (set_attr "length" "4,4,8,8")])
7916 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7918 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7919 (match_operand:DI 2 "reg_or_cint_operand" ""))
7920 (match_operand:DI 3 "mask64_operand" ""))
7922 (clobber (match_scratch:DI 4 ""))]
7923 "TARGET_POWERPC64 && reload_completed"
7925 (and:DI (rotate:DI (match_dup 1)
7929 (compare:CC (match_dup 4)
7933 (define_insn "*rotldi3_internal6"
7934 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
7936 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7937 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
7938 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
7940 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7941 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7944 rldc%B3. %0,%1,%2,%S3
7945 rldic%B3. %0,%1,%H2,%S3
7948 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7949 (set_attr "length" "4,4,8,8")])
7952 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7954 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7955 (match_operand:DI 2 "reg_or_cint_operand" ""))
7956 (match_operand:DI 3 "mask64_operand" ""))
7958 (set (match_operand:DI 0 "gpc_reg_operand" "")
7959 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7960 "TARGET_POWERPC64 && reload_completed"
7962 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7964 (compare:CC (match_dup 0)
7968 (define_insn "*rotldi3_internal7"
7969 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7972 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7973 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7977 rldicl %0,%1,%H2,56"
7978 [(set_attr "type" "var_shift_rotate,integer")])
7980 (define_insn "*rotldi3_internal8"
7981 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7982 (compare:CC (zero_extend:DI
7984 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7985 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7987 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7991 rldicl. %3,%1,%H2,56
7994 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7995 (set_attr "length" "4,4,8,8")])
7998 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7999 (compare:CC (zero_extend:DI
8001 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8002 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8004 (clobber (match_scratch:DI 3 ""))]
8005 "TARGET_POWERPC64 && reload_completed"
8007 (zero_extend:DI (subreg:QI
8008 (rotate:DI (match_dup 1)
8011 (compare:CC (match_dup 3)
8015 (define_insn "*rotldi3_internal9"
8016 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8017 (compare:CC (zero_extend:DI
8019 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8020 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8022 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8023 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8027 rldicl. %0,%1,%H2,56
8030 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8031 (set_attr "length" "4,4,8,8")])
8034 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8035 (compare:CC (zero_extend:DI
8037 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8038 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8040 (set (match_operand:DI 0 "gpc_reg_operand" "")
8041 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8042 "TARGET_POWERPC64 && reload_completed"
8044 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8046 (compare:CC (match_dup 0)
8050 (define_insn "*rotldi3_internal10"
8051 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8054 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8055 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8059 rldicl %0,%1,%H2,48"
8060 [(set_attr "type" "var_shift_rotate,integer")])
8062 (define_insn "*rotldi3_internal11"
8063 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8064 (compare:CC (zero_extend:DI
8066 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8067 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8069 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8073 rldicl. %3,%1,%H2,48
8076 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8077 (set_attr "length" "4,4,8,8")])
8080 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8081 (compare:CC (zero_extend:DI
8083 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8084 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8086 (clobber (match_scratch:DI 3 ""))]
8087 "TARGET_POWERPC64 && reload_completed"
8089 (zero_extend:DI (subreg:HI
8090 (rotate:DI (match_dup 1)
8093 (compare:CC (match_dup 3)
8097 (define_insn "*rotldi3_internal12"
8098 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8099 (compare:CC (zero_extend:DI
8101 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8102 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8104 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8105 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8109 rldicl. %0,%1,%H2,48
8112 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8113 (set_attr "length" "4,4,8,8")])
8116 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8117 (compare:CC (zero_extend:DI
8119 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8120 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8122 (set (match_operand:DI 0 "gpc_reg_operand" "")
8123 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8124 "TARGET_POWERPC64 && reload_completed"
8126 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8128 (compare:CC (match_dup 0)
8132 (define_insn "*rotldi3_internal13"
8133 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8136 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8137 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
8141 rldicl %0,%1,%H2,32"
8142 [(set_attr "type" "var_shift_rotate,integer")])
8144 (define_insn "*rotldi3_internal14"
8145 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8146 (compare:CC (zero_extend:DI
8148 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8149 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8151 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8155 rldicl. %3,%1,%H2,32
8158 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8159 (set_attr "length" "4,4,8,8")])
8162 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8163 (compare:CC (zero_extend:DI
8165 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8166 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8168 (clobber (match_scratch:DI 3 ""))]
8169 "TARGET_POWERPC64 && reload_completed"
8171 (zero_extend:DI (subreg:SI
8172 (rotate:DI (match_dup 1)
8175 (compare:CC (match_dup 3)
8179 (define_insn "*rotldi3_internal15"
8180 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8181 (compare:CC (zero_extend:DI
8183 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8184 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
8186 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8187 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8191 rldicl. %0,%1,%H2,32
8194 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8195 (set_attr "length" "4,4,8,8")])
8198 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8199 (compare:CC (zero_extend:DI
8201 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
8202 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
8204 (set (match_operand:DI 0 "gpc_reg_operand" "")
8205 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
8206 "TARGET_POWERPC64 && reload_completed"
8208 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
8210 (compare:CC (match_dup 0)
8214 (define_expand "ashldi3"
8215 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8216 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8217 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8218 "TARGET_POWERPC64 || TARGET_POWER"
8221 if (TARGET_POWERPC64)
8223 else if (TARGET_POWER)
8225 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
8232 (define_insn "*ashldi3_internal1"
8233 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8234 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8235 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8240 [(set_attr "type" "var_shift_rotate,shift")])
8242 (define_insn "*ashldi3_internal2"
8243 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8244 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8245 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8247 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8254 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8255 (set_attr "length" "4,4,8,8")])
8258 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8259 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8260 (match_operand:SI 2 "reg_or_cint_operand" ""))
8262 (clobber (match_scratch:DI 3 ""))]
8263 "TARGET_POWERPC64 && reload_completed"
8265 (ashift:DI (match_dup 1) (match_dup 2)))
8267 (compare:CC (match_dup 3)
8271 (define_insn "*ashldi3_internal3"
8272 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8273 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8274 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8276 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8277 (ashift:DI (match_dup 1) (match_dup 2)))]
8284 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8285 (set_attr "length" "4,4,8,8")])
8288 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8289 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8290 (match_operand:SI 2 "reg_or_cint_operand" ""))
8292 (set (match_operand:DI 0 "gpc_reg_operand" "")
8293 (ashift:DI (match_dup 1) (match_dup 2)))]
8294 "TARGET_POWERPC64 && reload_completed"
8296 (ashift:DI (match_dup 1) (match_dup 2)))
8298 (compare:CC (match_dup 0)
8302 (define_insn "*ashldi3_internal4"
8303 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8304 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8305 (match_operand:SI 2 "const_int_operand" "i"))
8306 (match_operand:DI 3 "const_int_operand" "n")))]
8307 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
8308 "rldic %0,%1,%H2,%W3")
8310 (define_insn "ashldi3_internal5"
8311 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8313 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8314 (match_operand:SI 2 "const_int_operand" "i,i"))
8315 (match_operand:DI 3 "const_int_operand" "n,n"))
8317 (clobber (match_scratch:DI 4 "=r,r"))]
8318 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8320 rldic. %4,%1,%H2,%W3
8322 [(set_attr "type" "compare")
8323 (set_attr "length" "4,8")])
8326 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8328 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8329 (match_operand:SI 2 "const_int_operand" ""))
8330 (match_operand:DI 3 "const_int_operand" ""))
8332 (clobber (match_scratch:DI 4 ""))]
8333 "TARGET_POWERPC64 && reload_completed
8334 && includes_rldic_lshift_p (operands[2], operands[3])"
8336 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8339 (compare:CC (match_dup 4)
8343 (define_insn "*ashldi3_internal6"
8344 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8346 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8347 (match_operand:SI 2 "const_int_operand" "i,i"))
8348 (match_operand:DI 3 "const_int_operand" "n,n"))
8350 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8351 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8352 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
8354 rldic. %0,%1,%H2,%W3
8356 [(set_attr "type" "compare")
8357 (set_attr "length" "4,8")])
8360 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8362 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8363 (match_operand:SI 2 "const_int_operand" ""))
8364 (match_operand:DI 3 "const_int_operand" ""))
8366 (set (match_operand:DI 0 "gpc_reg_operand" "")
8367 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8368 "TARGET_POWERPC64 && reload_completed
8369 && includes_rldic_lshift_p (operands[2], operands[3])"
8371 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8374 (compare:CC (match_dup 0)
8378 (define_insn "*ashldi3_internal7"
8379 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8380 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
8381 (match_operand:SI 2 "const_int_operand" "i"))
8382 (match_operand:DI 3 "mask64_operand" "n")))]
8383 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
8384 "rldicr %0,%1,%H2,%S3")
8386 (define_insn "ashldi3_internal8"
8387 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8389 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8390 (match_operand:SI 2 "const_int_operand" "i,i"))
8391 (match_operand:DI 3 "mask64_operand" "n,n"))
8393 (clobber (match_scratch:DI 4 "=r,r"))]
8394 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8396 rldicr. %4,%1,%H2,%S3
8398 [(set_attr "type" "compare")
8399 (set_attr "length" "4,8")])
8402 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8404 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8405 (match_operand:SI 2 "const_int_operand" ""))
8406 (match_operand:DI 3 "mask64_operand" ""))
8408 (clobber (match_scratch:DI 4 ""))]
8409 "TARGET_POWERPC64 && reload_completed
8410 && includes_rldicr_lshift_p (operands[2], operands[3])"
8412 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8415 (compare:CC (match_dup 4)
8419 (define_insn "*ashldi3_internal9"
8420 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
8422 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8423 (match_operand:SI 2 "const_int_operand" "i,i"))
8424 (match_operand:DI 3 "mask64_operand" "n,n"))
8426 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8427 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8428 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
8430 rldicr. %0,%1,%H2,%S3
8432 [(set_attr "type" "compare")
8433 (set_attr "length" "4,8")])
8436 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
8438 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
8439 (match_operand:SI 2 "const_int_operand" ""))
8440 (match_operand:DI 3 "mask64_operand" ""))
8442 (set (match_operand:DI 0 "gpc_reg_operand" "")
8443 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
8444 "TARGET_POWERPC64 && reload_completed
8445 && includes_rldicr_lshift_p (operands[2], operands[3])"
8447 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
8450 (compare:CC (match_dup 0)
8454 (define_expand "lshrdi3"
8455 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8456 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8457 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8458 "TARGET_POWERPC64 || TARGET_POWER"
8461 if (TARGET_POWERPC64)
8463 else if (TARGET_POWER)
8465 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
8472 (define_insn "*lshrdi3_internal1"
8473 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8474 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8475 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8480 [(set_attr "type" "var_shift_rotate,shift")])
8482 (define_insn "*lshrdi3_internal2"
8483 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8484 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8485 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8487 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8494 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8495 (set_attr "length" "4,4,8,8")])
8498 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8499 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8500 (match_operand:SI 2 "reg_or_cint_operand" ""))
8502 (clobber (match_scratch:DI 3 ""))]
8503 "TARGET_POWERPC64 && reload_completed"
8505 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8507 (compare:CC (match_dup 3)
8511 (define_insn "*lshrdi3_internal3"
8512 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8513 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8514 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8516 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8517 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8524 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8525 (set_attr "length" "4,4,8,8")])
8528 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8529 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8530 (match_operand:SI 2 "reg_or_cint_operand" ""))
8532 (set (match_operand:DI 0 "gpc_reg_operand" "")
8533 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
8534 "TARGET_POWERPC64 && reload_completed"
8536 (lshiftrt:DI (match_dup 1) (match_dup 2)))
8538 (compare:CC (match_dup 0)
8542 (define_expand "ashrdi3"
8543 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8544 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8545 (match_operand:SI 2 "reg_or_cint_operand" "")))]
8549 if (TARGET_POWERPC64)
8551 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
8553 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
8556 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
8557 && WORDS_BIG_ENDIAN)
8559 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
8566 (define_insn "*ashrdi3_internal1"
8567 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8568 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
8569 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
8574 [(set_attr "type" "var_shift_rotate,shift")])
8576 (define_insn "*ashrdi3_internal2"
8577 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
8578 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8579 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8581 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
8588 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8589 (set_attr "length" "4,4,8,8")])
8592 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8593 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8594 (match_operand:SI 2 "reg_or_cint_operand" ""))
8596 (clobber (match_scratch:DI 3 ""))]
8597 "TARGET_POWERPC64 && reload_completed"
8599 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8601 (compare:CC (match_dup 3)
8605 (define_insn "*ashrdi3_internal3"
8606 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
8607 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
8608 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
8610 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8611 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8618 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
8619 (set_attr "length" "4,4,8,8")])
8622 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8623 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
8624 (match_operand:SI 2 "reg_or_cint_operand" ""))
8626 (set (match_operand:DI 0 "gpc_reg_operand" "")
8627 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
8628 "TARGET_POWERPC64 && reload_completed"
8630 (ashiftrt:DI (match_dup 1) (match_dup 2)))
8632 (compare:CC (match_dup 0)
8636 (define_expand "anddi3"
8638 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8639 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8640 (match_operand:DI 2 "and64_2_operand" "")))
8641 (clobber (match_scratch:CC 3 ""))])]
8645 (define_insn "anddi3_mc"
8646 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
8647 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
8648 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
8649 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
8650 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
8653 rldic%B2 %0,%1,0,%S2
8654 rlwinm %0,%1,0,%m2,%M2
8658 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
8659 (set_attr "length" "4,4,4,4,4,8")])
8661 (define_insn "anddi3_nomc"
8662 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
8663 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
8664 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
8665 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
8666 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
8669 rldic%B2 %0,%1,0,%S2
8670 rlwinm %0,%1,0,%m2,%M2
8672 [(set_attr "length" "4,4,4,8")])
8675 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8676 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8677 (match_operand:DI 2 "mask64_2_operand" "")))
8678 (clobber (match_scratch:CC 3 ""))]
8680 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8681 && !mask_operand (operands[2], DImode)
8682 && !mask64_operand (operands[2], DImode)"
8684 (and:DI (rotate:DI (match_dup 1)
8688 (and:DI (rotate:DI (match_dup 0)
8692 build_mask64_2_operands (operands[2], &operands[4]);
8695 (define_insn "*anddi3_internal2_mc"
8696 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8697 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8698 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8700 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
8701 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8702 "TARGET_64BIT && rs6000_gen_cell_microcode"
8705 rldic%B2. %3,%1,0,%S2
8706 rlwinm. %3,%1,0,%m2,%M2
8716 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8717 fast_compare,compare,compare,compare,compare,compare,\
8719 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8722 [(set (match_operand:CC 0 "cc_reg_operand" "")
8723 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8724 (match_operand:DI 2 "mask64_2_operand" ""))
8726 (clobber (match_scratch:DI 3 ""))
8727 (clobber (match_scratch:CC 4 ""))]
8728 "TARGET_64BIT && reload_completed
8729 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8730 && !mask_operand (operands[2], DImode)
8731 && !mask64_operand (operands[2], DImode)"
8733 (and:DI (rotate:DI (match_dup 1)
8736 (parallel [(set (match_dup 0)
8737 (compare:CC (and:DI (rotate:DI (match_dup 3)
8741 (clobber (match_dup 3))])]
8744 build_mask64_2_operands (operands[2], &operands[5]);
8747 (define_insn "*anddi3_internal3_mc"
8748 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
8749 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
8750 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
8752 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
8753 (and:DI (match_dup 1) (match_dup 2)))
8754 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
8755 "TARGET_64BIT && rs6000_gen_cell_microcode"
8758 rldic%B2. %0,%1,0,%S2
8759 rlwinm. %0,%1,0,%m2,%M2
8769 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
8770 fast_compare,compare,compare,compare,compare,compare,\
8772 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
8775 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8776 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8777 (match_operand:DI 2 "and64_2_operand" ""))
8779 (set (match_operand:DI 0 "gpc_reg_operand" "")
8780 (and:DI (match_dup 1) (match_dup 2)))
8781 (clobber (match_scratch:CC 4 ""))]
8782 "TARGET_64BIT && reload_completed"
8783 [(parallel [(set (match_dup 0)
8784 (and:DI (match_dup 1) (match_dup 2)))
8785 (clobber (match_dup 4))])
8787 (compare:CC (match_dup 0)
8792 [(set (match_operand:CC 3 "cc_reg_operand" "")
8793 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
8794 (match_operand:DI 2 "mask64_2_operand" ""))
8796 (set (match_operand:DI 0 "gpc_reg_operand" "")
8797 (and:DI (match_dup 1) (match_dup 2)))
8798 (clobber (match_scratch:CC 4 ""))]
8799 "TARGET_64BIT && reload_completed
8800 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
8801 && !mask_operand (operands[2], DImode)
8802 && !mask64_operand (operands[2], DImode)"
8804 (and:DI (rotate:DI (match_dup 1)
8807 (parallel [(set (match_dup 3)
8808 (compare:CC (and:DI (rotate:DI (match_dup 0)
8813 (and:DI (rotate:DI (match_dup 0)
8818 build_mask64_2_operands (operands[2], &operands[5]);
8821 (define_expand "iordi3"
8822 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8823 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8824 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8828 if (non_logical_cint_operand (operands[2], DImode))
8830 HOST_WIDE_INT value;
8831 rtx tmp = ((!can_create_pseudo_p ()
8832 || rtx_equal_p (operands[0], operands[1]))
8833 ? operands[0] : gen_reg_rtx (DImode));
8835 if (GET_CODE (operands[2]) == CONST_INT)
8837 value = INTVAL (operands[2]);
8838 emit_insn (gen_iordi3 (tmp, operands[1],
8839 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8843 value = CONST_DOUBLE_LOW (operands[2]);
8844 emit_insn (gen_iordi3 (tmp, operands[1],
8845 immed_double_const (value
8846 & (~ (HOST_WIDE_INT) 0xffff),
8850 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8855 (define_expand "xordi3"
8856 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8857 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8858 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8862 if (non_logical_cint_operand (operands[2], DImode))
8864 HOST_WIDE_INT value;
8865 rtx tmp = ((!can_create_pseudo_p ()
8866 || rtx_equal_p (operands[0], operands[1]))
8867 ? operands[0] : gen_reg_rtx (DImode));
8869 if (GET_CODE (operands[2]) == CONST_INT)
8871 value = INTVAL (operands[2]);
8872 emit_insn (gen_xordi3 (tmp, operands[1],
8873 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8877 value = CONST_DOUBLE_LOW (operands[2]);
8878 emit_insn (gen_xordi3 (tmp, operands[1],
8879 immed_double_const (value
8880 & (~ (HOST_WIDE_INT) 0xffff),
8884 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8889 (define_insn "*booldi3_internal1"
8890 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8891 (match_operator:DI 3 "boolean_or_operator"
8892 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8893 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8900 (define_insn "*booldi3_internal2"
8901 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8902 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8903 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8904 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8906 (clobber (match_scratch:DI 3 "=r,r"))]
8911 [(set_attr "type" "fast_compare,compare")
8912 (set_attr "length" "4,8")])
8915 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8916 (compare:CC (match_operator:DI 4 "boolean_operator"
8917 [(match_operand:DI 1 "gpc_reg_operand" "")
8918 (match_operand:DI 2 "gpc_reg_operand" "")])
8920 (clobber (match_scratch:DI 3 ""))]
8921 "TARGET_POWERPC64 && reload_completed"
8922 [(set (match_dup 3) (match_dup 4))
8924 (compare:CC (match_dup 3)
8928 (define_insn "*booldi3_internal3"
8929 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8930 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8931 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8932 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8934 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8940 [(set_attr "type" "fast_compare,compare")
8941 (set_attr "length" "4,8")])
8944 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8945 (compare:CC (match_operator:DI 4 "boolean_operator"
8946 [(match_operand:DI 1 "gpc_reg_operand" "")
8947 (match_operand:DI 2 "gpc_reg_operand" "")])
8949 (set (match_operand:DI 0 "gpc_reg_operand" "")
8951 "TARGET_POWERPC64 && reload_completed"
8952 [(set (match_dup 0) (match_dup 4))
8954 (compare:CC (match_dup 0)
8958 ;; Split a logical operation that we can't do in one insn into two insns,
8959 ;; each of which does one 16-bit part. This is used by combine.
8962 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8963 (match_operator:DI 3 "boolean_or_operator"
8964 [(match_operand:DI 1 "gpc_reg_operand" "")
8965 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8967 [(set (match_dup 0) (match_dup 4))
8968 (set (match_dup 0) (match_dup 5))]
8973 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8975 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8976 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8978 i4 = GEN_INT (value & 0xffff);
8982 i3 = GEN_INT (INTVAL (operands[2])
8983 & (~ (HOST_WIDE_INT) 0xffff));
8984 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8986 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8988 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8992 (define_insn "*boolcdi3_internal1"
8993 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8994 (match_operator:DI 3 "boolean_operator"
8995 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8996 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
9000 (define_insn "*boolcdi3_internal2"
9001 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9002 (compare:CC (match_operator:DI 4 "boolean_operator"
9003 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9004 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9006 (clobber (match_scratch:DI 3 "=r,r"))]
9011 [(set_attr "type" "fast_compare,compare")
9012 (set_attr "length" "4,8")])
9015 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9016 (compare:CC (match_operator:DI 4 "boolean_operator"
9017 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9018 (match_operand:DI 2 "gpc_reg_operand" "")])
9020 (clobber (match_scratch:DI 3 ""))]
9021 "TARGET_POWERPC64 && reload_completed"
9022 [(set (match_dup 3) (match_dup 4))
9024 (compare:CC (match_dup 3)
9028 (define_insn "*boolcdi3_internal3"
9029 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9030 (compare:CC (match_operator:DI 4 "boolean_operator"
9031 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9032 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
9034 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9040 [(set_attr "type" "fast_compare,compare")
9041 (set_attr "length" "4,8")])
9044 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9045 (compare:CC (match_operator:DI 4 "boolean_operator"
9046 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9047 (match_operand:DI 2 "gpc_reg_operand" "")])
9049 (set (match_operand:DI 0 "gpc_reg_operand" "")
9051 "TARGET_POWERPC64 && reload_completed"
9052 [(set (match_dup 0) (match_dup 4))
9054 (compare:CC (match_dup 0)
9058 (define_insn "*boolccdi3_internal1"
9059 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9060 (match_operator:DI 3 "boolean_operator"
9061 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
9062 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
9066 (define_insn "*boolccdi3_internal2"
9067 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
9068 (compare:CC (match_operator:DI 4 "boolean_operator"
9069 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
9070 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9072 (clobber (match_scratch:DI 3 "=r,r"))]
9077 [(set_attr "type" "fast_compare,compare")
9078 (set_attr "length" "4,8")])
9081 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
9082 (compare:CC (match_operator:DI 4 "boolean_operator"
9083 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9084 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9086 (clobber (match_scratch:DI 3 ""))]
9087 "TARGET_POWERPC64 && reload_completed"
9088 [(set (match_dup 3) (match_dup 4))
9090 (compare:CC (match_dup 3)
9094 (define_insn "*boolccdi3_internal3"
9095 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
9096 (compare:CC (match_operator:DI 4 "boolean_operator"
9097 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
9098 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
9100 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
9106 [(set_attr "type" "fast_compare,compare")
9107 (set_attr "length" "4,8")])
9110 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
9111 (compare:CC (match_operator:DI 4 "boolean_operator"
9112 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
9113 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
9115 (set (match_operand:DI 0 "gpc_reg_operand" "")
9117 "TARGET_POWERPC64 && reload_completed"
9118 [(set (match_dup 0) (match_dup 4))
9120 (compare:CC (match_dup 0)
9124 (define_expand "smindi3"
9125 [(match_operand:DI 0 "gpc_reg_operand" "")
9126 (match_operand:DI 1 "gpc_reg_operand" "")
9127 (match_operand:DI 2 "gpc_reg_operand" "")]
9131 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
9135 (define_expand "smaxdi3"
9136 [(match_operand:DI 0 "gpc_reg_operand" "")
9137 (match_operand:DI 1 "gpc_reg_operand" "")
9138 (match_operand:DI 2 "gpc_reg_operand" "")]
9142 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
9146 (define_expand "umindi3"
9147 [(match_operand:DI 0 "gpc_reg_operand" "")
9148 (match_operand:DI 1 "gpc_reg_operand" "")
9149 (match_operand:DI 2 "gpc_reg_operand" "")]
9153 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
9157 (define_expand "umaxdi3"
9158 [(match_operand:DI 0 "gpc_reg_operand" "")
9159 (match_operand:DI 1 "gpc_reg_operand" "")
9160 (match_operand:DI 2 "gpc_reg_operand" "")]
9164 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
9169 ;; Now define ways of moving data around.
9171 ;; Set up a register with a value from the GOT table
9173 (define_expand "movsi_got"
9174 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9175 (unspec:SI [(match_operand:SI 1 "got_operand" "")
9176 (match_dup 2)] UNSPEC_MOVSI_GOT))]
9177 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9180 if (GET_CODE (operands[1]) == CONST)
9182 rtx offset = const0_rtx;
9183 HOST_WIDE_INT value;
9185 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
9186 value = INTVAL (offset);
9189 rtx tmp = (!can_create_pseudo_p ()
9191 : gen_reg_rtx (Pmode));
9192 emit_insn (gen_movsi_got (tmp, operands[1]));
9193 emit_insn (gen_addsi3 (operands[0], tmp, offset));
9198 operands[2] = rs6000_got_register (operands[1]);
9201 (define_insn "*movsi_got_internal"
9202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9203 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9204 (match_operand:SI 2 "gpc_reg_operand" "b")]
9206 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
9207 "{l|lwz} %0,%a1@got(%2)"
9208 [(set_attr "type" "load")])
9210 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
9211 ;; didn't get allocated to a hard register.
9213 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9214 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
9215 (match_operand:SI 2 "memory_operand" "")]
9217 "DEFAULT_ABI == ABI_V4
9219 && (reload_in_progress || reload_completed)"
9220 [(set (match_dup 0) (match_dup 2))
9221 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
9225 ;; For SI, we special-case integers that can't be loaded in one insn. We
9226 ;; do the load 16-bits at a time. We could do this by loading from memory,
9227 ;; and this is even supposed to be faster, but it is simpler not to get
9228 ;; integers in the TOC.
9229 (define_insn "movsi_low"
9230 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9231 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9232 (match_operand 2 "" ""))))]
9233 "TARGET_MACHO && ! TARGET_64BIT"
9234 "{l|lwz} %0,lo16(%2)(%1)"
9235 [(set_attr "type" "load")
9236 (set_attr "length" "4")])
9238 (define_insn "*movsi_internal1"
9239 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
9240 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
9241 "!TARGET_SINGLE_FPU &&
9242 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9246 {l%U1%X1|lwz%U1%X1} %0,%1
9247 {st%U0%X0|stw%U0%X0} %1,%0
9257 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
9258 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
9260 (define_insn "*movsi_internal1_single"
9261 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h,m,*f")
9262 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0,f,m"))]
9263 "TARGET_SINGLE_FPU &&
9264 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
9268 {l%U1%X1|lwz%U1%X1} %0,%1
9269 {st%U0%X0|stw%U0%X0} %1,%0
9281 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*,*,*")
9282 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4,4,4")])
9284 ;; Split a load of a large constant into the appropriate two-insn
9288 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9289 (match_operand:SI 1 "const_int_operand" ""))]
9290 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
9291 && (INTVAL (operands[1]) & 0xffff) != 0"
9295 (ior:SI (match_dup 0)
9298 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
9300 if (tem == operands[0])
9306 (define_insn "*mov<mode>_internal2"
9307 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
9308 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
9310 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
9313 {cmpi|cmp<wd>i} %2,%0,0
9316 [(set_attr "type" "cmp,compare,cmp")
9317 (set_attr "length" "4,4,8")])
9320 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
9321 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
9323 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
9325 [(set (match_dup 0) (match_dup 1))
9327 (compare:CC (match_dup 0)
9331 (define_insn "*movhi_internal"
9332 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9333 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9334 "gpc_reg_operand (operands[0], HImode)
9335 || gpc_reg_operand (operands[1], HImode)"
9345 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9347 (define_expand "mov<mode>"
9348 [(set (match_operand:INT 0 "general_operand" "")
9349 (match_operand:INT 1 "any_operand" ""))]
9351 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9353 (define_insn "*movqi_internal"
9354 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
9355 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
9356 "gpc_reg_operand (operands[0], QImode)
9357 || gpc_reg_operand (operands[1], QImode)"
9367 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
9369 ;; Here is how to move condition codes around. When we store CC data in
9370 ;; an integer register or memory, we store just the high-order 4 bits.
9371 ;; This lets us not shift in the most common case of CR0.
9372 (define_expand "movcc"
9373 [(set (match_operand:CC 0 "nonimmediate_operand" "")
9374 (match_operand:CC 1 "nonimmediate_operand" ""))]
9378 (define_insn "*movcc_internal1"
9379 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,q,cl,r,m")
9380 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,r,m,r"))]
9381 "register_operand (operands[0], CCmode)
9382 || register_operand (operands[1], CCmode)"
9386 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
9389 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
9395 {l%U1%X1|lwz%U1%X1} %0,%1
9396 {st%U0%U1|stw%U0%U1} %1,%0"
9398 (cond [(eq_attr "alternative" "0,3")
9399 (const_string "cr_logical")
9400 (eq_attr "alternative" "1,2")
9401 (const_string "mtcr")
9402 (eq_attr "alternative" "6,7,9")
9403 (const_string "integer")
9404 (eq_attr "alternative" "8")
9405 (const_string "mfjmpr")
9406 (eq_attr "alternative" "10")
9407 (const_string "mtjmpr")
9408 (eq_attr "alternative" "11")
9409 (const_string "load")
9410 (eq_attr "alternative" "12")
9411 (const_string "store")
9412 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
9413 (const_string "mfcrf")
9415 (const_string "mfcr")))
9416 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4,4")])
9418 ;; For floating-point, we normally deal with the floating-point registers
9419 ;; unless -msoft-float is used. The sole exception is that parameter passing
9420 ;; can produce floating-point values in fixed-point registers. Unless the
9421 ;; value is a simple constant or already in memory, we deal with this by
9422 ;; allocating memory and copying the value explicitly via that memory location.
9423 (define_expand "movsf"
9424 [(set (match_operand:SF 0 "nonimmediate_operand" "")
9425 (match_operand:SF 1 "any_operand" ""))]
9427 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
9430 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9431 (match_operand:SF 1 "const_double_operand" ""))]
9433 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9434 || (GET_CODE (operands[0]) == SUBREG
9435 && GET_CODE (SUBREG_REG (operands[0])) == REG
9436 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9437 [(set (match_dup 2) (match_dup 3))]
9443 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9444 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
9446 if (! TARGET_POWERPC64)
9447 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
9449 operands[2] = gen_lowpart (SImode, operands[0]);
9451 operands[3] = gen_int_mode (l, SImode);
9454 (define_insn "*movsf_hardfloat"
9455 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,*q,!r,*h,!r,!r")
9456 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
9457 "(gpc_reg_operand (operands[0], SFmode)
9458 || gpc_reg_operand (operands[1], SFmode))
9459 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
9462 {l%U1%X1|lwz%U1%X1} %0,%1
9463 {st%U0%X0|stw%U0%X0} %1,%0
9473 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,mfjmpr,*,*,*")
9474 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
9476 (define_insn "*movsf_softfloat"
9477 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
9478 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
9479 "(gpc_reg_operand (operands[0], SFmode)
9480 || gpc_reg_operand (operands[1], SFmode))
9481 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
9487 {l%U1%X1|lwz%U1%X1} %0,%1
9488 {st%U0%X0|stw%U0%X0} %1,%0
9495 [(set_attr "type" "*,mtjmpr,*,mfjmpr,load,store,*,*,*,*,*,*")
9496 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
9499 (define_expand "movdf"
9500 [(set (match_operand:DF 0 "nonimmediate_operand" "")
9501 (match_operand:DF 1 "any_operand" ""))]
9503 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
9506 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9507 (match_operand:DF 1 "const_int_operand" ""))]
9508 "! TARGET_POWERPC64 && reload_completed
9509 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9510 || (GET_CODE (operands[0]) == SUBREG
9511 && GET_CODE (SUBREG_REG (operands[0])) == REG
9512 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9513 [(set (match_dup 2) (match_dup 4))
9514 (set (match_dup 3) (match_dup 1))]
9517 int endian = (WORDS_BIG_ENDIAN == 0);
9518 HOST_WIDE_INT value = INTVAL (operands[1]);
9520 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9521 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9522 #if HOST_BITS_PER_WIDE_INT == 32
9523 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9525 operands[4] = GEN_INT (value >> 32);
9526 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9531 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9532 (match_operand:DF 1 "const_double_operand" ""))]
9533 "! TARGET_POWERPC64 && reload_completed
9534 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9535 || (GET_CODE (operands[0]) == SUBREG
9536 && GET_CODE (SUBREG_REG (operands[0])) == REG
9537 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9538 [(set (match_dup 2) (match_dup 4))
9539 (set (match_dup 3) (match_dup 5))]
9542 int endian = (WORDS_BIG_ENDIAN == 0);
9546 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9547 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9549 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
9550 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
9551 operands[4] = gen_int_mode (l[endian], SImode);
9552 operands[5] = gen_int_mode (l[1 - endian], SImode);
9556 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9557 (match_operand:DF 1 "const_double_operand" ""))]
9558 "TARGET_POWERPC64 && reload_completed
9559 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
9560 || (GET_CODE (operands[0]) == SUBREG
9561 && GET_CODE (SUBREG_REG (operands[0])) == REG
9562 && REGNO (SUBREG_REG (operands[0])) <= 31))"
9563 [(set (match_dup 2) (match_dup 3))]
9566 int endian = (WORDS_BIG_ENDIAN == 0);
9569 #if HOST_BITS_PER_WIDE_INT >= 64
9573 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
9574 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
9576 operands[2] = gen_lowpart (DImode, operands[0]);
9577 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
9578 #if HOST_BITS_PER_WIDE_INT >= 64
9579 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
9580 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
9582 operands[3] = gen_int_mode (val, DImode);
9584 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
9588 ;; Don't have reload use general registers to load a constant. First,
9589 ;; it might not work if the output operand is the equivalent of
9590 ;; a non-offsettable memref, but also it is less efficient than loading
9591 ;; the constant into an FP register, since it will probably be used there.
9592 ;; The "??" is a kludge until we can figure out a more reasonable way
9593 ;; of handling these non-offsettable values.
9594 (define_insn "*movdf_hardfloat32"
9595 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
9596 (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
9597 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9598 && (gpc_reg_operand (operands[0], DFmode)
9599 || gpc_reg_operand (operands[1], DFmode))"
9602 switch (which_alternative)
9612 return \"xxlor %x0,%x1,%x1\";
9615 return \"lxsd%U1x %x0,%y1\";
9618 return \"stxsd%U0x %x1,%y0\";
9620 return \"fmr %0,%1\";
9622 return \"lfd%U1%X1 %0,%1\";
9624 return \"stfd%U0%X0 %1,%0\";
9626 return \"xxlxor %x0,%x0,%x0\";
9633 [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
9634 (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9636 (define_insn "*movdf_softfloat32"
9637 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
9638 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
9640 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
9641 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
9642 && (gpc_reg_operand (operands[0], DFmode)
9643 || gpc_reg_operand (operands[1], DFmode))"
9645 [(set_attr "type" "two,load,store,*,*,*")
9646 (set_attr "length" "8,8,8,8,12,16")])
9648 ; ld/std require word-aligned displacements -> 'Y' constraint.
9649 ; List Y->r and r->Y before r->r for reload.
9650 (define_insn "*movdf_hardfloat64_mfpgpr"
9651 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r,r,d")
9652 (match_operand:DF 1 "input_operand" "r,Y,r,ws,?wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F,d,r"))]
9653 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9654 && TARGET_DOUBLE_FLOAT
9655 && (gpc_reg_operand (operands[0], DFmode)
9656 || gpc_reg_operand (operands[1], DFmode))"
9679 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
9680 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9682 ; ld/std require word-aligned displacements -> 'Y' constraint.
9683 ; List Y->r and r->Y before r->r for reload.
9684 (define_insn "*movdf_hardfloat64"
9685 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r")
9686 (match_operand:DF 1 "input_operand" "r,Y,r,ws,wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F"))]
9687 "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
9688 && TARGET_DOUBLE_FLOAT
9689 && (gpc_reg_operand (operands[0], DFmode)
9690 || gpc_reg_operand (operands[1], DFmode))"
9711 [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
9712 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
9714 (define_insn "*movdf_softfloat64"
9715 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
9716 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
9717 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9718 && (gpc_reg_operand (operands[0], DFmode)
9719 || gpc_reg_operand (operands[1], DFmode))"
9730 [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
9731 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9733 (define_expand "movtf"
9734 [(set (match_operand:TF 0 "general_operand" "")
9735 (match_operand:TF 1 "any_operand" ""))]
9736 "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
9737 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
9739 ; It's important to list the o->f and f->o moves before f->f because
9740 ; otherwise reload, given m->f, will try to pick f->f and reload it,
9741 ; which doesn't make progress. Likewise r->Y must be before r->r.
9742 (define_insn_and_split "*movtf_internal"
9743 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
9744 (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
9746 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
9747 && (gpc_reg_operand (operands[0], TFmode)
9748 || gpc_reg_operand (operands[1], TFmode))"
9750 "&& reload_completed"
9752 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9753 [(set_attr "length" "8,8,8,20,20,16")])
9755 (define_insn_and_split "*movtf_softfloat"
9756 [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=r,Y,r")
9757 (match_operand:TF 1 "input_operand" "YGHF,r,r"))]
9759 && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
9760 && (gpc_reg_operand (operands[0], TFmode)
9761 || gpc_reg_operand (operands[1], TFmode))"
9763 "&& reload_completed"
9765 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9766 [(set_attr "length" "20,20,16")])
9768 (define_expand "extenddftf2"
9769 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9770 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9772 && TARGET_HARD_FLOAT
9773 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9774 && TARGET_LONG_DOUBLE_128"
9776 if (TARGET_E500_DOUBLE)
9777 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9779 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9783 (define_expand "extenddftf2_fprs"
9784 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9785 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9786 (use (match_dup 2))])]
9788 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9789 && TARGET_LONG_DOUBLE_128"
9791 operands[2] = CONST0_RTX (DFmode);
9792 /* Generate GOT reference early for SVR4 PIC. */
9793 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9794 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9797 (define_insn_and_split "*extenddftf2_internal"
9798 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
9799 (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
9800 (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
9802 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9803 && TARGET_LONG_DOUBLE_128"
9805 "&& reload_completed"
9808 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9809 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9810 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9812 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9817 (define_expand "extendsftf2"
9818 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9819 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9821 && TARGET_HARD_FLOAT
9822 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9823 && TARGET_LONG_DOUBLE_128"
9825 rtx tmp = gen_reg_rtx (DFmode);
9826 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9827 emit_insn (gen_extenddftf2 (operands[0], tmp));
9831 (define_expand "trunctfdf2"
9832 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9833 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9835 && TARGET_HARD_FLOAT
9836 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9837 && TARGET_LONG_DOUBLE_128"
9840 (define_insn_and_split "trunctfdf2_internal1"
9841 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9842 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9843 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9844 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9848 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9851 emit_note (NOTE_INSN_DELETED);
9854 [(set_attr "type" "fp")])
9856 (define_insn "trunctfdf2_internal2"
9857 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9858 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9859 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9860 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9861 && TARGET_LONG_DOUBLE_128"
9863 [(set_attr "type" "fp")
9864 (set_attr "fp_type" "fp_addsub_d")])
9866 (define_expand "trunctfsf2"
9867 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9868 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9870 && TARGET_HARD_FLOAT
9871 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9872 && TARGET_LONG_DOUBLE_128"
9874 if (TARGET_E500_DOUBLE)
9875 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9877 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9881 (define_insn_and_split "trunctfsf2_fprs"
9882 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9883 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9884 (clobber (match_scratch:DF 2 "=d"))]
9886 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9887 && TARGET_LONG_DOUBLE_128"
9889 "&& reload_completed"
9891 (float_truncate:DF (match_dup 1)))
9893 (float_truncate:SF (match_dup 2)))]
9896 (define_expand "floatsitf2"
9897 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9898 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9900 && TARGET_HARD_FLOAT
9901 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9902 && TARGET_LONG_DOUBLE_128"
9904 rtx tmp = gen_reg_rtx (DFmode);
9905 expand_float (tmp, operands[1], false);
9906 emit_insn (gen_extenddftf2 (operands[0], tmp));
9910 ; fadd, but rounding towards zero.
9911 ; This is probably not the optimal code sequence.
9912 (define_insn "fix_trunc_helper"
9913 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9914 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9915 UNSPEC_FIX_TRUNC_TF))
9916 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9917 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9918 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9919 [(set_attr "type" "fp")
9920 (set_attr "length" "20")])
9922 (define_expand "fix_trunctfsi2"
9923 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9924 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9926 && (TARGET_POWER2 || TARGET_POWERPC)
9927 && TARGET_HARD_FLOAT
9928 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9929 && TARGET_LONG_DOUBLE_128"
9931 if (TARGET_E500_DOUBLE)
9932 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9934 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9938 (define_expand "fix_trunctfsi2_fprs"
9939 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9940 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9941 (clobber (match_dup 2))
9942 (clobber (match_dup 3))
9943 (clobber (match_dup 4))
9944 (clobber (match_dup 5))])]
9946 && (TARGET_POWER2 || TARGET_POWERPC)
9947 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9949 operands[2] = gen_reg_rtx (DFmode);
9950 operands[3] = gen_reg_rtx (DFmode);
9951 operands[4] = gen_reg_rtx (DImode);
9952 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
9955 (define_insn_and_split "*fix_trunctfsi2_internal"
9956 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9957 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9958 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9959 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9960 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9961 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9963 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9969 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9971 gcc_assert (MEM_P (operands[5]));
9972 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9974 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9975 emit_move_insn (operands[5], operands[4]);
9976 emit_move_insn (operands[0], lowword);
9980 (define_expand "negtf2"
9981 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9982 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9984 && TARGET_HARD_FLOAT
9985 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9986 && TARGET_LONG_DOUBLE_128"
9989 (define_insn "negtf2_internal"
9990 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9991 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9993 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9996 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9997 return \"fneg %L0,%L1\;fneg %0,%1\";
9999 return \"fneg %0,%1\;fneg %L0,%L1\";
10001 [(set_attr "type" "fp")
10002 (set_attr "length" "8")])
10004 (define_expand "abstf2"
10005 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10006 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
10008 && TARGET_HARD_FLOAT
10009 && (TARGET_FPRS || TARGET_E500_DOUBLE)
10010 && TARGET_LONG_DOUBLE_128"
10013 rtx label = gen_label_rtx ();
10014 if (TARGET_E500_DOUBLE)
10016 if (flag_finite_math_only && !flag_trapping_math)
10017 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
10019 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
10022 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
10023 emit_label (label);
10027 (define_expand "abstf2_internal"
10028 [(set (match_operand:TF 0 "gpc_reg_operand" "")
10029 (match_operand:TF 1 "gpc_reg_operand" ""))
10030 (set (match_dup 3) (match_dup 5))
10031 (set (match_dup 5) (abs:DF (match_dup 5)))
10032 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
10033 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
10034 (label_ref (match_operand 2 "" ""))
10036 (set (match_dup 6) (neg:DF (match_dup 6)))]
10038 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
10039 && TARGET_LONG_DOUBLE_128"
10042 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
10043 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
10044 operands[3] = gen_reg_rtx (DFmode);
10045 operands[4] = gen_reg_rtx (CCFPmode);
10046 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
10047 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
10050 ;; Next come the multi-word integer load and store and the load and store
10053 ; List r->r after r->"o<>", otherwise reload will try to reload a
10054 ; non-offsettable address by using r->r which won't make progress.
10055 (define_insn "*movdi_internal32"
10056 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r,?wa")
10057 (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF,O"))]
10058 "! TARGET_POWERPC64
10059 && (gpc_reg_operand (operands[0], DImode)
10060 || gpc_reg_operand (operands[1], DImode))"
10069 xxlxor %x0,%x0,%x0"
10070 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*,vecsimple")])
10073 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10074 (match_operand:DI 1 "const_int_operand" ""))]
10075 "! TARGET_POWERPC64 && reload_completed
10076 && gpr_or_gpr_p (operands[0], operands[1])"
10077 [(set (match_dup 2) (match_dup 4))
10078 (set (match_dup 3) (match_dup 1))]
10081 HOST_WIDE_INT value = INTVAL (operands[1]);
10082 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10084 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10086 #if HOST_BITS_PER_WIDE_INT == 32
10087 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
10089 operands[4] = GEN_INT (value >> 32);
10090 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
10095 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
10096 (match_operand:DIFD 1 "input_operand" ""))]
10097 "reload_completed && !TARGET_POWERPC64
10098 && gpr_or_gpr_p (operands[0], operands[1])"
10100 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10102 (define_insn "*movdi_mfpgpr"
10103 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
10104 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
10105 "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
10106 && (gpc_reg_operand (operands[0], DImode)
10107 || gpc_reg_operand (operands[1], DImode))"
10124 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
10125 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
10127 (define_insn "*movdi_internal64"
10128 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,?wa")
10129 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,O"))]
10130 "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
10131 && (gpc_reg_operand (operands[0], DImode)
10132 || gpc_reg_operand (operands[1], DImode))"
10147 xxlxor %x0,%x0,%x0"
10148 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*,vecsimple")
10149 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")])
10151 ;; immediate value valid for a single instruction hiding in a const_double
10153 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10154 (match_operand:DI 1 "const_double_operand" "F"))]
10155 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
10156 && GET_CODE (operands[1]) == CONST_DOUBLE
10157 && num_insns_constant (operands[1], DImode) == 1"
10160 return ((unsigned HOST_WIDE_INT)
10161 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
10162 ? \"li %0,%1\" : \"lis %0,%v1\";
10165 ;; Generate all one-bits and clear left or right.
10166 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
10168 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10169 (match_operand:DI 1 "mask64_operand" ""))]
10170 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10171 [(set (match_dup 0) (const_int -1))
10173 (and:DI (rotate:DI (match_dup 0)
10178 ;; Split a load of a large constant into the appropriate five-instruction
10179 ;; sequence. Handle anything in a constant number of insns.
10180 ;; When non-easy constants can go in the TOC, this should use
10181 ;; easy_fp_constant predicate.
10183 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10184 (match_operand:DI 1 "const_int_operand" ""))]
10185 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10186 [(set (match_dup 0) (match_dup 2))
10187 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10189 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10191 if (tem == operands[0])
10198 [(set (match_operand:DI 0 "gpc_reg_operand" "")
10199 (match_operand:DI 1 "const_double_operand" ""))]
10200 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
10201 [(set (match_dup 0) (match_dup 2))
10202 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
10204 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
10206 if (tem == operands[0])
10212 ;; TImode is similar, except that we usually want to compute the address into
10213 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
10214 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
10216 ;; We say that MQ is clobbered in the last alternative because the first
10217 ;; alternative would never get used otherwise since it would need a reload
10218 ;; while the 2nd alternative would not. We put memory cases first so they
10219 ;; are preferred. Otherwise, we'd try to reload the output instead of
10220 ;; giving the SCRATCH mq.
10222 (define_insn "*movti_power"
10223 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
10224 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
10225 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
10226 "TARGET_POWER && ! TARGET_POWERPC64
10227 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10230 switch (which_alternative)
10233 gcc_unreachable ();
10237 return \"{stsi|stswi} %1,%P0,16\";
10242 /* If the address is not used in the output, we can use lsi. Otherwise,
10243 fall through to generating four loads. */
10245 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10246 return \"{lsi|lswi} %0,%P1,16\";
10247 /* ... fall through ... */
10253 [(set_attr "type" "store,store,*,load,load,*")])
10255 (define_insn "*movti_string"
10256 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
10257 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
10258 "! TARGET_POWER && ! TARGET_POWERPC64
10259 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
10262 switch (which_alternative)
10265 gcc_unreachable ();
10268 return \"{stsi|stswi} %1,%P0,16\";
10273 /* If the address is not used in the output, we can use lsi. Otherwise,
10274 fall through to generating four loads. */
10276 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
10277 return \"{lsi|lswi} %0,%P1,16\";
10278 /* ... fall through ... */
10284 [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*")
10285 (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1))
10286 (const_string "always")
10287 (const_string "conditional")))])
10289 (define_insn "*movti_ppc64"
10290 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
10291 (match_operand:TI 1 "input_operand" "r,r,m"))]
10292 "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
10293 || gpc_reg_operand (operands[1], TImode)))
10294 && VECTOR_MEM_NONE_P (TImode)"
10296 [(set_attr "type" "*,store,load")])
10299 [(set (match_operand:TI 0 "gpc_reg_operand" "")
10300 (match_operand:TI 1 "const_double_operand" ""))]
10301 "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
10302 [(set (match_dup 2) (match_dup 4))
10303 (set (match_dup 3) (match_dup 5))]
10306 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
10308 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
10310 if (GET_CODE (operands[1]) == CONST_DOUBLE)
10312 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
10313 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
10315 else if (GET_CODE (operands[1]) == CONST_INT)
10317 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
10318 operands[5] = operands[1];
10325 [(set (match_operand:TI 0 "nonimmediate_operand" "")
10326 (match_operand:TI 1 "input_operand" ""))]
10327 "reload_completed && VECTOR_MEM_NONE_P (TImode)
10328 && gpr_or_gpr_p (operands[0], operands[1])"
10330 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
10332 (define_expand "load_multiple"
10333 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10334 (match_operand:SI 1 "" ""))
10335 (use (match_operand:SI 2 "" ""))])]
10336 "TARGET_STRING && !TARGET_POWERPC64"
10344 /* Support only loading a constant number of fixed-point registers from
10345 memory and only bother with this if more than two; the machine
10346 doesn't support more than eight. */
10347 if (GET_CODE (operands[2]) != CONST_INT
10348 || INTVAL (operands[2]) <= 2
10349 || INTVAL (operands[2]) > 8
10350 || GET_CODE (operands[1]) != MEM
10351 || GET_CODE (operands[0]) != REG
10352 || REGNO (operands[0]) >= 32)
10355 count = INTVAL (operands[2]);
10356 regno = REGNO (operands[0]);
10358 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
10359 op1 = replace_equiv_address (operands[1],
10360 force_reg (SImode, XEXP (operands[1], 0)));
10362 for (i = 0; i < count; i++)
10363 XVECEXP (operands[3], 0, i)
10364 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
10365 adjust_address_nv (op1, SImode, i * 4));
10368 (define_insn "*ldmsi8"
10369 [(match_parallel 0 "load_multiple_operation"
10370 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10371 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10372 (set (match_operand:SI 3 "gpc_reg_operand" "")
10373 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10374 (set (match_operand:SI 4 "gpc_reg_operand" "")
10375 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10376 (set (match_operand:SI 5 "gpc_reg_operand" "")
10377 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10378 (set (match_operand:SI 6 "gpc_reg_operand" "")
10379 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10380 (set (match_operand:SI 7 "gpc_reg_operand" "")
10381 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10382 (set (match_operand:SI 8 "gpc_reg_operand" "")
10383 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
10384 (set (match_operand:SI 9 "gpc_reg_operand" "")
10385 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
10386 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
10388 { return rs6000_output_load_multiple (operands); }"
10389 [(set_attr "type" "load_ux")
10390 (set_attr "length" "32")])
10392 (define_insn "*ldmsi7"
10393 [(match_parallel 0 "load_multiple_operation"
10394 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10395 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10396 (set (match_operand:SI 3 "gpc_reg_operand" "")
10397 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10398 (set (match_operand:SI 4 "gpc_reg_operand" "")
10399 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10400 (set (match_operand:SI 5 "gpc_reg_operand" "")
10401 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10402 (set (match_operand:SI 6 "gpc_reg_operand" "")
10403 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10404 (set (match_operand:SI 7 "gpc_reg_operand" "")
10405 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
10406 (set (match_operand:SI 8 "gpc_reg_operand" "")
10407 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
10408 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
10410 { return rs6000_output_load_multiple (operands); }"
10411 [(set_attr "type" "load_ux")
10412 (set_attr "length" "32")])
10414 (define_insn "*ldmsi6"
10415 [(match_parallel 0 "load_multiple_operation"
10416 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10417 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10418 (set (match_operand:SI 3 "gpc_reg_operand" "")
10419 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10420 (set (match_operand:SI 4 "gpc_reg_operand" "")
10421 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10422 (set (match_operand:SI 5 "gpc_reg_operand" "")
10423 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10424 (set (match_operand:SI 6 "gpc_reg_operand" "")
10425 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
10426 (set (match_operand:SI 7 "gpc_reg_operand" "")
10427 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
10428 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
10430 { return rs6000_output_load_multiple (operands); }"
10431 [(set_attr "type" "load_ux")
10432 (set_attr "length" "32")])
10434 (define_insn "*ldmsi5"
10435 [(match_parallel 0 "load_multiple_operation"
10436 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10437 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10438 (set (match_operand:SI 3 "gpc_reg_operand" "")
10439 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10440 (set (match_operand:SI 4 "gpc_reg_operand" "")
10441 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10442 (set (match_operand:SI 5 "gpc_reg_operand" "")
10443 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
10444 (set (match_operand:SI 6 "gpc_reg_operand" "")
10445 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
10446 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
10448 { return rs6000_output_load_multiple (operands); }"
10449 [(set_attr "type" "load_ux")
10450 (set_attr "length" "32")])
10452 (define_insn "*ldmsi4"
10453 [(match_parallel 0 "load_multiple_operation"
10454 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10455 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10456 (set (match_operand:SI 3 "gpc_reg_operand" "")
10457 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10458 (set (match_operand:SI 4 "gpc_reg_operand" "")
10459 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
10460 (set (match_operand:SI 5 "gpc_reg_operand" "")
10461 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
10462 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
10464 { return rs6000_output_load_multiple (operands); }"
10465 [(set_attr "type" "load_ux")
10466 (set_attr "length" "32")])
10468 (define_insn "*ldmsi3"
10469 [(match_parallel 0 "load_multiple_operation"
10470 [(set (match_operand:SI 2 "gpc_reg_operand" "")
10471 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
10472 (set (match_operand:SI 3 "gpc_reg_operand" "")
10473 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
10474 (set (match_operand:SI 4 "gpc_reg_operand" "")
10475 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
10476 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
10478 { return rs6000_output_load_multiple (operands); }"
10479 [(set_attr "type" "load_ux")
10480 (set_attr "length" "32")])
10482 (define_expand "store_multiple"
10483 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
10484 (match_operand:SI 1 "" ""))
10485 (clobber (scratch:SI))
10486 (use (match_operand:SI 2 "" ""))])]
10487 "TARGET_STRING && !TARGET_POWERPC64"
10496 /* Support only storing a constant number of fixed-point registers to
10497 memory and only bother with this if more than two; the machine
10498 doesn't support more than eight. */
10499 if (GET_CODE (operands[2]) != CONST_INT
10500 || INTVAL (operands[2]) <= 2
10501 || INTVAL (operands[2]) > 8
10502 || GET_CODE (operands[0]) != MEM
10503 || GET_CODE (operands[1]) != REG
10504 || REGNO (operands[1]) >= 32)
10507 count = INTVAL (operands[2]);
10508 regno = REGNO (operands[1]);
10510 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
10511 to = force_reg (SImode, XEXP (operands[0], 0));
10512 op0 = replace_equiv_address (operands[0], to);
10514 XVECEXP (operands[3], 0, 0)
10515 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
10516 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
10517 gen_rtx_SCRATCH (SImode));
10519 for (i = 1; i < count; i++)
10520 XVECEXP (operands[3], 0, i + 1)
10521 = gen_rtx_SET (VOIDmode,
10522 adjust_address_nv (op0, SImode, i * 4),
10523 gen_rtx_REG (SImode, regno + i));
10526 (define_insn "*stmsi8"
10527 [(match_parallel 0 "store_multiple_operation"
10528 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10529 (match_operand:SI 2 "gpc_reg_operand" "r"))
10530 (clobber (match_scratch:SI 3 "=X"))
10531 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10532 (match_operand:SI 4 "gpc_reg_operand" "r"))
10533 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10534 (match_operand:SI 5 "gpc_reg_operand" "r"))
10535 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10536 (match_operand:SI 6 "gpc_reg_operand" "r"))
10537 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10538 (match_operand:SI 7 "gpc_reg_operand" "r"))
10539 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10540 (match_operand:SI 8 "gpc_reg_operand" "r"))
10541 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10542 (match_operand:SI 9 "gpc_reg_operand" "r"))
10543 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10544 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10545 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10546 "{stsi|stswi} %2,%1,%O0"
10547 [(set_attr "type" "store_ux")
10548 (set_attr "cell_micro" "always")])
10550 (define_insn "*stmsi7"
10551 [(match_parallel 0 "store_multiple_operation"
10552 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10553 (match_operand:SI 2 "gpc_reg_operand" "r"))
10554 (clobber (match_scratch:SI 3 "=X"))
10555 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10556 (match_operand:SI 4 "gpc_reg_operand" "r"))
10557 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10558 (match_operand:SI 5 "gpc_reg_operand" "r"))
10559 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10560 (match_operand:SI 6 "gpc_reg_operand" "r"))
10561 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10562 (match_operand:SI 7 "gpc_reg_operand" "r"))
10563 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10564 (match_operand:SI 8 "gpc_reg_operand" "r"))
10565 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10566 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10567 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10568 "{stsi|stswi} %2,%1,%O0"
10569 [(set_attr "type" "store_ux")
10570 (set_attr "cell_micro" "always")])
10572 (define_insn "*stmsi6"
10573 [(match_parallel 0 "store_multiple_operation"
10574 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10575 (match_operand:SI 2 "gpc_reg_operand" "r"))
10576 (clobber (match_scratch:SI 3 "=X"))
10577 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10578 (match_operand:SI 4 "gpc_reg_operand" "r"))
10579 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10580 (match_operand:SI 5 "gpc_reg_operand" "r"))
10581 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10582 (match_operand:SI 6 "gpc_reg_operand" "r"))
10583 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10584 (match_operand:SI 7 "gpc_reg_operand" "r"))
10585 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10586 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10587 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10588 "{stsi|stswi} %2,%1,%O0"
10589 [(set_attr "type" "store_ux")
10590 (set_attr "cell_micro" "always")])
10592 (define_insn "*stmsi5"
10593 [(match_parallel 0 "store_multiple_operation"
10594 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10595 (match_operand:SI 2 "gpc_reg_operand" "r"))
10596 (clobber (match_scratch:SI 3 "=X"))
10597 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10598 (match_operand:SI 4 "gpc_reg_operand" "r"))
10599 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10600 (match_operand:SI 5 "gpc_reg_operand" "r"))
10601 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10602 (match_operand:SI 6 "gpc_reg_operand" "r"))
10603 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10604 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10605 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10606 "{stsi|stswi} %2,%1,%O0"
10607 [(set_attr "type" "store_ux")
10608 (set_attr "cell_micro" "always")])
10610 (define_insn "*stmsi4"
10611 [(match_parallel 0 "store_multiple_operation"
10612 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10613 (match_operand:SI 2 "gpc_reg_operand" "r"))
10614 (clobber (match_scratch:SI 3 "=X"))
10615 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10616 (match_operand:SI 4 "gpc_reg_operand" "r"))
10617 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10618 (match_operand:SI 5 "gpc_reg_operand" "r"))
10619 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10620 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10621 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10622 "{stsi|stswi} %2,%1,%O0"
10623 [(set_attr "type" "store_ux")
10624 (set_attr "cell_micro" "always")])
10626 (define_insn "*stmsi3"
10627 [(match_parallel 0 "store_multiple_operation"
10628 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10629 (match_operand:SI 2 "gpc_reg_operand" "r"))
10630 (clobber (match_scratch:SI 3 "=X"))
10631 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10632 (match_operand:SI 4 "gpc_reg_operand" "r"))
10633 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10634 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10635 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10636 "{stsi|stswi} %2,%1,%O0"
10637 [(set_attr "type" "store_ux")
10638 (set_attr "cell_micro" "always")])
10640 (define_insn "*stmsi8_power"
10641 [(match_parallel 0 "store_multiple_operation"
10642 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10643 (match_operand:SI 2 "gpc_reg_operand" "r"))
10644 (clobber (match_scratch:SI 3 "=q"))
10645 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10646 (match_operand:SI 4 "gpc_reg_operand" "r"))
10647 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10648 (match_operand:SI 5 "gpc_reg_operand" "r"))
10649 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10650 (match_operand:SI 6 "gpc_reg_operand" "r"))
10651 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10652 (match_operand:SI 7 "gpc_reg_operand" "r"))
10653 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10654 (match_operand:SI 8 "gpc_reg_operand" "r"))
10655 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10656 (match_operand:SI 9 "gpc_reg_operand" "r"))
10657 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
10658 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
10659 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 9"
10660 "{stsi|stswi} %2,%1,%O0"
10661 [(set_attr "type" "store_ux")
10662 (set_attr "cell_micro" "always")])
10664 (define_insn "*stmsi7_power"
10665 [(match_parallel 0 "store_multiple_operation"
10666 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10667 (match_operand:SI 2 "gpc_reg_operand" "r"))
10668 (clobber (match_scratch:SI 3 "=q"))
10669 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10670 (match_operand:SI 4 "gpc_reg_operand" "r"))
10671 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10672 (match_operand:SI 5 "gpc_reg_operand" "r"))
10673 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10674 (match_operand:SI 6 "gpc_reg_operand" "r"))
10675 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10676 (match_operand:SI 7 "gpc_reg_operand" "r"))
10677 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10678 (match_operand:SI 8 "gpc_reg_operand" "r"))
10679 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
10680 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
10681 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 8"
10682 "{stsi|stswi} %2,%1,%O0"
10683 [(set_attr "type" "store_ux")
10684 (set_attr "cell_micro" "always")])
10686 (define_insn "*stmsi6_power"
10687 [(match_parallel 0 "store_multiple_operation"
10688 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10689 (match_operand:SI 2 "gpc_reg_operand" "r"))
10690 (clobber (match_scratch:SI 3 "=q"))
10691 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10692 (match_operand:SI 4 "gpc_reg_operand" "r"))
10693 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10694 (match_operand:SI 5 "gpc_reg_operand" "r"))
10695 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10696 (match_operand:SI 6 "gpc_reg_operand" "r"))
10697 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10698 (match_operand:SI 7 "gpc_reg_operand" "r"))
10699 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
10700 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
10701 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 7"
10702 "{stsi|stswi} %2,%1,%O0"
10703 [(set_attr "type" "store_ux")
10704 (set_attr "cell_micro" "always")])
10706 (define_insn "*stmsi5_power"
10707 [(match_parallel 0 "store_multiple_operation"
10708 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10709 (match_operand:SI 2 "gpc_reg_operand" "r"))
10710 (clobber (match_scratch:SI 3 "=q"))
10711 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10712 (match_operand:SI 4 "gpc_reg_operand" "r"))
10713 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10714 (match_operand:SI 5 "gpc_reg_operand" "r"))
10715 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10716 (match_operand:SI 6 "gpc_reg_operand" "r"))
10717 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
10718 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
10719 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 6"
10720 "{stsi|stswi} %2,%1,%O0"
10721 [(set_attr "type" "store_ux")
10722 (set_attr "cell_micro" "always")])
10724 (define_insn "*stmsi4_power"
10725 [(match_parallel 0 "store_multiple_operation"
10726 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10727 (match_operand:SI 2 "gpc_reg_operand" "r"))
10728 (clobber (match_scratch:SI 3 "=q"))
10729 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10730 (match_operand:SI 4 "gpc_reg_operand" "r"))
10731 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10732 (match_operand:SI 5 "gpc_reg_operand" "r"))
10733 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
10734 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
10735 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 5"
10736 "{stsi|stswi} %2,%1,%O0"
10737 [(set_attr "type" "store_ux")
10738 (set_attr "cell_micro" "always")])
10740 (define_insn "*stmsi3_power"
10741 [(match_parallel 0 "store_multiple_operation"
10742 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
10743 (match_operand:SI 2 "gpc_reg_operand" "r"))
10744 (clobber (match_scratch:SI 3 "=q"))
10745 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
10746 (match_operand:SI 4 "gpc_reg_operand" "r"))
10747 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
10748 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
10749 "TARGET_STRING && TARGET_POWER && XVECLEN (operands[0], 0) == 4"
10750 "{stsi|stswi} %2,%1,%O0"
10751 [(set_attr "type" "store_ux")
10752 (set_attr "cell_micro" "always")])
10754 (define_expand "setmemsi"
10755 [(parallel [(set (match_operand:BLK 0 "" "")
10756 (match_operand 2 "const_int_operand" ""))
10757 (use (match_operand:SI 1 "" ""))
10758 (use (match_operand:SI 3 "" ""))])]
10762 /* If value to set is not zero, use the library routine. */
10763 if (operands[2] != const0_rtx)
10766 if (expand_block_clear (operands))
10772 ;; String/block move insn.
10773 ;; Argument 0 is the destination
10774 ;; Argument 1 is the source
10775 ;; Argument 2 is the length
10776 ;; Argument 3 is the alignment
10778 (define_expand "movmemsi"
10779 [(parallel [(set (match_operand:BLK 0 "" "")
10780 (match_operand:BLK 1 "" ""))
10781 (use (match_operand:SI 2 "" ""))
10782 (use (match_operand:SI 3 "" ""))])]
10786 if (expand_block_move (operands))
10792 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10793 ;; register allocator doesn't have a clue about allocating 8 word registers.
10794 ;; rD/rS = r5 is preferred, efficient form.
10795 (define_expand "movmemsi_8reg"
10796 [(parallel [(set (match_operand 0 "" "")
10797 (match_operand 1 "" ""))
10798 (use (match_operand 2 "" ""))
10799 (use (match_operand 3 "" ""))
10800 (clobber (reg:SI 5))
10801 (clobber (reg:SI 6))
10802 (clobber (reg:SI 7))
10803 (clobber (reg:SI 8))
10804 (clobber (reg:SI 9))
10805 (clobber (reg:SI 10))
10806 (clobber (reg:SI 11))
10807 (clobber (reg:SI 12))
10808 (clobber (match_scratch:SI 4 ""))])]
10813 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10814 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10815 (use (match_operand:SI 2 "immediate_operand" "i"))
10816 (use (match_operand:SI 3 "immediate_operand" "i"))
10817 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10818 (clobber (reg:SI 6))
10819 (clobber (reg:SI 7))
10820 (clobber (reg:SI 8))
10821 (clobber (reg:SI 9))
10822 (clobber (reg:SI 10))
10823 (clobber (reg:SI 11))
10824 (clobber (reg:SI 12))
10825 (clobber (match_scratch:SI 5 "=q"))]
10826 "TARGET_STRING && TARGET_POWER
10827 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10828 || INTVAL (operands[2]) == 0)
10829 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10830 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10831 && REGNO (operands[4]) == 5"
10832 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10833 [(set_attr "type" "store_ux")
10834 (set_attr "cell_micro" "always")
10835 (set_attr "length" "8")])
10838 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10839 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10840 (use (match_operand:SI 2 "immediate_operand" "i"))
10841 (use (match_operand:SI 3 "immediate_operand" "i"))
10842 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10843 (clobber (reg:SI 6))
10844 (clobber (reg:SI 7))
10845 (clobber (reg:SI 8))
10846 (clobber (reg:SI 9))
10847 (clobber (reg:SI 10))
10848 (clobber (reg:SI 11))
10849 (clobber (reg:SI 12))
10850 (clobber (match_scratch:SI 5 "=X"))]
10851 "TARGET_STRING && ! TARGET_POWER
10852 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10853 || INTVAL (operands[2]) == 0)
10854 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10855 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10856 && REGNO (operands[4]) == 5"
10857 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10858 [(set_attr "type" "store_ux")
10859 (set_attr "cell_micro" "always")
10860 (set_attr "length" "8")])
10862 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10863 ;; register allocator doesn't have a clue about allocating 6 word registers.
10864 ;; rD/rS = r5 is preferred, efficient form.
10865 (define_expand "movmemsi_6reg"
10866 [(parallel [(set (match_operand 0 "" "")
10867 (match_operand 1 "" ""))
10868 (use (match_operand 2 "" ""))
10869 (use (match_operand 3 "" ""))
10870 (clobber (reg:SI 5))
10871 (clobber (reg:SI 6))
10872 (clobber (reg:SI 7))
10873 (clobber (reg:SI 8))
10874 (clobber (reg:SI 9))
10875 (clobber (reg:SI 10))
10876 (clobber (match_scratch:SI 4 ""))])]
10881 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10882 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10883 (use (match_operand:SI 2 "immediate_operand" "i"))
10884 (use (match_operand:SI 3 "immediate_operand" "i"))
10885 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10886 (clobber (reg:SI 6))
10887 (clobber (reg:SI 7))
10888 (clobber (reg:SI 8))
10889 (clobber (reg:SI 9))
10890 (clobber (reg:SI 10))
10891 (clobber (match_scratch:SI 5 "=q"))]
10892 "TARGET_STRING && TARGET_POWER
10893 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
10894 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10895 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10896 && REGNO (operands[4]) == 5"
10897 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10898 [(set_attr "type" "store_ux")
10899 (set_attr "cell_micro" "always")
10900 (set_attr "length" "8")])
10903 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10904 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10905 (use (match_operand:SI 2 "immediate_operand" "i"))
10906 (use (match_operand:SI 3 "immediate_operand" "i"))
10907 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10908 (clobber (reg:SI 6))
10909 (clobber (reg:SI 7))
10910 (clobber (reg:SI 8))
10911 (clobber (reg:SI 9))
10912 (clobber (reg:SI 10))
10913 (clobber (match_scratch:SI 5 "=X"))]
10914 "TARGET_STRING && ! TARGET_POWER
10915 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10916 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10917 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10918 && REGNO (operands[4]) == 5"
10919 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10920 [(set_attr "type" "store_ux")
10921 (set_attr "cell_micro" "always")
10922 (set_attr "length" "8")])
10924 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10925 ;; problems with TImode.
10926 ;; rD/rS = r5 is preferred, efficient form.
10927 (define_expand "movmemsi_4reg"
10928 [(parallel [(set (match_operand 0 "" "")
10929 (match_operand 1 "" ""))
10930 (use (match_operand 2 "" ""))
10931 (use (match_operand 3 "" ""))
10932 (clobber (reg:SI 5))
10933 (clobber (reg:SI 6))
10934 (clobber (reg:SI 7))
10935 (clobber (reg:SI 8))
10936 (clobber (match_scratch:SI 4 ""))])]
10941 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10942 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10943 (use (match_operand:SI 2 "immediate_operand" "i"))
10944 (use (match_operand:SI 3 "immediate_operand" "i"))
10945 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10946 (clobber (reg:SI 6))
10947 (clobber (reg:SI 7))
10948 (clobber (reg:SI 8))
10949 (clobber (match_scratch:SI 5 "=q"))]
10950 "TARGET_STRING && TARGET_POWER
10951 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10952 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10953 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10954 && REGNO (operands[4]) == 5"
10955 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10956 [(set_attr "type" "store_ux")
10957 (set_attr "cell_micro" "always")
10958 (set_attr "length" "8")])
10961 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10962 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10963 (use (match_operand:SI 2 "immediate_operand" "i"))
10964 (use (match_operand:SI 3 "immediate_operand" "i"))
10965 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10966 (clobber (reg:SI 6))
10967 (clobber (reg:SI 7))
10968 (clobber (reg:SI 8))
10969 (clobber (match_scratch:SI 5 "=X"))]
10970 "TARGET_STRING && ! TARGET_POWER
10971 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10972 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10973 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10974 && REGNO (operands[4]) == 5"
10975 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
10976 [(set_attr "type" "store_ux")
10977 (set_attr "cell_micro" "always")
10978 (set_attr "length" "8")])
10980 ;; Move up to 8 bytes at a time.
10981 (define_expand "movmemsi_2reg"
10982 [(parallel [(set (match_operand 0 "" "")
10983 (match_operand 1 "" ""))
10984 (use (match_operand 2 "" ""))
10985 (use (match_operand 3 "" ""))
10986 (clobber (match_scratch:DI 4 ""))
10987 (clobber (match_scratch:SI 5 ""))])]
10988 "TARGET_STRING && ! TARGET_POWERPC64"
10992 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10993 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10994 (use (match_operand:SI 2 "immediate_operand" "i"))
10995 (use (match_operand:SI 3 "immediate_operand" "i"))
10996 (clobber (match_scratch:DI 4 "=&r"))
10997 (clobber (match_scratch:SI 5 "=q"))]
10998 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
10999 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11000 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11001 [(set_attr "type" "store_ux")
11002 (set_attr "cell_micro" "always")
11003 (set_attr "length" "8")])
11006 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11007 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11008 (use (match_operand:SI 2 "immediate_operand" "i"))
11009 (use (match_operand:SI 3 "immediate_operand" "i"))
11010 (clobber (match_scratch:DI 4 "=&r"))
11011 (clobber (match_scratch:SI 5 "=X"))]
11012 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
11013 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
11014 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11015 [(set_attr "type" "store_ux")
11016 (set_attr "cell_micro" "always")
11017 (set_attr "length" "8")])
11019 ;; Move up to 4 bytes at a time.
11020 (define_expand "movmemsi_1reg"
11021 [(parallel [(set (match_operand 0 "" "")
11022 (match_operand 1 "" ""))
11023 (use (match_operand 2 "" ""))
11024 (use (match_operand 3 "" ""))
11025 (clobber (match_scratch:SI 4 ""))
11026 (clobber (match_scratch:SI 5 ""))])]
11031 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
11032 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
11033 (use (match_operand:SI 2 "immediate_operand" "i"))
11034 (use (match_operand:SI 3 "immediate_operand" "i"))
11035 (clobber (match_scratch:SI 4 "=&r"))
11036 (clobber (match_scratch:SI 5 "=q"))]
11037 "TARGET_STRING && TARGET_POWER
11038 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11039 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11040 [(set_attr "type" "store_ux")
11041 (set_attr "cell_micro" "always")
11042 (set_attr "length" "8")])
11045 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
11046 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
11047 (use (match_operand:SI 2 "immediate_operand" "i"))
11048 (use (match_operand:SI 3 "immediate_operand" "i"))
11049 (clobber (match_scratch:SI 4 "=&r"))
11050 (clobber (match_scratch:SI 5 "=X"))]
11051 "TARGET_STRING && ! TARGET_POWER
11052 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
11053 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
11054 [(set_attr "type" "store_ux")
11055 (set_attr "cell_micro" "always")
11056 (set_attr "length" "8")])
11058 ;; Define insns that do load or store with update. Some of these we can
11059 ;; get by using pre-decrement or pre-increment, but the hardware can also
11060 ;; do cases where the increment is not the size of the object.
11062 ;; In all these cases, we use operands 0 and 1 for the register being
11063 ;; incremented because those are the operands that local-alloc will
11064 ;; tie and these are the pair most likely to be tieable (and the ones
11065 ;; that will benefit the most).
11067 (define_insn "*movdi_update1"
11068 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
11069 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
11070 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
11071 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
11072 (plus:DI (match_dup 1) (match_dup 2)))]
11073 "TARGET_POWERPC64 && TARGET_UPDATE
11074 && (!avoiding_indexed_address_p (DImode)
11075 || !gpc_reg_operand (operands[2], DImode))"
11079 [(set_attr "type" "load_ux,load_u")])
11081 (define_insn "movdi_<mode>_update"
11082 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11083 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11084 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11085 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11086 (plus:P (match_dup 1) (match_dup 2)))]
11087 "TARGET_POWERPC64 && TARGET_UPDATE
11088 && (!avoiding_indexed_address_p (Pmode)
11089 || !gpc_reg_operand (operands[2], Pmode)
11090 || (REG_P (operands[0])
11091 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11095 [(set_attr "type" "store_ux,store_u")])
11097 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
11098 ;; needed for stack allocation, even if the user passes -mno-update.
11099 (define_insn "movdi_<mode>_update_stack"
11100 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
11101 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
11102 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
11103 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
11104 (plus:P (match_dup 1) (match_dup 2)))]
11109 [(set_attr "type" "store_ux,store_u")])
11111 (define_insn "*movsi_update1"
11112 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11113 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11114 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11115 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11116 (plus:SI (match_dup 1) (match_dup 2)))]
11118 && (!avoiding_indexed_address_p (SImode)
11119 || !gpc_reg_operand (operands[2], SImode))"
11121 {lux|lwzux} %3,%0,%2
11122 {lu|lwzu} %3,%2(%0)"
11123 [(set_attr "type" "load_ux,load_u")])
11125 (define_insn "*movsi_update2"
11126 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
11128 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
11129 (match_operand:DI 2 "gpc_reg_operand" "r")))))
11130 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
11131 (plus:DI (match_dup 1) (match_dup 2)))]
11132 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
11133 && !avoiding_indexed_address_p (DImode)"
11135 [(set_attr "type" "load_ext_ux")])
11137 (define_insn "movsi_update"
11138 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11139 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11140 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11141 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11142 (plus:SI (match_dup 1) (match_dup 2)))]
11144 && (!avoiding_indexed_address_p (SImode)
11145 || !gpc_reg_operand (operands[2], SImode)
11146 || (REG_P (operands[0])
11147 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
11149 {stux|stwux} %3,%0,%2
11150 {stu|stwu} %3,%2(%0)"
11151 [(set_attr "type" "store_ux,store_u")])
11153 ;; This is an unconditional pattern; needed for stack allocation, even
11154 ;; if the user passes -mno-update.
11155 (define_insn "movsi_update_stack"
11156 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11157 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11158 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11159 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11160 (plus:SI (match_dup 1) (match_dup 2)))]
11163 {stux|stwux} %3,%0,%2
11164 {stu|stwu} %3,%2(%0)"
11165 [(set_attr "type" "store_ux,store_u")])
11167 (define_insn "*movhi_update1"
11168 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
11169 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11170 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11171 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11172 (plus:SI (match_dup 1) (match_dup 2)))]
11174 && (!avoiding_indexed_address_p (SImode)
11175 || !gpc_reg_operand (operands[2], SImode))"
11179 [(set_attr "type" "load_ux,load_u")])
11181 (define_insn "*movhi_update2"
11182 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11184 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11185 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11186 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11187 (plus:SI (match_dup 1) (match_dup 2)))]
11189 && (!avoiding_indexed_address_p (SImode)
11190 || !gpc_reg_operand (operands[2], SImode))"
11194 [(set_attr "type" "load_ux,load_u")])
11196 (define_insn "*movhi_update3"
11197 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11199 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11200 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11201 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11202 (plus:SI (match_dup 1) (match_dup 2)))]
11203 "TARGET_UPDATE && rs6000_gen_cell_microcode
11204 && (!avoiding_indexed_address_p (SImode)
11205 || !gpc_reg_operand (operands[2], SImode))"
11209 [(set_attr "type" "load_ext_ux,load_ext_u")])
11211 (define_insn "*movhi_update4"
11212 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11213 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11214 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
11215 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11216 (plus:SI (match_dup 1) (match_dup 2)))]
11218 && (!avoiding_indexed_address_p (SImode)
11219 || !gpc_reg_operand (operands[2], SImode))"
11223 [(set_attr "type" "store_ux,store_u")])
11225 (define_insn "*movqi_update1"
11226 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
11227 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11228 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11229 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11230 (plus:SI (match_dup 1) (match_dup 2)))]
11232 && (!avoiding_indexed_address_p (SImode)
11233 || !gpc_reg_operand (operands[2], SImode))"
11237 [(set_attr "type" "load_ux,load_u")])
11239 (define_insn "*movqi_update2"
11240 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11242 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11243 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
11244 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11245 (plus:SI (match_dup 1) (match_dup 2)))]
11247 && (!avoiding_indexed_address_p (SImode)
11248 || !gpc_reg_operand (operands[2], SImode))"
11252 [(set_attr "type" "load_ux,load_u")])
11254 (define_insn "*movqi_update3"
11255 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11256 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11257 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
11258 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11259 (plus:SI (match_dup 1) (match_dup 2)))]
11261 && (!avoiding_indexed_address_p (SImode)
11262 || !gpc_reg_operand (operands[2], SImode))"
11266 [(set_attr "type" "store_ux,store_u")])
11268 (define_insn "*movsf_update1"
11269 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
11270 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11271 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11272 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11273 (plus:SI (match_dup 1) (match_dup 2)))]
11274 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11275 && (!avoiding_indexed_address_p (SImode)
11276 || !gpc_reg_operand (operands[2], SImode))"
11280 [(set_attr "type" "fpload_ux,fpload_u")])
11282 (define_insn "*movsf_update2"
11283 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11284 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11285 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
11286 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11287 (plus:SI (match_dup 1) (match_dup 2)))]
11288 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
11289 && (!avoiding_indexed_address_p (SImode)
11290 || !gpc_reg_operand (operands[2], SImode))"
11294 [(set_attr "type" "fpstore_ux,fpstore_u")])
11296 (define_insn "*movsf_update3"
11297 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
11298 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11299 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11300 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11301 (plus:SI (match_dup 1) (match_dup 2)))]
11302 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11303 && (!avoiding_indexed_address_p (SImode)
11304 || !gpc_reg_operand (operands[2], SImode))"
11306 {lux|lwzux} %3,%0,%2
11307 {lu|lwzu} %3,%2(%0)"
11308 [(set_attr "type" "load_ux,load_u")])
11310 (define_insn "*movsf_update4"
11311 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11312 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11313 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
11314 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11315 (plus:SI (match_dup 1) (match_dup 2)))]
11316 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
11317 && (!avoiding_indexed_address_p (SImode)
11318 || !gpc_reg_operand (operands[2], SImode))"
11320 {stux|stwux} %3,%0,%2
11321 {stu|stwu} %3,%2(%0)"
11322 [(set_attr "type" "store_ux,store_u")])
11324 (define_insn "*movdf_update1"
11325 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
11326 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11327 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
11328 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11329 (plus:SI (match_dup 1) (match_dup 2)))]
11330 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11331 && (!avoiding_indexed_address_p (SImode)
11332 || !gpc_reg_operand (operands[2], SImode))"
11336 [(set_attr "type" "fpload_ux,fpload_u")])
11338 (define_insn "*movdf_update2"
11339 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
11340 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
11341 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
11342 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
11343 (plus:SI (match_dup 1) (match_dup 2)))]
11344 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
11345 && (!avoiding_indexed_address_p (SImode)
11346 || !gpc_reg_operand (operands[2], SImode))"
11350 [(set_attr "type" "fpstore_ux,fpstore_u")])
11352 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
11354 (define_insn "*lfq_power2"
11355 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
11356 (match_operand:V2DF 1 "memory_operand" ""))]
11358 && TARGET_HARD_FLOAT && TARGET_FPRS"
11362 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11363 (match_operand:DF 1 "memory_operand" ""))
11364 (set (match_operand:DF 2 "gpc_reg_operand" "")
11365 (match_operand:DF 3 "memory_operand" ""))]
11367 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11368 && registers_ok_for_quad_peep (operands[0], operands[2])
11369 && mems_ok_for_quad_peep (operands[1], operands[3])"
11370 [(set (match_dup 0)
11372 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
11373 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
11375 (define_insn "*stfq_power2"
11376 [(set (match_operand:V2DF 0 "memory_operand" "")
11377 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
11379 && TARGET_HARD_FLOAT && TARGET_FPRS"
11380 "stfq%U0%X0 %1,%0")
11384 [(set (match_operand:DF 0 "memory_operand" "")
11385 (match_operand:DF 1 "gpc_reg_operand" ""))
11386 (set (match_operand:DF 2 "memory_operand" "")
11387 (match_operand:DF 3 "gpc_reg_operand" ""))]
11389 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
11390 && registers_ok_for_quad_peep (operands[1], operands[3])
11391 && mems_ok_for_quad_peep (operands[0], operands[2])"
11392 [(set (match_dup 0)
11394 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
11395 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
11397 ;; After inserting conditional returns we can sometimes have
11398 ;; unnecessary register moves. Unfortunately we cannot have a
11399 ;; modeless peephole here, because some single SImode sets have early
11400 ;; clobber outputs. Although those sets expand to multi-ppc-insn
11401 ;; sequences, using get_attr_length here will smash the operands
11402 ;; array. Neither is there an early_cobbler_p predicate.
11403 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
11405 [(set (match_operand:DF 0 "gpc_reg_operand" "")
11406 (match_operand:DF 1 "any_operand" ""))
11407 (set (match_operand:DF 2 "gpc_reg_operand" "")
11409 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
11410 && peep2_reg_dead_p (2, operands[0])"
11411 [(set (match_dup 2) (match_dup 1))])
11414 [(set (match_operand:SF 0 "gpc_reg_operand" "")
11415 (match_operand:SF 1 "any_operand" ""))
11416 (set (match_operand:SF 2 "gpc_reg_operand" "")
11418 "peep2_reg_dead_p (2, operands[0])"
11419 [(set (match_dup 2) (match_dup 1))])
11424 ;; Mode attributes for different ABIs.
11425 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
11426 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
11427 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
11428 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
11430 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
11431 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11432 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11433 (match_operand 4 "" "g")))
11434 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11435 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11437 (clobber (reg:SI LR_REGNO))]
11438 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11440 if (TARGET_CMODEL != CMODEL_SMALL)
11441 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;bl %z3\;%.";
11443 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;%.";
11445 "&& TARGET_TLS_MARKERS"
11446 [(set (match_dup 0)
11447 (unspec:TLSmode [(match_dup 1)
11450 (parallel [(set (match_dup 0)
11451 (call (mem:TLSmode (match_dup 3))
11453 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11454 (clobber (reg:SI LR_REGNO))])]
11456 [(set_attr "type" "two")
11457 (set (attr "length")
11458 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11462 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
11463 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11464 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
11465 (match_operand 4 "" "g")))
11466 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11467 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11469 (clobber (reg:SI LR_REGNO))]
11470 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11474 if (TARGET_SECURE_PLT && flag_pic == 2)
11475 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
11477 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
11480 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
11482 "&& TARGET_TLS_MARKERS"
11483 [(set (match_dup 0)
11484 (unspec:TLSmode [(match_dup 1)
11487 (parallel [(set (match_dup 0)
11488 (call (mem:TLSmode (match_dup 3))
11490 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
11491 (clobber (reg:SI LR_REGNO))])]
11493 [(set_attr "type" "two")
11494 (set_attr "length" "8")])
11496 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
11497 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11498 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11499 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11501 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11502 "addi %0,%1,%2@got@tlsgd"
11503 "&& TARGET_CMODEL != CMODEL_SMALL"
11504 [(set (match_dup 3)
11505 (plus:TLSmode (match_dup 1)
11507 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD))))
11509 (lo_sum:TLSmode (match_dup 3)
11510 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
11513 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11515 [(set (attr "length")
11516 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11520 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
11521 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11522 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11524 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11526 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11527 "addis %0,%1,%2@got@tlsgd@ha"
11528 [(set_attr "length" "4")])
11530 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
11531 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11532 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11533 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11535 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11536 "addi %0,%1,%2@got@tlsgd@l"
11537 [(set_attr "length" "4")])
11539 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
11540 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11541 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11542 (match_operand 2 "" "g")))
11543 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11545 (clobber (reg:SI LR_REGNO))]
11546 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11547 "bl %z1(%3@tlsgd)\;%."
11548 [(set_attr "type" "branch")
11549 (set_attr "length" "8")])
11551 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
11552 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11553 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11554 (match_operand 2 "" "g")))
11555 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
11557 (clobber (reg:SI LR_REGNO))]
11558 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11562 if (TARGET_SECURE_PLT && flag_pic == 2)
11563 return "bl %z1+32768(%3@tlsgd)@plt";
11564 return "bl %z1(%3@tlsgd)@plt";
11566 return "bl %z1(%3@tlsgd)";
11568 [(set_attr "type" "branch")
11569 (set_attr "length" "4")])
11571 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
11572 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11573 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11574 (match_operand 3 "" "g")))
11575 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11577 (clobber (reg:SI LR_REGNO))]
11578 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
11580 if (TARGET_CMODEL != CMODEL_SMALL)
11581 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;bl %z2\;%.";
11583 return "addi %0,%1,%&@got@tlsld\;bl %z2\;%.";
11585 "&& TARGET_TLS_MARKERS"
11586 [(set (match_dup 0)
11587 (unspec:TLSmode [(match_dup 1)]
11589 (parallel [(set (match_dup 0)
11590 (call (mem:TLSmode (match_dup 2))
11592 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11593 (clobber (reg:SI LR_REGNO))])]
11595 [(set_attr "type" "two")
11596 (set (attr "length")
11597 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11601 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
11602 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11603 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
11604 (match_operand 3 "" "g")))
11605 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11607 (clobber (reg:SI LR_REGNO))]
11608 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
11612 if (TARGET_SECURE_PLT && flag_pic == 2)
11613 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
11615 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
11618 return "addi %0,%1,%&@got@tlsld\;bl %z2";
11620 "&& TARGET_TLS_MARKERS"
11621 [(set (match_dup 0)
11622 (unspec:TLSmode [(match_dup 1)]
11624 (parallel [(set (match_dup 0)
11625 (call (mem:TLSmode (match_dup 2))
11627 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11628 (clobber (reg:SI LR_REGNO))])]
11630 [(set_attr "length" "8")])
11632 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
11633 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11634 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
11636 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
11637 "addi %0,%1,%&@got@tlsld"
11638 "&& TARGET_CMODEL != CMODEL_SMALL"
11639 [(set (match_dup 2)
11640 (plus:TLSmode (match_dup 1)
11642 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))
11644 (lo_sum:TLSmode (match_dup 2)
11645 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11648 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11650 [(set (attr "length")
11651 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11655 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
11656 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11657 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11659 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD))))]
11660 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11661 "addis %0,%1,%&@got@tlsld@ha"
11662 [(set_attr "length" "4")])
11664 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
11665 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11666 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11667 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
11668 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
11669 "addi %0,%1,%&@got@tlsld@l"
11670 [(set_attr "length" "4")])
11672 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
11673 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11674 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11675 (match_operand 2 "" "g")))
11676 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11677 (clobber (reg:SI LR_REGNO))]
11678 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
11679 "bl %z1(%&@tlsld)\;%."
11680 [(set_attr "type" "branch")
11681 (set_attr "length" "8")])
11683 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
11684 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11685 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
11686 (match_operand 2 "" "g")))
11687 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
11688 (clobber (reg:SI LR_REGNO))]
11689 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
11693 if (TARGET_SECURE_PLT && flag_pic == 2)
11694 return "bl %z1+32768(%&@tlsld)@plt";
11695 return "bl %z1(%&@tlsld)@plt";
11697 return "bl %z1(%&@tlsld)";
11699 [(set_attr "type" "branch")
11700 (set_attr "length" "4")])
11702 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
11703 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11704 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11705 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11706 UNSPEC_TLSDTPREL))]
11708 "addi %0,%1,%2@dtprel")
11710 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
11711 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11712 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11713 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11714 UNSPEC_TLSDTPRELHA))]
11716 "addis %0,%1,%2@dtprel@ha")
11718 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
11719 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11720 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11721 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11722 UNSPEC_TLSDTPRELLO))]
11724 "addi %0,%1,%2@dtprel@l")
11726 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
11727 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11728 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11729 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11730 UNSPEC_TLSGOTDTPREL))]
11732 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
11733 "&& TARGET_CMODEL != CMODEL_SMALL"
11734 [(set (match_dup 3)
11735 (plus:TLSmode (match_dup 1)
11737 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL))))
11739 (lo_sum:TLSmode (match_dup 3)
11740 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
11743 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11745 [(set (attr "length")
11746 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11750 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
11751 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11752 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11754 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11755 UNSPEC_TLSGOTDTPREL))))]
11756 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11757 "addis %0,%1,%2@got@dtprel@ha"
11758 [(set_attr "length" "4")])
11760 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
11761 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11762 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11763 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11764 UNSPEC_TLSGOTDTPREL)))]
11765 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11766 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
11767 [(set_attr "length" "4")])
11769 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
11770 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11771 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11772 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11775 "addi %0,%1,%2@tprel")
11777 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
11778 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11779 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11780 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11781 UNSPEC_TLSTPRELHA))]
11783 "addis %0,%1,%2@tprel@ha")
11785 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
11786 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11787 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11788 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11789 UNSPEC_TLSTPRELLO))]
11791 "addi %0,%1,%2@tprel@l")
11793 ;; "b" output constraint here and on tls_tls input to support linker tls
11794 ;; optimization. The linker may edit the instructions emitted by a
11795 ;; tls_got_tprel/tls_tls pair to addis,addi.
11796 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
11797 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11798 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11799 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11800 UNSPEC_TLSGOTTPREL))]
11802 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
11803 "&& TARGET_CMODEL != CMODEL_SMALL"
11804 [(set (match_dup 3)
11805 (plus:TLSmode (match_dup 1)
11807 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL))))
11809 (lo_sum:TLSmode (match_dup 3)
11810 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
11813 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
11815 [(set (attr "length")
11816 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
11820 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
11821 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
11822 (plus:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11824 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11825 UNSPEC_TLSGOTTPREL))))]
11826 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11827 "addis %0,%1,%2@got@tprel@ha"
11828 [(set_attr "length" "4")])
11830 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
11831 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11832 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
11833 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11834 UNSPEC_TLSGOTTPREL)))]
11835 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
11836 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
11837 [(set_attr "length" "4")])
11839 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
11840 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
11841 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
11842 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
11845 "add %0,%1,%2@tls")
11847 ;; Next come insns related to the calling sequence.
11849 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
11850 ;; We move the back-chain and decrement the stack pointer.
11852 (define_expand "allocate_stack"
11853 [(set (match_operand 0 "gpc_reg_operand" "")
11854 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
11856 (minus (reg 1) (match_dup 1)))]
11859 { rtx chain = gen_reg_rtx (Pmode);
11860 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11862 rtx insn, par, set, mem;
11864 emit_move_insn (chain, stack_bot);
11866 /* Check stack bounds if necessary. */
11867 if (crtl->limit_stack)
11870 available = expand_binop (Pmode, sub_optab,
11871 stack_pointer_rtx, stack_limit_rtx,
11872 NULL_RTX, 1, OPTAB_WIDEN);
11873 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11876 if (GET_CODE (operands[1]) != CONST_INT
11877 || INTVAL (operands[1]) < -32767
11878 || INTVAL (operands[1]) > 32768)
11880 neg_op0 = gen_reg_rtx (Pmode);
11882 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11884 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11887 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11889 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11890 : gen_movdi_di_update_stack))
11891 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11893 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11894 it now and set the alias set/attributes. The above gen_*_update
11895 calls will generate a PARALLEL with the MEM set being the first
11897 par = PATTERN (insn);
11898 gcc_assert (GET_CODE (par) == PARALLEL);
11899 set = XVECEXP (par, 0, 0);
11900 gcc_assert (GET_CODE (set) == SET);
11901 mem = SET_DEST (set);
11902 gcc_assert (MEM_P (mem));
11903 MEM_NOTRAP_P (mem) = 1;
11904 set_mem_alias_set (mem, get_frame_alias_set ());
11906 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11910 ;; These patterns say how to save and restore the stack pointer. We need not
11911 ;; save the stack pointer at function level since we are careful to
11912 ;; preserve the backchain. At block level, we have to restore the backchain
11913 ;; when we restore the stack pointer.
11915 ;; For nonlocal gotos, we must save both the stack pointer and its
11916 ;; backchain and restore both. Note that in the nonlocal case, the
11917 ;; save area is a memory location.
11919 (define_expand "save_stack_function"
11920 [(match_operand 0 "any_operand" "")
11921 (match_operand 1 "any_operand" "")]
11925 (define_expand "restore_stack_function"
11926 [(match_operand 0 "any_operand" "")
11927 (match_operand 1 "any_operand" "")]
11931 ;; Adjust stack pointer (op0) to a new value (op1).
11932 ;; First copy old stack backchain to new location, and ensure that the
11933 ;; scheduler won't reorder the sp assignment before the backchain write.
11934 (define_expand "restore_stack_block"
11935 [(set (match_dup 2) (match_dup 3))
11936 (set (match_dup 4) (match_dup 2))
11937 (set (match_dup 5) (unspec:BLK [(match_dup 5)] UNSPEC_TIE))
11938 (set (match_operand 0 "register_operand" "")
11939 (match_operand 1 "register_operand" ""))]
11943 operands[1] = force_reg (Pmode, operands[1]);
11944 operands[2] = gen_reg_rtx (Pmode);
11945 operands[3] = gen_frame_mem (Pmode, operands[0]);
11946 operands[4] = gen_frame_mem (Pmode, operands[1]);
11947 operands[5] = gen_frame_mem (BLKmode, operands[0]);
11950 (define_expand "save_stack_nonlocal"
11951 [(set (match_dup 3) (match_dup 4))
11952 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11953 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11957 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11959 /* Copy the backchain to the first word, sp to the second. */
11960 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11961 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11962 operands[3] = gen_reg_rtx (Pmode);
11963 operands[4] = gen_frame_mem (Pmode, operands[1]);
11966 (define_expand "restore_stack_nonlocal"
11967 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11968 (set (match_dup 3) (match_dup 4))
11969 (set (match_dup 5) (match_dup 2))
11970 (set (match_dup 6) (unspec:BLK [(match_dup 6)] UNSPEC_TIE))
11971 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11975 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11977 /* Restore the backchain from the first word, sp from the second. */
11978 operands[2] = gen_reg_rtx (Pmode);
11979 operands[3] = gen_reg_rtx (Pmode);
11980 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11981 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11982 operands[5] = gen_frame_mem (Pmode, operands[3]);
11983 operands[6] = gen_frame_mem (BLKmode, operands[0]);
11986 ;; TOC register handling.
11988 ;; Code to initialize the TOC register...
11990 (define_insn "load_toc_aix_si"
11991 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11992 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11993 (use (reg:SI 2))])]
11994 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11998 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11999 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12000 operands[2] = gen_rtx_REG (Pmode, 2);
12001 return \"{l|lwz} %0,%1(%2)\";
12003 [(set_attr "type" "load")])
12005 (define_insn "load_toc_aix_di"
12006 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12007 (unspec:DI [(const_int 0)] UNSPEC_TOC))
12008 (use (reg:DI 2))])]
12009 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
12013 #ifdef TARGET_RELOCATABLE
12014 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
12015 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
12017 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
12020 strcat (buf, \"@toc\");
12021 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
12022 operands[2] = gen_rtx_REG (Pmode, 2);
12023 return \"ld %0,%1(%2)\";
12025 [(set_attr "type" "load")])
12027 (define_insn "load_toc_v4_pic_si"
12028 [(set (reg:SI LR_REGNO)
12029 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
12030 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
12031 "bl _GLOBAL_OFFSET_TABLE_@local-4"
12032 [(set_attr "type" "branch")
12033 (set_attr "length" "4")])
12035 (define_insn "load_toc_v4_PIC_1"
12036 [(set (reg:SI LR_REGNO)
12037 (match_operand:SI 0 "immediate_operand" "s"))
12038 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
12039 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
12040 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
12041 "bcl 20,31,%0\\n%0:"
12042 [(set_attr "type" "branch")
12043 (set_attr "length" "4")])
12045 (define_insn "load_toc_v4_PIC_1b"
12046 [(set (reg:SI LR_REGNO)
12047 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
12048 (label_ref (match_operand 1 "" ""))]
12051 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12052 "bcl 20,31,$+8\;.long %0-$"
12053 [(set_attr "type" "branch")
12054 (set_attr "length" "8")])
12056 (define_insn "load_toc_v4_PIC_2"
12057 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12058 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12059 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
12060 (match_operand:SI 3 "immediate_operand" "s")))))]
12061 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
12062 "{l|lwz} %0,%2-%3(%1)"
12063 [(set_attr "type" "load")])
12065 (define_insn "load_toc_v4_PIC_3b"
12066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12067 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12069 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12070 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
12071 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12072 "{cau|addis} %0,%1,%2-%3@ha")
12074 (define_insn "load_toc_v4_PIC_3c"
12075 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12076 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
12077 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
12078 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
12079 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
12080 "{cal %0,%2-%3@l(%1)|addi %0,%1,%2-%3@l}")
12082 ;; If the TOC is shared over a translation unit, as happens with all
12083 ;; the kinds of PIC that we support, we need to restore the TOC
12084 ;; pointer only when jumping over units of translation.
12085 ;; On Darwin, we need to reload the picbase.
12087 (define_expand "builtin_setjmp_receiver"
12088 [(use (label_ref (match_operand 0 "" "")))]
12089 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
12090 || (TARGET_TOC && TARGET_MINIMAL_TOC)
12091 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
12095 if (DEFAULT_ABI == ABI_DARWIN)
12097 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
12098 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
12102 crtl->uses_pic_offset_table = 1;
12103 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
12104 CODE_LABEL_NUMBER (operands[0]));
12105 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
12107 emit_insn (gen_load_macho_picbase (tmplabrtx));
12108 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
12109 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
12113 rs6000_emit_load_toc_table (FALSE);
12117 ;; Elf specific ways of loading addresses for non-PIC code.
12118 ;; The output of this could be r0, but we make a very strong
12119 ;; preference for a base register because it will usually
12120 ;; be needed there.
12121 (define_insn "elf_high"
12122 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
12123 (high:SI (match_operand 1 "" "")))]
12124 "TARGET_ELF && ! TARGET_64BIT"
12125 "{liu|lis} %0,%1@ha")
12127 (define_insn "elf_low"
12128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12129 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
12130 (match_operand 2 "" "")))]
12131 "TARGET_ELF && ! TARGET_64BIT"
12133 {cal|la} %0,%2@l(%1)
12134 {ai|addic} %0,%1,%K2")
12136 ;; Largetoc support
12137 (define_insn "largetoc_high"
12138 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
12139 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12140 (high:DI (match_operand:DI 2 "" ""))))]
12141 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12142 "{cau|addis} %0,%1,%2@ha")
12144 (define_insn "largetoc_low"
12145 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12146 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b")
12147 (match_operand:DI 2 "" "")))]
12148 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
12149 "{cal %0,%2@l(%1)|addi %0,%1,%2@l}")
12151 ;; A function pointer under AIX is a pointer to a data area whose first word
12152 ;; contains the actual address of the function, whose second word contains a
12153 ;; pointer to its TOC, and whose third word contains a value to place in the
12154 ;; static chain register (r11). Note that if we load the static chain, our
12155 ;; "trampoline" need not have any executable code.
12157 (define_expand "call_indirect_aix32"
12158 [(set (match_dup 2)
12159 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
12160 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12163 (mem:SI (plus:SI (match_dup 0)
12165 (parallel [(call (mem:SI (match_dup 2))
12166 (match_operand 1 "" ""))
12167 (use (mem:SI (plus:SI (match_dup 0) (const_int 4))))
12169 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12170 (clobber (reg:SI LR_REGNO))])]
12173 { operands[2] = gen_reg_rtx (SImode); }")
12175 (define_expand "call_indirect_aix64"
12176 [(set (match_dup 2)
12177 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
12178 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12181 (mem:DI (plus:DI (match_dup 0)
12183 (parallel [(call (mem:SI (match_dup 2))
12184 (match_operand 1 "" ""))
12185 (use (mem:DI (plus:DI (match_dup 0) (const_int 8))))
12187 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12188 (clobber (reg:SI LR_REGNO))])]
12191 { operands[2] = gen_reg_rtx (DImode); }")
12193 (define_expand "call_value_indirect_aix32"
12194 [(set (match_dup 3)
12195 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12196 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
12199 (mem:SI (plus:SI (match_dup 1)
12201 (parallel [(set (match_operand 0 "" "")
12202 (call (mem:SI (match_dup 3))
12203 (match_operand 2 "" "")))
12204 (use (mem:SI (plus:SI (match_dup 1) (const_int 4))))
12206 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12207 (clobber (reg:SI LR_REGNO))])]
12210 { operands[3] = gen_reg_rtx (SImode); }")
12212 (define_expand "call_value_indirect_aix64"
12213 [(set (match_dup 3)
12214 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12215 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
12218 (mem:DI (plus:DI (match_dup 1)
12220 (parallel [(set (match_operand 0 "" "")
12221 (call (mem:SI (match_dup 3))
12222 (match_operand 2 "" "")))
12223 (use (mem:DI (plus:DI (match_dup 1) (const_int 8))))
12225 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12226 (clobber (reg:SI LR_REGNO))])]
12229 { operands[3] = gen_reg_rtx (DImode); }")
12231 ;; Now the definitions for the call and call_value insns
12232 (define_expand "call"
12233 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12234 (match_operand 1 "" ""))
12235 (use (match_operand 2 "" ""))
12236 (clobber (reg:SI LR_REGNO))])]
12241 if (MACHOPIC_INDIRECT)
12242 operands[0] = machopic_indirect_call_target (operands[0]);
12245 gcc_assert (GET_CODE (operands[0]) == MEM);
12246 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12248 operands[0] = XEXP (operands[0], 0);
12250 if (GET_CODE (operands[0]) != SYMBOL_REF
12251 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
12252 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
12254 if (INTVAL (operands[2]) & CALL_LONG)
12255 operands[0] = rs6000_longcall_ref (operands[0]);
12257 switch (DEFAULT_ABI)
12261 operands[0] = force_reg (Pmode, operands[0]);
12265 /* AIX function pointers are really pointers to a three word
12267 emit_call_insn (TARGET_32BIT
12268 ? gen_call_indirect_aix32 (force_reg (SImode,
12271 : gen_call_indirect_aix64 (force_reg (DImode,
12277 gcc_unreachable ();
12282 (define_expand "call_value"
12283 [(parallel [(set (match_operand 0 "" "")
12284 (call (mem:SI (match_operand 1 "address_operand" ""))
12285 (match_operand 2 "" "")))
12286 (use (match_operand 3 "" ""))
12287 (clobber (reg:SI LR_REGNO))])]
12292 if (MACHOPIC_INDIRECT)
12293 operands[1] = machopic_indirect_call_target (operands[1]);
12296 gcc_assert (GET_CODE (operands[1]) == MEM);
12297 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12299 operands[1] = XEXP (operands[1], 0);
12301 if (GET_CODE (operands[1]) != SYMBOL_REF
12302 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
12303 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
12305 if (INTVAL (operands[3]) & CALL_LONG)
12306 operands[1] = rs6000_longcall_ref (operands[1]);
12308 switch (DEFAULT_ABI)
12312 operands[1] = force_reg (Pmode, operands[1]);
12316 /* AIX function pointers are really pointers to a three word
12318 emit_call_insn (TARGET_32BIT
12319 ? gen_call_value_indirect_aix32 (operands[0],
12323 : gen_call_value_indirect_aix64 (operands[0],
12330 gcc_unreachable ();
12335 ;; Call to function in current module. No TOC pointer reload needed.
12336 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12337 ;; either the function was not prototyped, or it was prototyped as a
12338 ;; variable argument function. It is > 0 if FP registers were passed
12339 ;; and < 0 if they were not.
12341 (define_insn "*call_local32"
12342 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12343 (match_operand 1 "" "g,g"))
12344 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12345 (clobber (reg:SI LR_REGNO))]
12346 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12349 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12350 output_asm_insn (\"crxor 6,6,6\", operands);
12352 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12353 output_asm_insn (\"creqv 6,6,6\", operands);
12355 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12357 [(set_attr "type" "branch")
12358 (set_attr "length" "4,8")])
12360 (define_insn "*call_local64"
12361 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12362 (match_operand 1 "" "g,g"))
12363 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12364 (clobber (reg:SI LR_REGNO))]
12365 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12368 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12369 output_asm_insn (\"crxor 6,6,6\", operands);
12371 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12372 output_asm_insn (\"creqv 6,6,6\", operands);
12374 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
12376 [(set_attr "type" "branch")
12377 (set_attr "length" "4,8")])
12379 (define_insn "*call_value_local32"
12380 [(set (match_operand 0 "" "")
12381 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12382 (match_operand 2 "" "g,g")))
12383 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12384 (clobber (reg:SI LR_REGNO))]
12385 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12388 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12389 output_asm_insn (\"crxor 6,6,6\", operands);
12391 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12392 output_asm_insn (\"creqv 6,6,6\", operands);
12394 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12396 [(set_attr "type" "branch")
12397 (set_attr "length" "4,8")])
12400 (define_insn "*call_value_local64"
12401 [(set (match_operand 0 "" "")
12402 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12403 (match_operand 2 "" "g,g")))
12404 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12405 (clobber (reg:SI LR_REGNO))]
12406 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12409 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12410 output_asm_insn (\"crxor 6,6,6\", operands);
12412 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12413 output_asm_insn (\"creqv 6,6,6\", operands);
12415 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
12417 [(set_attr "type" "branch")
12418 (set_attr "length" "4,8")])
12420 ;; Call to function which may be in another module. Restore the TOC
12421 ;; pointer (r2) after the call unless this is System V.
12422 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
12423 ;; either the function was not prototyped, or it was prototyped as a
12424 ;; variable argument function. It is > 0 if FP registers were passed
12425 ;; and < 0 if they were not.
12427 (define_insn_and_split "*call_indirect_nonlocal_aix32_internal"
12428 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12429 (match_operand 1 "" "g,g"))
12430 (use (mem:SI (plus:SI (match_operand:SI 2 "register_operand" "b,b") (const_int 4))))
12432 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12433 (clobber (reg:SI LR_REGNO))]
12434 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12436 "&& reload_completed"
12438 (mem:SI (plus:SI (match_dup 2) (const_int 4))))
12439 (parallel [(call (mem:SI (match_dup 0))
12444 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12445 (clobber (reg:SI LR_REGNO))])]
12447 [(set_attr "type" "jmpreg")
12448 (set_attr "length" "12")])
12450 (define_insn "*call_indirect_nonlocal_aix32"
12451 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
12452 (match_operand 1 "" "g,g"))
12456 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12457 (clobber (reg:SI LR_REGNO))]
12458 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12459 "b%T0l\;{l|lwz} 2,20(1)"
12460 [(set_attr "type" "jmpreg")
12461 (set_attr "length" "8")])
12463 (define_insn "*call_nonlocal_aix32"
12464 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12465 (match_operand 1 "" "g"))
12466 (use (match_operand:SI 2 "immediate_operand" "O"))
12467 (clobber (reg:SI LR_REGNO))]
12469 && DEFAULT_ABI == ABI_AIX
12470 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12472 [(set_attr "type" "branch")
12473 (set_attr "length" "8")])
12475 (define_insn_and_split "*call_indirect_nonlocal_aix64_internal"
12476 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12477 (match_operand 1 "" "g,g"))
12478 (use (mem:DI (plus:DI (match_operand:DI 2 "register_operand" "b,b")
12481 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12482 (clobber (reg:SI LR_REGNO))]
12483 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12485 "&& reload_completed"
12487 (mem:DI (plus:DI (match_dup 2) (const_int 8))))
12488 (parallel [(call (mem:SI (match_dup 0))
12493 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12494 (clobber (reg:SI LR_REGNO))])]
12496 [(set_attr "type" "jmpreg")
12497 (set_attr "length" "12")])
12499 (define_insn "*call_indirect_nonlocal_aix64"
12500 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
12501 (match_operand 1 "" "g,g"))
12505 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12506 (clobber (reg:SI LR_REGNO))]
12507 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12508 "b%T0l\;ld 2,40(1)"
12509 [(set_attr "type" "jmpreg")
12510 (set_attr "length" "8")])
12512 (define_insn "*call_nonlocal_aix64"
12513 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12514 (match_operand 1 "" "g"))
12515 (use (match_operand:SI 2 "immediate_operand" "O"))
12516 (clobber (reg:SI LR_REGNO))]
12518 && DEFAULT_ABI == ABI_AIX
12519 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12521 [(set_attr "type" "branch")
12522 (set_attr "length" "8")])
12524 (define_insn_and_split "*call_value_indirect_nonlocal_aix32_internal"
12525 [(set (match_operand 0 "" "")
12526 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12527 (match_operand 2 "" "g,g")))
12528 (use (mem:SI (plus:SI (match_operand:SI 3 "register_operand" "b,b")
12531 (use (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12532 (clobber (reg:SI LR_REGNO))]
12533 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
12535 "&& reload_completed"
12537 (mem:SI (plus:SI (match_dup 3) (const_int 4))))
12538 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12543 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12544 (clobber (reg:SI LR_REGNO))])]
12546 [(set_attr "type" "jmpreg")
12547 (set_attr "length" "12")])
12549 (define_insn "*call_value_indirect_nonlocal_aix32"
12550 [(set (match_operand 0 "" "")
12551 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
12552 (match_operand 2 "" "g,g")))
12556 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
12557 (clobber (reg:SI LR_REGNO))]
12558 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12559 "b%T1l\;{l|lwz} 2,20(1)"
12560 [(set_attr "type" "jmpreg")
12561 (set_attr "length" "8")])
12563 (define_insn "*call_value_nonlocal_aix32"
12564 [(set (match_operand 0 "" "")
12565 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12566 (match_operand 2 "" "g")))
12567 (use (match_operand:SI 3 "immediate_operand" "O"))
12568 (clobber (reg:SI LR_REGNO))]
12570 && DEFAULT_ABI == ABI_AIX
12571 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12573 [(set_attr "type" "branch")
12574 (set_attr "length" "8")])
12576 (define_insn_and_split "*call_value_indirect_nonlocal_aix64_internal"
12577 [(set (match_operand 0 "" "")
12578 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12579 (match_operand 2 "" "g,g")))
12580 (use (mem:DI (plus:DI (match_operand:DI 3 "register_operand" "b,b")
12583 (use (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12584 (clobber (reg:SI LR_REGNO))]
12585 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
12587 "&& reload_completed"
12589 (mem:DI (plus:DI (match_dup 3) (const_int 8))))
12590 (parallel [(set (match_dup 0) (call (mem:SI (match_dup 1))
12595 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12596 (clobber (reg:SI LR_REGNO))])]
12598 [(set_attr "type" "jmpreg")
12599 (set_attr "length" "12")])
12601 (define_insn "*call_value_indirect_nonlocal_aix64"
12602 [(set (match_operand 0 "" "")
12603 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
12604 (match_operand 2 "" "g,g")))
12608 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
12609 (clobber (reg:SI LR_REGNO))]
12610 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX && reload_completed"
12611 "b%T1l\;ld 2,40(1)"
12612 [(set_attr "type" "jmpreg")
12613 (set_attr "length" "8")])
12615 (define_insn "*call_value_nonlocal_aix64"
12616 [(set (match_operand 0 "" "")
12617 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12618 (match_operand 2 "" "g")))
12619 (use (match_operand:SI 3 "immediate_operand" "O"))
12620 (clobber (reg:SI LR_REGNO))]
12622 && DEFAULT_ABI == ABI_AIX
12623 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12625 [(set_attr "type" "branch")
12626 (set_attr "length" "8")])
12628 ;; A function pointer under System V is just a normal pointer
12629 ;; operands[0] is the function pointer
12630 ;; operands[1] is the stack size to clean up
12631 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
12632 ;; which indicates how to set cr1
12634 (define_insn "*call_indirect_nonlocal_sysv<mode>"
12635 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
12636 (match_operand 1 "" "g,g,g,g"))
12637 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
12638 (clobber (reg:SI LR_REGNO))]
12639 "DEFAULT_ABI == ABI_V4
12640 || DEFAULT_ABI == ABI_DARWIN"
12642 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12643 output_asm_insn ("crxor 6,6,6", operands);
12645 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12646 output_asm_insn ("creqv 6,6,6", operands);
12650 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12651 (set_attr "length" "4,4,8,8")])
12653 (define_insn_and_split "*call_nonlocal_sysv<mode>"
12654 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12655 (match_operand 1 "" "g,g"))
12656 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12657 (clobber (reg:SI LR_REGNO))]
12658 "(DEFAULT_ABI == ABI_DARWIN
12659 || (DEFAULT_ABI == ABI_V4
12660 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
12662 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12663 output_asm_insn ("crxor 6,6,6", operands);
12665 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12666 output_asm_insn ("creqv 6,6,6", operands);
12669 return output_call(insn, operands, 0, 2);
12671 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12673 gcc_assert (!TARGET_SECURE_PLT);
12674 return "bl %z0@plt";
12680 "DEFAULT_ABI == ABI_V4
12681 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12682 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12683 [(parallel [(call (mem:SI (match_dup 0))
12685 (use (match_dup 2))
12686 (use (match_dup 3))
12687 (clobber (reg:SI LR_REGNO))])]
12689 operands[3] = pic_offset_table_rtx;
12691 [(set_attr "type" "branch,branch")
12692 (set_attr "length" "4,8")])
12694 (define_insn "*call_nonlocal_sysv_secure<mode>"
12695 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
12696 (match_operand 1 "" "g,g"))
12697 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12698 (use (match_operand:SI 3 "register_operand" "r,r"))
12699 (clobber (reg:SI LR_REGNO))]
12700 "(DEFAULT_ABI == ABI_V4
12701 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
12702 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
12704 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12705 output_asm_insn ("crxor 6,6,6", operands);
12707 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12708 output_asm_insn ("creqv 6,6,6", operands);
12711 /* The magic 32768 offset here and in the other sysv call insns
12712 corresponds to the offset of r30 in .got2, as given by LCTOC1.
12713 See sysv4.h:toc_section. */
12714 return "bl %z0+32768@plt";
12716 return "bl %z0@plt";
12718 [(set_attr "type" "branch,branch")
12719 (set_attr "length" "4,8")])
12721 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
12722 [(set (match_operand 0 "" "")
12723 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
12724 (match_operand 2 "" "g,g,g,g")))
12725 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
12726 (clobber (reg:SI LR_REGNO))]
12727 "DEFAULT_ABI == ABI_V4
12728 || DEFAULT_ABI == ABI_DARWIN"
12730 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12731 output_asm_insn ("crxor 6,6,6", operands);
12733 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12734 output_asm_insn ("creqv 6,6,6", operands);
12738 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
12739 (set_attr "length" "4,4,8,8")])
12741 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
12742 [(set (match_operand 0 "" "")
12743 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12744 (match_operand 2 "" "g,g")))
12745 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12746 (clobber (reg:SI LR_REGNO))]
12747 "(DEFAULT_ABI == ABI_DARWIN
12748 || (DEFAULT_ABI == ABI_V4
12749 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
12751 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12752 output_asm_insn ("crxor 6,6,6", operands);
12754 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12755 output_asm_insn ("creqv 6,6,6", operands);
12758 return output_call(insn, operands, 1, 3);
12760 if (DEFAULT_ABI == ABI_V4 && flag_pic)
12762 gcc_assert (!TARGET_SECURE_PLT);
12763 return "bl %z1@plt";
12769 "DEFAULT_ABI == ABI_V4
12770 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12771 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12772 [(parallel [(set (match_dup 0)
12773 (call (mem:SI (match_dup 1))
12775 (use (match_dup 3))
12776 (use (match_dup 4))
12777 (clobber (reg:SI LR_REGNO))])]
12779 operands[4] = pic_offset_table_rtx;
12781 [(set_attr "type" "branch,branch")
12782 (set_attr "length" "4,8")])
12784 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
12785 [(set (match_operand 0 "" "")
12786 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
12787 (match_operand 2 "" "g,g")))
12788 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12789 (use (match_operand:SI 4 "register_operand" "r,r"))
12790 (clobber (reg:SI LR_REGNO))]
12791 "(DEFAULT_ABI == ABI_V4
12792 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
12793 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
12795 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12796 output_asm_insn ("crxor 6,6,6", operands);
12798 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12799 output_asm_insn ("creqv 6,6,6", operands);
12802 return "bl %z1+32768@plt";
12804 return "bl %z1@plt";
12806 [(set_attr "type" "branch,branch")
12807 (set_attr "length" "4,8")])
12809 ;; Call subroutine returning any type.
12810 (define_expand "untyped_call"
12811 [(parallel [(call (match_operand 0 "" "")
12813 (match_operand 1 "" "")
12814 (match_operand 2 "" "")])]
12820 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
12822 for (i = 0; i < XVECLEN (operands[2], 0); i++)
12824 rtx set = XVECEXP (operands[2], 0, i);
12825 emit_move_insn (SET_DEST (set), SET_SRC (set));
12828 /* The optimizer does not know that the call sets the function value
12829 registers we stored in the result block. We avoid problems by
12830 claiming that all hard registers are used and clobbered at this
12832 emit_insn (gen_blockage ());
12837 ;; sibling call patterns
12838 (define_expand "sibcall"
12839 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
12840 (match_operand 1 "" ""))
12841 (use (match_operand 2 "" ""))
12842 (use (reg:SI LR_REGNO))
12848 if (MACHOPIC_INDIRECT)
12849 operands[0] = machopic_indirect_call_target (operands[0]);
12852 gcc_assert (GET_CODE (operands[0]) == MEM);
12853 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
12855 operands[0] = XEXP (operands[0], 0);
12858 ;; this and similar patterns must be marked as using LR, otherwise
12859 ;; dataflow will try to delete the store into it. This is true
12860 ;; even when the actual reg to jump to is in CTR, when LR was
12861 ;; saved and restored around the PIC-setting BCL.
12862 (define_insn "*sibcall_local32"
12863 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
12864 (match_operand 1 "" "g,g"))
12865 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12866 (use (reg:SI LR_REGNO))
12868 "(INTVAL (operands[2]) & CALL_LONG) == 0"
12871 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12872 output_asm_insn (\"crxor 6,6,6\", operands);
12874 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12875 output_asm_insn (\"creqv 6,6,6\", operands);
12877 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12879 [(set_attr "type" "branch")
12880 (set_attr "length" "4,8")])
12882 (define_insn "*sibcall_local64"
12883 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
12884 (match_operand 1 "" "g,g"))
12885 (use (match_operand:SI 2 "immediate_operand" "O,n"))
12886 (use (reg:SI LR_REGNO))
12888 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
12891 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12892 output_asm_insn (\"crxor 6,6,6\", operands);
12894 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12895 output_asm_insn (\"creqv 6,6,6\", operands);
12897 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
12899 [(set_attr "type" "branch")
12900 (set_attr "length" "4,8")])
12902 (define_insn "*sibcall_value_local32"
12903 [(set (match_operand 0 "" "")
12904 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
12905 (match_operand 2 "" "g,g")))
12906 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12907 (use (reg:SI LR_REGNO))
12909 "(INTVAL (operands[3]) & CALL_LONG) == 0"
12912 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12913 output_asm_insn (\"crxor 6,6,6\", operands);
12915 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12916 output_asm_insn (\"creqv 6,6,6\", operands);
12918 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12920 [(set_attr "type" "branch")
12921 (set_attr "length" "4,8")])
12924 (define_insn "*sibcall_value_local64"
12925 [(set (match_operand 0 "" "")
12926 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12927 (match_operand 2 "" "g,g")))
12928 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12929 (use (reg:SI LR_REGNO))
12931 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12934 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12935 output_asm_insn (\"crxor 6,6,6\", operands);
12937 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12938 output_asm_insn (\"creqv 6,6,6\", operands);
12940 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12942 [(set_attr "type" "branch")
12943 (set_attr "length" "4,8")])
12945 (define_insn "*sibcall_nonlocal_aix32"
12946 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
12947 (match_operand 1 "" "g"))
12948 (use (match_operand:SI 2 "immediate_operand" "O"))
12949 (use (reg:SI LR_REGNO))
12952 && DEFAULT_ABI == ABI_AIX
12953 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12955 [(set_attr "type" "branch")
12956 (set_attr "length" "4")])
12958 (define_insn "*sibcall_nonlocal_aix64"
12959 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
12960 (match_operand 1 "" "g"))
12961 (use (match_operand:SI 2 "immediate_operand" "O"))
12962 (use (reg:SI LR_REGNO))
12965 && DEFAULT_ABI == ABI_AIX
12966 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12968 [(set_attr "type" "branch")
12969 (set_attr "length" "4")])
12971 (define_insn "*sibcall_value_nonlocal_aix32"
12972 [(set (match_operand 0 "" "")
12973 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
12974 (match_operand 2 "" "g")))
12975 (use (match_operand:SI 3 "immediate_operand" "O"))
12976 (use (reg:SI LR_REGNO))
12979 && DEFAULT_ABI == ABI_AIX
12980 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12982 [(set_attr "type" "branch")
12983 (set_attr "length" "4")])
12985 (define_insn "*sibcall_value_nonlocal_aix64"
12986 [(set (match_operand 0 "" "")
12987 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
12988 (match_operand 2 "" "g")))
12989 (use (match_operand:SI 3 "immediate_operand" "O"))
12990 (use (reg:SI LR_REGNO))
12993 && DEFAULT_ABI == ABI_AIX
12994 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12996 [(set_attr "type" "branch")
12997 (set_attr "length" "4")])
12999 (define_insn "*sibcall_nonlocal_sysv<mode>"
13000 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
13001 (match_operand 1 "" ""))
13002 (use (match_operand 2 "immediate_operand" "O,n"))
13003 (use (reg:SI LR_REGNO))
13005 "(DEFAULT_ABI == ABI_DARWIN
13006 || DEFAULT_ABI == ABI_V4)
13007 && (INTVAL (operands[2]) & CALL_LONG) == 0"
13010 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13011 output_asm_insn (\"crxor 6,6,6\", operands);
13013 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13014 output_asm_insn (\"creqv 6,6,6\", operands);
13016 if (DEFAULT_ABI == ABI_V4 && flag_pic)
13018 gcc_assert (!TARGET_SECURE_PLT);
13019 return \"b %z0@plt\";
13024 [(set_attr "type" "branch,branch")
13025 (set_attr "length" "4,8")])
13027 (define_expand "sibcall_value"
13028 [(parallel [(set (match_operand 0 "register_operand" "")
13029 (call (mem:SI (match_operand 1 "address_operand" ""))
13030 (match_operand 2 "" "")))
13031 (use (match_operand 3 "" ""))
13032 (use (reg:SI LR_REGNO))
13038 if (MACHOPIC_INDIRECT)
13039 operands[1] = machopic_indirect_call_target (operands[1]);
13042 gcc_assert (GET_CODE (operands[1]) == MEM);
13043 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
13045 operands[1] = XEXP (operands[1], 0);
13048 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
13049 [(set (match_operand 0 "" "")
13050 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
13051 (match_operand 2 "" "")))
13052 (use (match_operand:SI 3 "immediate_operand" "O,n"))
13053 (use (reg:SI LR_REGNO))
13055 "(DEFAULT_ABI == ABI_DARWIN
13056 || DEFAULT_ABI == ABI_V4)
13057 && (INTVAL (operands[3]) & CALL_LONG) == 0"
13060 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
13061 output_asm_insn (\"crxor 6,6,6\", operands);
13063 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
13064 output_asm_insn (\"creqv 6,6,6\", operands);
13066 if (DEFAULT_ABI == ABI_V4 && flag_pic)
13068 gcc_assert (!TARGET_SECURE_PLT);
13069 return \"b %z1@plt\";
13074 [(set_attr "type" "branch,branch")
13075 (set_attr "length" "4,8")])
13077 (define_expand "sibcall_epilogue"
13078 [(use (const_int 0))]
13079 "TARGET_SCHED_PROLOG"
13082 rs6000_emit_epilogue (TRUE);
13086 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
13087 ;; all of memory. This blocks insns from being moved across this point.
13089 (define_insn "blockage"
13090 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
13094 (define_insn "probe_stack"
13095 [(set (match_operand 0 "memory_operand" "=m")
13096 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
13098 "{st%U0%X0|stw%U0%X0} 0,%0"
13099 [(set_attr "type" "store")
13100 (set_attr "length" "4")])
13102 (define_insn "probe_stack_range<P:mode>"
13103 [(set (match_operand:P 0 "register_operand" "=r")
13104 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
13105 (match_operand:P 2 "register_operand" "r")]
13106 UNSPECV_PROBE_STACK_RANGE))]
13108 "* return output_probe_stack_range (operands[0], operands[2]);"
13109 [(set_attr "type" "three")])
13111 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
13112 ;; signed & unsigned, and one type of branch.
13114 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
13115 ;; insns, and branches.
13117 (define_expand "cbranch<mode>4"
13118 [(use (match_operator 0 "rs6000_cbranch_operator"
13119 [(match_operand:GPR 1 "gpc_reg_operand" "")
13120 (match_operand:GPR 2 "reg_or_short_operand" "")]))
13121 (use (match_operand 3 ""))]
13125 /* Take care of the possibility that operands[2] might be negative but
13126 this might be a logical operation. That insn doesn't exist. */
13127 if (GET_CODE (operands[2]) == CONST_INT
13128 && INTVAL (operands[2]) < 0)
13130 operands[2] = force_reg (<MODE>mode, operands[2]);
13131 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
13132 GET_MODE (operands[0]),
13133 operands[1], operands[2]);
13136 rs6000_emit_cbranch (<MODE>mode, operands);
13140 (define_expand "cbranch<mode>4"
13141 [(use (match_operator 0 "rs6000_cbranch_operator"
13142 [(match_operand:FP 1 "gpc_reg_operand" "")
13143 (match_operand:FP 2 "gpc_reg_operand" "")]))
13144 (use (match_operand 3 ""))]
13148 rs6000_emit_cbranch (<MODE>mode, operands);
13152 (define_expand "cstore<mode>4"
13153 [(use (match_operator 1 "rs6000_cbranch_operator"
13154 [(match_operand:GPR 2 "gpc_reg_operand" "")
13155 (match_operand:GPR 3 "reg_or_short_operand" "")]))
13156 (clobber (match_operand:SI 0 "register_operand"))]
13160 /* Take care of the possibility that operands[3] might be negative but
13161 this might be a logical operation. That insn doesn't exist. */
13162 if (GET_CODE (operands[3]) == CONST_INT
13163 && INTVAL (operands[3]) < 0)
13165 operands[3] = force_reg (<MODE>mode, operands[3]);
13166 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
13167 GET_MODE (operands[1]),
13168 operands[2], operands[3]);
13171 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
13172 For SEQ, likewise, except that comparisons with zero should be done
13173 with an scc insns. However, due to the order that combine see the
13174 resulting insns, we must, in fact, allow SEQ for integers. Fail in
13175 the cases we don't want to handle or are best handled by portable
13177 if (GET_CODE (operands[1]) == NE)
13179 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
13180 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
13181 && operands[3] == const0_rtx)
13183 rs6000_emit_sCOND (<MODE>mode, operands);
13187 (define_expand "cstore<mode>4"
13188 [(use (match_operator 1 "rs6000_cbranch_operator"
13189 [(match_operand:FP 2 "gpc_reg_operand" "")
13190 (match_operand:FP 3 "gpc_reg_operand" "")]))
13191 (clobber (match_operand:SI 0 "register_operand"))]
13195 rs6000_emit_sCOND (<MODE>mode, operands);
13200 (define_expand "stack_protect_set"
13201 [(match_operand 0 "memory_operand" "")
13202 (match_operand 1 "memory_operand" "")]
13205 #ifdef TARGET_THREAD_SSP_OFFSET
13206 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13207 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13208 operands[1] = gen_rtx_MEM (Pmode, addr);
13211 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
13213 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
13217 (define_insn "stack_protect_setsi"
13218 [(set (match_operand:SI 0 "memory_operand" "=m")
13219 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13220 (set (match_scratch:SI 2 "=&r") (const_int 0))]
13222 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
13223 [(set_attr "type" "three")
13224 (set_attr "length" "12")])
13226 (define_insn "stack_protect_setdi"
13227 [(set (match_operand:DI 0 "memory_operand" "=m")
13228 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
13229 (set (match_scratch:DI 2 "=&r") (const_int 0))]
13231 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
13232 [(set_attr "type" "three")
13233 (set_attr "length" "12")])
13235 (define_expand "stack_protect_test"
13236 [(match_operand 0 "memory_operand" "")
13237 (match_operand 1 "memory_operand" "")
13238 (match_operand 2 "" "")]
13241 rtx test, op0, op1;
13242 #ifdef TARGET_THREAD_SSP_OFFSET
13243 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
13244 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
13245 operands[1] = gen_rtx_MEM (Pmode, addr);
13248 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
13249 test = gen_rtx_EQ (VOIDmode, op0, op1);
13250 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
13254 (define_insn "stack_protect_testsi"
13255 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13256 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
13257 (match_operand:SI 2 "memory_operand" "m,m")]
13259 (set (match_scratch:SI 4 "=r,r") (const_int 0))
13260 (clobber (match_scratch:SI 3 "=&r,&r"))]
13263 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13264 {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"
13265 [(set_attr "length" "16,20")])
13267 (define_insn "stack_protect_testdi"
13268 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13269 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
13270 (match_operand:DI 2 "memory_operand" "m,m")]
13272 (set (match_scratch:DI 4 "=r,r") (const_int 0))
13273 (clobber (match_scratch:DI 3 "=&r,&r"))]
13276 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
13277 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
13278 [(set_attr "length" "16,20")])
13281 ;; Here are the actual compare insns.
13282 (define_insn "*cmp<mode>_internal1"
13283 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13284 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
13285 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
13287 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
13288 [(set_attr "type" "cmp")])
13290 ;; If we are comparing a register for equality with a large constant,
13291 ;; we can do this with an XOR followed by a compare. But this is profitable
13292 ;; only if the large constant is only used for the comparison (and in this
13293 ;; case we already have a register to reuse as scratch).
13295 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
13296 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
13299 [(set (match_operand:SI 0 "register_operand")
13300 (match_operand:SI 1 "logical_const_operand" ""))
13301 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
13303 (match_operand:SI 2 "logical_const_operand" "")]))
13304 (set (match_operand:CC 4 "cc_reg_operand" "")
13305 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
13308 (if_then_else (match_operator 6 "equality_operator"
13309 [(match_dup 4) (const_int 0)])
13310 (match_operand 7 "" "")
13311 (match_operand 8 "" "")))]
13312 "peep2_reg_dead_p (3, operands[0])
13313 && peep2_reg_dead_p (4, operands[4])"
13314 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
13315 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
13316 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
13319 /* Get the constant we are comparing against, and see what it looks like
13320 when sign-extended from 16 to 32 bits. Then see what constant we could
13321 XOR with SEXTC to get the sign-extended value. */
13322 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
13324 operands[1], operands[2]);
13325 HOST_WIDE_INT c = INTVAL (cnst);
13326 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
13327 HOST_WIDE_INT xorv = c ^ sextc;
13329 operands[9] = GEN_INT (xorv);
13330 operands[10] = GEN_INT (sextc);
13333 (define_insn "*cmpsi_internal2"
13334 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13335 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13336 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
13338 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
13339 [(set_attr "type" "cmp")])
13341 (define_insn "*cmpdi_internal2"
13342 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
13343 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
13344 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
13346 "cmpld%I2 %0,%1,%b2"
13347 [(set_attr "type" "cmp")])
13349 ;; The following two insns don't exist as single insns, but if we provide
13350 ;; them, we can swap an add and compare, which will enable us to overlap more
13351 ;; of the required delay between a compare and branch. We generate code for
13352 ;; them by splitting.
13355 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13356 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
13357 (match_operand:SI 2 "short_cint_operand" "i")))
13358 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13359 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13362 [(set_attr "length" "8")])
13365 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
13366 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
13367 (match_operand:SI 2 "u_short_cint_operand" "i")))
13368 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
13369 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
13372 [(set_attr "length" "8")])
13375 [(set (match_operand:CC 3 "cc_reg_operand" "")
13376 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
13377 (match_operand:SI 2 "short_cint_operand" "")))
13378 (set (match_operand:SI 0 "gpc_reg_operand" "")
13379 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13381 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
13382 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13385 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
13386 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
13387 (match_operand:SI 2 "u_short_cint_operand" "")))
13388 (set (match_operand:SI 0 "gpc_reg_operand" "")
13389 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
13391 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
13392 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
13394 (define_insn "*cmpsf_internal1"
13395 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13396 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
13397 (match_operand:SF 2 "gpc_reg_operand" "f")))]
13398 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
13400 [(set_attr "type" "fpcompare")])
13402 (define_insn "*cmpdf_internal1"
13403 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13404 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
13405 (match_operand:DF 2 "gpc_reg_operand" "d")))]
13406 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
13407 && !VECTOR_UNIT_VSX_P (DFmode)"
13409 [(set_attr "type" "fpcompare")])
13411 ;; Only need to compare second words if first words equal
13412 (define_insn "*cmptf_internal1"
13413 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13414 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13415 (match_operand:TF 2 "gpc_reg_operand" "d")))]
13416 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
13417 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13418 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
13419 [(set_attr "type" "fpcompare")
13420 (set_attr "length" "12")])
13422 (define_insn_and_split "*cmptf_internal2"
13423 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
13424 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
13425 (match_operand:TF 2 "gpc_reg_operand" "d")))
13426 (clobber (match_scratch:DF 3 "=d"))
13427 (clobber (match_scratch:DF 4 "=d"))
13428 (clobber (match_scratch:DF 5 "=d"))
13429 (clobber (match_scratch:DF 6 "=d"))
13430 (clobber (match_scratch:DF 7 "=d"))
13431 (clobber (match_scratch:DF 8 "=d"))
13432 (clobber (match_scratch:DF 9 "=d"))
13433 (clobber (match_scratch:DF 10 "=d"))
13434 (clobber (match_scratch:GPR 11 "=b"))]
13435 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
13436 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
13438 "&& reload_completed"
13439 [(set (match_dup 3) (match_dup 14))
13440 (set (match_dup 4) (match_dup 15))
13441 (set (match_dup 9) (abs:DF (match_dup 5)))
13442 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
13443 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
13444 (label_ref (match_dup 12))
13446 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
13447 (set (pc) (label_ref (match_dup 13)))
13449 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
13450 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
13451 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
13452 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
13455 REAL_VALUE_TYPE rv;
13456 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
13457 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
13459 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
13460 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
13461 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
13462 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
13463 operands[12] = gen_label_rtx ();
13464 operands[13] = gen_label_rtx ();
13466 operands[14] = force_const_mem (DFmode,
13467 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
13468 operands[15] = force_const_mem (DFmode,
13469 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
13474 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
13475 operands[14] = gen_const_mem (DFmode, tocref);
13476 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
13477 operands[15] = gen_const_mem (DFmode, tocref);
13478 set_mem_alias_set (operands[14], get_TOC_alias_set ());
13479 set_mem_alias_set (operands[15], get_TOC_alias_set ());
13483 ;; Now we have the scc insns. We can do some combinations because of the
13484 ;; way the machine works.
13486 ;; Note that this is probably faster if we can put an insn between the
13487 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
13488 ;; cases the insns below which don't use an intermediate CR field will
13489 ;; be used instead.
13491 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13492 (match_operator:SI 1 "scc_comparison_operator"
13493 [(match_operand 2 "cc_reg_operand" "y")
13496 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13497 [(set (attr "type")
13498 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13499 (const_string "mfcrf")
13501 (const_string "mfcr")))
13502 (set_attr "length" "8")])
13504 ;; Same as above, but get the GT bit.
13505 (define_insn "move_from_CR_gt_bit"
13506 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13507 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
13508 "TARGET_HARD_FLOAT && !TARGET_FPRS"
13509 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
13510 [(set_attr "type" "mfcr")
13511 (set_attr "length" "8")])
13513 ;; Same as above, but get the OV/ORDERED bit.
13514 (define_insn "move_from_CR_ov_bit"
13515 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13516 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
13518 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
13519 [(set_attr "type" "mfcr")
13520 (set_attr "length" "8")])
13523 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13524 (match_operator:DI 1 "scc_comparison_operator"
13525 [(match_operand 2 "cc_reg_operand" "y")
13528 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
13529 [(set (attr "type")
13530 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13531 (const_string "mfcrf")
13533 (const_string "mfcr")))
13534 (set_attr "length" "8")])
13537 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13538 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13539 [(match_operand 2 "cc_reg_operand" "y,y")
13542 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
13543 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13546 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
13548 [(set_attr "type" "delayed_compare")
13549 (set_attr "length" "8,16")])
13552 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13553 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
13554 [(match_operand 2 "cc_reg_operand" "")
13557 (set (match_operand:SI 3 "gpc_reg_operand" "")
13558 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
13559 "TARGET_32BIT && reload_completed"
13560 [(set (match_dup 3)
13561 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
13563 (compare:CC (match_dup 3)
13568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13569 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13570 [(match_operand 2 "cc_reg_operand" "y")
13572 (match_operand:SI 3 "const_int_operand" "n")))]
13576 int is_bit = ccr_bit (operands[1], 1);
13577 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13580 if (is_bit >= put_bit)
13581 count = is_bit - put_bit;
13583 count = 32 - (put_bit - is_bit);
13585 operands[4] = GEN_INT (count);
13586 operands[5] = GEN_INT (put_bit);
13588 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
13590 [(set (attr "type")
13591 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
13592 (const_string "mfcrf")
13594 (const_string "mfcr")))
13595 (set_attr "length" "8")])
13598 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13600 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13601 [(match_operand 2 "cc_reg_operand" "y,y")
13603 (match_operand:SI 3 "const_int_operand" "n,n"))
13605 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
13606 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13611 int is_bit = ccr_bit (operands[1], 1);
13612 int put_bit = 31 - (INTVAL (operands[3]) & 31);
13615 /* Force split for non-cc0 compare. */
13616 if (which_alternative == 1)
13619 if (is_bit >= put_bit)
13620 count = is_bit - put_bit;
13622 count = 32 - (put_bit - is_bit);
13624 operands[5] = GEN_INT (count);
13625 operands[6] = GEN_INT (put_bit);
13627 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
13629 [(set_attr "type" "delayed_compare")
13630 (set_attr "length" "8,16")])
13633 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13635 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
13636 [(match_operand 2 "cc_reg_operand" "")
13638 (match_operand:SI 3 "const_int_operand" ""))
13640 (set (match_operand:SI 4 "gpc_reg_operand" "")
13641 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13644 [(set (match_dup 4)
13645 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
13648 (compare:CC (match_dup 4)
13652 ;; There is a 3 cycle delay between consecutive mfcr instructions
13653 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
13656 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13657 (match_operator:SI 1 "scc_comparison_operator"
13658 [(match_operand 2 "cc_reg_operand" "y")
13660 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
13661 (match_operator:SI 4 "scc_comparison_operator"
13662 [(match_operand 5 "cc_reg_operand" "y")
13664 "REGNO (operands[2]) != REGNO (operands[5])"
13665 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13666 [(set_attr "type" "mfcr")
13667 (set_attr "length" "12")])
13670 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13671 (match_operator:DI 1 "scc_comparison_operator"
13672 [(match_operand 2 "cc_reg_operand" "y")
13674 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
13675 (match_operator:DI 4 "scc_comparison_operator"
13676 [(match_operand 5 "cc_reg_operand" "y")
13678 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
13679 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
13680 [(set_attr "type" "mfcr")
13681 (set_attr "length" "12")])
13683 ;; There are some scc insns that can be done directly, without a compare.
13684 ;; These are faster because they don't involve the communications between
13685 ;; the FXU and branch units. In fact, we will be replacing all of the
13686 ;; integer scc insns here or in the portable methods in emit_store_flag.
13688 ;; Also support (neg (scc ..)) since that construct is used to replace
13689 ;; branches, (plus (scc ..) ..) since that construct is common and
13690 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
13691 ;; cases where it is no more expensive than (neg (scc ..)).
13693 ;; Have reload force a constant into a register for the simple insns that
13694 ;; otherwise won't accept constants. We do this because it is faster than
13695 ;; the cmp/mfcr sequence we would otherwise generate.
13697 (define_mode_attr scc_eq_op2 [(SI "rKLI")
13700 (define_insn_and_split "*eq<mode>"
13701 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
13702 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
13703 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
13707 [(set (match_dup 0)
13708 (clz:GPR (match_dup 3)))
13710 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
13712 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13714 /* Use output operand as intermediate. */
13715 operands[3] = operands[0];
13717 if (logical_operand (operands[2], <MODE>mode))
13718 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13719 gen_rtx_XOR (<MODE>mode,
13720 operands[1], operands[2])));
13722 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13723 gen_rtx_PLUS (<MODE>mode, operands[1],
13724 negate_rtx (<MODE>mode,
13728 operands[3] = operands[1];
13730 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13733 (define_insn_and_split "*eq<mode>_compare"
13734 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
13736 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
13737 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
13739 (set (match_operand:P 0 "gpc_reg_operand" "=r")
13740 (eq:P (match_dup 1) (match_dup 2)))]
13741 "!TARGET_POWER && optimize_size"
13743 "!TARGET_POWER && optimize_size"
13744 [(set (match_dup 0)
13745 (clz:P (match_dup 4)))
13746 (parallel [(set (match_dup 3)
13747 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
13750 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
13752 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13754 /* Use output operand as intermediate. */
13755 operands[4] = operands[0];
13757 if (logical_operand (operands[2], <MODE>mode))
13758 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13759 gen_rtx_XOR (<MODE>mode,
13760 operands[1], operands[2])));
13762 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
13763 gen_rtx_PLUS (<MODE>mode, operands[1],
13764 negate_rtx (<MODE>mode,
13768 operands[4] = operands[1];
13770 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
13773 (define_insn "*eqsi_power"
13774 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
13775 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13776 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
13777 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
13780 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13781 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
13782 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13783 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
13784 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
13785 [(set_attr "type" "three,two,three,three,three")
13786 (set_attr "length" "12,8,12,12,12")])
13788 ;; We have insns of the form shown by the first define_insn below. If
13789 ;; there is something inside the comparison operation, we must split it.
13791 [(set (match_operand:SI 0 "gpc_reg_operand" "")
13792 (plus:SI (match_operator 1 "comparison_operator"
13793 [(match_operand:SI 2 "" "")
13794 (match_operand:SI 3
13795 "reg_or_cint_operand" "")])
13796 (match_operand:SI 4 "gpc_reg_operand" "")))
13797 (clobber (match_operand:SI 5 "register_operand" ""))]
13798 "! gpc_reg_operand (operands[2], SImode)"
13799 [(set (match_dup 5) (match_dup 2))
13800 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
13803 (define_insn "*plus_eqsi"
13804 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
13805 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
13806 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
13807 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
13810 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13811 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
13812 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13813 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
13814 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
13815 [(set_attr "type" "three,two,three,three,three")
13816 (set_attr "length" "12,8,12,12,12")])
13818 (define_insn "*compare_plus_eqsi"
13819 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13822 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13823 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13824 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13826 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
13827 "TARGET_32BIT && optimize_size"
13829 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13830 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
13831 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13832 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13833 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13839 [(set_attr "type" "compare")
13840 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13843 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13846 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13847 (match_operand:SI 2 "scc_eq_operand" ""))
13848 (match_operand:SI 3 "gpc_reg_operand" ""))
13850 (clobber (match_scratch:SI 4 ""))]
13851 "TARGET_32BIT && optimize_size && reload_completed"
13852 [(set (match_dup 4)
13853 (plus:SI (eq:SI (match_dup 1)
13857 (compare:CC (match_dup 4)
13861 (define_insn "*plus_eqsi_compare"
13862 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
13865 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
13866 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
13867 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
13869 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
13870 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13871 "TARGET_32BIT && optimize_size"
13873 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13874 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
13875 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13876 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13877 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13883 [(set_attr "type" "compare")
13884 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
13887 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13890 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
13891 (match_operand:SI 2 "scc_eq_operand" ""))
13892 (match_operand:SI 3 "gpc_reg_operand" ""))
13894 (set (match_operand:SI 0 "gpc_reg_operand" "")
13895 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13896 "TARGET_32BIT && optimize_size && reload_completed"
13897 [(set (match_dup 0)
13898 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13900 (compare:CC (match_dup 0)
13904 (define_insn "*neg_eq0<mode>"
13905 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13906 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
13909 "{ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0"
13910 [(set_attr "type" "two")
13911 (set_attr "length" "8")])
13913 (define_insn_and_split "*neg_eq<mode>"
13914 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13915 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
13916 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
13920 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
13922 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
13924 /* Use output operand as intermediate. */
13925 operands[3] = operands[0];
13927 if (logical_operand (operands[2], <MODE>mode))
13928 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13929 gen_rtx_XOR (<MODE>mode,
13930 operands[1], operands[2])));
13932 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13933 gen_rtx_PLUS (<MODE>mode, operands[1],
13934 negate_rtx (<MODE>mode,
13938 operands[3] = operands[1];
13941 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
13942 ;; since it nabs/sr is just as fast.
13943 (define_insn "*ne0si"
13944 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13945 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13947 (clobber (match_scratch:SI 2 "=&r"))]
13948 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
13949 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
13950 [(set_attr "type" "two")
13951 (set_attr "length" "8")])
13953 (define_insn "*ne0di"
13954 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13955 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13957 (clobber (match_scratch:DI 2 "=&r"))]
13959 "addic %2,%1,-1\;subfe %0,%2,%1"
13960 [(set_attr "type" "two")
13961 (set_attr "length" "8")])
13963 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
13964 (define_insn "*plus_ne0si"
13965 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13966 (plus:SI (lshiftrt:SI
13967 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
13969 (match_operand:SI 2 "gpc_reg_operand" "r")))
13970 (clobber (match_scratch:SI 3 "=&r"))]
13972 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
13973 [(set_attr "type" "two")
13974 (set_attr "length" "8")])
13976 (define_insn "*plus_ne0di"
13977 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13978 (plus:DI (lshiftrt:DI
13979 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
13981 (match_operand:DI 2 "gpc_reg_operand" "r")))
13982 (clobber (match_scratch:DI 3 "=&r"))]
13984 "addic %3,%1,-1\;addze %0,%2"
13985 [(set_attr "type" "two")
13986 (set_attr "length" "8")])
13988 (define_insn "*compare_plus_ne0si"
13989 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13991 (plus:SI (lshiftrt:SI
13992 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
13994 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13996 (clobber (match_scratch:SI 3 "=&r,&r"))
13997 (clobber (match_scratch:SI 4 "=X,&r"))]
14000 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
14002 [(set_attr "type" "compare")
14003 (set_attr "length" "8,12")])
14006 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14008 (plus:SI (lshiftrt:SI
14009 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14011 (match_operand:SI 2 "gpc_reg_operand" ""))
14013 (clobber (match_scratch:SI 3 ""))
14014 (clobber (match_scratch:SI 4 ""))]
14015 "TARGET_32BIT && reload_completed"
14016 [(parallel [(set (match_dup 3)
14017 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
14020 (clobber (match_dup 4))])
14022 (compare:CC (match_dup 3)
14026 (define_insn "*compare_plus_ne0di"
14027 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14029 (plus:DI (lshiftrt:DI
14030 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14032 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14034 (clobber (match_scratch:DI 3 "=&r,&r"))]
14037 addic %3,%1,-1\;addze. %3,%2
14039 [(set_attr "type" "compare")
14040 (set_attr "length" "8,12")])
14043 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
14045 (plus:DI (lshiftrt:DI
14046 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14048 (match_operand:DI 2 "gpc_reg_operand" ""))
14050 (clobber (match_scratch:DI 3 ""))]
14051 "TARGET_64BIT && reload_completed"
14052 [(set (match_dup 3)
14053 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
14057 (compare:CC (match_dup 3)
14061 (define_insn "*plus_ne0si_compare"
14062 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14064 (plus:SI (lshiftrt:SI
14065 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
14067 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
14069 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14070 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14072 (clobber (match_scratch:SI 3 "=&r,&r"))]
14075 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
14077 [(set_attr "type" "compare")
14078 (set_attr "length" "8,12")])
14081 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14083 (plus:SI (lshiftrt:SI
14084 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
14086 (match_operand:SI 2 "gpc_reg_operand" ""))
14088 (set (match_operand:SI 0 "gpc_reg_operand" "")
14089 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14091 (clobber (match_scratch:SI 3 ""))]
14092 "TARGET_32BIT && reload_completed"
14093 [(parallel [(set (match_dup 0)
14094 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
14096 (clobber (match_dup 3))])
14098 (compare:CC (match_dup 0)
14102 (define_insn "*plus_ne0di_compare"
14103 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14105 (plus:DI (lshiftrt:DI
14106 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
14108 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
14110 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
14111 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14113 (clobber (match_scratch:DI 3 "=&r,&r"))]
14116 addic %3,%1,-1\;addze. %0,%2
14118 [(set_attr "type" "compare")
14119 (set_attr "length" "8,12")])
14122 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
14124 (plus:DI (lshiftrt:DI
14125 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
14127 (match_operand:DI 2 "gpc_reg_operand" ""))
14129 (set (match_operand:DI 0 "gpc_reg_operand" "")
14130 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14132 (clobber (match_scratch:DI 3 ""))]
14133 "TARGET_64BIT && reload_completed"
14134 [(parallel [(set (match_dup 0)
14135 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
14137 (clobber (match_dup 3))])
14139 (compare:CC (match_dup 0)
14144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14145 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14146 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
14147 (clobber (match_scratch:SI 3 "=r,X"))]
14150 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
14151 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
14152 [(set_attr "length" "12")])
14155 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14157 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14158 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14160 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
14161 (le:SI (match_dup 1) (match_dup 2)))
14162 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
14165 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14166 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
14169 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
14170 (set_attr "length" "12,12,16,16")])
14173 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14175 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14176 (match_operand:SI 2 "reg_or_short_operand" ""))
14178 (set (match_operand:SI 0 "gpc_reg_operand" "")
14179 (le:SI (match_dup 1) (match_dup 2)))
14180 (clobber (match_scratch:SI 3 ""))]
14181 "TARGET_POWER && reload_completed"
14182 [(parallel [(set (match_dup 0)
14183 (le:SI (match_dup 1) (match_dup 2)))
14184 (clobber (match_dup 3))])
14186 (compare:CC (match_dup 0)
14191 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14192 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14193 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
14194 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
14197 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
14198 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
14199 [(set_attr "length" "12")])
14202 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14204 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14205 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14206 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14208 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14211 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14212 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
14215 [(set_attr "type" "compare")
14216 (set_attr "length" "12,12,16,16")])
14219 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14221 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14222 (match_operand:SI 2 "reg_or_short_operand" ""))
14223 (match_operand:SI 3 "gpc_reg_operand" ""))
14225 (clobber (match_scratch:SI 4 ""))]
14226 "TARGET_POWER && reload_completed"
14227 [(set (match_dup 4)
14228 (plus:SI (le:SI (match_dup 1) (match_dup 2))
14231 (compare:CC (match_dup 4)
14236 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14238 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14239 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
14240 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14242 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14243 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14246 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14247 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
14250 [(set_attr "type" "compare")
14251 (set_attr "length" "12,12,16,16")])
14254 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14256 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
14257 (match_operand:SI 2 "reg_or_short_operand" ""))
14258 (match_operand:SI 3 "gpc_reg_operand" ""))
14260 (set (match_operand:SI 0 "gpc_reg_operand" "")
14261 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14262 "TARGET_POWER && reload_completed"
14263 [(set (match_dup 0)
14264 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14266 (compare:CC (match_dup 0)
14271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14272 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14273 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
14276 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
14277 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
14278 [(set_attr "length" "12")])
14280 (define_insn "*leu<mode>"
14281 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14282 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14283 (match_operand:P 2 "reg_or_short_operand" "rI")))]
14285 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14286 [(set_attr "type" "three")
14287 (set_attr "length" "12")])
14289 (define_insn "*leu<mode>_compare"
14290 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14292 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14293 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
14295 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14296 (leu:P (match_dup 1) (match_dup 2)))]
14299 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14301 [(set_attr "type" "compare")
14302 (set_attr "length" "12,16")])
14305 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14307 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
14308 (match_operand:P 2 "reg_or_short_operand" ""))
14310 (set (match_operand:P 0 "gpc_reg_operand" "")
14311 (leu:P (match_dup 1) (match_dup 2)))]
14313 [(set (match_dup 0)
14314 (leu:P (match_dup 1) (match_dup 2)))
14316 (compare:CC (match_dup 0)
14320 (define_insn "*plus_leu<mode>"
14321 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14322 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14323 (match_operand:P 2 "reg_or_short_operand" "rI"))
14324 (match_operand:P 3 "gpc_reg_operand" "r")))]
14326 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
14327 [(set_attr "type" "two")
14328 (set_attr "length" "8")])
14331 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14333 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14334 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14335 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14337 (clobber (match_scratch:SI 4 "=&r,&r"))]
14340 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
14342 [(set_attr "type" "compare")
14343 (set_attr "length" "8,12")])
14346 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14348 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14349 (match_operand:SI 2 "reg_or_short_operand" ""))
14350 (match_operand:SI 3 "gpc_reg_operand" ""))
14352 (clobber (match_scratch:SI 4 ""))]
14353 "TARGET_32BIT && reload_completed"
14354 [(set (match_dup 4)
14355 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
14358 (compare:CC (match_dup 4)
14363 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14365 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14366 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14367 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14369 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14370 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14373 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
14375 [(set_attr "type" "compare")
14376 (set_attr "length" "8,12")])
14379 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14381 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14382 (match_operand:SI 2 "reg_or_short_operand" ""))
14383 (match_operand:SI 3 "gpc_reg_operand" ""))
14385 (set (match_operand:SI 0 "gpc_reg_operand" "")
14386 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14387 "TARGET_32BIT && reload_completed"
14388 [(set (match_dup 0)
14389 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14391 (compare:CC (match_dup 0)
14395 (define_insn "*neg_leu<mode>"
14396 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14397 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14398 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
14400 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
14401 [(set_attr "type" "three")
14402 (set_attr "length" "12")])
14404 (define_insn "*and_neg_leu<mode>"
14405 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
14407 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
14408 (match_operand:P 2 "reg_or_short_operand" "rI")))
14409 (match_operand:P 3 "gpc_reg_operand" "r")))]
14411 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14412 [(set_attr "type" "three")
14413 (set_attr "length" "12")])
14416 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14419 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14420 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14421 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14423 (clobber (match_scratch:SI 4 "=&r,&r"))]
14426 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14428 [(set_attr "type" "compare")
14429 (set_attr "length" "12,16")])
14432 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14435 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14436 (match_operand:SI 2 "reg_or_short_operand" "")))
14437 (match_operand:SI 3 "gpc_reg_operand" ""))
14439 (clobber (match_scratch:SI 4 ""))]
14440 "TARGET_32BIT && reload_completed"
14441 [(set (match_dup 4)
14442 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14445 (compare:CC (match_dup 4)
14450 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14453 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14454 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
14455 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14457 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14458 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14461 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14463 [(set_attr "type" "compare")
14464 (set_attr "length" "12,16")])
14467 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14470 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14471 (match_operand:SI 2 "reg_or_short_operand" "")))
14472 (match_operand:SI 3 "gpc_reg_operand" ""))
14474 (set (match_operand:SI 0 "gpc_reg_operand" "")
14475 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14476 "TARGET_32BIT && reload_completed"
14477 [(set (match_dup 0)
14478 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
14481 (compare:CC (match_dup 0)
14486 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14487 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14488 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
14490 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
14491 [(set_attr "length" "12")])
14494 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
14496 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14497 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14499 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14500 (lt:SI (match_dup 1) (match_dup 2)))]
14503 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
14505 [(set_attr "type" "delayed_compare")
14506 (set_attr "length" "12,16")])
14509 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
14511 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14512 (match_operand:SI 2 "reg_or_short_operand" ""))
14514 (set (match_operand:SI 0 "gpc_reg_operand" "")
14515 (lt:SI (match_dup 1) (match_dup 2)))]
14516 "TARGET_POWER && reload_completed"
14517 [(set (match_dup 0)
14518 (lt:SI (match_dup 1) (match_dup 2)))
14520 (compare:CC (match_dup 0)
14525 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14526 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14527 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14528 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14530 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
14531 [(set_attr "length" "12")])
14534 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14536 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14537 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14538 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14540 (clobber (match_scratch:SI 4 "=&r,&r"))]
14543 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
14545 [(set_attr "type" "compare")
14546 (set_attr "length" "12,16")])
14549 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14551 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14552 (match_operand:SI 2 "reg_or_short_operand" ""))
14553 (match_operand:SI 3 "gpc_reg_operand" ""))
14555 (clobber (match_scratch:SI 4 ""))]
14556 "TARGET_POWER && reload_completed"
14557 [(set (match_dup 4)
14558 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
14561 (compare:CC (match_dup 4)
14566 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14568 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14569 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14570 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14572 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14573 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14576 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
14578 [(set_attr "type" "compare")
14579 (set_attr "length" "12,16")])
14582 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14584 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
14585 (match_operand:SI 2 "reg_or_short_operand" ""))
14586 (match_operand:SI 3 "gpc_reg_operand" ""))
14588 (set (match_operand:SI 0 "gpc_reg_operand" "")
14589 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14590 "TARGET_POWER && reload_completed"
14591 [(set (match_dup 0)
14592 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14594 (compare:CC (match_dup 0)
14599 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14600 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14601 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14603 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
14604 [(set_attr "length" "12")])
14606 (define_insn_and_split "*ltu<mode>"
14607 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14608 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14609 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14613 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14614 (set (match_dup 0) (neg:P (match_dup 0)))]
14617 (define_insn_and_split "*ltu<mode>_compare"
14618 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14620 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14621 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14623 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14624 (ltu:P (match_dup 1) (match_dup 2)))]
14628 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14629 (parallel [(set (match_dup 3)
14630 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
14631 (set (match_dup 0) (neg:P (match_dup 0)))])]
14634 (define_insn_and_split "*plus_ltu<mode>"
14635 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
14636 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14637 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14638 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
14641 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14642 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14643 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
14646 (define_insn_and_split "*plus_ltu<mode>_compare"
14647 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14649 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14650 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14651 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
14653 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14654 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
14657 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
14658 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
14659 (parallel [(set (match_dup 4)
14660 (compare:CC (minus:P (match_dup 3) (match_dup 0))
14662 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
14665 (define_insn "*neg_ltu<mode>"
14666 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14667 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14668 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
14671 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
14672 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
14673 [(set_attr "type" "two")
14674 (set_attr "length" "8")])
14677 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14678 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14679 (match_operand:SI 2 "reg_or_short_operand" "rI")))
14680 (clobber (match_scratch:SI 3 "=r"))]
14682 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
14683 [(set_attr "length" "12")])
14686 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14688 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14689 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14691 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
14692 (ge:SI (match_dup 1) (match_dup 2)))
14693 (clobber (match_scratch:SI 3 "=r,r"))]
14696 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
14698 [(set_attr "type" "compare")
14699 (set_attr "length" "12,16")])
14702 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14704 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14705 (match_operand:SI 2 "reg_or_short_operand" ""))
14707 (set (match_operand:SI 0 "gpc_reg_operand" "")
14708 (ge:SI (match_dup 1) (match_dup 2)))
14709 (clobber (match_scratch:SI 3 ""))]
14710 "TARGET_POWER && reload_completed"
14711 [(parallel [(set (match_dup 0)
14712 (ge:SI (match_dup 1) (match_dup 2)))
14713 (clobber (match_dup 3))])
14715 (compare:CC (match_dup 0)
14720 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
14721 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14722 (match_operand:SI 2 "reg_or_short_operand" "rI"))
14723 (match_operand:SI 3 "gpc_reg_operand" "r")))]
14725 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
14726 [(set_attr "length" "12")])
14729 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
14731 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14732 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14733 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14735 (clobber (match_scratch:SI 4 "=&r,&r"))]
14738 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
14740 [(set_attr "type" "compare")
14741 (set_attr "length" "12,16")])
14744 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14746 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14747 (match_operand:SI 2 "reg_or_short_operand" ""))
14748 (match_operand:SI 3 "gpc_reg_operand" ""))
14750 (clobber (match_scratch:SI 4 ""))]
14751 "TARGET_POWER && reload_completed"
14752 [(set (match_dup 4)
14753 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
14756 (compare:CC (match_dup 4)
14761 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
14763 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
14764 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
14765 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
14767 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
14768 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14771 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
14773 [(set_attr "type" "compare")
14774 (set_attr "length" "12,16")])
14777 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14779 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
14780 (match_operand:SI 2 "reg_or_short_operand" ""))
14781 (match_operand:SI 3 "gpc_reg_operand" ""))
14783 (set (match_operand:SI 0 "gpc_reg_operand" "")
14784 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14785 "TARGET_POWER && reload_completed"
14786 [(set (match_dup 0)
14787 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14789 (compare:CC (match_dup 0)
14794 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14795 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
14796 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
14798 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
14799 [(set_attr "length" "12")])
14801 (define_insn "*geu<mode>"
14802 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14803 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14804 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
14807 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
14808 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
14809 [(set_attr "type" "three")
14810 (set_attr "length" "12")])
14812 (define_insn "*geu<mode>_compare"
14813 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
14815 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
14816 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
14818 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
14819 (geu:P (match_dup 1) (match_dup 2)))]
14822 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14823 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
14826 [(set_attr "type" "compare")
14827 (set_attr "length" "12,12,16,16")])
14830 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
14832 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
14833 (match_operand:P 2 "reg_or_neg_short_operand" ""))
14835 (set (match_operand:P 0 "gpc_reg_operand" "")
14836 (geu:P (match_dup 1) (match_dup 2)))]
14838 [(set (match_dup 0)
14839 (geu:P (match_dup 1) (match_dup 2)))
14841 (compare:CC (match_dup 0)
14845 (define_insn "*plus_geu<mode>"
14846 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14847 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14848 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
14849 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14852 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
14853 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
14854 [(set_attr "type" "two")
14855 (set_attr "length" "8")])
14858 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14860 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14861 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14862 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14864 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14867 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
14868 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
14871 [(set_attr "type" "compare")
14872 (set_attr "length" "8,8,12,12")])
14875 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14877 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14878 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14879 (match_operand:SI 3 "gpc_reg_operand" ""))
14881 (clobber (match_scratch:SI 4 ""))]
14882 "TARGET_32BIT && reload_completed"
14883 [(set (match_dup 4)
14884 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
14887 (compare:CC (match_dup 4)
14892 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14894 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14895 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
14896 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14898 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14899 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14902 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
14903 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
14906 [(set_attr "type" "compare")
14907 (set_attr "length" "8,8,12,12")])
14910 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
14912 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14913 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
14914 (match_operand:SI 3 "gpc_reg_operand" ""))
14916 (set (match_operand:SI 0 "gpc_reg_operand" "")
14917 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
14918 "TARGET_32BIT && reload_completed"
14919 [(set (match_dup 0)
14920 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
14922 (compare:CC (match_dup 0)
14926 (define_insn "*neg_geu<mode>"
14927 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
14928 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14929 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
14932 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
14933 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
14934 [(set_attr "type" "three")
14935 (set_attr "length" "12")])
14937 (define_insn "*and_neg_geu<mode>"
14938 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
14940 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
14941 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
14942 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
14945 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
14946 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
14947 [(set_attr "type" "three")
14948 (set_attr "length" "12")])
14951 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
14954 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14955 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14956 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14958 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
14961 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14962 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
14965 [(set_attr "type" "compare")
14966 (set_attr "length" "12,12,16,16")])
14969 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
14972 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
14973 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
14974 (match_operand:SI 3 "gpc_reg_operand" ""))
14976 (clobber (match_scratch:SI 4 ""))]
14977 "TARGET_32BIT && reload_completed"
14978 [(set (match_dup 4)
14979 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
14982 (compare:CC (match_dup 4)
14987 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
14990 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
14991 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
14992 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
14994 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
14995 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
14998 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
14999 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
15002 [(set_attr "type" "compare")
15003 (set_attr "length" "12,12,16,16")])
15006 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15009 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
15010 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
15011 (match_operand:SI 3 "gpc_reg_operand" ""))
15013 (set (match_operand:SI 0 "gpc_reg_operand" "")
15014 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
15015 "TARGET_32BIT && reload_completed"
15016 [(set (match_dup 0)
15017 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
15019 (compare:CC (match_dup 0)
15024 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15025 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15026 (match_operand:SI 2 "reg_or_short_operand" "r")))]
15028 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
15029 [(set_attr "length" "12")])
15032 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15034 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15035 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15037 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
15038 (gt:SI (match_dup 1) (match_dup 2)))]
15041 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
15043 [(set_attr "type" "delayed_compare")
15044 (set_attr "length" "12,16")])
15047 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15049 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15050 (match_operand:SI 2 "reg_or_short_operand" ""))
15052 (set (match_operand:SI 0 "gpc_reg_operand" "")
15053 (gt:SI (match_dup 1) (match_dup 2)))]
15054 "TARGET_POWER && reload_completed"
15055 [(set (match_dup 0)
15056 (gt:SI (match_dup 1) (match_dup 2)))
15058 (compare:CC (match_dup 0)
15062 (define_insn "*plus_gt0<mode>"
15063 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15064 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
15066 (match_operand:P 2 "gpc_reg_operand" "r")))]
15068 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
15069 [(set_attr "type" "three")
15070 (set_attr "length" "12")])
15073 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15075 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15077 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15079 (clobber (match_scratch:SI 3 "=&r,&r"))]
15082 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
15084 [(set_attr "type" "compare")
15085 (set_attr "length" "12,16")])
15088 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15090 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15092 (match_operand:SI 2 "gpc_reg_operand" ""))
15094 (clobber (match_scratch:SI 3 ""))]
15095 "TARGET_32BIT && reload_completed"
15096 [(set (match_dup 3)
15097 (plus:SI (gt:SI (match_dup 1) (const_int 0))
15100 (compare:CC (match_dup 3)
15105 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15107 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15109 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15111 (clobber (match_scratch:DI 3 "=&r,&r"))]
15114 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
15116 [(set_attr "type" "compare")
15117 (set_attr "length" "12,16")])
15120 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
15122 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15124 (match_operand:DI 2 "gpc_reg_operand" ""))
15126 (clobber (match_scratch:DI 3 ""))]
15127 "TARGET_64BIT && reload_completed"
15128 [(set (match_dup 3)
15129 (plus:DI (gt:DI (match_dup 1) (const_int 0))
15132 (compare:CC (match_dup 3)
15137 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15139 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15141 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
15143 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15144 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15147 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
15149 [(set_attr "type" "compare")
15150 (set_attr "length" "12,16")])
15153 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
15155 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15157 (match_operand:SI 2 "gpc_reg_operand" ""))
15159 (set (match_operand:SI 0 "gpc_reg_operand" "")
15160 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
15161 "TARGET_32BIT && reload_completed"
15162 [(set (match_dup 0)
15163 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
15165 (compare:CC (match_dup 0)
15170 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15172 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
15174 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
15176 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
15177 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15180 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
15182 [(set_attr "type" "compare")
15183 (set_attr "length" "12,16")])
15186 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
15188 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
15190 (match_operand:DI 2 "gpc_reg_operand" ""))
15192 (set (match_operand:DI 0 "gpc_reg_operand" "")
15193 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
15194 "TARGET_64BIT && reload_completed"
15195 [(set (match_dup 0)
15196 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
15198 (compare:CC (match_dup 0)
15203 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
15204 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15205 (match_operand:SI 2 "reg_or_short_operand" "r"))
15206 (match_operand:SI 3 "gpc_reg_operand" "r")))]
15208 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
15209 [(set_attr "length" "12")])
15212 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
15214 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15215 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15216 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15218 (clobber (match_scratch:SI 4 "=&r,&r"))]
15221 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
15223 [(set_attr "type" "compare")
15224 (set_attr "length" "12,16")])
15227 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
15229 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15230 (match_operand:SI 2 "reg_or_short_operand" ""))
15231 (match_operand:SI 3 "gpc_reg_operand" ""))
15233 (clobber (match_scratch:SI 4 ""))]
15234 "TARGET_POWER && reload_completed"
15235 [(set (match_dup 4)
15236 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15238 (compare:CC (match_dup 4)
15243 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
15245 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
15246 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
15247 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
15249 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
15250 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15253 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
15255 [(set_attr "type" "compare")
15256 (set_attr "length" "12,16")])
15259 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
15261 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
15262 (match_operand:SI 2 "reg_or_short_operand" ""))
15263 (match_operand:SI 3 "gpc_reg_operand" ""))
15265 (set (match_operand:SI 0 "gpc_reg_operand" "")
15266 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
15267 "TARGET_POWER && reload_completed"
15268 [(set (match_dup 0)
15269 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
15271 (compare:CC (match_dup 0)
15276 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15277 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
15278 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
15280 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
15281 [(set_attr "length" "12")])
15283 (define_insn_and_split "*gtu<mode>"
15284 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15285 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15286 (match_operand:P 2 "reg_or_short_operand" "rI")))]
15290 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15291 (set (match_dup 0) (neg:P (match_dup 0)))]
15294 (define_insn_and_split "*gtu<mode>_compare"
15295 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
15297 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
15298 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
15300 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
15301 (gtu:P (match_dup 1) (match_dup 2)))]
15305 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15306 (parallel [(set (match_dup 3)
15307 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
15308 (set (match_dup 0) (neg:P (match_dup 0)))])]
15311 (define_insn_and_split "*plus_gtu<mode>"
15312 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
15313 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15314 (match_operand:P 2 "reg_or_short_operand" "rI"))
15315 (match_operand:P 3 "reg_or_short_operand" "rI")))]
15318 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15319 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15320 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
15323 (define_insn_and_split "*plus_gtu<mode>_compare"
15324 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
15326 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
15327 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
15328 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
15330 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
15331 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
15334 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
15335 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
15336 (parallel [(set (match_dup 4)
15337 (compare:CC (minus:P (match_dup 3) (match_dup 0))
15339 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
15342 (define_insn "*neg_gtu<mode>"
15343 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
15344 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
15345 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
15347 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
15348 [(set_attr "type" "two")
15349 (set_attr "length" "8")])
15352 ;; Define both directions of branch and return. If we need a reload
15353 ;; register, we'd rather use CR0 since it is much easier to copy a
15354 ;; register CC value to there.
15358 (if_then_else (match_operator 1 "branch_comparison_operator"
15360 "cc_reg_operand" "y")
15362 (label_ref (match_operand 0 "" ""))
15367 return output_cbranch (operands[1], \"%l0\", 0, insn);
15369 [(set_attr "type" "branch")])
15373 (if_then_else (match_operator 0 "branch_comparison_operator"
15375 "cc_reg_operand" "y")
15382 return output_cbranch (operands[0], NULL, 0, insn);
15384 [(set_attr "type" "jmpreg")
15385 (set_attr "length" "4")])
15389 (if_then_else (match_operator 1 "branch_comparison_operator"
15391 "cc_reg_operand" "y")
15394 (label_ref (match_operand 0 "" ""))))]
15398 return output_cbranch (operands[1], \"%l0\", 1, insn);
15400 [(set_attr "type" "branch")])
15404 (if_then_else (match_operator 0 "branch_comparison_operator"
15406 "cc_reg_operand" "y")
15413 return output_cbranch (operands[0], NULL, 1, insn);
15415 [(set_attr "type" "jmpreg")
15416 (set_attr "length" "4")])
15418 ;; Logic on condition register values.
15420 ; This pattern matches things like
15421 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
15422 ; (eq:SI (reg:CCFP 68) (const_int 0)))
15424 ; which are generated by the branch logic.
15425 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
15427 (define_insn "*cceq_ior_compare"
15428 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15429 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
15430 [(match_operator:SI 2
15431 "branch_positive_comparison_operator"
15433 "cc_reg_operand" "y,y")
15435 (match_operator:SI 4
15436 "branch_positive_comparison_operator"
15438 "cc_reg_operand" "0,y")
15442 "cr%q1 %E0,%j2,%j4"
15443 [(set_attr "type" "cr_logical,delayed_cr")])
15445 ; Why is the constant -1 here, but 1 in the previous pattern?
15446 ; Because ~1 has all but the low bit set.
15448 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15449 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
15450 [(not:SI (match_operator:SI 2
15451 "branch_positive_comparison_operator"
15453 "cc_reg_operand" "y,y")
15455 (match_operator:SI 4
15456 "branch_positive_comparison_operator"
15458 "cc_reg_operand" "0,y")
15462 "cr%q1 %E0,%j2,%j4"
15463 [(set_attr "type" "cr_logical,delayed_cr")])
15465 (define_insn "*cceq_rev_compare"
15466 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
15467 (compare:CCEQ (match_operator:SI 1
15468 "branch_positive_comparison_operator"
15470 "cc_reg_operand" "0,y")
15474 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
15475 [(set_attr "type" "cr_logical,delayed_cr")])
15477 ;; If we are comparing the result of two comparisons, this can be done
15478 ;; using creqv or crxor.
15480 (define_insn_and_split ""
15481 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
15482 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
15483 [(match_operand 2 "cc_reg_operand" "y")
15485 (match_operator 3 "branch_comparison_operator"
15486 [(match_operand 4 "cc_reg_operand" "y")
15491 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
15495 int positive_1, positive_2;
15497 positive_1 = branch_positive_comparison_operator (operands[1],
15498 GET_MODE (operands[1]));
15499 positive_2 = branch_positive_comparison_operator (operands[3],
15500 GET_MODE (operands[3]));
15503 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
15504 GET_CODE (operands[1])),
15506 operands[2], const0_rtx);
15507 else if (GET_MODE (operands[1]) != SImode)
15508 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
15509 operands[2], const0_rtx);
15512 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
15513 GET_CODE (operands[3])),
15515 operands[4], const0_rtx);
15516 else if (GET_MODE (operands[3]) != SImode)
15517 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
15518 operands[4], const0_rtx);
15520 if (positive_1 == positive_2)
15522 operands[1] = gen_rtx_NOT (SImode, operands[1]);
15523 operands[5] = constm1_rtx;
15527 operands[5] = const1_rtx;
15531 ;; Unconditional branch and return.
15533 (define_insn "jump"
15535 (label_ref (match_operand 0 "" "")))]
15538 [(set_attr "type" "branch")])
15540 (define_insn "return"
15544 [(set_attr "type" "jmpreg")])
15546 (define_expand "indirect_jump"
15547 [(set (pc) (match_operand 0 "register_operand" ""))])
15549 (define_insn "*indirect_jump<mode>"
15550 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
15555 [(set_attr "type" "jmpreg")])
15557 ;; Table jump for switch statements:
15558 (define_expand "tablejump"
15559 [(use (match_operand 0 "" ""))
15560 (use (label_ref (match_operand 1 "" "")))]
15565 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
15567 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
15571 (define_expand "tablejumpsi"
15572 [(set (match_dup 3)
15573 (plus:SI (match_operand:SI 0 "" "")
15575 (parallel [(set (pc) (match_dup 3))
15576 (use (label_ref (match_operand 1 "" "")))])]
15579 { operands[0] = force_reg (SImode, operands[0]);
15580 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
15581 operands[3] = gen_reg_rtx (SImode);
15584 (define_expand "tablejumpdi"
15585 [(set (match_dup 4)
15586 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
15588 (plus:DI (match_dup 4)
15590 (parallel [(set (pc) (match_dup 3))
15591 (use (label_ref (match_operand 1 "" "")))])]
15594 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
15595 operands[3] = gen_reg_rtx (DImode);
15596 operands[4] = gen_reg_rtx (DImode);
15599 (define_insn "*tablejump<mode>_internal1"
15601 (match_operand:P 0 "register_operand" "c,*l"))
15602 (use (label_ref (match_operand 1 "" "")))]
15607 [(set_attr "type" "jmpreg")])
15612 "{cror 0,0,0|nop}")
15614 ;; Define the subtract-one-and-jump insns, starting with the template
15615 ;; so loop.c knows what to generate.
15617 (define_expand "doloop_end"
15618 [(use (match_operand 0 "" "")) ; loop pseudo
15619 (use (match_operand 1 "" "")) ; iterations; zero if unknown
15620 (use (match_operand 2 "" "")) ; max iterations
15621 (use (match_operand 3 "" "")) ; loop level
15622 (use (match_operand 4 "" ""))] ; label
15626 /* Only use this on innermost loops. */
15627 if (INTVAL (operands[3]) > 1)
15631 if (GET_MODE (operands[0]) != DImode)
15633 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
15637 if (GET_MODE (operands[0]) != SImode)
15639 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
15644 (define_expand "ctr<mode>"
15645 [(parallel [(set (pc)
15646 (if_then_else (ne (match_operand:P 0 "register_operand" "")
15648 (label_ref (match_operand 1 "" ""))
15651 (plus:P (match_dup 0)
15653 (clobber (match_scratch:CC 2 ""))
15654 (clobber (match_scratch:P 3 ""))])]
15658 ;; We need to be able to do this for any operand, including MEM, or we
15659 ;; will cause reload to blow up since we don't allow output reloads on
15661 ;; For the length attribute to be calculated correctly, the
15662 ;; label MUST be operand 0.
15664 (define_insn "*ctr<mode>_internal1"
15666 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15668 (label_ref (match_operand 0 "" ""))
15670 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15671 (plus:P (match_dup 1)
15673 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15674 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15678 if (which_alternative != 0)
15680 else if (get_attr_length (insn) == 4)
15681 return \"{bdn|bdnz} %l0\";
15683 return \"bdz $+8\;b %l0\";
15685 [(set_attr "type" "branch")
15686 (set_attr "length" "*,12,16,16")])
15688 (define_insn "*ctr<mode>_internal2"
15690 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15693 (label_ref (match_operand 0 "" ""))))
15694 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15695 (plus:P (match_dup 1)
15697 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15698 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15702 if (which_alternative != 0)
15704 else if (get_attr_length (insn) == 4)
15705 return \"bdz %l0\";
15707 return \"{bdn|bdnz} $+8\;b %l0\";
15709 [(set_attr "type" "branch")
15710 (set_attr "length" "*,12,16,16")])
15712 ;; Similar but use EQ
15714 (define_insn "*ctr<mode>_internal5"
15716 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15718 (label_ref (match_operand 0 "" ""))
15720 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15721 (plus:P (match_dup 1)
15723 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15724 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15728 if (which_alternative != 0)
15730 else if (get_attr_length (insn) == 4)
15731 return \"bdz %l0\";
15733 return \"{bdn|bdnz} $+8\;b %l0\";
15735 [(set_attr "type" "branch")
15736 (set_attr "length" "*,12,16,16")])
15738 (define_insn "*ctr<mode>_internal6"
15740 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
15743 (label_ref (match_operand 0 "" ""))))
15744 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
15745 (plus:P (match_dup 1)
15747 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
15748 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
15752 if (which_alternative != 0)
15754 else if (get_attr_length (insn) == 4)
15755 return \"{bdn|bdnz} %l0\";
15757 return \"bdz $+8\;b %l0\";
15759 [(set_attr "type" "branch")
15760 (set_attr "length" "*,12,16,16")])
15762 ;; Now the splitters if we could not allocate the CTR register
15766 (if_then_else (match_operator 2 "comparison_operator"
15767 [(match_operand:P 1 "gpc_reg_operand" "")
15769 (match_operand 5 "" "")
15770 (match_operand 6 "" "")))
15771 (set (match_operand:P 0 "gpc_reg_operand" "")
15772 (plus:P (match_dup 1) (const_int -1)))
15773 (clobber (match_scratch:CC 3 ""))
15774 (clobber (match_scratch:P 4 ""))]
15776 [(parallel [(set (match_dup 3)
15777 (compare:CC (plus:P (match_dup 1)
15781 (plus:P (match_dup 1)
15783 (set (pc) (if_then_else (match_dup 7)
15787 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15788 operands[3], const0_rtx); }")
15792 (if_then_else (match_operator 2 "comparison_operator"
15793 [(match_operand:P 1 "gpc_reg_operand" "")
15795 (match_operand 5 "" "")
15796 (match_operand 6 "" "")))
15797 (set (match_operand:P 0 "nonimmediate_operand" "")
15798 (plus:P (match_dup 1) (const_int -1)))
15799 (clobber (match_scratch:CC 3 ""))
15800 (clobber (match_scratch:P 4 ""))]
15801 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
15802 [(parallel [(set (match_dup 3)
15803 (compare:CC (plus:P (match_dup 1)
15807 (plus:P (match_dup 1)
15811 (set (pc) (if_then_else (match_dup 7)
15815 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
15816 operands[3], const0_rtx); }")
15818 (define_insn "trap"
15819 [(trap_if (const_int 1) (const_int 0))]
15822 [(set_attr "type" "trap")])
15824 (define_expand "ctrap<mode>4"
15825 [(trap_if (match_operator 0 "ordered_comparison_operator"
15826 [(match_operand:GPR 1 "register_operand")
15827 (match_operand:GPR 2 "reg_or_short_operand")])
15828 (match_operand 3 "zero_constant" ""))]
15833 [(trap_if (match_operator 0 "ordered_comparison_operator"
15834 [(match_operand:GPR 1 "register_operand" "r")
15835 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
15838 "{t|t<wd>}%V0%I2 %1,%2"
15839 [(set_attr "type" "trap")])
15841 ;; Insns related to generating the function prologue and epilogue.
15843 (define_expand "prologue"
15844 [(use (const_int 0))]
15845 "TARGET_SCHED_PROLOG"
15848 rs6000_emit_prologue ();
15852 (define_insn "*movesi_from_cr_one"
15853 [(match_parallel 0 "mfcr_operation"
15854 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15855 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
15856 (match_operand 3 "immediate_operand" "n")]
15857 UNSPEC_MOVESI_FROM_CR))])]
15863 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15865 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15866 operands[4] = GEN_INT (mask);
15867 output_asm_insn (\"mfcr %1,%4\", operands);
15871 [(set_attr "type" "mfcrf")])
15873 (define_insn "movesi_from_cr"
15874 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
15875 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
15876 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
15877 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
15878 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
15879 UNSPEC_MOVESI_FROM_CR))]
15882 [(set_attr "type" "mfcr")])
15884 (define_insn "*stmw"
15885 [(match_parallel 0 "stmw_operation"
15886 [(set (match_operand:SI 1 "memory_operand" "=m")
15887 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
15890 [(set_attr "type" "store_ux")])
15892 (define_insn "*save_gpregs_<mode>"
15893 [(match_parallel 0 "any_parallel_operand"
15894 [(clobber (reg:P 65))
15895 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15896 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15897 (set (match_operand:P 3 "memory_operand" "=m")
15898 (match_operand:P 4 "gpc_reg_operand" "r"))])]
15901 [(set_attr "type" "branch")
15902 (set_attr "length" "4")])
15904 (define_insn "*save_fpregs_<mode>"
15905 [(match_parallel 0 "any_parallel_operand"
15906 [(clobber (reg:P 65))
15907 (use (match_operand:P 1 "symbol_ref_operand" "s"))
15908 (use (match_operand:P 2 "gpc_reg_operand" "r"))
15909 (set (match_operand:DF 3 "memory_operand" "=m")
15910 (match_operand:DF 4 "gpc_reg_operand" "d"))])]
15913 [(set_attr "type" "branch")
15914 (set_attr "length" "4")])
15916 ; These are to explain that changes to the stack pointer should
15917 ; not be moved over stores to stack memory.
15918 (define_insn "stack_tie"
15919 [(set (match_operand:BLK 0 "memory_operand" "+m")
15920 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
15923 [(set_attr "length" "0")])
15925 ; Like stack_tie, but depend on both fp and sp based memory.
15926 (define_insn "frame_tie"
15927 [(set (match_operand:BLK 0 "memory_operand" "+m")
15928 (unspec:BLK [(match_dup 0)
15929 (match_operand:BLK 1 "memory_operand" "m")] UNSPEC_TIE))]
15932 [(set_attr "length" "0")])
15935 (define_expand "epilogue"
15936 [(use (const_int 0))]
15937 "TARGET_SCHED_PROLOG"
15940 rs6000_emit_epilogue (FALSE);
15944 ; On some processors, doing the mtcrf one CC register at a time is
15945 ; faster (like on the 604e). On others, doing them all at once is
15946 ; faster; for instance, on the 601 and 750.
15948 (define_expand "movsi_to_cr_one"
15949 [(set (match_operand:CC 0 "cc_reg_operand" "")
15950 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
15951 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
15953 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
15955 (define_insn "*movsi_to_cr"
15956 [(match_parallel 0 "mtcrf_operation"
15957 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
15958 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
15959 (match_operand 3 "immediate_operand" "n")]
15960 UNSPEC_MOVESI_TO_CR))])]
15966 for (i = 0; i < XVECLEN (operands[0], 0); i++)
15967 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
15968 operands[4] = GEN_INT (mask);
15969 return \"mtcrf %4,%2\";
15971 [(set_attr "type" "mtcr")])
15973 (define_insn "*mtcrfsi"
15974 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
15975 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
15976 (match_operand 2 "immediate_operand" "n")]
15977 UNSPEC_MOVESI_TO_CR))]
15978 "GET_CODE (operands[0]) == REG
15979 && CR_REGNO_P (REGNO (operands[0]))
15980 && GET_CODE (operands[2]) == CONST_INT
15981 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
15983 [(set_attr "type" "mtcr")])
15985 ; The load-multiple instructions have similar properties.
15986 ; Note that "load_multiple" is a name known to the machine-independent
15987 ; code that actually corresponds to the PowerPC load-string.
15989 (define_insn "*lmw"
15990 [(match_parallel 0 "lmw_operation"
15991 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
15992 (match_operand:SI 2 "memory_operand" "m"))])]
15995 [(set_attr "type" "load_ux")
15996 (set_attr "cell_micro" "always")])
15998 (define_insn "*return_internal_<mode>"
16000 (use (match_operand:P 0 "register_operand" "lc"))]
16003 [(set_attr "type" "jmpreg")])
16005 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
16006 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
16008 (define_insn "*restore_gpregs_<mode>"
16009 [(match_parallel 0 "any_parallel_operand"
16010 [(clobber (match_operand:P 1 "register_operand" "=l"))
16011 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16012 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16013 (set (match_operand:P 4 "gpc_reg_operand" "=r")
16014 (match_operand:P 5 "memory_operand" "m"))])]
16017 [(set_attr "type" "branch")
16018 (set_attr "length" "4")])
16020 (define_insn "*return_and_restore_gpregs_<mode>"
16021 [(match_parallel 0 "any_parallel_operand"
16023 (clobber (match_operand:P 1 "register_operand" "=l"))
16024 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16025 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16026 (set (match_operand:P 4 "gpc_reg_operand" "=r")
16027 (match_operand:P 5 "memory_operand" "m"))])]
16030 [(set_attr "type" "branch")
16031 (set_attr "length" "4")])
16033 (define_insn "*return_and_restore_fpregs_<mode>"
16034 [(match_parallel 0 "any_parallel_operand"
16036 (clobber (match_operand:P 1 "register_operand" "=l"))
16037 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16038 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16039 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16040 (match_operand:DF 5 "memory_operand" "m"))])]
16043 [(set_attr "type" "branch")
16044 (set_attr "length" "4")])
16046 (define_insn "*return_and_restore_fpregs_aix_<mode>"
16047 [(match_parallel 0 "any_parallel_operand"
16049 (use (match_operand:P 1 "register_operand" "l"))
16050 (use (match_operand:P 2 "symbol_ref_operand" "s"))
16051 (use (match_operand:P 3 "gpc_reg_operand" "r"))
16052 (set (match_operand:DF 4 "gpc_reg_operand" "=d")
16053 (match_operand:DF 5 "memory_operand" "m"))])]
16056 [(set_attr "type" "branch")
16057 (set_attr "length" "4")])
16059 ; This is used in compiling the unwind routines.
16060 (define_expand "eh_return"
16061 [(use (match_operand 0 "general_operand" ""))]
16066 emit_insn (gen_eh_set_lr_si (operands[0]));
16068 emit_insn (gen_eh_set_lr_di (operands[0]));
16072 ; We can't expand this before we know where the link register is stored.
16073 (define_insn "eh_set_lr_<mode>"
16074 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
16076 (clobber (match_scratch:P 1 "=&b"))]
16081 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
16082 (clobber (match_scratch 1 ""))]
16087 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
16091 (define_insn "prefetch"
16092 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
16093 (match_operand:SI 1 "const_int_operand" "n")
16094 (match_operand:SI 2 "const_int_operand" "n"))]
16098 if (GET_CODE (operands[0]) == REG)
16099 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
16100 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
16102 [(set_attr "type" "load")])
16104 (define_insn "bpermd_<mode>"
16105 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
16106 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
16107 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
16110 [(set_attr "type" "integer")])
16113 ;; Builtin fma support. Handle
16114 ;; Note that the conditions for expansion are in the FMA_F iterator.
16116 (define_expand "fma<mode>4"
16117 [(set (match_operand:FMA_F 0 "register_operand" "")
16119 (match_operand:FMA_F 1 "register_operand" "")
16120 (match_operand:FMA_F 2 "register_operand" "")
16121 (match_operand:FMA_F 3 "register_operand" "")))]
16125 ; Altivec only has fma and nfms.
16126 (define_expand "fms<mode>4"
16127 [(set (match_operand:FMA_F 0 "register_operand" "")
16129 (match_operand:FMA_F 1 "register_operand" "")
16130 (match_operand:FMA_F 2 "register_operand" "")
16131 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
16132 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16135 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
16136 (define_expand "fnma<mode>4"
16137 [(set (match_operand:FMA_F 0 "register_operand" "")
16140 (match_operand:FMA_F 1 "register_operand" "")
16141 (match_operand:FMA_F 2 "register_operand" "")
16142 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16143 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
16146 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
16147 (define_expand "fnms<mode>4"
16148 [(set (match_operand:FMA_F 0 "register_operand" "")
16151 (match_operand:FMA_F 1 "register_operand" "")
16152 (match_operand:FMA_F 2 "register_operand" "")
16153 (match_operand:FMA_F 3 "register_operand" ""))))]
16154 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16157 ; Not an official optab name, but used from builtins.
16158 (define_expand "nfma<mode>4"
16159 [(set (match_operand:FMA_F 0 "register_operand" "")
16162 (match_operand:FMA_F 1 "register_operand" "")
16163 (match_operand:FMA_F 2 "register_operand" "")
16164 (match_operand:FMA_F 3 "register_operand" ""))))]
16165 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
16168 ; Not an official optab name, but used from builtins.
16169 (define_expand "nfms<mode>4"
16170 [(set (match_operand:FMA_F 0 "register_operand" "")
16173 (match_operand:FMA_F 1 "register_operand" "")
16174 (match_operand:FMA_F 2 "register_operand" "")
16175 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
16181 (include "sync.md")
16182 (include "vector.md")
16184 (include "altivec.md")
16187 (include "paired.md")