1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990-2013 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 3, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
29 (STACK_POINTER_REGNUM 1)
31 (STATIC_CHAIN_REGNUM 11)
32 (HARD_FRAME_POINTER_REGNUM 31)
38 (ARG_POINTER_REGNUM 67)
49 (FIRST_ALTIVEC_REGNO 77)
50 (LAST_ALTIVEC_REGNO 108)
55 (FRAME_POINTER_REGNUM 113)
57 ; ABI defined stack offsets for storing the TOC pointer with AIX calls.
58 (TOC_SAVE_OFFSET_32BIT 20)
59 (TOC_SAVE_OFFSET_64BIT 40)
61 ; Function TOC offset in the AIX function descriptor.
62 (AIX_FUNC_DESC_TOC_32BIT 4)
63 (AIX_FUNC_DESC_TOC_64BIT 8)
65 ; Static chain offset in the AIX function descriptor.
66 (AIX_FUNC_DESC_SC_32BIT 8)
67 (AIX_FUNC_DESC_SC_64BIT 16)
74 (define_c_enum "unspec"
75 [UNSPEC_FRSP ; frsp for POWER machines
76 UNSPEC_PROBE_STACK ; probe stack memory reference
77 UNSPEC_TOCPTR ; address of a word pointing to the TOC
78 UNSPEC_TOC ; address of the TOC (more-or-less)
80 UNSPEC_MV_CR_OV ; move_from_CR_ov_bit
86 UNSPEC_LD_MPIC ; load_macho_picbase
87 UNSPEC_MPIC_CORRECT ; macho_correct_pic
101 UNSPEC_FIX_TRUNC_TF ; fadd, rounding towards zero
102 UNSPEC_MV_CR_GT ; move_from_CR_gt_bit
120 UNSPEC_MACHOPIC_OFFSET
133 ;; UNSPEC_VOLATILE usage
136 (define_c_enum "unspecv"
138 UNSPECV_LL ; load-locked
139 UNSPECV_SC ; store-conditional
140 UNSPECV_PROBE_STACK_RANGE ; probe range of stack addresses
141 UNSPECV_EH_RR ; eh_reg_restore
142 UNSPECV_ISYNC ; isync instruction
143 UNSPECV_MFTB ; move from time base
147 ;; Define an insn type attribute. This is used in function unit delay
149 (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,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt"
150 (const_string "integer"))
152 ;; Define floating point instruction sub-types for use with Xfpu.md
153 (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"))
155 ;; Length (in bytes).
156 ; '(pc)' in the following doesn't include the instruction itself; it is
157 ; calculated as if the instruction had zero size.
158 (define_attr "length" ""
159 (if_then_else (eq_attr "type" "branch")
160 (if_then_else (and (ge (minus (match_dup 0) (pc))
162 (lt (minus (match_dup 0) (pc))
168 ;; Processor type -- this attribute must exactly match the processor_type
169 ;; enumeration in rs6000.h.
171 (define_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan"
172 (const (symbol_ref "rs6000_cpu_attr")))
175 ;; If this instruction is microcoded on the CELL processor
176 ; The default for load extended, the recorded instructions and rotate/shifts by a variable is always microcoded
177 (define_attr "cell_micro" "not,conditional,always"
178 (if_then_else (eq_attr "type" "compare,delayed_compare,imul_compare,lmul_compare,load_ext,load_ext_ux,var_shift_rotate,var_delayed_compare")
179 (const_string "always")
180 (const_string "not")))
182 (automata_option "ndfa")
195 (include "e300c2c3.md")
196 (include "e500mc.md")
197 (include "e500mc64.md")
200 (include "power4.md")
201 (include "power5.md")
202 (include "power6.md")
203 (include "power7.md")
209 (include "predicates.md")
210 (include "constraints.md")
212 (include "darwin.md")
217 ; This mode iterator allows :GPR to be used to indicate the allowable size
218 ; of whole values in GPRs.
219 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
221 ; Any supported integer mode.
222 (define_mode_iterator INT [QI HI SI DI TI PTI])
224 ; Any supported integer mode that fits in one register.
225 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
227 ; extend modes for DImode
228 (define_mode_iterator QHSI [QI HI SI])
230 ; SImode or DImode, even if DImode doesn't fit in GPRs.
231 (define_mode_iterator SDI [SI DI])
233 ; The size of a pointer. Also, the size of the value that a record-condition
234 ; (one with a '.') will compare; and the size used for arithmetic carries.
235 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
237 ; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
238 ; PTImode is GPR only)
239 (define_mode_iterator TI2 [TI PTI])
241 ; Any hardware-supported floating-point mode
242 (define_mode_iterator FP [
243 (SF "TARGET_HARD_FLOAT
244 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) || TARGET_E500_SINGLE)")
245 (DF "TARGET_HARD_FLOAT
246 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)")
247 (TF "!TARGET_IEEEQUAD
249 && (TARGET_FPRS || TARGET_E500_DOUBLE)
250 && TARGET_LONG_DOUBLE_128")
254 ; Any fma capable floating-point mode.
255 (define_mode_iterator FMA_F [
256 (SF "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT")
257 (DF "(TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
258 || VECTOR_UNIT_VSX_P (DFmode)")
259 (V2SF "TARGET_PAIRED_FLOAT")
260 (V4SF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)")
261 (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
264 ; Floating point move iterators to combine binary and decimal moves
265 (define_mode_iterator FMOVE32 [SF SD])
266 (define_mode_iterator FMOVE64 [DF DD])
267 (define_mode_iterator FMOVE64X [DI DF DD])
268 (define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
269 (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
271 ; Whether a floating point move is ok, don't allow SD without hardware FP
272 (define_mode_attr fmove_ok [(SF "")
274 (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
277 ; Convert REAL_VALUE to the appropriate bits
278 (define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
279 (DF "REAL_VALUE_TO_TARGET_DOUBLE")
280 (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
281 (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
283 ; Definitions for load to 32-bit fpr register
284 (define_mode_attr f32_lr [(SF "f") (SD "wz")])
285 (define_mode_attr f32_lm [(SF "m") (SD "Z")])
286 (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
288 ; Definitions for store from 32-bit fpr register
289 (define_mode_attr f32_sr [(SF "f") (SD "wx")])
290 (define_mode_attr f32_sm [(SF "m") (SD "Z")])
291 (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
293 ; These modes do not fit in integer registers in 32-bit mode.
294 ; but on e500v2, the gpr are 64 bit registers
295 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
297 ; Iterator for reciprocal estimate instructions
298 (define_mode_iterator RECIPF [SF DF V4SF V2DF])
300 ; Iterator for just SF/DF
301 (define_mode_iterator SFDF [SF DF])
303 ; Conditional returns.
304 (define_code_iterator any_return [return simple_return])
305 (define_code_attr return_pred [(return "direct_return ()")
306 (simple_return "1")])
307 (define_code_attr return_str [(return "") (simple_return "simple_")])
309 ; Various instructions that come in SI and DI forms.
310 ; A generic w/d attribute, for things like cmpw/cmpd.
311 (define_mode_attr wd [(QI "b")
321 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
323 ;; ISEL/ISEL64 target selection
324 (define_mode_attr sel [(SI "") (DI "64")])
326 ;; Suffix for reload patterns
327 (define_mode_attr ptrsize [(SI "32bit")
330 (define_mode_attr tptrsize [(SI "TARGET_32BIT")
331 (DI "TARGET_64BIT")])
333 (define_mode_attr mptrsize [(SI "si")
336 (define_mode_attr ptrload [(SI "lwz")
339 (define_mode_attr ptrm [(SI "m")
342 (define_mode_attr rreg [(SF "f")
347 (define_mode_attr rreg2 [(SF "f")
350 (define_mode_attr SI_CONVERT_FP [(SF "TARGET_FCFIDS")
351 (DF "TARGET_FCFID")])
353 (define_mode_attr E500_CONVERT [(SF "!TARGET_FPRS")
354 (DF "TARGET_E500_DOUBLE")])
356 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
357 (DF "TARGET_DOUBLE_FLOAT")])
359 ;; Start with fixed-point load and store insns. Here we put only the more
360 ;; complex forms. Basic data transfer is done later.
362 (define_expand "zero_extend<mode>di2"
363 [(set (match_operand:DI 0 "gpc_reg_operand" "")
364 (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "")))]
368 (define_insn "*zero_extend<mode>di2_internal1"
369 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
370 (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
374 rldicl %0,%1,0,<dbits>"
375 [(set_attr_alternative "type"
377 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
378 (const_string "load_ux")
380 (match_test "update_address_mem (operands[1], VOIDmode)")
381 (const_string "load_u")
382 (const_string "load")))
383 (const_string "*")])])
385 (define_insn "*zero_extend<mode>di2_internal2"
386 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
387 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
389 (clobber (match_scratch:DI 2 "=r,r"))]
392 rldicl. %2,%1,0,<dbits>
394 [(set_attr "type" "compare")
395 (set_attr "length" "4,8")])
398 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
399 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
401 (clobber (match_scratch:DI 2 ""))]
402 "TARGET_POWERPC64 && reload_completed"
404 (zero_extend:DI (match_dup 1)))
406 (compare:CC (match_dup 2)
410 (define_insn "*zero_extend<mode>di2_internal3"
411 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
412 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" "r,r"))
414 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
415 (zero_extend:DI (match_dup 1)))]
418 rldicl. %0,%1,0,<dbits>
420 [(set_attr "type" "compare")
421 (set_attr "length" "4,8")])
424 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
425 (compare:CC (zero_extend:DI (match_operand:QHSI 1 "gpc_reg_operand" ""))
427 (set (match_operand:DI 0 "gpc_reg_operand" "")
428 (zero_extend:DI (match_dup 1)))]
429 "TARGET_POWERPC64 && reload_completed"
431 (zero_extend:DI (match_dup 1)))
433 (compare:CC (match_dup 0)
437 (define_insn "extendqidi2"
438 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
439 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
442 [(set_attr "type" "exts")])
445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
446 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
448 (clobber (match_scratch:DI 2 "=r,r"))]
453 [(set_attr "type" "compare")
454 (set_attr "length" "4,8")])
457 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
458 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
460 (clobber (match_scratch:DI 2 ""))]
461 "TARGET_POWERPC64 && reload_completed"
463 (sign_extend:DI (match_dup 1)))
465 (compare:CC (match_dup 2)
470 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
471 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
473 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
474 (sign_extend:DI (match_dup 1)))]
479 [(set_attr "type" "compare")
480 (set_attr "length" "4,8")])
483 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
484 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
486 (set (match_operand:DI 0 "gpc_reg_operand" "")
487 (sign_extend:DI (match_dup 1)))]
488 "TARGET_POWERPC64 && reload_completed"
490 (sign_extend:DI (match_dup 1)))
492 (compare:CC (match_dup 0)
496 (define_expand "extendhidi2"
497 [(set (match_operand:DI 0 "gpc_reg_operand" "")
498 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
503 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
504 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
505 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
509 [(set_attr_alternative "type"
511 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
512 (const_string "load_ext_ux")
514 (match_test "update_address_mem (operands[1], VOIDmode)")
515 (const_string "load_ext_u")
516 (const_string "load_ext")))
517 (const_string "exts")])])
520 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
521 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r")))]
522 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
524 [(set_attr "type" "exts")])
527 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
528 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
530 (clobber (match_scratch:DI 2 "=r,r"))]
535 [(set_attr "type" "compare")
536 (set_attr "length" "4,8")])
539 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
540 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
542 (clobber (match_scratch:DI 2 ""))]
543 "TARGET_POWERPC64 && reload_completed"
545 (sign_extend:DI (match_dup 1)))
547 (compare:CC (match_dup 2)
552 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
553 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
555 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
556 (sign_extend:DI (match_dup 1)))]
561 [(set_attr "type" "compare")
562 (set_attr "length" "4,8")])
565 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
566 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
568 (set (match_operand:DI 0 "gpc_reg_operand" "")
569 (sign_extend:DI (match_dup 1)))]
570 "TARGET_POWERPC64 && reload_completed"
572 (sign_extend:DI (match_dup 1)))
574 (compare:CC (match_dup 0)
578 (define_expand "extendsidi2"
579 [(set (match_operand:DI 0 "gpc_reg_operand" "")
580 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
585 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
586 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
587 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
591 [(set_attr_alternative "type"
593 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
594 (const_string "load_ext_ux")
596 (match_test "update_address_mem (operands[1], VOIDmode)")
597 (const_string "load_ext_u")
598 (const_string "load_ext")))
599 (const_string "exts")])])
602 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
603 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
604 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
606 [(set_attr "type" "exts")])
609 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
610 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
612 (clobber (match_scratch:DI 2 "=r,r"))]
617 [(set_attr "type" "compare")
618 (set_attr "length" "4,8")])
621 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
622 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
624 (clobber (match_scratch:DI 2 ""))]
625 "TARGET_POWERPC64 && reload_completed"
627 (sign_extend:DI (match_dup 1)))
629 (compare:CC (match_dup 2)
634 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
635 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
637 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
638 (sign_extend:DI (match_dup 1)))]
643 [(set_attr "type" "compare")
644 (set_attr "length" "4,8")])
647 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
648 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
650 (set (match_operand:DI 0 "gpc_reg_operand" "")
651 (sign_extend:DI (match_dup 1)))]
652 "TARGET_POWERPC64 && reload_completed"
654 (sign_extend:DI (match_dup 1)))
656 (compare:CC (match_dup 0)
660 (define_expand "zero_extendqisi2"
661 [(set (match_operand:SI 0 "gpc_reg_operand" "")
662 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
667 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
668 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
673 [(set_attr_alternative "type"
675 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
676 (const_string "load_ux")
678 (match_test "update_address_mem (operands[1], VOIDmode)")
679 (const_string "load_u")
680 (const_string "load")))
681 (const_string "*")])])
684 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
685 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
687 (clobber (match_scratch:SI 2 "=r,r"))]
692 [(set_attr "type" "fast_compare,compare")
693 (set_attr "length" "4,8")])
696 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
697 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
699 (clobber (match_scratch:SI 2 ""))]
702 (zero_extend:SI (match_dup 1)))
704 (compare:CC (match_dup 2)
709 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
710 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
712 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
713 (zero_extend:SI (match_dup 1)))]
718 [(set_attr "type" "fast_compare,compare")
719 (set_attr "length" "4,8")])
722 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
723 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
725 (set (match_operand:SI 0 "gpc_reg_operand" "")
726 (zero_extend:SI (match_dup 1)))]
729 (zero_extend:SI (match_dup 1)))
731 (compare:CC (match_dup 0)
735 (define_insn "extendqisi2"
736 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
737 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
740 [(set_attr "type" "exts")])
743 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
744 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
746 (clobber (match_scratch:SI 2 "=r,r"))]
751 [(set_attr "type" "compare")
752 (set_attr "length" "4,8")])
755 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
756 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
758 (clobber (match_scratch:SI 2 ""))]
761 (sign_extend:SI (match_dup 1)))
763 (compare:CC (match_dup 2)
768 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
769 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
771 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
772 (sign_extend:SI (match_dup 1)))]
777 [(set_attr "type" "compare")
778 (set_attr "length" "4,8")])
781 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
782 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
784 (set (match_operand:SI 0 "gpc_reg_operand" "")
785 (sign_extend:SI (match_dup 1)))]
788 (sign_extend:SI (match_dup 1)))
790 (compare:CC (match_dup 0)
795 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
796 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
801 [(set_attr_alternative "type"
803 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
804 (const_string "load_ux")
806 (match_test "update_address_mem (operands[1], VOIDmode)")
807 (const_string "load_u")
808 (const_string "load")))
809 (const_string "*")])])
812 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
813 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
815 (clobber (match_scratch:HI 2 "=r,r"))]
820 [(set_attr "type" "fast_compare,compare")
821 (set_attr "length" "4,8")])
824 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
825 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
827 (clobber (match_scratch:HI 2 ""))]
830 (zero_extend:HI (match_dup 1)))
832 (compare:CC (match_dup 2)
837 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
838 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
840 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
841 (zero_extend:HI (match_dup 1)))]
846 [(set_attr "type" "fast_compare,compare")
847 (set_attr "length" "4,8")])
850 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
851 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
853 (set (match_operand:HI 0 "gpc_reg_operand" "")
854 (zero_extend:HI (match_dup 1)))]
857 (zero_extend:HI (match_dup 1)))
859 (compare:CC (match_dup 0)
863 (define_insn "extendqihi2"
864 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
865 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
868 [(set_attr "type" "exts")])
871 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
872 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
874 (clobber (match_scratch:HI 2 "=r,r"))]
879 [(set_attr "type" "compare")
880 (set_attr "length" "4,8")])
883 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
884 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
886 (clobber (match_scratch:HI 2 ""))]
889 (sign_extend:HI (match_dup 1)))
891 (compare:CC (match_dup 2)
896 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
897 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
899 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
900 (sign_extend:HI (match_dup 1)))]
905 [(set_attr "type" "compare")
906 (set_attr "length" "4,8")])
909 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
910 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
912 (set (match_operand:HI 0 "gpc_reg_operand" "")
913 (sign_extend:HI (match_dup 1)))]
916 (sign_extend:HI (match_dup 1)))
918 (compare:CC (match_dup 0)
922 (define_expand "zero_extendhisi2"
923 [(set (match_operand:SI 0 "gpc_reg_operand" "")
924 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
929 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
930 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
934 rlwinm %0,%1,0,0xffff"
935 [(set_attr_alternative "type"
937 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
938 (const_string "load_ux")
940 (match_test "update_address_mem (operands[1], VOIDmode)")
941 (const_string "load_u")
942 (const_string "load")))
943 (const_string "*")])])
946 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
947 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
949 (clobber (match_scratch:SI 2 "=r,r"))]
954 [(set_attr "type" "fast_compare,compare")
955 (set_attr "length" "4,8")])
958 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
959 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
961 (clobber (match_scratch:SI 2 ""))]
964 (zero_extend:SI (match_dup 1)))
966 (compare:CC (match_dup 2)
971 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
972 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
974 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
975 (zero_extend:SI (match_dup 1)))]
980 [(set_attr "type" "fast_compare,compare")
981 (set_attr "length" "4,8")])
984 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
985 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
987 (set (match_operand:SI 0 "gpc_reg_operand" "")
988 (zero_extend:SI (match_dup 1)))]
991 (zero_extend:SI (match_dup 1)))
993 (compare:CC (match_dup 0)
997 (define_expand "extendhisi2"
998 [(set (match_operand:SI 0 "gpc_reg_operand" "")
999 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1004 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1005 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1006 "rs6000_gen_cell_microcode"
1010 [(set_attr_alternative "type"
1012 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
1013 (const_string "load_ext_ux")
1015 (match_test "update_address_mem (operands[1], VOIDmode)")
1016 (const_string "load_ext_u")
1017 (const_string "load_ext")))
1018 (const_string "exts")])])
1021 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1022 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")))]
1023 "!rs6000_gen_cell_microcode"
1025 [(set_attr "type" "exts")])
1028 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1029 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1031 (clobber (match_scratch:SI 2 "=r,r"))]
1036 [(set_attr "type" "compare")
1037 (set_attr "length" "4,8")])
1040 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1041 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1043 (clobber (match_scratch:SI 2 ""))]
1046 (sign_extend:SI (match_dup 1)))
1048 (compare:CC (match_dup 2)
1053 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1054 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1056 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1057 (sign_extend:SI (match_dup 1)))]
1062 [(set_attr "type" "compare")
1063 (set_attr "length" "4,8")])
1066 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1067 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1069 (set (match_operand:SI 0 "gpc_reg_operand" "")
1070 (sign_extend:SI (match_dup 1)))]
1073 (sign_extend:SI (match_dup 1)))
1075 (compare:CC (match_dup 0)
1079 ;; IBM 405, 440, 464 and 476 half-word multiplication operations.
1081 (define_insn "*macchwc"
1082 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1083 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1084 (match_operand:SI 2 "gpc_reg_operand" "r")
1087 (match_operand:HI 1 "gpc_reg_operand" "r")))
1088 (match_operand:SI 4 "gpc_reg_operand" "0"))
1090 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1091 (plus:SI (mult:SI (ashiftrt:SI
1099 [(set_attr "type" "imul3")])
1101 (define_insn "*macchw"
1102 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1103 (plus:SI (mult:SI (ashiftrt:SI
1104 (match_operand:SI 2 "gpc_reg_operand" "r")
1107 (match_operand:HI 1 "gpc_reg_operand" "r")))
1108 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1111 [(set_attr "type" "imul3")])
1113 (define_insn "*macchwuc"
1114 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1115 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1116 (match_operand:SI 2 "gpc_reg_operand" "r")
1119 (match_operand:HI 1 "gpc_reg_operand" "r")))
1120 (match_operand:SI 4 "gpc_reg_operand" "0"))
1122 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1123 (plus:SI (mult:SI (lshiftrt:SI
1131 [(set_attr "type" "imul3")])
1133 (define_insn "*macchwu"
1134 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1135 (plus:SI (mult:SI (lshiftrt:SI
1136 (match_operand:SI 2 "gpc_reg_operand" "r")
1139 (match_operand:HI 1 "gpc_reg_operand" "r")))
1140 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1143 [(set_attr "type" "imul3")])
1145 (define_insn "*machhwc"
1146 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1147 (compare:CC (plus:SI (mult:SI (ashiftrt:SI
1148 (match_operand:SI 1 "gpc_reg_operand" "%r")
1151 (match_operand:SI 2 "gpc_reg_operand" "r")
1153 (match_operand:SI 4 "gpc_reg_operand" "0"))
1155 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1156 (plus:SI (mult:SI (ashiftrt:SI
1165 [(set_attr "type" "imul3")])
1167 (define_insn "*machhw"
1168 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1169 (plus:SI (mult:SI (ashiftrt:SI
1170 (match_operand:SI 1 "gpc_reg_operand" "%r")
1173 (match_operand:SI 2 "gpc_reg_operand" "r")
1175 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1178 [(set_attr "type" "imul3")])
1180 (define_insn "*machhwuc"
1181 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1182 (compare:CC (plus:SI (mult:SI (lshiftrt:SI
1183 (match_operand:SI 1 "gpc_reg_operand" "%r")
1186 (match_operand:SI 2 "gpc_reg_operand" "r")
1188 (match_operand:SI 4 "gpc_reg_operand" "0"))
1190 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1191 (plus:SI (mult:SI (lshiftrt:SI
1200 [(set_attr "type" "imul3")])
1202 (define_insn "*machhwu"
1203 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1204 (plus:SI (mult:SI (lshiftrt:SI
1205 (match_operand:SI 1 "gpc_reg_operand" "%r")
1208 (match_operand:SI 2 "gpc_reg_operand" "r")
1210 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1213 [(set_attr "type" "imul3")])
1215 (define_insn "*maclhwc"
1216 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1217 (compare:CC (plus:SI (mult:SI (sign_extend:SI
1218 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1220 (match_operand:HI 2 "gpc_reg_operand" "r")))
1221 (match_operand:SI 4 "gpc_reg_operand" "0"))
1223 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1224 (plus:SI (mult:SI (sign_extend:SI
1231 [(set_attr "type" "imul3")])
1233 (define_insn "*maclhw"
1234 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1235 (plus:SI (mult:SI (sign_extend:SI
1236 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1238 (match_operand:HI 2 "gpc_reg_operand" "r")))
1239 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1242 [(set_attr "type" "imul3")])
1244 (define_insn "*maclhwuc"
1245 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1246 (compare:CC (plus:SI (mult:SI (zero_extend:SI
1247 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1249 (match_operand:HI 2 "gpc_reg_operand" "r")))
1250 (match_operand:SI 4 "gpc_reg_operand" "0"))
1252 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1253 (plus:SI (mult:SI (zero_extend:SI
1260 [(set_attr "type" "imul3")])
1262 (define_insn "*maclhwu"
1263 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1264 (plus:SI (mult:SI (zero_extend:SI
1265 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1267 (match_operand:HI 2 "gpc_reg_operand" "r")))
1268 (match_operand:SI 3 "gpc_reg_operand" "0")))]
1271 [(set_attr "type" "imul3")])
1273 (define_insn "*nmacchwc"
1274 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1275 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1276 (mult:SI (ashiftrt:SI
1277 (match_operand:SI 2 "gpc_reg_operand" "r")
1280 (match_operand:HI 1 "gpc_reg_operand" "r"))))
1282 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1283 (minus:SI (match_dup 4)
1284 (mult:SI (ashiftrt:SI
1291 [(set_attr "type" "imul3")])
1293 (define_insn "*nmacchw"
1294 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1295 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1296 (mult:SI (ashiftrt:SI
1297 (match_operand:SI 2 "gpc_reg_operand" "r")
1300 (match_operand:HI 1 "gpc_reg_operand" "r")))))]
1303 [(set_attr "type" "imul3")])
1305 (define_insn "*nmachhwc"
1306 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1307 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1308 (mult:SI (ashiftrt:SI
1309 (match_operand:SI 1 "gpc_reg_operand" "%r")
1312 (match_operand:SI 2 "gpc_reg_operand" "r")
1315 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1316 (minus:SI (match_dup 4)
1317 (mult:SI (ashiftrt:SI
1325 [(set_attr "type" "imul3")])
1327 (define_insn "*nmachhw"
1328 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1329 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1330 (mult:SI (ashiftrt:SI
1331 (match_operand:SI 1 "gpc_reg_operand" "%r")
1334 (match_operand:SI 2 "gpc_reg_operand" "r")
1338 [(set_attr "type" "imul3")])
1340 (define_insn "*nmaclhwc"
1341 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1342 (compare:CC (minus:SI (match_operand:SI 4 "gpc_reg_operand" "0")
1343 (mult:SI (sign_extend:SI
1344 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1346 (match_operand:HI 2 "gpc_reg_operand" "r"))))
1348 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1349 (minus:SI (match_dup 4)
1350 (mult:SI (sign_extend:SI
1356 [(set_attr "type" "imul3")])
1358 (define_insn "*nmaclhw"
1359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1360 (minus:SI (match_operand:SI 3 "gpc_reg_operand" "0")
1361 (mult:SI (sign_extend:SI
1362 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1364 (match_operand:HI 2 "gpc_reg_operand" "r")))))]
1367 [(set_attr "type" "imul3")])
1369 (define_insn "*mulchwc"
1370 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1371 (compare:CC (mult:SI (ashiftrt:SI
1372 (match_operand:SI 2 "gpc_reg_operand" "r")
1375 (match_operand:HI 1 "gpc_reg_operand" "r")))
1377 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1378 (mult:SI (ashiftrt:SI
1385 [(set_attr "type" "imul3")])
1387 (define_insn "*mulchw"
1388 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1389 (mult:SI (ashiftrt:SI
1390 (match_operand:SI 2 "gpc_reg_operand" "r")
1393 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1396 [(set_attr "type" "imul3")])
1398 (define_insn "*mulchwuc"
1399 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1400 (compare:CC (mult:SI (lshiftrt:SI
1401 (match_operand:SI 2 "gpc_reg_operand" "r")
1404 (match_operand:HI 1 "gpc_reg_operand" "r")))
1406 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1407 (mult:SI (lshiftrt:SI
1414 [(set_attr "type" "imul3")])
1416 (define_insn "*mulchwu"
1417 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1418 (mult:SI (lshiftrt:SI
1419 (match_operand:SI 2 "gpc_reg_operand" "r")
1422 (match_operand:HI 1 "gpc_reg_operand" "r"))))]
1425 [(set_attr "type" "imul3")])
1427 (define_insn "*mulhhwc"
1428 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1429 (compare:CC (mult:SI (ashiftrt:SI
1430 (match_operand:SI 1 "gpc_reg_operand" "%r")
1433 (match_operand:SI 2 "gpc_reg_operand" "r")
1436 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1437 (mult:SI (ashiftrt:SI
1445 [(set_attr "type" "imul3")])
1447 (define_insn "*mulhhw"
1448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1449 (mult:SI (ashiftrt:SI
1450 (match_operand:SI 1 "gpc_reg_operand" "%r")
1453 (match_operand:SI 2 "gpc_reg_operand" "r")
1457 [(set_attr "type" "imul3")])
1459 (define_insn "*mulhhwuc"
1460 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1461 (compare:CC (mult:SI (lshiftrt:SI
1462 (match_operand:SI 1 "gpc_reg_operand" "%r")
1465 (match_operand:SI 2 "gpc_reg_operand" "r")
1468 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1469 (mult:SI (lshiftrt:SI
1477 [(set_attr "type" "imul3")])
1479 (define_insn "*mulhhwu"
1480 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1481 (mult:SI (lshiftrt:SI
1482 (match_operand:SI 1 "gpc_reg_operand" "%r")
1485 (match_operand:SI 2 "gpc_reg_operand" "r")
1489 [(set_attr "type" "imul3")])
1491 (define_insn "*mullhwc"
1492 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1493 (compare:CC (mult:SI (sign_extend:SI
1494 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1496 (match_operand:HI 2 "gpc_reg_operand" "r")))
1498 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1499 (mult:SI (sign_extend:SI
1505 [(set_attr "type" "imul3")])
1507 (define_insn "*mullhw"
1508 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1509 (mult:SI (sign_extend:SI
1510 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1512 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1515 [(set_attr "type" "imul3")])
1517 (define_insn "*mullhwuc"
1518 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1519 (compare:CC (mult:SI (zero_extend:SI
1520 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1522 (match_operand:HI 2 "gpc_reg_operand" "r")))
1524 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1525 (mult:SI (zero_extend:SI
1531 [(set_attr "type" "imul3")])
1533 (define_insn "*mullhwu"
1534 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1535 (mult:SI (zero_extend:SI
1536 (match_operand:HI 1 "gpc_reg_operand" "%r"))
1538 (match_operand:HI 2 "gpc_reg_operand" "r"))))]
1541 [(set_attr "type" "imul3")])
1543 ;; IBM 405, 440, 464 and 476 string-search dlmzb instruction support.
1544 (define_insn "dlmzb"
1545 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1546 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
1547 (match_operand:SI 2 "gpc_reg_operand" "r")]
1549 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1550 (unspec:SI [(match_dup 1)
1556 (define_expand "strlensi"
1557 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1558 (unspec:SI [(match_operand:BLK 1 "general_operand" "")
1559 (match_operand:QI 2 "const_int_operand" "")
1560 (match_operand 3 "const_int_operand" "")]
1561 UNSPEC_DLMZB_STRLEN))
1562 (clobber (match_scratch:CC 4 "=x"))]
1563 "TARGET_DLMZB && WORDS_BIG_ENDIAN && !optimize_size"
1565 rtx result = operands[0];
1566 rtx src = operands[1];
1567 rtx search_char = operands[2];
1568 rtx align = operands[3];
1569 rtx addr, scratch_string, word1, word2, scratch_dlmzb;
1570 rtx loop_label, end_label, mem, cr0, cond;
1571 if (search_char != const0_rtx
1572 || GET_CODE (align) != CONST_INT
1573 || INTVAL (align) < 8)
1575 word1 = gen_reg_rtx (SImode);
1576 word2 = gen_reg_rtx (SImode);
1577 scratch_dlmzb = gen_reg_rtx (SImode);
1578 scratch_string = gen_reg_rtx (Pmode);
1579 loop_label = gen_label_rtx ();
1580 end_label = gen_label_rtx ();
1581 addr = force_reg (Pmode, XEXP (src, 0));
1582 emit_move_insn (scratch_string, addr);
1583 emit_label (loop_label);
1584 mem = change_address (src, SImode, scratch_string);
1585 emit_move_insn (word1, mem);
1586 emit_move_insn (word2, adjust_address (mem, SImode, 4));
1587 cr0 = gen_rtx_REG (CCmode, CR0_REGNO);
1588 emit_insn (gen_dlmzb (scratch_dlmzb, word1, word2, cr0));
1589 cond = gen_rtx_NE (VOIDmode, cr0, const0_rtx);
1590 emit_jump_insn (gen_rtx_SET (VOIDmode,
1592 gen_rtx_IF_THEN_ELSE (VOIDmode,
1598 emit_insn (gen_addsi3 (scratch_string, scratch_string, GEN_INT (8)));
1599 emit_jump_insn (gen_rtx_SET (VOIDmode,
1601 gen_rtx_LABEL_REF (VOIDmode, loop_label)));
1603 emit_label (end_label);
1604 emit_insn (gen_addsi3 (scratch_string, scratch_string, scratch_dlmzb));
1605 emit_insn (gen_subsi3 (result, scratch_string, addr));
1606 emit_insn (gen_subsi3 (result, result, const1_rtx));
1610 ;; Fixed-point arithmetic insns.
1612 (define_expand "add<mode>3"
1613 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1614 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1615 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1618 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1620 if (non_short_cint_operand (operands[2], DImode))
1623 else if (GET_CODE (operands[2]) == CONST_INT
1624 && ! add_operand (operands[2], <MODE>mode))
1626 rtx tmp = ((!can_create_pseudo_p ()
1627 || rtx_equal_p (operands[0], operands[1]))
1628 ? operands[0] : gen_reg_rtx (<MODE>mode));
1630 HOST_WIDE_INT val = INTVAL (operands[2]);
1631 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1632 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1634 if (<MODE>mode == DImode && !satisfies_constraint_L (GEN_INT (rest)))
1637 /* The ordering here is important for the prolog expander.
1638 When space is allocated from the stack, adding 'low' first may
1639 produce a temporary deallocation (which would be bad). */
1640 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1641 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1646 ;; Discourage ai/addic because of carry but provide it in an alternative
1647 ;; allowing register zero as source.
1648 (define_insn "*add<mode>3_internal1"
1649 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1650 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1651 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1652 "!DECIMAL_FLOAT_MODE_P (GET_MODE (operands[0])) && !DECIMAL_FLOAT_MODE_P (GET_MODE (operands[1]))"
1658 [(set_attr "length" "4,4,4,4")])
1660 (define_insn "addsi3_high"
1661 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1662 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1663 (high:SI (match_operand 2 "" ""))))]
1664 "TARGET_MACHO && !TARGET_64BIT"
1665 "addis %0,%1,ha16(%2)"
1666 [(set_attr "length" "4")])
1668 (define_insn "*add<mode>3_internal2"
1669 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1670 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1671 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1673 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1680 [(set_attr "type" "fast_compare,compare,compare,compare")
1681 (set_attr "length" "4,4,8,8")])
1684 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1685 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1686 (match_operand:GPR 2 "reg_or_short_operand" ""))
1688 (clobber (match_scratch:GPR 3 ""))]
1691 (plus:GPR (match_dup 1)
1694 (compare:CC (match_dup 3)
1698 (define_insn "*add<mode>3_internal3"
1699 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1700 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1701 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1703 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1704 (plus:P (match_dup 1)
1712 [(set_attr "type" "fast_compare,compare,compare,compare")
1713 (set_attr "length" "4,4,8,8")])
1716 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1717 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1718 (match_operand:P 2 "reg_or_short_operand" ""))
1720 (set (match_operand:P 0 "gpc_reg_operand" "")
1721 (plus:P (match_dup 1) (match_dup 2)))]
1724 (plus:P (match_dup 1)
1727 (compare:CC (match_dup 0)
1731 ;; Split an add that we can't do in one insn into two insns, each of which
1732 ;; does one 16-bit part. This is used by combine. Note that the low-order
1733 ;; add should be last in case the result gets used in an address.
1736 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1737 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1738 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1740 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1741 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1743 HOST_WIDE_INT val = INTVAL (operands[2]);
1744 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1745 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1747 operands[4] = GEN_INT (low);
1748 if (<MODE>mode == SImode || satisfies_constraint_L (GEN_INT (rest)))
1749 operands[3] = GEN_INT (rest);
1750 else if (can_create_pseudo_p ())
1752 operands[3] = gen_reg_rtx (DImode);
1753 emit_move_insn (operands[3], operands[2]);
1754 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1761 (define_insn "one_cmpl<mode>2"
1762 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1763 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1768 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1769 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1771 (clobber (match_scratch:P 2 "=r,r"))]
1776 [(set_attr "type" "fast_compare,compare")
1777 (set_attr "length" "4,8")])
1780 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
1781 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1783 (clobber (match_scratch:P 2 ""))]
1786 (not:P (match_dup 1)))
1788 (compare:CC (match_dup 2)
1793 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1794 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1796 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1797 (not:P (match_dup 1)))]
1802 [(set_attr "type" "fast_compare,compare")
1803 (set_attr "length" "4,8")])
1806 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
1807 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1809 (set (match_operand:P 0 "gpc_reg_operand" "")
1810 (not:P (match_dup 1)))]
1813 (not:P (match_dup 1)))
1815 (compare:CC (match_dup 0)
1820 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1821 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1822 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1829 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1830 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1831 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1833 (clobber (match_scratch:P 3 "=r,r"))]
1838 [(set_attr "type" "fast_compare")
1839 (set_attr "length" "4,8")])
1842 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1843 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1844 (match_operand:P 2 "gpc_reg_operand" ""))
1846 (clobber (match_scratch:P 3 ""))]
1849 (minus:P (match_dup 1)
1852 (compare:CC (match_dup 3)
1857 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1858 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1859 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1861 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1862 (minus:P (match_dup 1)
1868 [(set_attr "type" "fast_compare")
1869 (set_attr "length" "4,8")])
1872 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1873 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1874 (match_operand:P 2 "gpc_reg_operand" ""))
1876 (set (match_operand:P 0 "gpc_reg_operand" "")
1877 (minus:P (match_dup 1)
1881 (minus:P (match_dup 1)
1884 (compare:CC (match_dup 0)
1888 (define_expand "sub<mode>3"
1889 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1890 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1891 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1895 if (GET_CODE (operands[2]) == CONST_INT)
1897 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1898 negate_rtx (<MODE>mode, operands[2])));
1903 (define_expand "neg<mode>2"
1904 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1905 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1909 (define_insn "*neg<mode>2_internal"
1910 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1911 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1916 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1917 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1919 (clobber (match_scratch:P 2 "=r,r"))]
1924 [(set_attr "type" "fast_compare")
1925 (set_attr "length" "4,8")])
1928 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1929 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1931 (clobber (match_scratch:P 2 ""))]
1934 (neg:P (match_dup 1)))
1936 (compare:CC (match_dup 2)
1941 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1942 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1944 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1945 (neg:P (match_dup 1)))]
1950 [(set_attr "type" "fast_compare")
1951 (set_attr "length" "4,8")])
1954 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1955 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1957 (set (match_operand:P 0 "gpc_reg_operand" "")
1958 (neg:P (match_dup 1)))]
1961 (neg:P (match_dup 1)))
1963 (compare:CC (match_dup 0)
1967 (define_insn "clz<mode>2"
1968 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1969 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1972 [(set_attr "type" "cntlz")])
1974 (define_expand "ctz<mode>2"
1976 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1977 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1979 (clobber (scratch:CC))])
1980 (set (match_dup 4) (clz:GPR (match_dup 3)))
1981 (set (match_operand:GPR 0 "gpc_reg_operand" "")
1982 (minus:GPR (match_dup 5) (match_dup 4)))]
1985 operands[2] = gen_reg_rtx (<MODE>mode);
1986 operands[3] = gen_reg_rtx (<MODE>mode);
1987 operands[4] = gen_reg_rtx (<MODE>mode);
1988 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
1991 (define_expand "ffs<mode>2"
1993 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))
1994 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1996 (clobber (scratch:CC))])
1997 (set (match_dup 4) (clz:GPR (match_dup 3)))
1998 (set (match_operand:GPR 0 "gpc_reg_operand" "")
1999 (minus:GPR (match_dup 5) (match_dup 4)))]
2002 operands[2] = gen_reg_rtx (<MODE>mode);
2003 operands[3] = gen_reg_rtx (<MODE>mode);
2004 operands[4] = gen_reg_rtx (<MODE>mode);
2005 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
2008 (define_insn "popcntb<mode>2"
2009 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2010 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
2014 [(set_attr "length" "4")
2015 (set_attr "type" "popcnt")])
2017 (define_insn "popcntd<mode>2"
2018 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2019 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
2022 [(set_attr "length" "4")
2023 (set_attr "type" "popcnt")])
2025 (define_expand "popcount<mode>2"
2026 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2027 (popcount:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2028 "TARGET_POPCNTB || TARGET_POPCNTD"
2030 rs6000_emit_popcount (operands[0], operands[1]);
2034 (define_insn "parity<mode>2_cmpb"
2035 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2036 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
2037 "TARGET_CMPB && TARGET_POPCNTB"
2040 (define_expand "parity<mode>2"
2041 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2042 (parity:GPR (match_operand:GPR 1 "gpc_reg_operand" "")))]
2045 rs6000_emit_parity (operands[0], operands[1]);
2049 ;; Since the hardware zeros the upper part of the register, save generating the
2050 ;; AND immediate if we are converting to unsigned
2051 (define_insn "*bswaphi2_extenddi"
2052 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2054 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2057 [(set_attr "length" "4")
2058 (set_attr "type" "load")])
2060 (define_insn "*bswaphi2_extendsi"
2061 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2063 (bswap:HI (match_operand:HI 1 "memory_operand" "Z"))))]
2066 [(set_attr "length" "4")
2067 (set_attr "type" "load")])
2069 (define_expand "bswaphi2"
2070 [(parallel [(set (match_operand:HI 0 "reg_or_mem_operand" "")
2072 (match_operand:HI 1 "reg_or_mem_operand" "")))
2073 (clobber (match_scratch:SI 2 ""))])]
2076 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2077 operands[1] = force_reg (HImode, operands[1]);
2080 (define_insn "bswaphi2_internal"
2081 [(set (match_operand:HI 0 "reg_or_mem_operand" "=r,Z,&r")
2083 (match_operand:HI 1 "reg_or_mem_operand" "Z,r,r")))
2084 (clobber (match_scratch:SI 2 "=X,X,&r"))]
2090 [(set_attr "length" "4,4,12")
2091 (set_attr "type" "load,store,*")])
2093 ;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
2094 ;; correct for -mlittle as well as -mbig.
2096 [(set (match_operand:HI 0 "gpc_reg_operand" "")
2097 (bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
2098 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2101 (zero_extract:SI (match_dup 4)
2105 (and:SI (ashift:SI (match_dup 4)
2107 (const_int 65280))) ;; 0xff00
2109 (ior:SI (match_dup 3)
2113 operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
2114 operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
2117 (define_insn "*bswapsi2_extenddi"
2118 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2120 (bswap:SI (match_operand:SI 1 "memory_operand" "Z"))))]
2123 [(set_attr "length" "4")
2124 (set_attr "type" "load")])
2126 (define_expand "bswapsi2"
2127 [(set (match_operand:SI 0 "reg_or_mem_operand" "")
2129 (match_operand:SI 1 "reg_or_mem_operand" "")))]
2132 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2133 operands[1] = force_reg (SImode, operands[1]);
2136 (define_insn "*bswapsi2_internal"
2137 [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Z,&r")
2139 (match_operand:SI 1 "reg_or_mem_operand" "Z,r,r")))]
2145 [(set_attr "length" "4,4,12")
2146 (set_attr "type" "load,store,*")])
2148 ;; We are always BITS_BIG_ENDIAN, so the bit positions below in
2149 ;; zero_extract insns do not change for -mlittle.
2151 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2152 (bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2155 (rotate:SI (match_dup 1) (const_int 8)))
2156 (set (zero_extract:SI (match_dup 0)
2160 (set (zero_extract:SI (match_dup 0)
2163 (rotate:SI (match_dup 1)
2167 (define_expand "bswapdi2"
2168 [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
2170 (match_operand:DI 1 "reg_or_mem_operand" "")))
2171 (clobber (match_scratch:DI 2 ""))
2172 (clobber (match_scratch:DI 3 ""))
2173 (clobber (match_scratch:DI 4 ""))])]
2176 if (!REG_P (operands[0]) && !REG_P (operands[1]))
2177 operands[1] = force_reg (DImode, operands[1]);
2179 if (!TARGET_POWERPC64)
2181 /* 32-bit mode needs fewer scratch registers, but 32-bit addressing mode
2182 that uses 64-bit registers needs the same scratch registers as 64-bit
2184 emit_insn (gen_bswapdi2_32bit (operands[0], operands[1]));
2189 ;; Power7/cell has ldbrx/stdbrx, so use it directly
2190 (define_insn "*bswapdi2_ldbrx"
2191 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2192 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2193 (clobber (match_scratch:DI 2 "=X,X,&r"))
2194 (clobber (match_scratch:DI 3 "=X,X,&r"))
2195 (clobber (match_scratch:DI 4 "=X,X,&r"))]
2196 "TARGET_POWERPC64 && TARGET_LDBRX
2197 && (REG_P (operands[0]) || REG_P (operands[1]))"
2202 [(set_attr "length" "4,4,36")
2203 (set_attr "type" "load,store,*")])
2205 ;; Non-power7/cell, fall back to use lwbrx/stwbrx
2206 (define_insn "*bswapdi2_64bit"
2207 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2208 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2209 (clobber (match_scratch:DI 2 "=&b,&b,&r"))
2210 (clobber (match_scratch:DI 3 "=&r,&r,&r"))
2211 (clobber (match_scratch:DI 4 "=&r,X,&r"))]
2212 "TARGET_POWERPC64 && !TARGET_LDBRX
2213 && (REG_P (operands[0]) || REG_P (operands[1]))"
2215 [(set_attr "length" "16,12,36")])
2218 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2219 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2220 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2221 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2222 (clobber (match_operand:DI 4 "gpc_reg_operand" ""))]
2223 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2227 rtx dest = operands[0];
2228 rtx src = operands[1];
2229 rtx op2 = operands[2];
2230 rtx op3 = operands[3];
2231 rtx op4 = operands[4];
2232 rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
2233 BYTES_BIG_ENDIAN ? 4 : 0);
2234 rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
2235 BYTES_BIG_ENDIAN ? 4 : 0);
2241 addr1 = XEXP (src, 0);
2242 if (GET_CODE (addr1) == PLUS)
2244 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2245 if (TARGET_AVOID_XFORM)
2247 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2251 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2253 else if (TARGET_AVOID_XFORM)
2255 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2260 emit_move_insn (op2, GEN_INT (4));
2261 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2264 if (BYTES_BIG_ENDIAN)
2266 word_high = change_address (src, SImode, addr1);
2267 word_low = change_address (src, SImode, addr2);
2271 word_high = change_address (src, SImode, addr2);
2272 word_low = change_address (src, SImode, addr1);
2275 emit_insn (gen_bswapsi2 (op3_32, word_low));
2276 emit_insn (gen_bswapsi2 (op4_32, word_high));
2277 emit_insn (gen_ashldi3 (dest, op3, GEN_INT (32)));
2278 emit_insn (gen_iordi3 (dest, dest, op4));
2282 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2283 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2284 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2285 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2286 (clobber (match_operand:DI 4 "" ""))]
2287 "TARGET_POWERPC64 && !TARGET_LDBRX && reload_completed"
2291 rtx dest = operands[0];
2292 rtx src = operands[1];
2293 rtx op2 = operands[2];
2294 rtx op3 = operands[3];
2295 rtx src_si = simplify_gen_subreg (SImode, src, DImode,
2296 BYTES_BIG_ENDIAN ? 4 : 0);
2297 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
2298 BYTES_BIG_ENDIAN ? 4 : 0);
2304 addr1 = XEXP (dest, 0);
2305 if (GET_CODE (addr1) == PLUS)
2307 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2308 if (TARGET_AVOID_XFORM)
2310 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2314 addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
2316 else if (TARGET_AVOID_XFORM)
2318 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2323 emit_move_insn (op2, GEN_INT (4));
2324 addr2 = gen_rtx_PLUS (Pmode, op2, addr1);
2327 emit_insn (gen_lshrdi3 (op3, src, GEN_INT (32)));
2328 if (BYTES_BIG_ENDIAN)
2330 word_high = change_address (dest, SImode, addr1);
2331 word_low = change_address (dest, SImode, addr2);
2332 emit_insn (gen_bswapsi2 (word_high, src_si));
2333 emit_insn (gen_bswapsi2 (word_low, op3_si));
2337 word_high = change_address (dest, SImode, addr2);
2338 word_low = change_address (dest, SImode, addr1);
2339 emit_insn (gen_bswapsi2 (word_low, src_si));
2340 emit_insn (gen_bswapsi2 (word_high, op3_si));
2345 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2346 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2347 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
2348 (clobber (match_operand:DI 3 "gpc_reg_operand" ""))
2349 (clobber (match_operand:DI 4 "" ""))]
2350 "TARGET_POWERPC64 && reload_completed"
2354 rtx dest = operands[0];
2355 rtx src = operands[1];
2356 rtx op2 = operands[2];
2357 rtx op3 = operands[3];
2358 int lo_off = BYTES_BIG_ENDIAN ? 4 : 0;
2359 rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
2360 rtx src_si = simplify_gen_subreg (SImode, src, DImode, lo_off);
2361 rtx op2_si = simplify_gen_subreg (SImode, op2, DImode, lo_off);
2362 rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, lo_off);
2364 emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
2365 emit_insn (gen_bswapsi2 (dest_si, src_si));
2366 emit_insn (gen_bswapsi2 (op3_si, op2_si));
2367 emit_insn (gen_ashldi3 (dest, dest, GEN_INT (32)));
2368 emit_insn (gen_iordi3 (dest, dest, op3));
2371 (define_insn "bswapdi2_32bit"
2372 [(set (match_operand:DI 0 "reg_or_mem_operand" "=&r,Z,??&r")
2373 (bswap:DI (match_operand:DI 1 "reg_or_mem_operand" "Z,r,r")))
2374 (clobber (match_scratch:SI 2 "=&b,&b,X"))]
2375 "!TARGET_POWERPC64 && (REG_P (operands[0]) || REG_P (operands[1]))"
2377 [(set_attr "length" "16,12,36")])
2380 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2381 (bswap:DI (match_operand:DI 1 "indexed_or_indirect_operand" "")))
2382 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2383 "!TARGET_POWERPC64 && reload_completed"
2387 rtx dest = operands[0];
2388 rtx src = operands[1];
2389 rtx op2 = operands[2];
2390 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2391 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2397 addr1 = XEXP (src, 0);
2398 if (GET_CODE (addr1) == PLUS)
2400 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2401 if (TARGET_AVOID_XFORM)
2403 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2407 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2409 else if (TARGET_AVOID_XFORM)
2411 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2416 emit_move_insn (op2, GEN_INT (4));
2417 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2420 word1 = change_address (src, SImode, addr1);
2421 word2 = change_address (src, SImode, addr2);
2423 emit_insn (gen_bswapsi2 (dest2, word1));
2424 emit_insn (gen_bswapsi2 (dest1, word2));
2428 [(set (match_operand:DI 0 "indexed_or_indirect_operand" "")
2429 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2430 (clobber (match_operand:SI 2 "gpc_reg_operand" ""))]
2431 "!TARGET_POWERPC64 && reload_completed"
2435 rtx dest = operands[0];
2436 rtx src = operands[1];
2437 rtx op2 = operands[2];
2438 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2439 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2445 addr1 = XEXP (dest, 0);
2446 if (GET_CODE (addr1) == PLUS)
2448 emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
2449 if (TARGET_AVOID_XFORM)
2451 emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
2455 addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
2457 else if (TARGET_AVOID_XFORM)
2459 emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
2464 emit_move_insn (op2, GEN_INT (4));
2465 addr2 = gen_rtx_PLUS (SImode, op2, addr1);
2468 word1 = change_address (dest, SImode, addr1);
2469 word2 = change_address (dest, SImode, addr2);
2471 emit_insn (gen_bswapsi2 (word2, src1));
2472 emit_insn (gen_bswapsi2 (word1, src2));
2476 [(set (match_operand:DI 0 "gpc_reg_operand" "")
2477 (bswap:DI (match_operand:DI 1 "gpc_reg_operand" "")))
2478 (clobber (match_operand:SI 2 "" ""))]
2479 "!TARGET_POWERPC64 && reload_completed"
2483 rtx dest = operands[0];
2484 rtx src = operands[1];
2485 rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
2486 rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
2487 rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
2488 rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
2490 emit_insn (gen_bswapsi2 (dest1, src2));
2491 emit_insn (gen_bswapsi2 (dest2, src1));
2494 (define_insn "mulsi3"
2495 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2496 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2497 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2503 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2504 (const_string "imul3")
2505 (match_operand:SI 2 "short_cint_operand" "")
2506 (const_string "imul2")]
2507 (const_string "imul")))])
2509 (define_insn "*mulsi3_internal1"
2510 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2511 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2512 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2514 (clobber (match_scratch:SI 3 "=r,r"))]
2519 [(set_attr "type" "imul_compare")
2520 (set_attr "length" "4,8")])
2523 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2524 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2525 (match_operand:SI 2 "gpc_reg_operand" ""))
2527 (clobber (match_scratch:SI 3 ""))]
2530 (mult:SI (match_dup 1) (match_dup 2)))
2532 (compare:CC (match_dup 3)
2536 (define_insn "*mulsi3_internal2"
2537 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2538 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2539 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2541 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2542 (mult:SI (match_dup 1) (match_dup 2)))]
2547 [(set_attr "type" "imul_compare")
2548 (set_attr "length" "4,8")])
2551 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2552 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2553 (match_operand:SI 2 "gpc_reg_operand" ""))
2555 (set (match_operand:SI 0 "gpc_reg_operand" "")
2556 (mult:SI (match_dup 1) (match_dup 2)))]
2559 (mult:SI (match_dup 1) (match_dup 2)))
2561 (compare:CC (match_dup 0)
2566 (define_insn "udiv<mode>3"
2567 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2568 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2569 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2573 (cond [(match_operand:SI 0 "" "")
2574 (const_string "idiv")]
2575 (const_string "ldiv")))])
2578 ;; For powers of two we can do srai/aze for divide and then adjust for
2579 ;; modulus. If it isn't a power of two, force operands into register and do
2581 (define_expand "div<mode>3"
2582 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
2583 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2584 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2587 if (GET_CODE (operands[2]) != CONST_INT
2588 || INTVAL (operands[2]) <= 0
2589 || exact_log2 (INTVAL (operands[2])) < 0)
2590 operands[2] = force_reg (<MODE>mode, operands[2]);
2593 (define_insn "*div<mode>3"
2594 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2595 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2596 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2600 (cond [(match_operand:SI 0 "" "")
2601 (const_string "idiv")]
2602 (const_string "ldiv")))])
2604 (define_expand "mod<mode>3"
2605 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2606 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2607 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2615 if (GET_CODE (operands[2]) != CONST_INT
2616 || INTVAL (operands[2]) <= 0
2617 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2620 temp1 = gen_reg_rtx (<MODE>mode);
2621 temp2 = gen_reg_rtx (<MODE>mode);
2623 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2624 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2625 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2630 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2631 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2632 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2634 "sra<wd>i %0,%1,%p2\;addze %0,%0"
2635 [(set_attr "type" "two")
2636 (set_attr "length" "8")])
2639 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2640 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2641 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2643 (clobber (match_scratch:P 3 "=r,r"))]
2646 sra<wd>i %3,%1,%p2\;addze. %3,%3
2648 [(set_attr "type" "compare")
2649 (set_attr "length" "8,12")
2650 (set_attr "cell_micro" "not")])
2653 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2654 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2655 (match_operand:GPR 2 "exact_log2_cint_operand"
2658 (clobber (match_scratch:GPR 3 ""))]
2661 (div:<MODE> (match_dup 1) (match_dup 2)))
2663 (compare:CC (match_dup 3)
2668 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2669 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2670 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2672 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2673 (div:P (match_dup 1) (match_dup 2)))]
2676 sra<wd>i %0,%1,%p2\;addze. %0,%0
2678 [(set_attr "type" "compare")
2679 (set_attr "length" "8,12")
2680 (set_attr "cell_micro" "not")])
2683 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2684 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2685 (match_operand:GPR 2 "exact_log2_cint_operand"
2688 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2689 (div:GPR (match_dup 1) (match_dup 2)))]
2692 (div:<MODE> (match_dup 1) (match_dup 2)))
2694 (compare:CC (match_dup 0)
2698 ;; Logical instructions
2699 ;; The logical instructions are mostly combined by using match_operator,
2700 ;; but the plain AND insns are somewhat different because there is no
2701 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2702 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2704 (define_expand "andsi3"
2706 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2707 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2708 (match_operand:SI 2 "and_operand" "")))
2709 (clobber (match_scratch:CC 3 ""))])]
2713 (define_insn "andsi3_mc"
2714 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2715 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2716 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2717 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2718 "rs6000_gen_cell_microcode"
2721 rlwinm %0,%1,0,%m2,%M2
2724 [(set_attr "type" "*,*,fast_compare,fast_compare")])
2726 (define_insn "andsi3_nomc"
2727 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2728 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2729 (match_operand:SI 2 "and_operand" "?r,T")))
2730 (clobber (match_scratch:CC 3 "=X,X"))]
2731 "!rs6000_gen_cell_microcode"
2734 rlwinm %0,%1,0,%m2,%M2")
2736 (define_insn "andsi3_internal0_nomc"
2737 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2738 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2739 (match_operand:SI 2 "and_operand" "?r,T")))]
2740 "!rs6000_gen_cell_microcode"
2743 rlwinm %0,%1,0,%m2,%M2")
2746 ;; Note to set cr's other than cr0 we do the and immediate and then
2747 ;; the test again -- this avoids a mfcr which on the higher end
2748 ;; machines causes an execution serialization
2750 (define_insn "*andsi3_internal2_mc"
2751 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2752 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2753 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2755 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2756 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2757 "TARGET_32BIT && rs6000_gen_cell_microcode"
2762 rlwinm. %3,%1,0,%m2,%M2
2767 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2768 compare,compare,compare,compare")
2769 (set_attr "length" "4,4,4,4,8,8,8,8")])
2771 (define_insn "*andsi3_internal3_mc"
2772 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2773 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2774 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2776 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2777 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2778 "TARGET_64BIT && rs6000_gen_cell_microcode"
2783 rlwinm. %3,%1,0,%m2,%M2
2788 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2789 compare,compare,compare")
2790 (set_attr "length" "8,4,4,4,8,8,8,8")])
2793 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
2794 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2795 (match_operand:GPR 2 "and_operand" ""))
2797 (clobber (match_scratch:GPR 3 ""))
2798 (clobber (match_scratch:CC 4 ""))]
2800 [(parallel [(set (match_dup 3)
2801 (and:<MODE> (match_dup 1)
2803 (clobber (match_dup 4))])
2805 (compare:CC (match_dup 3)
2809 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2810 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2813 [(set (match_operand:CC 0 "cc_reg_operand" "")
2814 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2815 (match_operand:SI 2 "gpc_reg_operand" ""))
2817 (clobber (match_scratch:SI 3 ""))
2818 (clobber (match_scratch:CC 4 ""))]
2819 "TARGET_POWERPC64 && reload_completed"
2820 [(parallel [(set (match_dup 3)
2821 (and:SI (match_dup 1)
2823 (clobber (match_dup 4))])
2825 (compare:CC (match_dup 3)
2829 (define_insn "*andsi3_internal4"
2830 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2831 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2832 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2834 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2835 (and:SI (match_dup 1)
2837 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2838 "TARGET_32BIT && rs6000_gen_cell_microcode"
2843 rlwinm. %0,%1,0,%m2,%M2
2848 [(set_attr "type" "fast_compare,fast_compare,fast_compare,delayed_compare,\
2849 compare,compare,compare,compare")
2850 (set_attr "length" "4,4,4,4,8,8,8,8")])
2852 (define_insn "*andsi3_internal5_mc"
2853 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2854 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2855 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2857 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2858 (and:SI (match_dup 1)
2860 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2861 "TARGET_64BIT && rs6000_gen_cell_microcode"
2866 rlwinm. %0,%1,0,%m2,%M2
2871 [(set_attr "type" "compare,fast_compare,fast_compare,delayed_compare,compare,\
2872 compare,compare,compare")
2873 (set_attr "length" "8,4,4,4,8,8,8,8")])
2876 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
2877 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2878 (match_operand:SI 2 "and_operand" ""))
2880 (set (match_operand:SI 0 "gpc_reg_operand" "")
2881 (and:SI (match_dup 1)
2883 (clobber (match_scratch:CC 4 ""))]
2885 [(parallel [(set (match_dup 0)
2886 (and:SI (match_dup 1)
2888 (clobber (match_dup 4))])
2890 (compare:CC (match_dup 0)
2895 [(set (match_operand:CC 3 "cc_reg_operand" "")
2896 (compare:CC (and: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 (and:SI (match_dup 1)
2902 (clobber (match_scratch:CC 4 ""))]
2903 "TARGET_POWERPC64 && reload_completed"
2904 [(parallel [(set (match_dup 0)
2905 (and:SI (match_dup 1)
2907 (clobber (match_dup 4))])
2909 (compare:CC (match_dup 0)
2913 ;; Handle the PowerPC64 rlwinm corner case
2915 (define_insn_and_split "*andsi3_internal6"
2916 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2917 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2918 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2923 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2926 (rotate:SI (match_dup 0) (match_dup 5)))]
2929 int mb = extract_MB (operands[2]);
2930 int me = extract_ME (operands[2]);
2931 operands[3] = GEN_INT (me + 1);
2932 operands[5] = GEN_INT (32 - (me + 1));
2933 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2935 [(set_attr "length" "8")])
2937 (define_expand "iorsi3"
2938 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2939 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2940 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2944 if (GET_CODE (operands[2]) == CONST_INT
2945 && ! logical_operand (operands[2], SImode))
2947 HOST_WIDE_INT value = INTVAL (operands[2]);
2948 rtx tmp = ((!can_create_pseudo_p ()
2949 || rtx_equal_p (operands[0], operands[1]))
2950 ? operands[0] : gen_reg_rtx (SImode));
2952 emit_insn (gen_iorsi3 (tmp, operands[1],
2953 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2954 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2959 (define_expand "xorsi3"
2960 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2961 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2962 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2966 if (GET_CODE (operands[2]) == CONST_INT
2967 && ! logical_operand (operands[2], SImode))
2969 HOST_WIDE_INT value = INTVAL (operands[2]);
2970 rtx tmp = ((!can_create_pseudo_p ()
2971 || rtx_equal_p (operands[0], operands[1]))
2972 ? operands[0] : gen_reg_rtx (SImode));
2974 emit_insn (gen_xorsi3 (tmp, operands[1],
2975 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2976 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2981 (define_insn "*boolsi3_internal1"
2982 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2983 (match_operator:SI 3 "boolean_or_operator"
2984 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2985 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2992 (define_insn "*boolsi3_internal2"
2993 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2994 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2995 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2996 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2998 (clobber (match_scratch:SI 3 "=r,r"))]
3003 [(set_attr "type" "fast_compare,compare")
3004 (set_attr "length" "4,8")])
3007 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3008 (compare:CC (match_operator:SI 4 "boolean_operator"
3009 [(match_operand:SI 1 "gpc_reg_operand" "")
3010 (match_operand:SI 2 "gpc_reg_operand" "")])
3012 (clobber (match_scratch:SI 3 ""))]
3013 "TARGET_32BIT && reload_completed"
3014 [(set (match_dup 3) (match_dup 4))
3016 (compare:CC (match_dup 3)
3020 (define_insn "*boolsi3_internal3"
3021 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3022 (compare:CC (match_operator:SI 4 "boolean_operator"
3023 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3024 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3026 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3032 [(set_attr "type" "fast_compare,compare")
3033 (set_attr "length" "4,8")])
3036 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3037 (compare:CC (match_operator:SI 4 "boolean_operator"
3038 [(match_operand:SI 1 "gpc_reg_operand" "")
3039 (match_operand:SI 2 "gpc_reg_operand" "")])
3041 (set (match_operand:SI 0 "gpc_reg_operand" "")
3043 "TARGET_32BIT && reload_completed"
3044 [(set (match_dup 0) (match_dup 4))
3046 (compare:CC (match_dup 0)
3050 ;; Split a logical operation that we can't do in one insn into two insns,
3051 ;; each of which does one 16-bit part. This is used by combine.
3054 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3055 (match_operator:SI 3 "boolean_or_operator"
3056 [(match_operand:SI 1 "gpc_reg_operand" "")
3057 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3059 [(set (match_dup 0) (match_dup 4))
3060 (set (match_dup 0) (match_dup 5))]
3064 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3065 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3067 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3068 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
3072 (define_insn "*boolcsi3_internal1"
3073 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3074 (match_operator:SI 3 "boolean_operator"
3075 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3076 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3080 (define_insn "*boolcsi3_internal2"
3081 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3082 (compare:CC (match_operator:SI 4 "boolean_operator"
3083 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3084 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3086 (clobber (match_scratch:SI 3 "=r,r"))]
3091 [(set_attr "type" "compare")
3092 (set_attr "length" "4,8")])
3095 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3096 (compare:CC (match_operator:SI 4 "boolean_operator"
3097 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3098 (match_operand:SI 2 "gpc_reg_operand" "")])
3100 (clobber (match_scratch:SI 3 ""))]
3101 "TARGET_32BIT && reload_completed"
3102 [(set (match_dup 3) (match_dup 4))
3104 (compare:CC (match_dup 3)
3108 (define_insn "*boolcsi3_internal3"
3109 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3110 (compare:CC (match_operator:SI 4 "boolean_operator"
3111 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3112 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3114 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3120 [(set_attr "type" "compare")
3121 (set_attr "length" "4,8")])
3124 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3125 (compare:CC (match_operator:SI 4 "boolean_operator"
3126 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3127 (match_operand:SI 2 "gpc_reg_operand" "")])
3129 (set (match_operand:SI 0 "gpc_reg_operand" "")
3131 "TARGET_32BIT && reload_completed"
3132 [(set (match_dup 0) (match_dup 4))
3134 (compare:CC (match_dup 0)
3138 (define_insn "*boolccsi3_internal1"
3139 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3140 (match_operator:SI 3 "boolean_operator"
3141 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3142 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3146 (define_insn "*boolccsi3_internal2"
3147 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3148 (compare:CC (match_operator:SI 4 "boolean_operator"
3149 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3150 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3152 (clobber (match_scratch:SI 3 "=r,r"))]
3157 [(set_attr "type" "fast_compare,compare")
3158 (set_attr "length" "4,8")])
3161 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3162 (compare:CC (match_operator:SI 4 "boolean_operator"
3163 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3164 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3166 (clobber (match_scratch:SI 3 ""))]
3167 "TARGET_32BIT && reload_completed"
3168 [(set (match_dup 3) (match_dup 4))
3170 (compare:CC (match_dup 3)
3174 (define_insn "*boolccsi3_internal3"
3175 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3176 (compare:CC (match_operator:SI 4 "boolean_operator"
3177 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3178 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3180 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3186 [(set_attr "type" "fast_compare,compare")
3187 (set_attr "length" "4,8")])
3190 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3191 (compare:CC (match_operator:SI 4 "boolean_operator"
3192 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3193 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3195 (set (match_operand:SI 0 "gpc_reg_operand" "")
3197 "TARGET_32BIT && reload_completed"
3198 [(set (match_dup 0) (match_dup 4))
3200 (compare:CC (match_dup 0)
3204 ;; Rotate and shift insns, in all their variants. These support shifts,
3205 ;; field inserts and extracts, and various combinations thereof.
3206 (define_expand "insv"
3207 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3208 (match_operand:SI 1 "const_int_operand" "")
3209 (match_operand:SI 2 "const_int_operand" ""))
3210 (match_operand 3 "gpc_reg_operand" ""))]
3214 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3215 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3216 compiler if the address of the structure is taken later. Likewise, do
3217 not handle invalid E500 subregs. */
3218 if (GET_CODE (operands[0]) == SUBREG
3219 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD
3220 || ((TARGET_E500_DOUBLE || TARGET_SPE)
3221 && invalid_e500_subreg (operands[0], GET_MODE (operands[0])))))
3224 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3225 emit_insn (gen_insvdi_internal (operands[0], operands[1], operands[2],
3228 emit_insn (gen_insvsi_internal (operands[0], operands[1], operands[2],
3233 (define_insn "insvsi_internal"
3234 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3235 (match_operand:SI 1 "const_int_operand" "i")
3236 (match_operand:SI 2 "const_int_operand" "i"))
3237 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3241 int start = INTVAL (operands[2]) & 31;
3242 int size = INTVAL (operands[1]) & 31;
3244 operands[4] = GEN_INT (32 - start - size);
3245 operands[1] = GEN_INT (start + size - 1);
3246 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3248 [(set_attr "type" "insert_word")])
3250 (define_insn "*insvsi_internal1"
3251 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3252 (match_operand:SI 1 "const_int_operand" "i")
3253 (match_operand:SI 2 "const_int_operand" "i"))
3254 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3255 (match_operand:SI 4 "const_int_operand" "i")))]
3256 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3259 int shift = INTVAL (operands[4]) & 31;
3260 int start = INTVAL (operands[2]) & 31;
3261 int size = INTVAL (operands[1]) & 31;
3263 operands[4] = GEN_INT (shift - start - size);
3264 operands[1] = GEN_INT (start + size - 1);
3265 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3267 [(set_attr "type" "insert_word")])
3269 (define_insn "*insvsi_internal2"
3270 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3271 (match_operand:SI 1 "const_int_operand" "i")
3272 (match_operand:SI 2 "const_int_operand" "i"))
3273 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3274 (match_operand:SI 4 "const_int_operand" "i")))]
3275 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3278 int shift = INTVAL (operands[4]) & 31;
3279 int start = INTVAL (operands[2]) & 31;
3280 int size = INTVAL (operands[1]) & 31;
3282 operands[4] = GEN_INT (32 - shift - start - size);
3283 operands[1] = GEN_INT (start + size - 1);
3284 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3286 [(set_attr "type" "insert_word")])
3288 (define_insn "*insvsi_internal3"
3289 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3290 (match_operand:SI 1 "const_int_operand" "i")
3291 (match_operand:SI 2 "const_int_operand" "i"))
3292 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3293 (match_operand:SI 4 "const_int_operand" "i")))]
3294 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3297 int shift = INTVAL (operands[4]) & 31;
3298 int start = INTVAL (operands[2]) & 31;
3299 int size = INTVAL (operands[1]) & 31;
3301 operands[4] = GEN_INT (32 - shift - start - size);
3302 operands[1] = GEN_INT (start + size - 1);
3303 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3305 [(set_attr "type" "insert_word")])
3307 (define_insn "*insvsi_internal4"
3308 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3309 (match_operand:SI 1 "const_int_operand" "i")
3310 (match_operand:SI 2 "const_int_operand" "i"))
3311 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3312 (match_operand:SI 4 "const_int_operand" "i")
3313 (match_operand:SI 5 "const_int_operand" "i")))]
3314 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3317 int extract_start = INTVAL (operands[5]) & 31;
3318 int extract_size = INTVAL (operands[4]) & 31;
3319 int insert_start = INTVAL (operands[2]) & 31;
3320 int insert_size = INTVAL (operands[1]) & 31;
3322 /* Align extract field with insert field */
3323 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3324 operands[1] = GEN_INT (insert_start + insert_size - 1);
3325 return \"rlwimi %0,%3,%h5,%h2,%h1\";
3327 [(set_attr "type" "insert_word")])
3329 ;; combine patterns for rlwimi
3330 (define_insn "*insvsi_internal5"
3331 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3332 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3333 (match_operand:SI 1 "mask_operand" "i"))
3334 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3335 (match_operand:SI 2 "const_int_operand" "i"))
3336 (match_operand:SI 5 "mask_operand" "i"))))]
3337 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3340 int me = extract_ME(operands[5]);
3341 int mb = extract_MB(operands[5]);
3342 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3343 operands[2] = GEN_INT(mb);
3344 operands[1] = GEN_INT(me);
3345 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3347 [(set_attr "type" "insert_word")])
3349 (define_insn "*insvsi_internal6"
3350 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3351 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3352 (match_operand:SI 2 "const_int_operand" "i"))
3353 (match_operand:SI 5 "mask_operand" "i"))
3354 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3355 (match_operand:SI 1 "mask_operand" "i"))))]
3356 "INTVAL(operands[1]) == ~INTVAL(operands[5])"
3359 int me = extract_ME(operands[5]);
3360 int mb = extract_MB(operands[5]);
3361 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3362 operands[2] = GEN_INT(mb);
3363 operands[1] = GEN_INT(me);
3364 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3366 [(set_attr "type" "insert_word")])
3368 (define_insn "insvdi_internal"
3369 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3370 (match_operand:SI 1 "const_int_operand" "i")
3371 (match_operand:SI 2 "const_int_operand" "i"))
3372 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3376 int start = INTVAL (operands[2]) & 63;
3377 int size = INTVAL (operands[1]) & 63;
3379 operands[1] = GEN_INT (64 - start - size);
3380 return \"rldimi %0,%3,%H1,%H2\";
3382 [(set_attr "type" "insert_dword")])
3384 (define_insn "*insvdi_internal2"
3385 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3386 (match_operand:SI 1 "const_int_operand" "i")
3387 (match_operand:SI 2 "const_int_operand" "i"))
3388 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3389 (match_operand:SI 4 "const_int_operand" "i")))]
3391 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3394 int shift = INTVAL (operands[4]) & 63;
3395 int start = (INTVAL (operands[2]) & 63) - 32;
3396 int size = INTVAL (operands[1]) & 63;
3398 operands[4] = GEN_INT (64 - shift - start - size);
3399 operands[2] = GEN_INT (start);
3400 operands[1] = GEN_INT (start + size - 1);
3401 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3404 (define_insn "*insvdi_internal3"
3405 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3406 (match_operand:SI 1 "const_int_operand" "i")
3407 (match_operand:SI 2 "const_int_operand" "i"))
3408 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3409 (match_operand:SI 4 "const_int_operand" "i")))]
3411 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3414 int shift = INTVAL (operands[4]) & 63;
3415 int start = (INTVAL (operands[2]) & 63) - 32;
3416 int size = INTVAL (operands[1]) & 63;
3418 operands[4] = GEN_INT (64 - shift - start - size);
3419 operands[2] = GEN_INT (start);
3420 operands[1] = GEN_INT (start + size - 1);
3421 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3424 (define_expand "extzv"
3425 [(set (match_operand 0 "gpc_reg_operand" "")
3426 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3427 (match_operand:SI 2 "const_int_operand" "")
3428 (match_operand:SI 3 "const_int_operand" "")))]
3432 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3433 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3434 compiler if the address of the structure is taken later. */
3435 if (GET_CODE (operands[0]) == SUBREG
3436 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3439 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3440 emit_insn (gen_extzvdi_internal (operands[0], operands[1], operands[2],
3443 emit_insn (gen_extzvsi_internal (operands[0], operands[1], operands[2],
3448 (define_insn "extzvsi_internal"
3449 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3450 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3451 (match_operand:SI 2 "const_int_operand" "i")
3452 (match_operand:SI 3 "const_int_operand" "i")))]
3456 int start = INTVAL (operands[3]) & 31;
3457 int size = INTVAL (operands[2]) & 31;
3459 if (start + size >= 32)
3460 operands[3] = const0_rtx;
3462 operands[3] = GEN_INT (start + size);
3463 return \"rlwinm %0,%1,%3,%s2,31\";
3466 (define_insn "*extzvsi_internal1"
3467 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3468 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3469 (match_operand:SI 2 "const_int_operand" "i,i")
3470 (match_operand:SI 3 "const_int_operand" "i,i"))
3472 (clobber (match_scratch:SI 4 "=r,r"))]
3476 int start = INTVAL (operands[3]) & 31;
3477 int size = INTVAL (operands[2]) & 31;
3479 /* Force split for non-cc0 compare. */
3480 if (which_alternative == 1)
3483 /* If the bit-field being tested fits in the upper or lower half of a
3484 word, it is possible to use andiu. or andil. to test it. This is
3485 useful because the condition register set-use delay is smaller for
3486 andi[ul]. than for rlinm. This doesn't work when the starting bit
3487 position is 0 because the LT and GT bits may be set wrong. */
3489 if ((start > 0 && start + size <= 16) || start >= 16)
3491 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3492 - (1 << (16 - (start & 15) - size))));
3494 return \"andis. %4,%1,%3\";
3496 return \"andi. %4,%1,%3\";
3499 if (start + size >= 32)
3500 operands[3] = const0_rtx;
3502 operands[3] = GEN_INT (start + size);
3503 return \"rlwinm. %4,%1,%3,%s2,31\";
3505 [(set_attr "type" "delayed_compare")
3506 (set_attr "length" "4,8")])
3509 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3510 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3511 (match_operand:SI 2 "const_int_operand" "")
3512 (match_operand:SI 3 "const_int_operand" ""))
3514 (clobber (match_scratch:SI 4 ""))]
3517 (zero_extract:SI (match_dup 1) (match_dup 2)
3520 (compare:CC (match_dup 4)
3524 (define_insn "*extzvsi_internal2"
3525 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3526 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3527 (match_operand:SI 2 "const_int_operand" "i,i")
3528 (match_operand:SI 3 "const_int_operand" "i,i"))
3530 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3531 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3535 int start = INTVAL (operands[3]) & 31;
3536 int size = INTVAL (operands[2]) & 31;
3538 /* Force split for non-cc0 compare. */
3539 if (which_alternative == 1)
3542 /* Since we are using the output value, we can't ignore any need for
3543 a shift. The bit-field must end at the LSB. */
3544 if (start >= 16 && start + size == 32)
3546 operands[3] = GEN_INT ((1 << size) - 1);
3547 return \"andi. %0,%1,%3\";
3550 if (start + size >= 32)
3551 operands[3] = const0_rtx;
3553 operands[3] = GEN_INT (start + size);
3554 return \"rlwinm. %0,%1,%3,%s2,31\";
3556 [(set_attr "type" "delayed_compare")
3557 (set_attr "length" "4,8")])
3560 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3561 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3562 (match_operand:SI 2 "const_int_operand" "")
3563 (match_operand:SI 3 "const_int_operand" ""))
3565 (set (match_operand:SI 0 "gpc_reg_operand" "")
3566 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3569 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3571 (compare:CC (match_dup 0)
3575 (define_insn "extzvdi_internal"
3576 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3577 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3578 (match_operand:SI 2 "const_int_operand" "i")
3579 (match_operand:SI 3 "const_int_operand" "i")))]
3583 int start = INTVAL (operands[3]) & 63;
3584 int size = INTVAL (operands[2]) & 63;
3586 if (start + size >= 64)
3587 operands[3] = const0_rtx;
3589 operands[3] = GEN_INT (start + size);
3590 operands[2] = GEN_INT (64 - size);
3591 return \"rldicl %0,%1,%3,%2\";
3594 (define_insn "*extzvdi_internal1"
3595 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3596 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3597 (match_operand:SI 2 "const_int_operand" "i")
3598 (match_operand:SI 3 "const_int_operand" "i"))
3600 (clobber (match_scratch:DI 4 "=r"))]
3601 "TARGET_64BIT && rs6000_gen_cell_microcode"
3604 int start = INTVAL (operands[3]) & 63;
3605 int size = INTVAL (operands[2]) & 63;
3607 if (start + size >= 64)
3608 operands[3] = const0_rtx;
3610 operands[3] = GEN_INT (start + size);
3611 operands[2] = GEN_INT (64 - size);
3612 return \"rldicl. %4,%1,%3,%2\";
3614 [(set_attr "type" "compare")])
3616 (define_insn "*extzvdi_internal2"
3617 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3618 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3619 (match_operand:SI 2 "const_int_operand" "i")
3620 (match_operand:SI 3 "const_int_operand" "i"))
3622 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3623 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3624 "TARGET_64BIT && rs6000_gen_cell_microcode"
3627 int start = INTVAL (operands[3]) & 63;
3628 int size = INTVAL (operands[2]) & 63;
3630 if (start + size >= 64)
3631 operands[3] = const0_rtx;
3633 operands[3] = GEN_INT (start + size);
3634 operands[2] = GEN_INT (64 - size);
3635 return \"rldicl. %0,%1,%3,%2\";
3637 [(set_attr "type" "compare")])
3639 (define_insn "rotlsi3"
3640 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3641 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3642 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
3645 rlwnm %0,%1,%2,0xffffffff
3646 rlwinm %0,%1,%h2,0xffffffff"
3647 [(set_attr "type" "var_shift_rotate,integer")])
3649 (define_insn "*rotlsi3_64"
3650 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3652 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3653 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
3656 rlwnm %0,%1,%2,0xffffffff
3657 rlwinm %0,%1,%h2,0xffffffff"
3658 [(set_attr "type" "var_shift_rotate,integer")])
3660 (define_insn "*rotlsi3_internal2"
3661 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3662 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3663 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3665 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3668 rlwnm. %3,%1,%2,0xffffffff
3669 rlwinm. %3,%1,%h2,0xffffffff
3672 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3673 (set_attr "length" "4,4,8,8")])
3676 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3677 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3678 (match_operand:SI 2 "reg_or_cint_operand" ""))
3680 (clobber (match_scratch:SI 3 ""))]
3683 (rotate:SI (match_dup 1) (match_dup 2)))
3685 (compare:CC (match_dup 3)
3689 (define_insn "*rotlsi3_internal3"
3690 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3691 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3692 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3694 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3695 (rotate:SI (match_dup 1) (match_dup 2)))]
3698 rlwnm. %0,%1,%2,0xffffffff
3699 rlwinm. %0,%1,%h2,0xffffffff
3702 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3703 (set_attr "length" "4,4,8,8")])
3706 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3707 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3708 (match_operand:SI 2 "reg_or_cint_operand" ""))
3710 (set (match_operand:SI 0 "gpc_reg_operand" "")
3711 (rotate:SI (match_dup 1) (match_dup 2)))]
3714 (rotate:SI (match_dup 1) (match_dup 2)))
3716 (compare:CC (match_dup 0)
3720 (define_insn "*rotlsi3_internal4"
3721 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3722 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3723 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
3724 (match_operand:SI 3 "mask_operand" "n,n")))]
3727 rlwnm %0,%1,%2,%m3,%M3
3728 rlwinm %0,%1,%h2,%m3,%M3"
3729 [(set_attr "type" "var_shift_rotate,integer")])
3731 (define_insn "*rotlsi3_internal5"
3732 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3734 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3735 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3736 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3738 (clobber (match_scratch:SI 4 "=r,r,r,r"))]
3741 rlwnm. %4,%1,%2,%m3,%M3
3742 rlwinm. %4,%1,%h2,%m3,%M3
3745 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3746 (set_attr "length" "4,4,8,8")])
3749 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3751 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3752 (match_operand:SI 2 "reg_or_cint_operand" ""))
3753 (match_operand:SI 3 "mask_operand" ""))
3755 (clobber (match_scratch:SI 4 ""))]
3758 (and:SI (rotate:SI (match_dup 1)
3762 (compare:CC (match_dup 4)
3766 (define_insn "*rotlsi3_internal6"
3767 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
3769 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3770 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3771 (match_operand:SI 3 "mask_operand" "n,n,n,n"))
3773 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3774 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3777 rlwnm. %0,%1,%2,%m3,%M3
3778 rlwinm. %0,%1,%h2,%m3,%M3
3781 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3782 (set_attr "length" "4,4,8,8")])
3785 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
3787 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3788 (match_operand:SI 2 "reg_or_cint_operand" ""))
3789 (match_operand:SI 3 "mask_operand" ""))
3791 (set (match_operand:SI 0 "gpc_reg_operand" "")
3792 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3795 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3797 (compare:CC (match_dup 0)
3801 (define_insn "*rotlsi3_internal7le"
3802 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3805 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3806 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3808 "rlw%I2nm %0,%1,%h2,0xff"
3809 [(set (attr "cell_micro")
3810 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3811 (const_string "not")
3812 (const_string "always")))])
3814 (define_insn "*rotlsi3_internal7be"
3815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3818 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3819 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 3)))]
3821 "rlw%I2nm %0,%1,%h2,0xff"
3822 [(set (attr "cell_micro")
3823 (if_then_else (match_operand:SI 2 "const_int_operand" "")
3824 (const_string "not")
3825 (const_string "always")))])
3827 (define_insn "*rotlsi3_internal8le"
3828 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3829 (compare:CC (zero_extend:SI
3831 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3832 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3834 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3837 rlwnm. %3,%1,%2,0xff
3838 rlwinm. %3,%1,%h2,0xff
3841 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3842 (set_attr "length" "4,4,8,8")])
3844 (define_insn "*rotlsi3_internal8be"
3845 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3846 (compare:CC (zero_extend:SI
3848 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3849 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
3851 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
3854 rlwnm. %3,%1,%2,0xff
3855 rlwinm. %3,%1,%h2,0xff
3858 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3859 (set_attr "length" "4,4,8,8")])
3862 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3863 (compare:CC (zero_extend:SI
3865 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3866 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3868 (clobber (match_scratch:SI 3 ""))]
3869 "!BYTES_BIG_ENDIAN && reload_completed"
3871 (zero_extend:SI (subreg:QI
3872 (rotate:SI (match_dup 1)
3875 (compare:CC (match_dup 3)
3880 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
3881 (compare:CC (zero_extend:SI
3883 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3884 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
3886 (clobber (match_scratch:SI 3 ""))]
3887 "BYTES_BIG_ENDIAN && reload_completed"
3889 (zero_extend:SI (subreg:QI
3890 (rotate:SI (match_dup 1)
3893 (compare:CC (match_dup 3)
3897 (define_insn "*rotlsi3_internal9le"
3898 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3899 (compare:CC (zero_extend:SI
3901 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3902 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3904 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3905 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3908 rlwnm. %0,%1,%2,0xff
3909 rlwinm. %0,%1,%h2,0xff
3912 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3913 (set_attr "length" "4,4,8,8")])
3915 (define_insn "*rotlsi3_internal9be"
3916 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3917 (compare:CC (zero_extend:SI
3919 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3920 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 3))
3922 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3923 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
3926 rlwnm. %0,%1,%2,0xff
3927 rlwinm. %0,%1,%h2,0xff
3930 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
3931 (set_attr "length" "4,4,8,8")])
3934 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3935 (compare:CC (zero_extend:SI
3937 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3938 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3940 (set (match_operand:SI 0 "gpc_reg_operand" "")
3941 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3942 "!BYTES_BIG_ENDIAN && reload_completed"
3944 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3946 (compare:CC (match_dup 0)
3951 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
3952 (compare:CC (zero_extend:SI
3954 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3955 (match_operand:SI 2 "reg_or_cint_operand" "")) 3))
3957 (set (match_operand:SI 0 "gpc_reg_operand" "")
3958 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))]
3959 "BYTES_BIG_ENDIAN && reload_completed"
3961 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 3)))
3963 (compare:CC (match_dup 0)
3967 (define_insn "*rotlsi3_internal10le"
3968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3971 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3972 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 0)))]
3975 rlwnm %0,%1,%2,0xffff
3976 rlwinm %0,%1,%h2,0xffff"
3977 [(set_attr "type" "var_shift_rotate,integer")])
3979 (define_insn "*rotlsi3_internal10be"
3980 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3983 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3984 (match_operand:SI 2 "reg_or_cint_operand" "r,i")) 2)))]
3987 rlwnm %0,%1,%2,0xffff
3988 rlwinm %0,%1,%h2,0xffff"
3989 [(set_attr "type" "var_shift_rotate,integer")])
3991 (define_insn "*rotlsi3_internal11le"
3992 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3993 (compare:CC (zero_extend:SI
3995 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3996 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
3998 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4001 rlwnm. %3,%1,%2,0xffff
4002 rlwinm. %3,%1,%h2,0xffff
4005 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4006 (set_attr "length" "4,4,8,8")])
4008 (define_insn "*rotlsi3_internal11be"
4009 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4010 (compare:CC (zero_extend:SI
4012 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4013 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4015 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4018 rlwnm. %3,%1,%2,0xffff
4019 rlwinm. %3,%1,%h2,0xffff
4022 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4023 (set_attr "length" "4,4,8,8")])
4026 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4027 (compare:CC (zero_extend:SI
4029 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4030 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4032 (clobber (match_scratch:SI 3 ""))]
4033 "!BYTES_BIG_ENDIAN && reload_completed"
4035 (zero_extend:SI (subreg:HI
4036 (rotate:SI (match_dup 1)
4039 (compare:CC (match_dup 3)
4044 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4045 (compare:CC (zero_extend:SI
4047 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4048 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4050 (clobber (match_scratch:SI 3 ""))]
4051 "BYTES_BIG_ENDIAN && reload_completed"
4053 (zero_extend:SI (subreg:HI
4054 (rotate:SI (match_dup 1)
4057 (compare:CC (match_dup 3)
4061 (define_insn "*rotlsi3_internal12le"
4062 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4063 (compare:CC (zero_extend:SI
4065 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4066 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
4068 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4069 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4072 rlwnm. %0,%1,%2,0xffff
4073 rlwinm. %0,%1,%h2,0xffff
4076 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4077 (set_attr "length" "4,4,8,8")])
4079 (define_insn "*rotlsi3_internal12be"
4080 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4081 (compare:CC (zero_extend:SI
4083 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4084 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i")) 2))
4086 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4087 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4090 rlwnm. %0,%1,%2,0xffff
4091 rlwinm. %0,%1,%h2,0xffff
4094 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4095 (set_attr "length" "4,4,8,8")])
4098 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4099 (compare:CC (zero_extend:SI
4101 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4102 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4104 (set (match_operand:SI 0 "gpc_reg_operand" "")
4105 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4106 "!BYTES_BIG_ENDIAN && reload_completed"
4108 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4110 (compare:CC (match_dup 0)
4115 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4116 (compare:CC (zero_extend:SI
4118 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4119 (match_operand:SI 2 "reg_or_cint_operand" "")) 2))
4121 (set (match_operand:SI 0 "gpc_reg_operand" "")
4122 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))]
4123 "BYTES_BIG_ENDIAN && reload_completed"
4125 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 2)))
4127 (compare:CC (match_dup 0)
4131 (define_insn "ashlsi3"
4132 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4133 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4134 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4139 [(set_attr "type" "var_shift_rotate,shift")])
4141 (define_insn "*ashlsi3_64"
4142 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4144 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4145 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4150 [(set_attr "type" "var_shift_rotate,shift")])
4153 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4154 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4155 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4157 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4164 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4165 (set_attr "length" "4,4,8,8")])
4168 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4169 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4170 (match_operand:SI 2 "reg_or_cint_operand" ""))
4172 (clobber (match_scratch:SI 3 ""))]
4173 "TARGET_32BIT && reload_completed"
4175 (ashift:SI (match_dup 1) (match_dup 2)))
4177 (compare:CC (match_dup 3)
4182 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4183 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4184 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4186 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4187 (ashift:SI (match_dup 1) (match_dup 2)))]
4194 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4195 (set_attr "length" "4,4,8,8")])
4198 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4199 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4200 (match_operand:SI 2 "reg_or_cint_operand" ""))
4202 (set (match_operand:SI 0 "gpc_reg_operand" "")
4203 (ashift:SI (match_dup 1) (match_dup 2)))]
4204 "TARGET_32BIT && reload_completed"
4206 (ashift:SI (match_dup 1) (match_dup 2)))
4208 (compare:CC (match_dup 0)
4212 (define_insn "rlwinm"
4213 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4214 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4215 (match_operand:SI 2 "const_int_operand" "i"))
4216 (match_operand:SI 3 "mask_operand" "n")))]
4217 "includes_lshift_p (operands[2], operands[3])"
4218 "rlwinm %0,%1,%h2,%m3,%M3")
4221 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4223 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4224 (match_operand:SI 2 "const_int_operand" "i,i"))
4225 (match_operand:SI 3 "mask_operand" "n,n"))
4227 (clobber (match_scratch:SI 4 "=r,r"))]
4228 "includes_lshift_p (operands[2], operands[3])"
4230 rlwinm. %4,%1,%h2,%m3,%M3
4232 [(set_attr "type" "delayed_compare")
4233 (set_attr "length" "4,8")])
4236 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4238 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4239 (match_operand:SI 2 "const_int_operand" ""))
4240 (match_operand:SI 3 "mask_operand" ""))
4242 (clobber (match_scratch:SI 4 ""))]
4243 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4245 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4248 (compare:CC (match_dup 4)
4253 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4255 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4256 (match_operand:SI 2 "const_int_operand" "i,i"))
4257 (match_operand:SI 3 "mask_operand" "n,n"))
4259 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4260 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4261 "includes_lshift_p (operands[2], operands[3])"
4263 rlwinm. %0,%1,%h2,%m3,%M3
4265 [(set_attr "type" "delayed_compare")
4266 (set_attr "length" "4,8")])
4269 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4271 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4272 (match_operand:SI 2 "const_int_operand" ""))
4273 (match_operand:SI 3 "mask_operand" ""))
4275 (set (match_operand:SI 0 "gpc_reg_operand" "")
4276 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4277 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4279 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4281 (compare:CC (match_dup 0)
4285 (define_insn "lshrsi3"
4286 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4287 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4288 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i")))]
4294 [(set_attr "type" "integer,var_shift_rotate,shift")])
4296 (define_insn "*lshrsi3_64"
4297 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4299 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4300 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4305 [(set_attr "type" "var_shift_rotate,shift")])
4308 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4309 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4310 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4312 (clobber (match_scratch:SI 3 "=X,r,r,X,r,r"))]
4321 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4322 (set_attr "length" "4,4,4,8,8,8")])
4325 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4326 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4327 (match_operand:SI 2 "reg_or_cint_operand" ""))
4329 (clobber (match_scratch:SI 3 ""))]
4330 "TARGET_32BIT && reload_completed"
4332 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4334 (compare:CC (match_dup 3)
4339 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4340 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4341 (match_operand:SI 2 "reg_or_cint_operand" "O,r,i,O,r,i"))
4343 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4344 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4353 [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4354 (set_attr "length" "4,4,4,8,8,8")])
4357 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4358 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4359 (match_operand:SI 2 "reg_or_cint_operand" ""))
4361 (set (match_operand:SI 0 "gpc_reg_operand" "")
4362 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4363 "TARGET_32BIT && reload_completed"
4365 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4367 (compare:CC (match_dup 0)
4372 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4373 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4374 (match_operand:SI 2 "const_int_operand" "i"))
4375 (match_operand:SI 3 "mask_operand" "n")))]
4376 "includes_rshift_p (operands[2], operands[3])"
4377 "rlwinm %0,%1,%s2,%m3,%M3")
4380 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4382 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4383 (match_operand:SI 2 "const_int_operand" "i,i"))
4384 (match_operand:SI 3 "mask_operand" "n,n"))
4386 (clobber (match_scratch:SI 4 "=r,r"))]
4387 "includes_rshift_p (operands[2], operands[3])"
4389 rlwinm. %4,%1,%s2,%m3,%M3
4391 [(set_attr "type" "delayed_compare")
4392 (set_attr "length" "4,8")])
4395 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4397 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4398 (match_operand:SI 2 "const_int_operand" ""))
4399 (match_operand:SI 3 "mask_operand" ""))
4401 (clobber (match_scratch:SI 4 ""))]
4402 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4404 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4407 (compare:CC (match_dup 4)
4412 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4414 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4415 (match_operand:SI 2 "const_int_operand" "i,i"))
4416 (match_operand:SI 3 "mask_operand" "n,n"))
4418 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4419 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4420 "includes_rshift_p (operands[2], operands[3])"
4422 rlwinm. %0,%1,%s2,%m3,%M3
4424 [(set_attr "type" "delayed_compare")
4425 (set_attr "length" "4,8")])
4428 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
4430 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4431 (match_operand:SI 2 "const_int_operand" ""))
4432 (match_operand:SI 3 "mask_operand" ""))
4434 (set (match_operand:SI 0 "gpc_reg_operand" "")
4435 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4436 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4438 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4440 (compare:CC (match_dup 0)
4444 (define_insn "*lshiftrt_internal1le"
4445 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4448 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4449 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4450 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4451 "rlwinm %0,%1,%s2,0xff")
4453 (define_insn "*lshiftrt_internal1be"
4454 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4457 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4458 (match_operand:SI 2 "const_int_operand" "i")) 3)))]
4459 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4460 "rlwinm %0,%1,%s2,0xff")
4462 (define_insn "*lshiftrt_internal2le"
4463 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4467 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4468 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4470 (clobber (match_scratch:SI 3 "=r,r"))]
4471 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4473 rlwinm. %3,%1,%s2,0xff
4475 [(set_attr "type" "delayed_compare")
4476 (set_attr "length" "4,8")])
4478 (define_insn "*lshiftrt_internal2be"
4479 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4483 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4484 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4486 (clobber (match_scratch:SI 3 "=r,r"))]
4487 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4489 rlwinm. %3,%1,%s2,0xff
4491 [(set_attr "type" "delayed_compare")
4492 (set_attr "length" "4,8")])
4495 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4499 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4500 (match_operand:SI 2 "const_int_operand" "")) 0))
4502 (clobber (match_scratch:SI 3 ""))]
4503 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4505 (zero_extend:SI (subreg:QI
4506 (lshiftrt:SI (match_dup 1)
4509 (compare:CC (match_dup 3)
4514 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4518 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4519 (match_operand:SI 2 "const_int_operand" "")) 3))
4521 (clobber (match_scratch:SI 3 ""))]
4522 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4524 (zero_extend:SI (subreg:QI
4525 (lshiftrt:SI (match_dup 1)
4528 (compare:CC (match_dup 3)
4532 (define_insn "*lshiftrt_internal3le"
4533 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4537 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4538 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4540 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4541 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4542 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4544 rlwinm. %0,%1,%s2,0xff
4546 [(set_attr "type" "delayed_compare")
4547 (set_attr "length" "4,8")])
4549 (define_insn "*lshiftrt_internal3be"
4550 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4554 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4555 (match_operand:SI 2 "const_int_operand" "i,i")) 3))
4557 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4558 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4559 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255))"
4561 rlwinm. %0,%1,%s2,0xff
4563 [(set_attr "type" "delayed_compare")
4564 (set_attr "length" "4,8")])
4567 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4571 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4572 (match_operand:SI 2 "const_int_operand" "")) 0))
4574 (set (match_operand:SI 0 "gpc_reg_operand" "")
4575 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4576 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4578 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4580 (compare:CC (match_dup 0)
4585 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4589 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4590 (match_operand:SI 2 "const_int_operand" "")) 3))
4592 (set (match_operand:SI 0 "gpc_reg_operand" "")
4593 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))]
4594 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4596 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 3)))
4598 (compare:CC (match_dup 0)
4602 (define_insn "*lshiftrt_internal4le"
4603 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4606 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4607 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4608 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4609 "rlwinm %0,%1,%s2,0xffff")
4611 (define_insn "*lshiftrt_internal4be"
4612 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4615 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4616 (match_operand:SI 2 "const_int_operand" "i")) 2)))]
4617 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4618 "rlwinm %0,%1,%s2,0xffff")
4620 (define_insn "*lshiftrt_internal5le"
4621 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4625 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4626 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4628 (clobber (match_scratch:SI 3 "=r,r"))]
4629 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4631 rlwinm. %3,%1,%s2,0xffff
4633 [(set_attr "type" "delayed_compare")
4634 (set_attr "length" "4,8")])
4636 (define_insn "*lshiftrt_internal5be"
4637 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4641 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4642 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4644 (clobber (match_scratch:SI 3 "=r,r"))]
4645 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4647 rlwinm. %3,%1,%s2,0xffff
4649 [(set_attr "type" "delayed_compare")
4650 (set_attr "length" "4,8")])
4653 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4657 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4658 (match_operand:SI 2 "const_int_operand" "")) 0))
4660 (clobber (match_scratch:SI 3 ""))]
4661 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4663 (zero_extend:SI (subreg:HI
4664 (lshiftrt:SI (match_dup 1)
4667 (compare:CC (match_dup 3)
4672 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4676 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4677 (match_operand:SI 2 "const_int_operand" "")) 2))
4679 (clobber (match_scratch:SI 3 ""))]
4680 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4682 (zero_extend:SI (subreg:HI
4683 (lshiftrt:SI (match_dup 1)
4686 (compare:CC (match_dup 3)
4690 (define_insn "*lshiftrt_internal5le"
4691 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4695 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4696 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4698 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4699 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4700 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4702 rlwinm. %0,%1,%s2,0xffff
4704 [(set_attr "type" "delayed_compare")
4705 (set_attr "length" "4,8")])
4707 (define_insn "*lshiftrt_internal5be"
4708 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4712 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4713 (match_operand:SI 2 "const_int_operand" "i,i")) 2))
4715 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4716 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4717 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535))"
4719 rlwinm. %0,%1,%s2,0xffff
4721 [(set_attr "type" "delayed_compare")
4722 (set_attr "length" "4,8")])
4725 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4729 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4730 (match_operand:SI 2 "const_int_operand" "")) 0))
4732 (set (match_operand:SI 0 "gpc_reg_operand" "")
4733 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4734 "!BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4736 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4738 (compare:CC (match_dup 0)
4743 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4747 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4748 (match_operand:SI 2 "const_int_operand" "")) 2))
4750 (set (match_operand:SI 0 "gpc_reg_operand" "")
4751 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))]
4752 "BYTES_BIG_ENDIAN && includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4754 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 2)))
4756 (compare:CC (match_dup 0)
4760 (define_insn "ashrsi3"
4761 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4762 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4763 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
4768 [(set_attr "type" "var_shift_rotate,shift")])
4770 (define_insn "*ashrsi3_64"
4771 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4773 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4774 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))))]
4779 [(set_attr "type" "var_shift_rotate,shift")])
4782 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4783 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4784 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4786 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
4793 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4794 (set_attr "length" "4,4,8,8")])
4797 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
4798 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4799 (match_operand:SI 2 "reg_or_cint_operand" ""))
4801 (clobber (match_scratch:SI 3 ""))]
4804 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4806 (compare:CC (match_dup 3)
4811 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4812 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4813 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4815 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4816 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4823 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
4824 (set_attr "length" "4,4,8,8")])
4826 ;; Builtins to replace a division to generate FRE reciprocal estimate
4827 ;; instructions and the necessary fixup instructions
4828 (define_expand "recip<mode>3"
4829 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4830 (match_operand:RECIPF 1 "gpc_reg_operand" "")
4831 (match_operand:RECIPF 2 "gpc_reg_operand" "")]
4832 "RS6000_RECIP_HAVE_RE_P (<MODE>mode)"
4834 rs6000_emit_swdiv (operands[0], operands[1], operands[2], false);
4838 ;; Split to create division from FRE/FRES/etc. and fixup instead of the normal
4839 ;; hardware division. This is only done before register allocation and with
4840 ;; -ffast-math. This must appear before the divsf3/divdf3 insns.
4842 [(set (match_operand:RECIPF 0 "gpc_reg_operand" "")
4843 (div:RECIPF (match_operand 1 "gpc_reg_operand" "")
4844 (match_operand 2 "gpc_reg_operand" "")))]
4845 "RS6000_RECIP_AUTO_RE_P (<MODE>mode)
4846 && can_create_pseudo_p () && optimize_insn_for_speed_p ()
4847 && flag_finite_math_only && !flag_trapping_math && flag_reciprocal_math"
4850 rs6000_emit_swdiv (operands[0], operands[1], operands[2], true);
4854 ;; Builtins to replace 1/sqrt(x) with instructions using RSQRTE and the
4855 ;; appropriate fixup.
4856 (define_expand "rsqrt<mode>2"
4857 [(match_operand:RECIPF 0 "gpc_reg_operand" "")
4858 (match_operand:RECIPF 1 "gpc_reg_operand" "")]
4859 "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
4861 rs6000_emit_swrsqrt (operands[0], operands[1]);
4866 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
4867 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4868 (match_operand:SI 2 "reg_or_cint_operand" ""))
4870 (set (match_operand:SI 0 "gpc_reg_operand" "")
4871 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4874 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4876 (compare:CC (match_dup 0)
4880 ;; Floating-point insns, excluding normal data motion.
4882 ;; PowerPC has a full set of single-precision floating point instructions.
4884 ;; For the POWER architecture, we pretend that we have both SFmode and
4885 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4886 ;; The only conversions we will do will be when storing to memory. In that
4887 ;; case, we will use the "frsp" instruction before storing.
4889 ;; Note that when we store into a single-precision memory location, we need to
4890 ;; use the frsp insn first. If the register being stored isn't dead, we
4891 ;; need a scratch register for the frsp. But this is difficult when the store
4892 ;; is done by reload. It is not incorrect to do the frsp on the register in
4893 ;; this case, we just lose precision that we would have otherwise gotten but
4894 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4896 (define_expand "extendsfdf2"
4897 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4898 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4899 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4902 (define_insn_and_split "*extendsfdf2_fpr"
4903 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
4904 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4905 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4910 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4913 emit_note (NOTE_INSN_DELETED);
4916 [(set_attr_alternative "type"
4917 [(const_string "fp")
4920 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
4921 (const_string "fpload_ux")
4923 (match_test "update_address_mem (operands[1], VOIDmode)")
4924 (const_string "fpload_u")
4925 (const_string "fpload")))])])
4927 (define_expand "truncdfsf2"
4928 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4929 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4930 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
4933 (define_insn "*truncdfsf2_fpr"
4934 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4935 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
4936 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
4938 [(set_attr "type" "fp")])
4940 (define_expand "negsf2"
4941 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4942 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4943 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4946 (define_insn "*negsf2"
4947 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4948 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4949 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4951 [(set_attr "type" "fp")])
4953 (define_expand "abssf2"
4954 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4955 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4956 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4959 (define_insn "*abssf2"
4960 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4961 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4962 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4964 [(set_attr "type" "fp")])
4967 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4968 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4969 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4971 [(set_attr "type" "fp")])
4973 (define_expand "addsf3"
4974 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4975 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4976 (match_operand:SF 2 "gpc_reg_operand" "")))]
4977 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4981 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4982 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4983 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4984 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
4986 [(set_attr "type" "fp")
4987 (set_attr "fp_type" "fp_addsub_s")])
4989 (define_expand "subsf3"
4990 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4991 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4992 (match_operand:SF 2 "gpc_reg_operand" "")))]
4993 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
4997 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4998 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4999 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5000 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5002 [(set_attr "type" "fp")
5003 (set_attr "fp_type" "fp_addsub_s")])
5005 (define_expand "mulsf3"
5006 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5007 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5008 (match_operand:SF 2 "gpc_reg_operand" "")))]
5009 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
5013 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5014 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5015 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5016 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5018 [(set_attr "type" "fp")
5019 (set_attr "fp_type" "fp_mul_s")])
5021 (define_expand "divsf3"
5022 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5023 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5024 (match_operand:SF 2 "gpc_reg_operand" "")))]
5025 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5029 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5030 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5031 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5032 "TARGET_HARD_FLOAT && TARGET_FPRS
5033 && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5035 [(set_attr "type" "sdiv")])
5038 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5039 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5042 [(set_attr "type" "fp")])
5044 ; builtin fmaf support
5045 (define_insn "*fmasf4_fpr"
5046 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5047 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5048 (match_operand:SF 2 "gpc_reg_operand" "f")
5049 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5050 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5051 "fmadds %0,%1,%2,%3"
5052 [(set_attr "type" "fp")
5053 (set_attr "fp_type" "fp_maddsub_s")])
5055 (define_insn "*fmssf4_fpr"
5056 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5057 (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5058 (match_operand:SF 2 "gpc_reg_operand" "f")
5059 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5060 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5061 "fmsubs %0,%1,%2,%3"
5062 [(set_attr "type" "fp")
5063 (set_attr "fp_type" "fp_maddsub_s")])
5065 (define_insn "*nfmasf4_fpr"
5066 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5067 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5068 (match_operand:SF 2 "gpc_reg_operand" "f")
5069 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5070 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5071 "fnmadds %0,%1,%2,%3"
5072 [(set_attr "type" "fp")
5073 (set_attr "fp_type" "fp_maddsub_s")])
5075 (define_insn "*nfmssf4_fpr"
5076 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5077 (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5078 (match_operand:SF 2 "gpc_reg_operand" "f")
5079 (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
5080 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5081 "fnmsubs %0,%1,%2,%3"
5082 [(set_attr "type" "fp")
5083 (set_attr "fp_type" "fp_maddsub_s")])
5085 (define_expand "sqrtsf2"
5086 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5087 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5088 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU)
5089 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
5090 && !TARGET_SIMPLE_FPU"
5094 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5095 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5096 "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
5097 && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
5099 [(set_attr "type" "ssqrt")])
5101 (define_insn "*rsqrtsf_internal1"
5102 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5103 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
5107 [(set_attr "type" "fp")])
5109 (define_expand "copysign<mode>3"
5111 (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
5113 (neg:SFDF (abs:SFDF (match_dup 1))))
5114 (set (match_operand:SFDF 0 "gpc_reg_operand" "")
5115 (if_then_else:SFDF (ge (match_operand:SFDF 2 "gpc_reg_operand" "")
5119 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
5120 && ((TARGET_PPC_GFXOPT
5121 && !HONOR_NANS (<MODE>mode)
5122 && !HONOR_SIGNED_ZEROS (<MODE>mode))
5124 || VECTOR_UNIT_VSX_P (<MODE>mode))"
5126 if (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))
5128 emit_insn (gen_copysign<mode>3_fcpsgn (operands[0], operands[1],
5133 operands[3] = gen_reg_rtx (<MODE>mode);
5134 operands[4] = gen_reg_rtx (<MODE>mode);
5135 operands[5] = CONST0_RTX (<MODE>mode);
5138 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
5139 ;; compiler from optimizing -0.0
5140 (define_insn "copysign<mode>3_fcpsgn"
5141 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
5142 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
5143 (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
5145 "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
5147 [(set_attr "type" "fp")])
5149 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5150 ;; fsel instruction and some auxiliary computations. Then we just have a
5151 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5153 (define_expand "smaxsf3"
5154 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5155 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5156 (match_operand:SF 2 "gpc_reg_operand" ""))
5159 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5160 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5161 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5163 (define_expand "sminsf3"
5164 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5165 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5166 (match_operand:SF 2 "gpc_reg_operand" ""))
5169 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5170 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5171 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5174 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5175 (match_operator:SF 3 "min_max_operator"
5176 [(match_operand:SF 1 "gpc_reg_operand" "")
5177 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5178 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
5179 && TARGET_SINGLE_FLOAT && !flag_trapping_math"
5182 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5183 operands[1], operands[2]);
5187 (define_expand "mov<mode>cc"
5188 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
5189 (if_then_else:GPR (match_operand 1 "comparison_operator" "")
5190 (match_operand:GPR 2 "gpc_reg_operand" "")
5191 (match_operand:GPR 3 "gpc_reg_operand" "")))]
5195 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5201 ;; We use the BASE_REGS for the isel input operands because, if rA is
5202 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5203 ;; because we may switch the operands and rB may end up being rA.
5205 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5206 ;; leave out the mode in operand 4 and use one pattern, but reload can
5207 ;; change the mode underneath our feet and then gets confused trying
5208 ;; to reload the value.
5209 (define_insn "isel_signed_<mode>"
5210 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5212 (match_operator 1 "scc_comparison_operator"
5213 [(match_operand:CC 4 "cc_reg_operand" "y,y")
5215 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5216 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5219 { return output_isel (operands); }"
5220 [(set_attr "type" "isel")
5221 (set_attr "length" "4")])
5223 (define_insn "isel_unsigned_<mode>"
5224 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
5226 (match_operator 1 "scc_comparison_operator"
5227 [(match_operand:CCUNS 4 "cc_reg_operand" "y,y")
5229 (match_operand:GPR 2 "reg_or_cint_operand" "O,b")
5230 (match_operand:GPR 3 "gpc_reg_operand" "r,r")))]
5233 { return output_isel (operands); }"
5234 [(set_attr "type" "isel")
5235 (set_attr "length" "4")])
5237 ;; These patterns can be useful for combine; they let combine know that
5238 ;; isel can handle reversed comparisons so long as the operands are
5241 (define_insn "*isel_reversed_signed_<mode>"
5242 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5244 (match_operator 1 "scc_rev_comparison_operator"
5245 [(match_operand:CC 4 "cc_reg_operand" "y")
5247 (match_operand:GPR 2 "gpc_reg_operand" "b")
5248 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5251 { return output_isel (operands); }"
5252 [(set_attr "type" "isel")
5253 (set_attr "length" "4")])
5255 (define_insn "*isel_reversed_unsigned_<mode>"
5256 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
5258 (match_operator 1 "scc_rev_comparison_operator"
5259 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5261 (match_operand:GPR 2 "gpc_reg_operand" "b")
5262 (match_operand:GPR 3 "gpc_reg_operand" "b")))]
5265 { return output_isel (operands); }"
5266 [(set_attr "type" "isel")
5267 (set_attr "length" "4")])
5269 (define_expand "movsfcc"
5270 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5271 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5272 (match_operand:SF 2 "gpc_reg_operand" "")
5273 (match_operand:SF 3 "gpc_reg_operand" "")))]
5274 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5277 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5283 (define_insn "*fselsfsf4"
5284 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5285 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5286 (match_operand:SF 4 "zero_fp_constant" "F"))
5287 (match_operand:SF 2 "gpc_reg_operand" "f")
5288 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5289 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
5291 [(set_attr "type" "fp")])
5293 (define_insn "*fseldfsf4"
5294 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5295 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5296 (match_operand:DF 4 "zero_fp_constant" "F"))
5297 (match_operand:SF 2 "gpc_reg_operand" "f")
5298 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5299 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5301 [(set_attr "type" "fp")])
5303 (define_expand "negdf2"
5304 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5305 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5306 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5309 (define_insn "*negdf2_fpr"
5310 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5311 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5312 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5313 && !VECTOR_UNIT_VSX_P (DFmode)"
5315 [(set_attr "type" "fp")])
5317 (define_expand "absdf2"
5318 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5319 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5320 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5323 (define_insn "*absdf2_fpr"
5324 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5325 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5326 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5327 && !VECTOR_UNIT_VSX_P (DFmode)"
5329 [(set_attr "type" "fp")])
5331 (define_insn "*nabsdf2_fpr"
5332 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5333 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
5334 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5335 && !VECTOR_UNIT_VSX_P (DFmode)"
5337 [(set_attr "type" "fp")])
5339 (define_expand "adddf3"
5340 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5341 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5342 (match_operand:DF 2 "gpc_reg_operand" "")))]
5343 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5346 (define_insn "*adddf3_fpr"
5347 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5348 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
5349 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5350 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5351 && !VECTOR_UNIT_VSX_P (DFmode)"
5353 [(set_attr "type" "fp")
5354 (set_attr "fp_type" "fp_addsub_d")])
5356 (define_expand "subdf3"
5357 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5358 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5359 (match_operand:DF 2 "gpc_reg_operand" "")))]
5360 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5363 (define_insn "*subdf3_fpr"
5364 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5365 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
5366 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5367 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5368 && !VECTOR_UNIT_VSX_P (DFmode)"
5370 [(set_attr "type" "fp")
5371 (set_attr "fp_type" "fp_addsub_d")])
5373 (define_expand "muldf3"
5374 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5375 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5376 (match_operand:DF 2 "gpc_reg_operand" "")))]
5377 "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5380 (define_insn "*muldf3_fpr"
5381 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5382 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
5383 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5384 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5385 && !VECTOR_UNIT_VSX_P (DFmode)"
5387 [(set_attr "type" "dmul")
5388 (set_attr "fp_type" "fp_mul_d")])
5390 (define_expand "divdf3"
5391 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5392 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5393 (match_operand:DF 2 "gpc_reg_operand" "")))]
5395 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
5396 && !TARGET_SIMPLE_FPU"
5399 (define_insn "*divdf3_fpr"
5400 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5401 (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
5402 (match_operand:DF 2 "gpc_reg_operand" "d")))]
5403 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
5404 && !VECTOR_UNIT_VSX_P (DFmode)"
5406 [(set_attr "type" "ddiv")])
5408 (define_insn "*fred_fpr"
5409 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5410 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5411 "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
5413 [(set_attr "type" "fp")])
5415 (define_insn "*rsqrtdf_internal1"
5416 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5417 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
5419 "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
5421 [(set_attr "type" "fp")])
5423 ; builtin fma support
5424 (define_insn "*fmadf4_fpr"
5425 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5426 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5427 (match_operand:DF 2 "gpc_reg_operand" "f")
5428 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5429 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5430 && VECTOR_UNIT_NONE_P (DFmode)"
5432 [(set_attr "type" "fp")
5433 (set_attr "fp_type" "fp_maddsub_d")])
5435 (define_insn "*fmsdf4_fpr"
5436 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5437 (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5438 (match_operand:DF 2 "gpc_reg_operand" "f")
5439 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5440 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5441 && VECTOR_UNIT_NONE_P (DFmode)"
5443 [(set_attr "type" "fp")
5444 (set_attr "fp_type" "fp_maddsub_d")])
5446 (define_insn "*nfmadf4_fpr"
5447 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5448 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5449 (match_operand:DF 2 "gpc_reg_operand" "f")
5450 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5451 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5452 && VECTOR_UNIT_NONE_P (DFmode)"
5453 "fnmadd %0,%1,%2,%3"
5454 [(set_attr "type" "fp")
5455 (set_attr "fp_type" "fp_maddsub_d")])
5457 (define_insn "*nfmsdf4_fpr"
5458 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5459 (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5460 (match_operand:DF 2 "gpc_reg_operand" "f")
5461 (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
5462 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5463 && VECTOR_UNIT_NONE_P (DFmode)"
5464 "fnmsub %0,%1,%2,%3"
5465 [(set_attr "type" "fp")
5466 (set_attr "fp_type" "fp_maddsub_d")])
5468 (define_expand "sqrtdf2"
5469 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5470 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
5471 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5474 (define_insn "*sqrtdf2_fpr"
5475 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5476 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
5477 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5478 && !VECTOR_UNIT_VSX_P (DFmode)"
5480 [(set_attr "type" "dsqrt")])
5482 ;; The conditional move instructions allow us to perform max and min
5483 ;; operations even when
5485 (define_expand "smaxdf3"
5486 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5487 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5488 (match_operand:DF 2 "gpc_reg_operand" ""))
5491 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5492 && !flag_trapping_math"
5493 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5495 (define_expand "smindf3"
5496 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5497 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5498 (match_operand:DF 2 "gpc_reg_operand" ""))
5501 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5502 && !flag_trapping_math"
5503 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5506 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5507 (match_operator:DF 3 "min_max_operator"
5508 [(match_operand:DF 1 "gpc_reg_operand" "")
5509 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5510 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5511 && !flag_trapping_math"
5514 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5515 operands[1], operands[2]);
5519 (define_expand "movdfcc"
5520 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5521 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5522 (match_operand:DF 2 "gpc_reg_operand" "")
5523 (match_operand:DF 3 "gpc_reg_operand" "")))]
5524 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5527 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5533 (define_insn "*fseldfdf4"
5534 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5535 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
5536 (match_operand:DF 4 "zero_fp_constant" "F"))
5537 (match_operand:DF 2 "gpc_reg_operand" "d")
5538 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5539 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5541 [(set_attr "type" "fp")])
5543 (define_insn "*fselsfdf4"
5544 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
5545 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5546 (match_operand:SF 4 "zero_fp_constant" "F"))
5547 (match_operand:DF 2 "gpc_reg_operand" "d")
5548 (match_operand:DF 3 "gpc_reg_operand" "d")))]
5549 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
5551 [(set_attr "type" "fp")])
5553 ;; Conversions to and from floating-point.
5555 ; We don't define lfiwax/lfiwzx with the normal definition, because we
5556 ; don't want to support putting SImode in FPR registers.
5557 (define_insn "lfiwax"
5558 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5559 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5561 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
5563 [(set_attr "type" "fpload")])
5565 ; This split must be run before register allocation because it allocates the
5566 ; memory slot that is needed to move values to/from the FPR. We don't allocate
5567 ; it earlier to allow for the combiner to merge insns together where it might
5568 ; not be needed and also in case the insns are deleted as dead code.
5570 (define_insn_and_split "floatsi<mode>2_lfiwax"
5571 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5572 (float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5573 (clobber (match_scratch:DI 2 "=d"))]
5574 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5575 && <SI_CONVERT_FP> && can_create_pseudo_p ()"
5581 rtx dest = operands[0];
5582 rtx src = operands[1];
5585 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5586 tmp = convert_to_mode (DImode, src, false);
5590 if (GET_CODE (tmp) == SCRATCH)
5591 tmp = gen_reg_rtx (DImode);
5594 src = rs6000_address_for_fpconvert (src);
5595 emit_insn (gen_lfiwax (tmp, src));
5599 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5600 emit_move_insn (stack, src);
5601 emit_insn (gen_lfiwax (tmp, stack));
5604 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5607 [(set_attr "length" "12")
5608 (set_attr "type" "fpload")])
5610 (define_insn_and_split "floatsi<mode>2_lfiwax_mem"
5611 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5614 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5615 (clobber (match_scratch:DI 2 "=0,d"))]
5616 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX
5623 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5624 if (GET_CODE (operands[2]) == SCRATCH)
5625 operands[2] = gen_reg_rtx (DImode);
5626 emit_insn (gen_lfiwax (operands[2], operands[1]));
5627 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5630 [(set_attr "length" "8")
5631 (set_attr "type" "fpload")])
5633 (define_insn "lfiwzx"
5634 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5635 (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
5637 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
5639 [(set_attr "type" "fpload")])
5641 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
5642 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
5643 (unsigned_float:SFDF (match_operand:SI 1 "nonimmediate_operand" "r")))
5644 (clobber (match_scratch:DI 2 "=d"))]
5645 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5652 rtx dest = operands[0];
5653 rtx src = operands[1];
5656 if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
5657 tmp = convert_to_mode (DImode, src, true);
5661 if (GET_CODE (tmp) == SCRATCH)
5662 tmp = gen_reg_rtx (DImode);
5665 src = rs6000_address_for_fpconvert (src);
5666 emit_insn (gen_lfiwzx (tmp, src));
5670 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5671 emit_move_insn (stack, src);
5672 emit_insn (gen_lfiwzx (tmp, stack));
5675 emit_insn (gen_floatdi<mode>2 (dest, tmp));
5678 [(set_attr "length" "12")
5679 (set_attr "type" "fpload")])
5681 (define_insn_and_split "floatunssi<mode>2_lfiwzx_mem"
5682 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,<rreg2>")
5683 (unsigned_float:SFDF
5685 (match_operand:SI 1 "memory_operand" "Z,Z"))))
5686 (clobber (match_scratch:DI 2 "=0,d"))]
5687 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX
5694 operands[1] = rs6000_address_for_fpconvert (operands[1]);
5695 if (GET_CODE (operands[2]) == SCRATCH)
5696 operands[2] = gen_reg_rtx (DImode);
5697 emit_insn (gen_lfiwzx (operands[2], operands[1]));
5698 emit_insn (gen_floatdi<mode>2 (operands[0], operands[2]));
5701 [(set_attr "length" "8")
5702 (set_attr "type" "fpload")])
5704 ; For each of these conversions, there is a define_expand, a define_insn
5705 ; with a '#' template, and a define_split (with C code). The idea is
5706 ; to allow constant folding with the template of the define_insn,
5707 ; then to have the insns split later (between sched1 and final).
5709 (define_expand "floatsidf2"
5710 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5711 (float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5714 (clobber (match_dup 4))
5715 (clobber (match_dup 5))
5716 (clobber (match_dup 6))])]
5718 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5721 if (TARGET_E500_DOUBLE)
5723 if (!REG_P (operands[1]))
5724 operands[1] = force_reg (SImode, operands[1]);
5725 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5728 else if (TARGET_LFIWAX && TARGET_FCFID)
5730 emit_insn (gen_floatsidf2_lfiwax (operands[0], operands[1]));
5733 else if (TARGET_FCFID)
5735 rtx dreg = operands[1];
5737 dreg = force_reg (SImode, dreg);
5738 dreg = convert_to_mode (DImode, dreg, false);
5739 emit_insn (gen_floatdidf2 (operands[0], dreg));
5743 if (!REG_P (operands[1]))
5744 operands[1] = force_reg (SImode, operands[1]);
5745 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5746 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5747 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5748 operands[5] = gen_reg_rtx (DFmode);
5749 operands[6] = gen_reg_rtx (SImode);
5752 (define_insn_and_split "*floatsidf2_internal"
5753 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5754 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5755 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5756 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5757 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5758 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
5759 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5760 "! TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5766 rtx lowword, highword;
5767 gcc_assert (MEM_P (operands[4]));
5768 highword = adjust_address (operands[4], SImode, 0);
5769 lowword = adjust_address (operands[4], SImode, 4);
5770 if (! WORDS_BIG_ENDIAN)
5773 tmp = highword; highword = lowword; lowword = tmp;
5776 emit_insn (gen_xorsi3 (operands[6], operands[1],
5777 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5778 emit_move_insn (lowword, operands[6]);
5779 emit_move_insn (highword, operands[2]);
5780 emit_move_insn (operands[5], operands[4]);
5781 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5784 [(set_attr "length" "24")
5785 (set_attr "type" "fp")])
5787 ;; If we don't have a direct conversion to single precision, don't enable this
5788 ;; conversion for 32-bit without fast math, because we don't have the insn to
5789 ;; generate the fixup swizzle to avoid double rounding problems.
5790 (define_expand "floatunssisf2"
5791 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5792 (unsigned_float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
5793 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
5796 && ((TARGET_FCFIDUS && TARGET_LFIWZX)
5797 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
5798 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
5803 if (!REG_P (operands[1]))
5804 operands[1] = force_reg (SImode, operands[1]);
5806 else if (TARGET_LFIWZX && TARGET_FCFIDUS)
5808 emit_insn (gen_floatunssisf2_lfiwzx (operands[0], operands[1]));
5813 rtx dreg = operands[1];
5815 dreg = force_reg (SImode, dreg);
5816 dreg = convert_to_mode (DImode, dreg, true);
5817 emit_insn (gen_floatdisf2 (operands[0], dreg));
5822 (define_expand "floatunssidf2"
5823 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5824 (unsigned_float:DF (match_operand:SI 1 "nonimmediate_operand" "")))
5827 (clobber (match_dup 4))
5828 (clobber (match_dup 5))])]
5830 && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
5833 if (TARGET_E500_DOUBLE)
5835 if (!REG_P (operands[1]))
5836 operands[1] = force_reg (SImode, operands[1]);
5837 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5840 else if (TARGET_LFIWZX && TARGET_FCFID)
5842 emit_insn (gen_floatunssidf2_lfiwzx (operands[0], operands[1]));
5845 else if (TARGET_FCFID)
5847 rtx dreg = operands[1];
5849 dreg = force_reg (SImode, dreg);
5850 dreg = convert_to_mode (DImode, dreg, true);
5851 emit_insn (gen_floatdidf2 (operands[0], dreg));
5855 if (!REG_P (operands[1]))
5856 operands[1] = force_reg (SImode, operands[1]);
5857 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5858 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5859 operands[4] = rs6000_allocate_stack_temp (DFmode, true, false);
5860 operands[5] = gen_reg_rtx (DFmode);
5863 (define_insn_and_split "*floatunssidf2_internal"
5864 [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
5865 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5866 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5867 (use (match_operand:DF 3 "gpc_reg_operand" "d"))
5868 (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
5869 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
5870 "! TARGET_FCFIDU && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5871 && !(TARGET_FCFID && TARGET_POWERPC64)"
5877 rtx lowword, highword;
5878 gcc_assert (MEM_P (operands[4]));
5879 highword = adjust_address (operands[4], SImode, 0);
5880 lowword = adjust_address (operands[4], SImode, 4);
5881 if (! WORDS_BIG_ENDIAN)
5884 tmp = highword; highword = lowword; lowword = tmp;
5887 emit_move_insn (lowword, operands[1]);
5888 emit_move_insn (highword, operands[2]);
5889 emit_move_insn (operands[5], operands[4]);
5890 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5893 [(set_attr "length" "20")
5894 (set_attr "type" "fp")])
5896 (define_expand "fix_trunc<mode>si2"
5897 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5898 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5899 "TARGET_HARD_FLOAT && ((TARGET_FPRS && <TARGET_FLOAT>) || <E500_CONVERT>)"
5902 if (!<E500_CONVERT>)
5907 emit_insn (gen_fix_trunc<mode>si2_stfiwx (operands[0], operands[1]));
5910 tmp = gen_reg_rtx (DImode);
5911 stack = rs6000_allocate_stack_temp (DImode, true, false);
5912 emit_insn (gen_fix_trunc<mode>si2_internal (operands[0], operands[1],
5919 ; Like the convert to float patterns, this insn must be split before
5920 ; register allocation so that it can allocate the memory slot if it
5922 (define_insn_and_split "fix_trunc<mode>si2_stfiwx"
5923 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5924 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
5925 (clobber (match_scratch:DI 2 "=d"))]
5926 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
5927 && (<MODE>mode != SFmode || TARGET_SINGLE_FLOAT)
5928 && TARGET_STFIWX && can_create_pseudo_p ()"
5933 rtx dest = operands[0];
5934 rtx src = operands[1];
5935 rtx tmp = operands[2];
5937 if (GET_CODE (tmp) == SCRATCH)
5938 tmp = gen_reg_rtx (DImode);
5940 emit_insn (gen_fctiwz_<mode> (tmp, src));
5943 dest = rs6000_address_for_fpconvert (dest);
5944 emit_insn (gen_stfiwx (dest, tmp));
5947 else if (TARGET_MFPGPR && TARGET_POWERPC64)
5949 dest = gen_lowpart (DImode, dest);
5950 emit_move_insn (dest, tmp);
5955 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
5956 emit_insn (gen_stfiwx (stack, tmp));
5957 emit_move_insn (dest, stack);
5961 [(set_attr "length" "12")
5962 (set_attr "type" "fp")])
5964 (define_insn_and_split "fix_trunc<mode>si2_internal"
5965 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,?r")
5966 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,<rreg>")))
5967 (clobber (match_operand:DI 2 "gpc_reg_operand" "=1,d"))
5968 (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o,o"))]
5969 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
5976 gcc_assert (MEM_P (operands[3]));
5977 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5979 emit_insn (gen_fctiwz_<mode> (operands[2], operands[1]));
5980 emit_move_insn (operands[3], operands[2]);
5981 emit_move_insn (operands[0], lowword);
5984 [(set_attr "length" "16")
5985 (set_attr "type" "fp")])
5987 (define_expand "fix_trunc<mode>di2"
5988 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5989 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
5990 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5994 (define_insn "*fix_trunc<mode>di2_fctidz"
5995 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
5996 (fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
5997 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
5998 && TARGET_FCFID && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6000 [(set_attr "type" "fp")])
6002 (define_expand "fixuns_trunc<mode>si2"
6003 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6004 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "")))]
6006 && ((TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ && TARGET_STFIWX)
6010 if (!<E500_CONVERT>)
6012 emit_insn (gen_fixuns_trunc<mode>si2_stfiwx (operands[0], operands[1]));
6017 (define_insn_and_split "fixuns_trunc<mode>si2_stfiwx"
6018 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
6019 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d")))
6020 (clobber (match_scratch:DI 2 "=d"))]
6021 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ
6022 && TARGET_STFIWX && can_create_pseudo_p ()"
6027 rtx dest = operands[0];
6028 rtx src = operands[1];
6029 rtx tmp = operands[2];
6031 if (GET_CODE (tmp) == SCRATCH)
6032 tmp = gen_reg_rtx (DImode);
6034 emit_insn (gen_fctiwuz_<mode> (tmp, src));
6037 dest = rs6000_address_for_fpconvert (dest);
6038 emit_insn (gen_stfiwx (dest, tmp));
6041 else if (TARGET_MFPGPR && TARGET_POWERPC64)
6043 dest = gen_lowpart (DImode, dest);
6044 emit_move_insn (dest, tmp);
6049 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6050 emit_insn (gen_stfiwx (stack, tmp));
6051 emit_move_insn (dest, stack);
6055 [(set_attr "length" "12")
6056 (set_attr "type" "fp")])
6058 (define_expand "fixuns_trunc<mode>di2"
6059 [(set (match_operand:DI 0 "register_operand" "")
6060 (unsigned_fix:DI (match_operand:SFDF 1 "register_operand" "")))]
6061 "TARGET_HARD_FLOAT && (TARGET_FCTIDUZ || VECTOR_UNIT_VSX_P (<MODE>mode))"
6064 (define_insn "*fixuns_trunc<mode>di2_fctiduz"
6065 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6066 (unsigned_fix:DI (match_operand:SFDF 1 "gpc_reg_operand" "d")))]
6067 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6068 && TARGET_FCTIDUZ && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6070 [(set_attr "type" "fp")])
6072 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
6073 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
6074 ; because the first makes it clear that operand 0 is not live
6075 ; before the instruction.
6076 (define_insn "fctiwz_<mode>"
6077 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6078 (unspec:DI [(fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))]
6080 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
6082 [(set_attr "type" "fp")])
6084 (define_insn "fctiwuz_<mode>"
6085 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6086 (unspec:DI [(unsigned_fix:SI
6087 (match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>"))]
6089 "TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT> && TARGET_FCTIWUZ"
6091 [(set_attr "type" "fp")])
6093 ;; Only optimize (float (fix x)) -> frz if we are in fast-math mode, since
6094 ;; since the friz instruction does not truncate the value if the floating
6095 ;; point value is < LONG_MIN or > LONG_MAX.
6096 (define_insn "*friz"
6097 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6098 (float:DF (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d"))))]
6099 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_FPRND
6100 && !VECTOR_UNIT_VSX_P (DFmode) && flag_unsafe_math_optimizations
6101 && !flag_trapping_math && TARGET_FRIZ"
6103 [(set_attr "type" "fp")])
6105 ;; Since FCTIWZ doesn't sign extend the upper bits, we have to do a store and a
6106 ;; load to properly sign extend the value, but at least doing a store, load
6107 ;; into a GPR to sign extend, a store from the GPR and a load back into the FPR
6108 ;; if we have 32-bit memory ops
6109 (define_insn_and_split "*round32<mode>2_fprs"
6110 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6112 (fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6113 (clobber (match_scratch:DI 2 "=d"))
6114 (clobber (match_scratch:DI 3 "=d"))]
6115 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6116 && <SI_CONVERT_FP> && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID
6117 && can_create_pseudo_p ()"
6122 rtx dest = operands[0];
6123 rtx src = operands[1];
6124 rtx tmp1 = operands[2];
6125 rtx tmp2 = operands[3];
6126 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6128 if (GET_CODE (tmp1) == SCRATCH)
6129 tmp1 = gen_reg_rtx (DImode);
6130 if (GET_CODE (tmp2) == SCRATCH)
6131 tmp2 = gen_reg_rtx (DImode);
6133 emit_insn (gen_fctiwz_<mode> (tmp1, src));
6134 emit_insn (gen_stfiwx (stack, tmp1));
6135 emit_insn (gen_lfiwax (tmp2, stack));
6136 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6139 [(set_attr "type" "fpload")
6140 (set_attr "length" "16")])
6142 (define_insn_and_split "*roundu32<mode>2_fprs"
6143 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
6144 (unsigned_float:SFDF
6145 (unsigned_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d"))))
6146 (clobber (match_scratch:DI 2 "=d"))
6147 (clobber (match_scratch:DI 3 "=d"))]
6148 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
6149 && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU
6150 && can_create_pseudo_p ()"
6155 rtx dest = operands[0];
6156 rtx src = operands[1];
6157 rtx tmp1 = operands[2];
6158 rtx tmp2 = operands[3];
6159 rtx stack = rs6000_allocate_stack_temp (SImode, false, true);
6161 if (GET_CODE (tmp1) == SCRATCH)
6162 tmp1 = gen_reg_rtx (DImode);
6163 if (GET_CODE (tmp2) == SCRATCH)
6164 tmp2 = gen_reg_rtx (DImode);
6166 emit_insn (gen_fctiwuz_<mode> (tmp1, src));
6167 emit_insn (gen_stfiwx (stack, tmp1));
6168 emit_insn (gen_lfiwzx (tmp2, stack));
6169 emit_insn (gen_floatdi<mode>2 (dest, tmp2));
6172 [(set_attr "type" "fpload")
6173 (set_attr "length" "16")])
6175 ;; No VSX equivalent to fctid
6176 (define_insn "lrint<mode>di2"
6177 [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
6178 (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6180 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6182 [(set_attr "type" "fp")])
6184 (define_expand "btrunc<mode>2"
6185 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6186 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6188 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6191 (define_insn "*btrunc<mode>2_fpr"
6192 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6193 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6195 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6196 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6198 [(set_attr "type" "fp")])
6200 (define_expand "ceil<mode>2"
6201 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6202 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6204 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6207 (define_insn "*ceil<mode>2_fpr"
6208 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6209 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6211 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6212 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6214 [(set_attr "type" "fp")])
6216 (define_expand "floor<mode>2"
6217 [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
6218 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
6220 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6223 (define_insn "*floor<mode>2_fpr"
6224 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6225 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6227 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
6228 && !VECTOR_UNIT_VSX_P (<MODE>mode)"
6230 [(set_attr "type" "fp")])
6232 ;; No VSX equivalent to frin
6233 (define_insn "round<mode>2"
6234 [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
6235 (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
6237 "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
6239 [(set_attr "type" "fp")])
6241 ; An UNSPEC is used so we don't have to support SImode in FP registers.
6242 (define_insn "stfiwx"
6243 [(set (match_operand:SI 0 "memory_operand" "=Z")
6244 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
6248 [(set_attr "type" "fpstore")])
6250 ;; If we don't have a direct conversion to single precision, don't enable this
6251 ;; conversion for 32-bit without fast math, because we don't have the insn to
6252 ;; generate the fixup swizzle to avoid double rounding problems.
6253 (define_expand "floatsisf2"
6254 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6255 (float:SF (match_operand:SI 1 "nonimmediate_operand" "")))]
6256 "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT
6259 && ((TARGET_FCFIDS && TARGET_LFIWAX)
6260 || (TARGET_DOUBLE_FLOAT && TARGET_FCFID
6261 && (TARGET_POWERPC64 || flag_unsafe_math_optimizations)))))"
6266 if (!REG_P (operands[1]))
6267 operands[1] = force_reg (SImode, operands[1]);
6269 else if (TARGET_FCFIDS && TARGET_LFIWAX)
6271 emit_insn (gen_floatsisf2_lfiwax (operands[0], operands[1]));
6274 else if (TARGET_FCFID && TARGET_LFIWAX)
6276 rtx dfreg = gen_reg_rtx (DFmode);
6277 emit_insn (gen_floatsidf2_lfiwax (dfreg, operands[1]));
6278 emit_insn (gen_truncdfsf2 (operands[0], dfreg));
6283 rtx dreg = operands[1];
6285 dreg = force_reg (SImode, dreg);
6286 dreg = convert_to_mode (DImode, dreg, false);
6287 emit_insn (gen_floatdisf2 (operands[0], dreg));
6292 (define_expand "floatdidf2"
6293 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6294 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
6295 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
6298 (define_insn "*floatdidf2_fpr"
6299 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6300 (float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6301 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
6302 && !VECTOR_UNIT_VSX_P (DFmode)"
6304 [(set_attr "type" "fp")])
6306 ; Allow the combiner to merge source memory operands to the conversion so that
6307 ; the optimizer/register allocator doesn't try to load the value too early in a
6308 ; GPR and then use store/load to move it to a FPR and suffer from a store-load
6309 ; hit. We will split after reload to avoid the trip through the GPRs
6311 (define_insn_and_split "*floatdidf2_mem"
6312 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6313 (float:DF (match_operand:DI 1 "memory_operand" "m")))
6314 (clobber (match_scratch:DI 2 "=d"))]
6315 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS && TARGET_FCFID"
6317 "&& reload_completed"
6318 [(set (match_dup 2) (match_dup 1))
6319 (set (match_dup 0) (float:DF (match_dup 2)))]
6321 [(set_attr "length" "8")
6322 (set_attr "type" "fpload")])
6324 (define_expand "floatunsdidf2"
6325 [(set (match_operand:DF 0 "gpc_reg_operand" "")
6327 (match_operand:DI 1 "gpc_reg_operand" "")))]
6328 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6331 (define_insn "*floatunsdidf2_fcfidu"
6332 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6333 (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6334 "TARGET_HARD_FLOAT && TARGET_FCFIDU && !VECTOR_UNIT_VSX_P (DFmode)"
6336 [(set_attr "type" "fp")
6337 (set_attr "length" "4")])
6339 (define_insn_and_split "*floatunsdidf2_mem"
6340 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
6341 (unsigned_float:DF (match_operand:DI 1 "memory_operand" "m")))
6342 (clobber (match_scratch:DI 2 "=d"))]
6343 "TARGET_HARD_FLOAT && (TARGET_FCFIDU || VECTOR_UNIT_VSX_P (DFmode))"
6345 "&& reload_completed"
6346 [(set (match_dup 2) (match_dup 1))
6347 (set (match_dup 0) (unsigned_float:DF (match_dup 2)))]
6349 [(set_attr "length" "8")
6350 (set_attr "type" "fpload")])
6352 (define_expand "floatdisf2"
6353 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6354 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6355 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6356 && (TARGET_FCFIDS || TARGET_POWERPC64 || flag_unsafe_math_optimizations)"
6361 rtx val = operands[1];
6362 if (!flag_unsafe_math_optimizations)
6364 rtx label = gen_label_rtx ();
6365 val = gen_reg_rtx (DImode);
6366 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
6369 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
6374 (define_insn "floatdisf2_fcfids"
6375 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6376 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6377 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6378 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6380 [(set_attr "type" "fp")])
6382 (define_insn_and_split "*floatdisf2_mem"
6383 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6384 (float:SF (match_operand:DI 1 "memory_operand" "m")))
6385 (clobber (match_scratch:DI 2 "=f"))]
6386 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6387 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDS"
6389 "&& reload_completed"
6393 emit_move_insn (operands[2], operands[1]);
6394 emit_insn (gen_floatdisf2_fcfids (operands[0], operands[2]));
6397 [(set_attr "length" "8")])
6399 ;; This is not IEEE compliant if rounding mode is "round to nearest".
6400 ;; If the DI->DF conversion is inexact, then it's possible to suffer
6401 ;; from double rounding.
6402 ;; Instead of creating a new cpu type for two FP operations, just use fp
6403 (define_insn_and_split "floatdisf2_internal1"
6404 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6405 (float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))
6406 (clobber (match_scratch:DF 2 "=d"))]
6407 "TARGET_FCFID && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6409 "&& reload_completed"
6411 (float:DF (match_dup 1)))
6413 (float_truncate:SF (match_dup 2)))]
6415 [(set_attr "length" "8")
6416 (set_attr "type" "fp")])
6418 ;; Twiddles bits to avoid double rounding.
6419 ;; Bits that might be truncated when converting to DFmode are replaced
6420 ;; by a bit that won't be lost at that stage, but is below the SFmode
6421 ;; rounding position.
6422 (define_expand "floatdisf2_internal2"
6423 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
6425 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
6427 (clobber (scratch:CC))])
6428 (set (match_dup 3) (plus:DI (match_dup 3)
6430 (set (match_dup 0) (plus:DI (match_dup 0)
6432 (set (match_dup 4) (compare:CCUNS (match_dup 3)
6434 (set (match_dup 0) (ior:DI (match_dup 0)
6436 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
6438 (clobber (scratch:CC))])
6439 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
6440 (label_ref (match_operand:DI 2 "" ""))
6442 (set (match_dup 0) (match_dup 1))]
6443 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
6446 operands[3] = gen_reg_rtx (DImode);
6447 operands[4] = gen_reg_rtx (CCUNSmode);
6450 (define_expand "floatunsdisf2"
6451 [(set (match_operand:SF 0 "gpc_reg_operand" "")
6452 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
6453 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6454 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6457 (define_insn "floatunsdisf2_fcfidus"
6458 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6459 (unsigned_float:SF (match_operand:DI 1 "gpc_reg_operand" "d")))]
6460 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6461 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6463 [(set_attr "type" "fp")])
6465 (define_insn_and_split "*floatunsdisf2_mem"
6466 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
6467 (unsigned_float:SF (match_operand:DI 1 "memory_operand" "m")))
6468 (clobber (match_scratch:DI 2 "=f"))]
6469 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
6470 && TARGET_DOUBLE_FLOAT && TARGET_FCFIDUS"
6472 "&& reload_completed"
6476 emit_move_insn (operands[2], operands[1]);
6477 emit_insn (gen_floatunsdisf2_fcfidus (operands[0], operands[2]));
6480 [(set_attr "length" "8")
6481 (set_attr "type" "fpload")])
6483 ;; Define the DImode operations that can be done in a small number
6484 ;; of instructions. The & constraints are to prevent the register
6485 ;; allocator from allocating registers that overlap with the inputs
6486 ;; (for example, having an input in 7,8 and an output in 6,7). We
6487 ;; also allow for the output being the same as one of the inputs.
6489 (define_insn "*adddi3_noppc64"
6490 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6491 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6492 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6493 "! TARGET_POWERPC64"
6496 if (WORDS_BIG_ENDIAN)
6497 return (GET_CODE (operands[2])) != CONST_INT
6498 ? \"addc %L0,%L1,%L2\;adde %0,%1,%2\"
6499 : \"addic %L0,%L1,%2\;add%G2e %0,%1\";
6501 return (GET_CODE (operands[2])) != CONST_INT
6502 ? \"addc %0,%1,%2\;adde %L0,%L1,%L2\"
6503 : \"addic %0,%1,%2\;add%G2e %L0,%L1\";
6505 [(set_attr "type" "two")
6506 (set_attr "length" "8")])
6508 (define_insn "*subdi3_noppc64"
6509 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6510 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6511 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6512 "! TARGET_POWERPC64"
6515 if (WORDS_BIG_ENDIAN)
6516 return (GET_CODE (operands[1]) != CONST_INT)
6517 ? \"subfc %L0,%L2,%L1\;subfe %0,%2,%1\"
6518 : \"subfic %L0,%L2,%1\;subf%G1e %0,%2\";
6520 return (GET_CODE (operands[1]) != CONST_INT)
6521 ? \"subfc %0,%2,%1\;subfe %L0,%L2,%L1\"
6522 : \"subfic %0,%2,%1\;subf%G1e %L0,%L2\";
6524 [(set_attr "type" "two")
6525 (set_attr "length" "8")])
6527 (define_insn "*negdi2_noppc64"
6528 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6529 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6530 "! TARGET_POWERPC64"
6533 return (WORDS_BIG_ENDIAN)
6534 ? \"subfic %L0,%L1,0\;subfze %0,%1\"
6535 : \"subfic %0,%1,0\;subfze %L0,%L1\";
6537 [(set_attr "type" "two")
6538 (set_attr "length" "8")])
6540 (define_insn "mulsidi3"
6541 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6542 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6543 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6544 "! TARGET_POWERPC64"
6546 return (WORDS_BIG_ENDIAN)
6547 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6548 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6550 [(set_attr "type" "imul")
6551 (set_attr "length" "8")])
6554 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6555 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6556 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6557 "! TARGET_POWERPC64 && reload_completed"
6560 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6561 (sign_extend:DI (match_dup 2)))
6564 (mult:SI (match_dup 1)
6568 int endian = (WORDS_BIG_ENDIAN == 0);
6569 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6570 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6573 (define_insn "umulsidi3"
6574 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6575 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6576 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6577 "! TARGET_POWERPC64"
6580 return (WORDS_BIG_ENDIAN)
6581 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6582 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6584 [(set_attr "type" "imul")
6585 (set_attr "length" "8")])
6588 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6589 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6590 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6591 "! TARGET_POWERPC64 && reload_completed"
6594 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6595 (zero_extend:DI (match_dup 2)))
6598 (mult:SI (match_dup 1)
6602 int endian = (WORDS_BIG_ENDIAN == 0);
6603 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6604 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6607 (define_insn "smulsi3_highpart"
6608 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6610 (lshiftrt:DI (mult:DI (sign_extend:DI
6611 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6613 (match_operand:SI 2 "gpc_reg_operand" "r")))
6617 [(set_attr "type" "imul")])
6619 (define_insn "umulsi3_highpart"
6620 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6622 (lshiftrt:DI (mult:DI (zero_extend:DI
6623 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6625 (match_operand:SI 2 "gpc_reg_operand" "r")))
6629 [(set_attr "type" "imul")])
6631 ;; Shift by a variable amount is too complex to be worth open-coding. We
6632 ;; just handle shifts by constants.
6633 (define_insn "ashrdi3_no_power"
6634 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6635 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6636 (match_operand:SI 2 "const_int_operand" "M,i")))]
6637 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6639 srawi %0,%1,31\;srawi %L0,%1,%h2
6640 srwi %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;srawi %0,%1,%h2"
6641 [(set_attr "type" "two,three")
6642 (set_attr "length" "8,12")])
6644 (define_insn "*ashrdisi3_noppc64be"
6645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6646 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6647 (const_int 32)) 4))]
6648 "TARGET_32BIT && !TARGET_POWERPC64 && WORDS_BIG_ENDIAN"
6651 if (REGNO (operands[0]) == REGNO (operands[1]))
6654 return \"mr %0,%1\";
6656 [(set_attr "length" "4")])
6659 ;; PowerPC64 DImode operations.
6661 (define_insn "muldi3"
6662 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6663 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6664 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
6670 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
6671 (const_string "imul3")
6672 (match_operand:SI 2 "short_cint_operand" "")
6673 (const_string "imul2")]
6674 (const_string "lmul")))])
6676 (define_insn "*muldi3_internal1"
6677 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6678 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6679 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6681 (clobber (match_scratch:DI 3 "=r,r"))]
6686 [(set_attr "type" "lmul_compare")
6687 (set_attr "length" "4,8")])
6690 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6691 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6692 (match_operand:DI 2 "gpc_reg_operand" ""))
6694 (clobber (match_scratch:DI 3 ""))]
6695 "TARGET_POWERPC64 && reload_completed"
6697 (mult:DI (match_dup 1) (match_dup 2)))
6699 (compare:CC (match_dup 3)
6703 (define_insn "*muldi3_internal2"
6704 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6705 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
6706 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6708 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6709 (mult:DI (match_dup 1) (match_dup 2)))]
6714 [(set_attr "type" "lmul_compare")
6715 (set_attr "length" "4,8")])
6718 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6719 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6720 (match_operand:DI 2 "gpc_reg_operand" ""))
6722 (set (match_operand:DI 0 "gpc_reg_operand" "")
6723 (mult:DI (match_dup 1) (match_dup 2)))]
6724 "TARGET_POWERPC64 && reload_completed"
6726 (mult:DI (match_dup 1) (match_dup 2)))
6728 (compare:CC (match_dup 0)
6732 (define_insn "smuldi3_highpart"
6733 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6735 (lshiftrt:TI (mult:TI (sign_extend:TI
6736 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6738 (match_operand:DI 2 "gpc_reg_operand" "r")))
6742 [(set_attr "type" "lmul")])
6744 (define_insn "umuldi3_highpart"
6745 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6747 (lshiftrt:TI (mult:TI (zero_extend:TI
6748 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6750 (match_operand:DI 2 "gpc_reg_operand" "r")))
6754 [(set_attr "type" "lmul")])
6756 (define_expand "mulditi3"
6757 [(set (match_operand:TI 0 "gpc_reg_operand")
6758 (mult:TI (sign_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6759 (sign_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6762 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6763 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6764 emit_insn (gen_smuldi3_highpart (h, operands[1], operands[2]));
6765 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6766 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6770 (define_expand "umulditi3"
6771 [(set (match_operand:TI 0 "gpc_reg_operand")
6772 (mult:TI (zero_extend:TI (match_operand:DI 1 "gpc_reg_operand"))
6773 (zero_extend:TI (match_operand:DI 2 "gpc_reg_operand"))))]
6776 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
6777 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
6778 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
6779 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
6780 emit_move_insn (gen_highpart (DImode, operands[0]), h);
6784 (define_insn "rotldi3"
6785 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6786 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6787 (match_operand:DI 2 "reg_or_cint_operand" "r,i")))]
6792 [(set_attr "type" "var_shift_rotate,integer")])
6794 (define_insn "*rotldi3_internal2"
6795 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6796 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6797 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6799 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6806 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6807 (set_attr "length" "4,4,8,8")])
6810 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6811 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6812 (match_operand:DI 2 "reg_or_cint_operand" ""))
6814 (clobber (match_scratch:DI 3 ""))]
6815 "TARGET_POWERPC64 && reload_completed"
6817 (rotate:DI (match_dup 1) (match_dup 2)))
6819 (compare:CC (match_dup 3)
6823 (define_insn "*rotldi3_internal3"
6824 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6825 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6826 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6828 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6829 (rotate:DI (match_dup 1) (match_dup 2)))]
6836 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6837 (set_attr "length" "4,4,8,8")])
6840 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
6841 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6842 (match_operand:DI 2 "reg_or_cint_operand" ""))
6844 (set (match_operand:DI 0 "gpc_reg_operand" "")
6845 (rotate:DI (match_dup 1) (match_dup 2)))]
6846 "TARGET_POWERPC64 && reload_completed"
6848 (rotate:DI (match_dup 1) (match_dup 2)))
6850 (compare:CC (match_dup 0)
6854 (define_insn "*rotldi3_internal4"
6855 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6856 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6857 (match_operand:DI 2 "reg_or_cint_operand" "r,i"))
6858 (match_operand:DI 3 "mask64_operand" "n,n")))]
6861 rldc%B3 %0,%1,%2,%S3
6862 rldic%B3 %0,%1,%H2,%S3"
6863 [(set_attr "type" "var_shift_rotate,integer")])
6865 (define_insn "*rotldi3_internal5"
6866 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6868 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6869 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6870 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6872 (clobber (match_scratch:DI 4 "=r,r,r,r"))]
6875 rldc%B3. %4,%1,%2,%S3
6876 rldic%B3. %4,%1,%H2,%S3
6879 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6880 (set_attr "length" "4,4,8,8")])
6883 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6885 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6886 (match_operand:DI 2 "reg_or_cint_operand" ""))
6887 (match_operand:DI 3 "mask64_operand" ""))
6889 (clobber (match_scratch:DI 4 ""))]
6890 "TARGET_POWERPC64 && reload_completed"
6892 (and:DI (rotate:DI (match_dup 1)
6896 (compare:CC (match_dup 4)
6900 (define_insn "*rotldi3_internal6"
6901 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
6903 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6904 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i"))
6905 (match_operand:DI 3 "mask64_operand" "n,n,n,n"))
6907 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6908 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6911 rldc%B3. %0,%1,%2,%S3
6912 rldic%B3. %0,%1,%H2,%S3
6915 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6916 (set_attr "length" "4,4,8,8")])
6919 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
6921 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6922 (match_operand:DI 2 "reg_or_cint_operand" ""))
6923 (match_operand:DI 3 "mask64_operand" ""))
6925 (set (match_operand:DI 0 "gpc_reg_operand" "")
6926 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6927 "TARGET_POWERPC64 && reload_completed"
6929 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6931 (compare:CC (match_dup 0)
6935 (define_insn "*rotldi3_internal7le"
6936 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6939 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6940 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
6941 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
6944 rldicl %0,%1,%H2,56"
6945 [(set_attr "type" "var_shift_rotate,integer")])
6947 (define_insn "*rotldi3_internal7be"
6948 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6951 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6952 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 7)))]
6953 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
6956 rldicl %0,%1,%H2,56"
6957 [(set_attr "type" "var_shift_rotate,integer")])
6959 (define_insn "*rotldi3_internal8le"
6960 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6961 (compare:CC (zero_extend:DI
6963 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6964 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
6966 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6967 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
6970 rldicl. %3,%1,%H2,56
6973 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6974 (set_attr "length" "4,4,8,8")])
6976 (define_insn "*rotldi3_internal8be"
6977 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6978 (compare:CC (zero_extend:DI
6980 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
6981 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
6983 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6984 "TARGET_64BIT && BYTES_BIG_ENDIAN"
6987 rldicl. %3,%1,%H2,56
6990 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
6991 (set_attr "length" "4,4,8,8")])
6994 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
6995 (compare:CC (zero_extend:DI
6997 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6998 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7000 (clobber (match_scratch:DI 3 ""))]
7001 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7003 (zero_extend:DI (subreg:QI
7004 (rotate:DI (match_dup 1)
7007 (compare:CC (match_dup 3)
7012 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7013 (compare:CC (zero_extend:DI
7015 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7016 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7018 (clobber (match_scratch:DI 3 ""))]
7019 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7021 (zero_extend:DI (subreg:QI
7022 (rotate:DI (match_dup 1)
7025 (compare:CC (match_dup 3)
7029 (define_insn "*rotldi3_internal9le"
7030 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7031 (compare:CC (zero_extend:DI
7033 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7034 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7036 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7037 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7038 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7041 rldicl. %0,%1,%H2,56
7044 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7045 (set_attr "length" "4,4,8,8")])
7047 (define_insn "*rotldi3_internal9be"
7048 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7049 (compare:CC (zero_extend:DI
7051 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7052 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 7))
7054 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7055 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7056 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7059 rldicl. %0,%1,%H2,56
7062 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7063 (set_attr "length" "4,4,8,8")])
7066 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7067 (compare:CC (zero_extend:DI
7069 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7070 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7072 (set (match_operand:DI 0 "gpc_reg_operand" "")
7073 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7074 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7076 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7078 (compare:CC (match_dup 0)
7083 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7084 (compare:CC (zero_extend:DI
7086 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7087 (match_operand:DI 2 "reg_or_cint_operand" "")) 7))
7089 (set (match_operand:DI 0 "gpc_reg_operand" "")
7090 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))]
7091 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7093 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 7)))
7095 (compare:CC (match_dup 0)
7099 (define_insn "*rotldi3_internal10le"
7100 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7103 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7104 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7105 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7108 rldicl %0,%1,%H2,48"
7109 [(set_attr "type" "var_shift_rotate,integer")])
7111 (define_insn "*rotldi3_internal10be"
7112 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7115 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7116 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 6)))]
7117 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7120 rldicl %0,%1,%H2,48"
7121 [(set_attr "type" "var_shift_rotate,integer")])
7123 (define_insn "*rotldi3_internal11le"
7124 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7125 (compare:CC (zero_extend:DI
7127 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7128 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7130 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7131 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7134 rldicl. %3,%1,%H2,48
7137 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7138 (set_attr "length" "4,4,8,8")])
7140 (define_insn "*rotldi3_internal11be"
7141 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7142 (compare:CC (zero_extend:DI
7144 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7145 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7147 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7148 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7151 rldicl. %3,%1,%H2,48
7154 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7155 (set_attr "length" "4,4,8,8")])
7158 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7159 (compare:CC (zero_extend:DI
7161 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7162 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7164 (clobber (match_scratch:DI 3 ""))]
7165 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7167 (zero_extend:DI (subreg:HI
7168 (rotate:DI (match_dup 1)
7171 (compare:CC (match_dup 3)
7176 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7177 (compare:CC (zero_extend:DI
7179 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7180 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7182 (clobber (match_scratch:DI 3 ""))]
7183 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7185 (zero_extend:DI (subreg:HI
7186 (rotate:DI (match_dup 1)
7189 (compare:CC (match_dup 3)
7193 (define_insn "*rotldi3_internal12le"
7194 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7195 (compare:CC (zero_extend:DI
7197 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7198 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7200 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7201 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7202 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7205 rldicl. %0,%1,%H2,48
7208 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7209 (set_attr "length" "4,4,8,8")])
7211 (define_insn "*rotldi3_internal12be"
7212 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7213 (compare:CC (zero_extend:DI
7215 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7216 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 6))
7218 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7219 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7220 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7223 rldicl. %0,%1,%H2,48
7226 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7227 (set_attr "length" "4,4,8,8")])
7230 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7231 (compare:CC (zero_extend:DI
7233 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7234 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7236 (set (match_operand:DI 0 "gpc_reg_operand" "")
7237 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7238 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7240 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7242 (compare:CC (match_dup 0)
7247 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7248 (compare:CC (zero_extend:DI
7250 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7251 (match_operand:DI 2 "reg_or_cint_operand" "")) 6))
7253 (set (match_operand:DI 0 "gpc_reg_operand" "")
7254 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))]
7255 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7257 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 6)))
7259 (compare:CC (match_dup 0)
7263 (define_insn "*rotldi3_internal13le"
7264 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7267 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7268 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 0)))]
7269 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN"
7272 rldicl %0,%1,%H2,32"
7273 [(set_attr "type" "var_shift_rotate,integer")])
7275 (define_insn "*rotldi3_internal13be"
7276 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7279 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7280 (match_operand:DI 2 "reg_or_cint_operand" "r,i")) 4)))]
7281 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN"
7284 rldicl %0,%1,%H2,32"
7285 [(set_attr "type" "var_shift_rotate,integer")])
7287 (define_insn "*rotldi3_internal14le"
7288 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7289 (compare:CC (zero_extend:DI
7291 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7292 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7294 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7295 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7298 rldicl. %3,%1,%H2,32
7301 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7302 (set_attr "length" "4,4,8,8")])
7304 (define_insn "*rotldi3_internal14be"
7305 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7306 (compare:CC (zero_extend:DI
7308 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7309 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7311 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7312 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7315 rldicl. %3,%1,%H2,32
7318 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7319 (set_attr "length" "4,4,8,8")])
7322 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7323 (compare:CC (zero_extend:DI
7325 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7326 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7328 (clobber (match_scratch:DI 3 ""))]
7329 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7331 (zero_extend:DI (subreg:SI
7332 (rotate:DI (match_dup 1)
7335 (compare:CC (match_dup 3)
7340 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7341 (compare:CC (zero_extend:DI
7343 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7344 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7346 (clobber (match_scratch:DI 3 ""))]
7347 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7349 (zero_extend:DI (subreg:SI
7350 (rotate:DI (match_dup 1)
7353 (compare:CC (match_dup 3)
7357 (define_insn "*rotldi3_internal15le"
7358 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7359 (compare:CC (zero_extend:DI
7361 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7362 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 0))
7364 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7365 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7366 "TARGET_64BIT && !BYTES_BIG_ENDIAN"
7369 rldicl. %0,%1,%H2,32
7372 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7373 (set_attr "length" "4,4,8,8")])
7375 (define_insn "*rotldi3_internal15be"
7376 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7377 (compare:CC (zero_extend:DI
7379 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7380 (match_operand:DI 2 "reg_or_cint_operand" "r,i,r,i")) 4))
7382 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7383 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7384 "TARGET_64BIT && BYTES_BIG_ENDIAN"
7387 rldicl. %0,%1,%H2,32
7390 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7391 (set_attr "length" "4,4,8,8")])
7394 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7395 (compare:CC (zero_extend:DI
7397 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7398 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7400 (set (match_operand:DI 0 "gpc_reg_operand" "")
7401 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7402 "TARGET_POWERPC64 && !BYTES_BIG_ENDIAN && reload_completed"
7404 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7406 (compare:CC (match_dup 0)
7411 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7412 (compare:CC (zero_extend:DI
7414 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7415 (match_operand:DI 2 "reg_or_cint_operand" "")) 4))
7417 (set (match_operand:DI 0 "gpc_reg_operand" "")
7418 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))]
7419 "TARGET_POWERPC64 && BYTES_BIG_ENDIAN && reload_completed"
7421 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 4)))
7423 (compare:CC (match_dup 0)
7427 (define_expand "ashldi3"
7428 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7429 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7430 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7434 (define_insn "*ashldi3_internal1"
7435 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7436 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7437 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7442 [(set_attr "type" "var_shift_rotate,shift")])
7444 (define_insn "*ashldi3_internal2"
7445 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7446 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7447 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7449 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7456 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7457 (set_attr "length" "4,4,8,8")])
7460 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7461 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7462 (match_operand:SI 2 "reg_or_cint_operand" ""))
7464 (clobber (match_scratch:DI 3 ""))]
7465 "TARGET_POWERPC64 && reload_completed"
7467 (ashift:DI (match_dup 1) (match_dup 2)))
7469 (compare:CC (match_dup 3)
7473 (define_insn "*ashldi3_internal3"
7474 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7475 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7476 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7478 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7479 (ashift:DI (match_dup 1) (match_dup 2)))]
7486 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7487 (set_attr "length" "4,4,8,8")])
7490 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7491 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7492 (match_operand:SI 2 "reg_or_cint_operand" ""))
7494 (set (match_operand:DI 0 "gpc_reg_operand" "")
7495 (ashift:DI (match_dup 1) (match_dup 2)))]
7496 "TARGET_POWERPC64 && reload_completed"
7498 (ashift:DI (match_dup 1) (match_dup 2)))
7500 (compare:CC (match_dup 0)
7504 (define_insn "*ashldi3_internal4"
7505 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7506 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7507 (match_operand:SI 2 "const_int_operand" "i"))
7508 (match_operand:DI 3 "const_int_operand" "n")))]
7509 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7510 "rldic %0,%1,%H2,%W3")
7512 (define_insn "ashldi3_internal5"
7513 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7515 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7516 (match_operand:SI 2 "const_int_operand" "i,i"))
7517 (match_operand:DI 3 "const_int_operand" "n,n"))
7519 (clobber (match_scratch:DI 4 "=r,r"))]
7520 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7522 rldic. %4,%1,%H2,%W3
7524 [(set_attr "type" "compare")
7525 (set_attr "length" "4,8")])
7528 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7530 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7531 (match_operand:SI 2 "const_int_operand" ""))
7532 (match_operand:DI 3 "const_int_operand" ""))
7534 (clobber (match_scratch:DI 4 ""))]
7535 "TARGET_POWERPC64 && reload_completed
7536 && includes_rldic_lshift_p (operands[2], operands[3])"
7538 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7541 (compare:CC (match_dup 4)
7545 (define_insn "*ashldi3_internal6"
7546 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7548 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7549 (match_operand:SI 2 "const_int_operand" "i,i"))
7550 (match_operand:DI 3 "const_int_operand" "n,n"))
7552 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7553 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7554 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
7556 rldic. %0,%1,%H2,%W3
7558 [(set_attr "type" "compare")
7559 (set_attr "length" "4,8")])
7562 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7564 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7565 (match_operand:SI 2 "const_int_operand" ""))
7566 (match_operand:DI 3 "const_int_operand" ""))
7568 (set (match_operand:DI 0 "gpc_reg_operand" "")
7569 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7570 "TARGET_POWERPC64 && reload_completed
7571 && includes_rldic_lshift_p (operands[2], operands[3])"
7573 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7576 (compare:CC (match_dup 0)
7580 (define_insn "*ashldi3_internal7"
7581 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7582 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7583 (match_operand:SI 2 "const_int_operand" "i"))
7584 (match_operand:DI 3 "mask64_operand" "n")))]
7585 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7586 "rldicr %0,%1,%H2,%S3")
7588 (define_insn "ashldi3_internal8"
7589 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7591 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7592 (match_operand:SI 2 "const_int_operand" "i,i"))
7593 (match_operand:DI 3 "mask64_operand" "n,n"))
7595 (clobber (match_scratch:DI 4 "=r,r"))]
7596 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7598 rldicr. %4,%1,%H2,%S3
7600 [(set_attr "type" "compare")
7601 (set_attr "length" "4,8")])
7604 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7606 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7607 (match_operand:SI 2 "const_int_operand" ""))
7608 (match_operand:DI 3 "mask64_operand" ""))
7610 (clobber (match_scratch:DI 4 ""))]
7611 "TARGET_POWERPC64 && reload_completed
7612 && includes_rldicr_lshift_p (operands[2], operands[3])"
7614 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7617 (compare:CC (match_dup 4)
7621 (define_insn "*ashldi3_internal9"
7622 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7624 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7625 (match_operand:SI 2 "const_int_operand" "i,i"))
7626 (match_operand:DI 3 "mask64_operand" "n,n"))
7628 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7629 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7630 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
7632 rldicr. %0,%1,%H2,%S3
7634 [(set_attr "type" "compare")
7635 (set_attr "length" "4,8")])
7638 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
7640 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7641 (match_operand:SI 2 "const_int_operand" ""))
7642 (match_operand:DI 3 "mask64_operand" ""))
7644 (set (match_operand:DI 0 "gpc_reg_operand" "")
7645 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7646 "TARGET_POWERPC64 && reload_completed
7647 && includes_rldicr_lshift_p (operands[2], operands[3])"
7649 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7652 (compare:CC (match_dup 0)
7656 (define_expand "lshrdi3"
7657 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7658 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7659 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7663 (define_insn "*lshrdi3_internal1"
7664 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7665 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7666 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7671 [(set_attr "type" "var_shift_rotate,shift")])
7673 (define_insn "*lshrdi3_internal2"
7674 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7675 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7676 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7678 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7685 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7686 (set_attr "length" "4,4,8,8")])
7689 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
7690 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7691 (match_operand:SI 2 "reg_or_cint_operand" ""))
7693 (clobber (match_scratch:DI 3 ""))]
7694 "TARGET_POWERPC64 && reload_completed"
7696 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7698 (compare:CC (match_dup 3)
7702 (define_insn "*lshrdi3_internal3"
7703 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7704 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7705 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7707 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7708 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7715 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7716 (set_attr "length" "4,4,8,8")])
7719 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7720 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7721 (match_operand:SI 2 "reg_or_cint_operand" ""))
7723 (set (match_operand:DI 0 "gpc_reg_operand" "")
7724 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7725 "TARGET_POWERPC64 && reload_completed"
7727 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7729 (compare:CC (match_dup 0)
7733 (define_expand "ashrdi3"
7734 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7735 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7736 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7740 if (TARGET_POWERPC64)
7742 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
7743 && WORDS_BIG_ENDIAN)
7745 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7752 (define_insn "*ashrdi3_internal1"
7753 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7754 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7755 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))]
7760 [(set_attr "type" "var_shift_rotate,shift")])
7762 (define_insn "*ashrdi3_internal2"
7763 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
7764 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7765 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7767 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
7774 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7775 (set_attr "length" "4,4,8,8")])
7778 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7779 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7780 (match_operand:SI 2 "reg_or_cint_operand" ""))
7782 (clobber (match_scratch:DI 3 ""))]
7783 "TARGET_POWERPC64 && reload_completed"
7785 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7787 (compare:CC (match_dup 3)
7791 (define_insn "*ashrdi3_internal3"
7792 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
7793 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
7794 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
7796 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7797 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7804 [(set_attr "type" "var_delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
7805 (set_attr "length" "4,4,8,8")])
7808 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7809 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7810 (match_operand:SI 2 "reg_or_cint_operand" ""))
7812 (set (match_operand:DI 0 "gpc_reg_operand" "")
7813 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7814 "TARGET_POWERPC64 && reload_completed"
7816 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7818 (compare:CC (match_dup 0)
7822 (define_expand "anddi3"
7824 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7825 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7826 (match_operand:DI 2 "and64_2_operand" "")))
7827 (clobber (match_scratch:CC 3 ""))])]
7831 (define_insn "anddi3_mc"
7832 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
7833 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7834 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
7835 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
7836 "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
7839 rldic%B2 %0,%1,0,%S2
7840 rlwinm %0,%1,0,%m2,%M2
7844 [(set_attr "type" "*,*,*,fast_compare,fast_compare,*")
7845 (set_attr "length" "4,4,4,4,4,8")])
7847 (define_insn "anddi3_nomc"
7848 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7849 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7850 (match_operand:DI 2 "and64_2_operand" "?r,S,T,t")))
7851 (clobber (match_scratch:CC 3 "=X,X,X,X"))]
7852 "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
7855 rldic%B2 %0,%1,0,%S2
7856 rlwinm %0,%1,0,%m2,%M2
7858 [(set_attr "length" "4,4,4,8")])
7861 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7862 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7863 (match_operand:DI 2 "mask64_2_operand" "")))
7864 (clobber (match_scratch:CC 3 ""))]
7866 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7867 && !mask_operand (operands[2], DImode)
7868 && !mask64_operand (operands[2], DImode)"
7870 (and:DI (rotate:DI (match_dup 1)
7874 (and:DI (rotate:DI (match_dup 0)
7878 build_mask64_2_operands (operands[2], &operands[4]);
7881 (define_insn "*anddi3_internal2_mc"
7882 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7883 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7884 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7886 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r,r,r"))
7887 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7888 "TARGET_64BIT && rs6000_gen_cell_microcode"
7891 rldic%B2. %3,%1,0,%S2
7892 rlwinm. %3,%1,0,%m2,%M2
7902 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7903 fast_compare,compare,compare,compare,compare,compare,\
7905 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7908 [(set (match_operand:CC 0 "cc_reg_operand" "")
7909 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7910 (match_operand:DI 2 "mask64_2_operand" ""))
7912 (clobber (match_scratch:DI 3 ""))
7913 (clobber (match_scratch:CC 4 ""))]
7914 "TARGET_64BIT && reload_completed
7915 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7916 && !mask_operand (operands[2], DImode)
7917 && !mask64_operand (operands[2], DImode)"
7919 (and:DI (rotate:DI (match_dup 1)
7922 (parallel [(set (match_dup 0)
7923 (compare:CC (and:DI (rotate:DI (match_dup 3)
7927 (clobber (match_dup 3))])]
7930 build_mask64_2_operands (operands[2], &operands[5]);
7933 (define_insn "*anddi3_internal3_mc"
7934 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,x,?y,?y,?y,??y,??y,?y")
7935 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r,r,r")
7936 (match_operand:DI 2 "and64_2_operand" "r,S,T,K,J,t,r,S,T,K,J,t"))
7938 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r,r,r")
7939 (and:DI (match_dup 1) (match_dup 2)))
7940 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,X,X,x,x,X"))]
7941 "TARGET_64BIT && rs6000_gen_cell_microcode"
7944 rldic%B2. %0,%1,0,%S2
7945 rlwinm. %0,%1,0,%m2,%M2
7955 [(set_attr "type" "fast_compare,compare,delayed_compare,fast_compare,\
7956 fast_compare,compare,compare,compare,compare,compare,\
7958 (set_attr "length" "4,4,4,4,4,8,8,8,8,8,8,12")])
7961 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
7962 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7963 (match_operand:DI 2 "and64_2_operand" ""))
7965 (set (match_operand:DI 0 "gpc_reg_operand" "")
7966 (and:DI (match_dup 1) (match_dup 2)))
7967 (clobber (match_scratch:CC 4 ""))]
7968 "TARGET_64BIT && reload_completed"
7969 [(parallel [(set (match_dup 0)
7970 (and:DI (match_dup 1) (match_dup 2)))
7971 (clobber (match_dup 4))])
7973 (compare:CC (match_dup 0)
7978 [(set (match_operand:CC 3 "cc_reg_operand" "")
7979 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7980 (match_operand:DI 2 "mask64_2_operand" ""))
7982 (set (match_operand:DI 0 "gpc_reg_operand" "")
7983 (and:DI (match_dup 1) (match_dup 2)))
7984 (clobber (match_scratch:CC 4 ""))]
7985 "TARGET_64BIT && reload_completed
7986 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7987 && !mask_operand (operands[2], DImode)
7988 && !mask64_operand (operands[2], DImode)"
7990 (and:DI (rotate:DI (match_dup 1)
7993 (parallel [(set (match_dup 3)
7994 (compare:CC (and:DI (rotate:DI (match_dup 0)
7999 (and:DI (rotate:DI (match_dup 0)
8004 build_mask64_2_operands (operands[2], &operands[5]);
8007 (define_expand "iordi3"
8008 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8009 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
8010 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8014 if (non_logical_cint_operand (operands[2], DImode))
8016 HOST_WIDE_INT value;
8017 rtx tmp = ((!can_create_pseudo_p ()
8018 || rtx_equal_p (operands[0], operands[1]))
8019 ? operands[0] : gen_reg_rtx (DImode));
8021 value = INTVAL (operands[2]);
8022 emit_insn (gen_iordi3 (tmp, operands[1],
8023 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8025 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8030 (define_expand "xordi3"
8031 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8032 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
8033 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
8037 if (non_logical_cint_operand (operands[2], DImode))
8039 HOST_WIDE_INT value;
8040 rtx tmp = ((!can_create_pseudo_p ()
8041 || rtx_equal_p (operands[0], operands[1]))
8042 ? operands[0] : gen_reg_rtx (DImode));
8044 value = INTVAL (operands[2]);
8045 emit_insn (gen_xordi3 (tmp, operands[1],
8046 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
8048 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
8053 (define_insn "*booldi3_internal1"
8054 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
8055 (match_operator:DI 3 "boolean_or_operator"
8056 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
8057 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
8064 (define_insn "*booldi3_internal2"
8065 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8066 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8067 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8068 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8070 (clobber (match_scratch:DI 3 "=r,r"))]
8075 [(set_attr "type" "fast_compare,compare")
8076 (set_attr "length" "4,8")])
8079 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8080 (compare:CC (match_operator:DI 4 "boolean_operator"
8081 [(match_operand:DI 1 "gpc_reg_operand" "")
8082 (match_operand:DI 2 "gpc_reg_operand" "")])
8084 (clobber (match_scratch:DI 3 ""))]
8085 "TARGET_POWERPC64 && reload_completed"
8086 [(set (match_dup 3) (match_dup 4))
8088 (compare:CC (match_dup 3)
8092 (define_insn "*booldi3_internal3"
8093 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8094 (compare:CC (match_operator:DI 4 "boolean_or_operator"
8095 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
8096 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8098 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8104 [(set_attr "type" "fast_compare,compare")
8105 (set_attr "length" "4,8")])
8108 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8109 (compare:CC (match_operator:DI 4 "boolean_operator"
8110 [(match_operand:DI 1 "gpc_reg_operand" "")
8111 (match_operand:DI 2 "gpc_reg_operand" "")])
8113 (set (match_operand:DI 0 "gpc_reg_operand" "")
8115 "TARGET_POWERPC64 && reload_completed"
8116 [(set (match_dup 0) (match_dup 4))
8118 (compare:CC (match_dup 0)
8122 ;; Split a logical operation that we can't do in one insn into two insns,
8123 ;; each of which does one 16-bit part. This is used by combine.
8126 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8127 (match_operator:DI 3 "boolean_or_operator"
8128 [(match_operand:DI 1 "gpc_reg_operand" "")
8129 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
8131 [(set (match_dup 0) (match_dup 4))
8132 (set (match_dup 0) (match_dup 5))]
8137 i3 = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
8138 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8139 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8141 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
8145 (define_insn "*boolcdi3_internal1"
8146 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8147 (match_operator:DI 3 "boolean_operator"
8148 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8149 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8153 (define_insn "*boolcdi3_internal2"
8154 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8155 (compare:CC (match_operator:DI 4 "boolean_operator"
8156 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8157 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8159 (clobber (match_scratch:DI 3 "=r,r"))]
8164 [(set_attr "type" "fast_compare,compare")
8165 (set_attr "length" "4,8")])
8168 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8169 (compare:CC (match_operator:DI 4 "boolean_operator"
8170 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8171 (match_operand:DI 2 "gpc_reg_operand" "")])
8173 (clobber (match_scratch:DI 3 ""))]
8174 "TARGET_POWERPC64 && reload_completed"
8175 [(set (match_dup 3) (match_dup 4))
8177 (compare:CC (match_dup 3)
8181 (define_insn "*boolcdi3_internal3"
8182 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8183 (compare:CC (match_operator:DI 4 "boolean_operator"
8184 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8185 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8187 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8193 [(set_attr "type" "fast_compare,compare")
8194 (set_attr "length" "4,8")])
8197 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8198 (compare:CC (match_operator:DI 4 "boolean_operator"
8199 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8200 (match_operand:DI 2 "gpc_reg_operand" "")])
8202 (set (match_operand:DI 0 "gpc_reg_operand" "")
8204 "TARGET_POWERPC64 && reload_completed"
8205 [(set (match_dup 0) (match_dup 4))
8207 (compare:CC (match_dup 0)
8211 (define_insn "*boolccdi3_internal1"
8212 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8213 (match_operator:DI 3 "boolean_operator"
8214 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8215 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8219 (define_insn "*boolccdi3_internal2"
8220 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8221 (compare:CC (match_operator:DI 4 "boolean_operator"
8222 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8223 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8225 (clobber (match_scratch:DI 3 "=r,r"))]
8230 [(set_attr "type" "fast_compare,compare")
8231 (set_attr "length" "4,8")])
8234 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
8235 (compare:CC (match_operator:DI 4 "boolean_operator"
8236 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8237 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8239 (clobber (match_scratch:DI 3 ""))]
8240 "TARGET_POWERPC64 && reload_completed"
8241 [(set (match_dup 3) (match_dup 4))
8243 (compare:CC (match_dup 3)
8247 (define_insn "*boolccdi3_internal3"
8248 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8249 (compare:CC (match_operator:DI 4 "boolean_operator"
8250 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8251 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8253 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8259 [(set_attr "type" "fast_compare,compare")
8260 (set_attr "length" "4,8")])
8263 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
8264 (compare:CC (match_operator:DI 4 "boolean_operator"
8265 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8266 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8268 (set (match_operand:DI 0 "gpc_reg_operand" "")
8270 "TARGET_POWERPC64 && reload_completed"
8271 [(set (match_dup 0) (match_dup 4))
8273 (compare:CC (match_dup 0)
8277 ;; Now define ways of moving data around.
8279 ;; Set up a register with a value from the GOT table
8281 (define_expand "movsi_got"
8282 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8283 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8284 (match_dup 2)] UNSPEC_MOVSI_GOT))]
8285 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8288 if (GET_CODE (operands[1]) == CONST)
8290 rtx offset = const0_rtx;
8291 HOST_WIDE_INT value;
8293 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8294 value = INTVAL (offset);
8297 rtx tmp = (!can_create_pseudo_p ()
8299 : gen_reg_rtx (Pmode));
8300 emit_insn (gen_movsi_got (tmp, operands[1]));
8301 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8306 operands[2] = rs6000_got_register (operands[1]);
8309 (define_insn "*movsi_got_internal"
8310 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8311 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8312 (match_operand:SI 2 "gpc_reg_operand" "b")]
8314 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8315 "lwz %0,%a1@got(%2)"
8316 [(set_attr "type" "load")])
8318 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8319 ;; didn't get allocated to a hard register.
8321 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8322 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8323 (match_operand:SI 2 "memory_operand" "")]
8325 "DEFAULT_ABI == ABI_V4
8327 && (reload_in_progress || reload_completed)"
8328 [(set (match_dup 0) (match_dup 2))
8329 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
8333 ;; For SI, we special-case integers that can't be loaded in one insn. We
8334 ;; do the load 16-bits at a time. We could do this by loading from memory,
8335 ;; and this is even supposed to be faster, but it is simpler not to get
8336 ;; integers in the TOC.
8337 (define_insn "movsi_low"
8338 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8339 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8340 (match_operand 2 "" ""))))]
8341 "TARGET_MACHO && ! TARGET_64BIT"
8342 "lwz %0,lo16(%2)(%1)"
8343 [(set_attr "type" "load")
8344 (set_attr "length" "4")])
8346 (define_insn "*movsi_internal1"
8347 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h")
8348 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0"))]
8349 "!TARGET_SINGLE_FPU &&
8350 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8363 [(set_attr_alternative "type"
8367 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8368 (const_string "load_ux")
8370 (match_test "update_address_mem (operands[1], VOIDmode)")
8371 (const_string "load_u")
8372 (const_string "load")))
8374 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8375 (const_string "store_ux")
8377 (match_test "update_address_mem (operands[0], VOIDmode)")
8378 (const_string "store_u")
8379 (const_string "store")))
8383 (const_string "mfjmpr")
8384 (const_string "mtjmpr")
8386 (const_string "*")])
8388 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
8390 (define_insn "*movsi_internal1_single"
8391 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,*c*l,*h,*h,m,*f")
8392 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,*h,r,r,0,f,m"))]
8393 "TARGET_SINGLE_FPU &&
8394 (gpc_reg_operand (operands[0], SImode) || gpc_reg_operand (operands[1], SImode))"
8409 [(set_attr_alternative "type"
8413 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8414 (const_string "load_ux")
8416 (match_test "update_address_mem (operands[1], VOIDmode)")
8417 (const_string "load_u")
8418 (const_string "load")))
8420 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8421 (const_string "store_ux")
8423 (match_test "update_address_mem (operands[0], VOIDmode)")
8424 (const_string "store_u")
8425 (const_string "store")))
8429 (const_string "mfjmpr")
8430 (const_string "mtjmpr")
8434 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8435 (const_string "fpstore_ux")
8437 (match_test "update_address_mem (operands[0], VOIDmode)")
8438 (const_string "fpstore_u")
8439 (const_string "fpstore")))
8441 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8442 (const_string "fpload_ux")
8444 (match_test "update_address_mem (operands[1], VOIDmode)")
8445 (const_string "fpload_u")
8446 (const_string "fpload")))])
8447 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8449 ;; Split a load of a large constant into the appropriate two-insn
8453 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8454 (match_operand:SI 1 "const_int_operand" ""))]
8455 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8456 && (INTVAL (operands[1]) & 0xffff) != 0"
8460 (ior:SI (match_dup 0)
8463 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8465 if (tem == operands[0])
8471 (define_insn "*mov<mode>_internal2"
8472 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
8473 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
8475 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
8481 [(set_attr "type" "cmp,compare,cmp")
8482 (set_attr "length" "4,4,8")])
8485 [(set (match_operand:CC 2 "cc_reg_not_micro_cr0_operand" "")
8486 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
8488 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
8490 [(set (match_dup 0) (match_dup 1))
8492 (compare:CC (match_dup 0)
8496 (define_insn "*movhi_internal"
8497 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8498 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8499 "gpc_reg_operand (operands[0], HImode)
8500 || gpc_reg_operand (operands[1], HImode)"
8509 [(set_attr_alternative "type"
8512 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8513 (const_string "load_ux")
8515 (match_test "update_address_mem (operands[1], VOIDmode)")
8516 (const_string "load_u")
8517 (const_string "load")))
8519 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8520 (const_string "store_ux")
8522 (match_test "update_address_mem (operands[0], VOIDmode)")
8523 (const_string "store_u")
8524 (const_string "store")))
8526 (const_string "mfjmpr")
8527 (const_string "mtjmpr")
8528 (const_string "*")])])
8530 (define_expand "mov<mode>"
8531 [(set (match_operand:INT 0 "general_operand" "")
8532 (match_operand:INT 1 "any_operand" ""))]
8534 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8536 (define_insn "*movqi_internal"
8537 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*c*l,*h")
8538 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
8539 "gpc_reg_operand (operands[0], QImode)
8540 || gpc_reg_operand (operands[1], QImode)"
8549 [(set_attr_alternative "type"
8552 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8553 (const_string "load_ux")
8555 (match_test "update_address_mem (operands[1], VOIDmode)")
8556 (const_string "load_u")
8557 (const_string "load")))
8559 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8560 (const_string "store_ux")
8562 (match_test "update_address_mem (operands[0], VOIDmode)")
8563 (const_string "store_u")
8564 (const_string "store")))
8566 (const_string "mfjmpr")
8567 (const_string "mtjmpr")
8568 (const_string "*")])])
8570 ;; Here is how to move condition codes around. When we store CC data in
8571 ;; an integer register or memory, we store just the high-order 4 bits.
8572 ;; This lets us not shift in the most common case of CR0.
8573 (define_expand "movcc"
8574 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8575 (match_operand:CC 1 "nonimmediate_operand" ""))]
8579 (define_insn "*movcc_internal1"
8580 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,y,r,r,r,r,r,cl,r,m")
8581 (match_operand:CC 1 "general_operand" "y,r,r,O,x,y,r,I,h,r,m,r"))]
8582 "register_operand (operands[0], CCmode)
8583 || register_operand (operands[1], CCmode)"
8587 rlwinm %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;rlwinm %1,%1,%f0,0xffffffff
8590 mfcr %0%Q1\;rlwinm %0,%0,%f1,0xf0000000
8598 (cond [(eq_attr "alternative" "0,3")
8599 (const_string "cr_logical")
8600 (eq_attr "alternative" "1,2")
8601 (const_string "mtcr")
8602 (eq_attr "alternative" "6,7")
8603 (const_string "integer")
8604 (eq_attr "alternative" "8")
8605 (const_string "mfjmpr")
8606 (eq_attr "alternative" "9")
8607 (const_string "mtjmpr")
8608 (eq_attr "alternative" "10")
8610 (match_test "update_indexed_address_mem (operands[1],
8612 (const_string "load_ux")
8614 (match_test "update_address_mem (operands[1], VOIDmode)")
8615 (const_string "load_u")
8616 (const_string "load")))
8617 (eq_attr "alternative" "11")
8619 (match_test "update_indexed_address_mem (operands[0],
8621 (const_string "store_ux")
8623 (match_test "update_address_mem (operands[0], VOIDmode)")
8624 (const_string "store_u")
8625 (const_string "store")))
8626 (match_test "TARGET_MFCRF")
8627 (const_string "mfcrf")
8629 (const_string "mfcr")))
8630 (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
8632 ;; For floating-point, we normally deal with the floating-point registers
8633 ;; unless -msoft-float is used. The sole exception is that parameter passing
8634 ;; can produce floating-point values in fixed-point registers. Unless the
8635 ;; value is a simple constant or already in memory, we deal with this by
8636 ;; allocating memory and copying the value explicitly via that memory location.
8638 ;; Move 32-bit binary/decimal floating point
8639 (define_expand "mov<mode>"
8640 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
8641 (match_operand:FMOVE32 1 "any_operand" ""))]
8643 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8646 [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
8647 (match_operand:FMOVE32 1 "const_double_operand" ""))]
8649 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8650 || (GET_CODE (operands[0]) == SUBREG
8651 && GET_CODE (SUBREG_REG (operands[0])) == REG
8652 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8653 [(set (match_dup 2) (match_dup 3))]
8659 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8660 <real_value_to_target> (rv, l);
8662 if (! TARGET_POWERPC64)
8663 operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
8665 operands[2] = gen_lowpart (SImode, operands[0]);
8667 operands[3] = gen_int_mode (l, SImode);
8670 (define_insn "mov<mode>_hardfloat"
8671 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,*c*l,!r,*h,!r,!r")
8672 (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,r,h,0,G,Fn"))]
8673 "(gpc_reg_operand (operands[0], <MODE>mode)
8674 || gpc_reg_operand (operands[1], <MODE>mode))
8675 && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
8690 [(set_attr_alternative "type"
8693 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8694 (const_string "load_ux")
8696 (match_test "update_address_mem (operands[1], VOIDmode)")
8697 (const_string "load_u")
8698 (const_string "load")))
8700 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8701 (const_string "store_ux")
8703 (match_test "update_address_mem (operands[0], VOIDmode)")
8704 (const_string "store_u")
8705 (const_string "store")))
8707 (const_string "vecsimple")
8708 (const_string "vecsimple")
8710 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8711 (const_string "fpload_ux")
8713 (match_test "update_address_mem (operands[1], VOIDmode)")
8714 (const_string "fpload_u")
8715 (const_string "fpload")))
8717 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8718 (const_string "fpstore_ux")
8720 (match_test "update_address_mem (operands[0], VOIDmode)")
8721 (const_string "fpstore_u")
8722 (const_string "fpstore")))
8723 (const_string "mtjmpr")
8724 (const_string "mfjmpr")
8727 (const_string "*")])
8728 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,8")])
8730 (define_insn "*mov<mode>_softfloat"
8731 [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
8732 (match_operand:FMOVE32 1 "input_operand" "r, r,h,m,r,I,L,G,Fn,0"))]
8733 "(gpc_reg_operand (operands[0], <MODE>mode)
8734 || gpc_reg_operand (operands[1], <MODE>mode))
8735 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8747 [(set_attr_alternative "type"
8749 (const_string "mtjmpr")
8750 (const_string "mfjmpr")
8752 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8753 (const_string "load_ux")
8755 (match_test "update_address_mem (operands[1], VOIDmode)")
8756 (const_string "load_u")
8757 (const_string "load")))
8759 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8760 (const_string "store_ux")
8762 (match_test "update_address_mem (operands[0], VOIDmode)")
8763 (const_string "store_u")
8764 (const_string "store")))
8769 (const_string "*")])
8770 (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
8773 ;; Move 64-bit binary/decimal floating point
8774 (define_expand "mov<mode>"
8775 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
8776 (match_operand:FMOVE64 1 "any_operand" ""))]
8778 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
8781 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8782 (match_operand:FMOVE64 1 "const_int_operand" ""))]
8783 "! TARGET_POWERPC64 && reload_completed
8784 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8785 || (GET_CODE (operands[0]) == SUBREG
8786 && GET_CODE (SUBREG_REG (operands[0])) == REG
8787 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8788 [(set (match_dup 2) (match_dup 4))
8789 (set (match_dup 3) (match_dup 1))]
8792 int endian = (WORDS_BIG_ENDIAN == 0);
8793 HOST_WIDE_INT value = INTVAL (operands[1]);
8795 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8796 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8797 operands[4] = GEN_INT (value >> 32);
8798 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8802 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8803 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8804 "! TARGET_POWERPC64 && reload_completed
8805 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8806 || (GET_CODE (operands[0]) == SUBREG
8807 && GET_CODE (SUBREG_REG (operands[0])) == REG
8808 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8809 [(set (match_dup 2) (match_dup 4))
8810 (set (match_dup 3) (match_dup 5))]
8813 int endian = (WORDS_BIG_ENDIAN == 0);
8817 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8818 <real_value_to_target> (rv, l);
8820 operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
8821 operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
8822 operands[4] = gen_int_mode (l[endian], SImode);
8823 operands[5] = gen_int_mode (l[1 - endian], SImode);
8827 [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
8828 (match_operand:FMOVE64 1 "const_double_operand" ""))]
8829 "TARGET_POWERPC64 && reload_completed
8830 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8831 || (GET_CODE (operands[0]) == SUBREG
8832 && GET_CODE (SUBREG_REG (operands[0])) == REG
8833 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8834 [(set (match_dup 2) (match_dup 3))]
8837 int endian = (WORDS_BIG_ENDIAN == 0);
8842 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8843 <real_value_to_target> (rv, l);
8845 operands[2] = gen_lowpart (DImode, operands[0]);
8846 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8847 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8848 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8850 operands[3] = gen_int_mode (val, DImode);
8853 ;; Don't have reload use general registers to load a constant. It is
8854 ;; less efficient than loading the constant into an FP register, since
8855 ;; it will probably be used there.
8857 ;; The move constraints are ordered to prefer floating point registers before
8858 ;; general purpose registers to avoid doing a store and a load to get the value
8859 ;; into a floating point register when it is needed for a floating point
8860 ;; operation. Prefer traditional floating point registers over VSX registers,
8861 ;; since the D-form version of the memory instructions does not need a GPR for
8864 (define_insn "*mov<mode>_hardfloat32"
8865 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
8866 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
8867 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8868 && (gpc_reg_operand (operands[0], <MODE>mode)
8869 || gpc_reg_operand (operands[1], <MODE>mode))"
8887 [(set_attr_alternative "type"
8889 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8890 (const_string "fpstore_ux")
8892 (match_test "update_address_mem (operands[0], VOIDmode)")
8893 (const_string "fpstore_u")
8894 (const_string "fpstore")))
8896 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8897 (const_string "fpload_ux")
8899 (match_test "update_address_mem (operands[1], VOIDmode)")
8900 (const_string "fpload_u")
8901 (const_string "fpload")))
8904 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8905 (const_string "fpload_ux")
8906 (const_string "fpload"))
8908 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8909 (const_string "fpload_ux")
8910 (const_string "fpload"))
8912 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8913 (const_string "fpstore_ux")
8914 (const_string "fpstore"))
8916 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8917 (const_string "fpstore_ux")
8918 (const_string "fpstore"))
8919 (const_string "vecsimple")
8920 (const_string "vecsimple")
8921 (const_string "vecsimple")
8922 (const_string "store")
8923 (const_string "load")
8924 (const_string "two")
8927 (const_string "*")])
8928 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
8930 (define_insn "*mov<mode>_softfloat32"
8931 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
8932 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
8934 && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
8935 || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
8936 && (gpc_reg_operand (operands[0], <MODE>mode)
8937 || gpc_reg_operand (operands[1], <MODE>mode))"
8939 [(set_attr "type" "store,load,two,*,*,*")
8940 (set_attr "length" "8,8,8,8,12,16")])
8942 ; ld/std require word-aligned displacements -> 'Y' constraint.
8943 ; List Y->r and r->Y before r->r for reload.
8944 (define_insn "*mov<mode>_hardfloat64"
8945 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg")
8946 (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,r,h,0,G,H,F,wg,r"))]
8947 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
8948 && (gpc_reg_operand (operands[0], <MODE>mode)
8949 || gpc_reg_operand (operands[1], <MODE>mode))"
8972 [(set_attr_alternative "type"
8974 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8975 (const_string "fpstore_ux")
8977 (match_test "update_address_mem (operands[0], VOIDmode)")
8978 (const_string "fpstore_u")
8979 (const_string "fpstore")))
8981 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8982 (const_string "fpload_ux")
8984 (match_test "update_address_mem (operands[1], VOIDmode)")
8985 (const_string "fpload_u")
8986 (const_string "fpload")))
8989 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8990 (const_string "fpload_ux")
8991 (const_string "fpload"))
8993 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
8994 (const_string "fpload_ux")
8995 (const_string "fpload"))
8997 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
8998 (const_string "fpstore_ux")
8999 (const_string "fpstore"))
9001 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9002 (const_string "fpstore_ux")
9003 (const_string "fpstore"))
9004 (const_string "vecsimple")
9005 (const_string "vecsimple")
9006 (const_string "vecsimple")
9008 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9009 (const_string "store_ux")
9011 (match_test "update_address_mem (operands[0], VOIDmode)")
9012 (const_string "store_u")
9013 (const_string "store")))
9015 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9016 (const_string "load_ux")
9018 (match_test "update_address_mem (operands[1], VOIDmode)")
9019 (const_string "load_u")
9020 (const_string "load")))
9022 (const_string "mtjmpr")
9023 (const_string "mfjmpr")
9028 (const_string "mftgpr")
9029 (const_string "mffgpr")])
9030 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
9032 (define_insn "*mov<mode>_softfloat64"
9033 [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
9034 (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
9035 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
9036 && (gpc_reg_operand (operands[0], <MODE>mode)
9037 || gpc_reg_operand (operands[1], <MODE>mode))"
9048 [(set_attr_alternative "type"
9050 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9051 (const_string "store_ux")
9053 (match_test "update_address_mem (operands[0], VOIDmode)")
9054 (const_string "store_u")
9055 (const_string "store")))
9057 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9058 (const_string "load_ux")
9060 (match_test "update_address_mem (operands[1], VOIDmode)")
9061 (const_string "load_u")
9062 (const_string "load")))
9064 (const_string "mtjmpr")
9065 (const_string "mfjmpr")
9069 (const_string "*")])
9070 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
9072 (define_expand "mov<mode>"
9073 [(set (match_operand:FMOVE128 0 "general_operand" "")
9074 (match_operand:FMOVE128 1 "any_operand" ""))]
9076 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
9078 ;; It's important to list Y->r and r->Y before r->r because otherwise
9079 ;; reload, given m->r, will try to pick r->r and reload it, which
9080 ;; doesn't make progress.
9081 (define_insn_and_split "*mov<mode>_internal"
9082 [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
9083 (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
9084 "TARGET_HARD_FLOAT && TARGET_FPRS
9085 && (gpc_reg_operand (operands[0], <MODE>mode)
9086 || gpc_reg_operand (operands[1], <MODE>mode))"
9088 "&& reload_completed"
9090 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9091 [(set_attr "length" "8,8,8,20,20,16")])
9093 (define_insn_and_split "*mov<mode>_softfloat"
9094 [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
9095 (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
9096 "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
9097 && (gpc_reg_operand (operands[0], <MODE>mode)
9098 || gpc_reg_operand (operands[1], <MODE>mode))"
9100 "&& reload_completed"
9102 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
9103 [(set_attr "length" "20,20,16")])
9105 (define_expand "extenddftf2"
9106 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9107 (float_extend:TF (match_operand:DF 1 "input_operand" "")))]
9109 && TARGET_HARD_FLOAT
9110 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9111 && TARGET_LONG_DOUBLE_128"
9113 if (TARGET_E500_DOUBLE)
9114 emit_insn (gen_spe_extenddftf2 (operands[0], operands[1]));
9116 emit_insn (gen_extenddftf2_fprs (operands[0], operands[1]));
9120 (define_expand "extenddftf2_fprs"
9121 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
9122 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
9123 (use (match_dup 2))])]
9125 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9126 && TARGET_LONG_DOUBLE_128"
9128 operands[2] = CONST0_RTX (DFmode);
9129 /* Generate GOT reference early for SVR4 PIC. */
9130 if (DEFAULT_ABI == ABI_V4 && flag_pic)
9131 operands[2] = validize_mem (force_const_mem (DFmode, operands[2]));
9134 (define_insn_and_split "*extenddftf2_internal"
9135 [(set (match_operand:TF 0 "nonimmediate_operand" "=m,Y,d,&d,r")
9136 (float_extend:TF (match_operand:DF 1 "input_operand" "d,r,md,md,rmGHF")))
9137 (use (match_operand:DF 2 "zero_reg_mem_operand" "d,r,m,d,n"))]
9139 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9140 && TARGET_LONG_DOUBLE_128"
9142 "&& reload_completed"
9145 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9146 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9147 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
9149 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
9154 (define_expand "extendsftf2"
9155 [(set (match_operand:TF 0 "nonimmediate_operand" "")
9156 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
9158 && TARGET_HARD_FLOAT
9159 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9160 && TARGET_LONG_DOUBLE_128"
9162 rtx tmp = gen_reg_rtx (DFmode);
9163 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
9164 emit_insn (gen_extenddftf2 (operands[0], tmp));
9168 (define_expand "trunctfdf2"
9169 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9170 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
9172 && TARGET_HARD_FLOAT
9173 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9174 && TARGET_LONG_DOUBLE_128"
9177 (define_insn_and_split "trunctfdf2_internal1"
9178 [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
9179 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
9180 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
9181 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9185 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
9188 emit_note (NOTE_INSN_DELETED);
9191 [(set_attr "type" "fp")])
9193 (define_insn "trunctfdf2_internal2"
9194 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9195 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9196 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
9197 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9198 && TARGET_LONG_DOUBLE_128"
9200 [(set_attr "type" "fp")
9201 (set_attr "fp_type" "fp_addsub_d")])
9203 (define_expand "trunctfsf2"
9204 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9205 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "")))]
9207 && TARGET_HARD_FLOAT
9208 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9209 && TARGET_LONG_DOUBLE_128"
9211 if (TARGET_E500_DOUBLE)
9212 emit_insn (gen_spe_trunctfsf2 (operands[0], operands[1]));
9214 emit_insn (gen_trunctfsf2_fprs (operands[0], operands[1]));
9218 (define_insn_and_split "trunctfsf2_fprs"
9219 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
9220 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
9221 (clobber (match_scratch:DF 2 "=d"))]
9223 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
9224 && TARGET_LONG_DOUBLE_128"
9226 "&& reload_completed"
9228 (float_truncate:DF (match_dup 1)))
9230 (float_truncate:SF (match_dup 2)))]
9233 (define_expand "floatsitf2"
9234 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9235 (float:TF (match_operand:SI 1 "gpc_reg_operand" "")))]
9237 && TARGET_HARD_FLOAT
9238 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9239 && TARGET_LONG_DOUBLE_128"
9241 rtx tmp = gen_reg_rtx (DFmode);
9242 expand_float (tmp, operands[1], false);
9243 emit_insn (gen_extenddftf2 (operands[0], tmp));
9247 ; fadd, but rounding towards zero.
9248 ; This is probably not the optimal code sequence.
9249 (define_insn "fix_trunc_helper"
9250 [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
9251 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
9252 UNSPEC_FIX_TRUNC_TF))
9253 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
9254 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
9255 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
9256 [(set_attr "type" "fp")
9257 (set_attr "length" "20")])
9259 (define_expand "fix_trunctfsi2"
9260 [(set (match_operand:SI 0 "gpc_reg_operand" "")
9261 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))]
9262 "!TARGET_IEEEQUAD && TARGET_HARD_FLOAT
9263 && (TARGET_FPRS || TARGET_E500_DOUBLE) && TARGET_LONG_DOUBLE_128"
9265 if (TARGET_E500_DOUBLE)
9266 emit_insn (gen_spe_fix_trunctfsi2 (operands[0], operands[1]));
9268 emit_insn (gen_fix_trunctfsi2_fprs (operands[0], operands[1]));
9272 (define_expand "fix_trunctfsi2_fprs"
9273 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
9274 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
9275 (clobber (match_dup 2))
9276 (clobber (match_dup 3))
9277 (clobber (match_dup 4))
9278 (clobber (match_dup 5))])]
9280 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9282 operands[2] = gen_reg_rtx (DFmode);
9283 operands[3] = gen_reg_rtx (DFmode);
9284 operands[4] = gen_reg_rtx (DImode);
9285 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode));
9288 (define_insn_and_split "*fix_trunctfsi2_internal"
9289 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9290 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
9291 (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
9292 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
9293 (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
9294 (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
9296 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9302 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
9304 gcc_assert (MEM_P (operands[5]));
9305 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
9307 emit_insn (gen_fctiwz_df (operands[4], operands[2]));
9308 emit_move_insn (operands[5], operands[4]);
9309 emit_move_insn (operands[0], lowword);
9313 (define_expand "negtf2"
9314 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9315 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9317 && TARGET_HARD_FLOAT
9318 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9319 && TARGET_LONG_DOUBLE_128"
9322 (define_insn "negtf2_internal"
9323 [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
9324 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
9326 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9329 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9330 return \"fneg %L0,%L1\;fneg %0,%1\";
9332 return \"fneg %0,%1\;fneg %L0,%L1\";
9334 [(set_attr "type" "fp")
9335 (set_attr "length" "8")])
9337 (define_expand "abstf2"
9338 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9339 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "")))]
9341 && TARGET_HARD_FLOAT
9342 && (TARGET_FPRS || TARGET_E500_DOUBLE)
9343 && TARGET_LONG_DOUBLE_128"
9346 rtx label = gen_label_rtx ();
9347 if (TARGET_E500_DOUBLE)
9349 if (flag_finite_math_only && !flag_trapping_math)
9350 emit_insn (gen_spe_abstf2_tst (operands[0], operands[1], label));
9352 emit_insn (gen_spe_abstf2_cmp (operands[0], operands[1], label));
9355 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
9360 (define_expand "abstf2_internal"
9361 [(set (match_operand:TF 0 "gpc_reg_operand" "")
9362 (match_operand:TF 1 "gpc_reg_operand" ""))
9363 (set (match_dup 3) (match_dup 5))
9364 (set (match_dup 5) (abs:DF (match_dup 5)))
9365 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
9366 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
9367 (label_ref (match_operand 2 "" ""))
9369 (set (match_dup 6) (neg:DF (match_dup 6)))]
9371 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
9372 && TARGET_LONG_DOUBLE_128"
9375 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
9376 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
9377 operands[3] = gen_reg_rtx (DFmode);
9378 operands[4] = gen_reg_rtx (CCFPmode);
9379 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
9380 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
9383 ;; Reload helper functions used by rs6000_secondary_reload. The patterns all
9384 ;; must have 3 arguments, and scratch register constraint must be a single
9387 ;; Reload patterns to support gpr load/store with misaligned mem.
9388 ;; and multiple gpr load/store at offset >= 0xfffc
9389 (define_expand "reload_<mode>_store"
9390 [(parallel [(match_operand 0 "memory_operand" "=m")
9391 (match_operand 1 "gpc_reg_operand" "r")
9392 (match_operand:GPR 2 "register_operand" "=&b")])]
9395 rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
9399 (define_expand "reload_<mode>_load"
9400 [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
9401 (match_operand 1 "memory_operand" "m")
9402 (match_operand:GPR 2 "register_operand" "=b")])]
9405 rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
9410 ;; Next come the multi-word integer load and store and the load and store
9413 ;; List r->r after r->Y, otherwise reload will try to reload a
9414 ;; non-offsettable address by using r->r which won't make progress.
9415 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
9416 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
9417 (define_insn "*movdi_internal32"
9418 [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa")
9419 (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))]
9421 && (gpc_reg_operand (operands[0], DImode)
9422 || gpc_reg_operand (operands[1], DImode))"
9432 [(set_attr_alternative "type"
9433 [(const_string "store")
9434 (const_string "load")
9437 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9438 (const_string "fpstore_ux")
9440 (match_test "update_address_mem (operands[0], VOIDmode)")
9441 (const_string "fpstore_u")
9442 (const_string "fpstore")))
9444 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9445 (const_string "fpload_ux")
9447 (match_test "update_address_mem (operands[1], VOIDmode)")
9448 (const_string "fpload_u")
9449 (const_string "fpload")))
9452 (const_string "vecsimple")])])
9455 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9456 (match_operand:DI 1 "const_int_operand" ""))]
9457 "! TARGET_POWERPC64 && reload_completed
9458 && gpr_or_gpr_p (operands[0], operands[1])"
9459 [(set (match_dup 2) (match_dup 4))
9460 (set (match_dup 3) (match_dup 1))]
9463 HOST_WIDE_INT value = INTVAL (operands[1]);
9464 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9466 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9468 operands[4] = GEN_INT (value >> 32);
9469 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9473 [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
9474 (match_operand:DIFD 1 "input_operand" ""))]
9475 "reload_completed && !TARGET_POWERPC64
9476 && gpr_or_gpr_p (operands[0], operands[1])"
9478 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9480 (define_insn "*movdi_internal64"
9481 [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,?Z,?wa,?wa,r,*h,*h,?wa,r,?*wg")
9482 (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,wa,Z,wa,*h,r,0,O,*wg,r"))]
9484 && (gpc_reg_operand (operands[0], DImode)
9485 || gpc_reg_operand (operands[1], DImode))"
9505 [(set_attr_alternative "type"
9507 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9508 (const_string "store_ux")
9510 (match_test "update_address_mem (operands[0], VOIDmode)")
9511 (const_string "store_u")
9512 (const_string "store")))
9514 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9515 (const_string "load_ux")
9517 (match_test "update_address_mem (operands[1], VOIDmode)")
9518 (const_string "load_u")
9519 (const_string "load")))
9525 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9526 (const_string "fpstore_ux")
9528 (match_test "update_address_mem (operands[0], VOIDmode)")
9529 (const_string "fpstore_u")
9530 (const_string "fpstore")))
9532 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9533 (const_string "fpload_ux")
9535 (match_test "update_address_mem (operands[1], VOIDmode)")
9536 (const_string "fpload_u")
9537 (const_string "fpload")))
9540 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
9541 (const_string "fpstore_ux")
9542 (const_string "fpstore"))
9544 (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
9545 (const_string "fpload_ux")
9546 (const_string "fpload"))
9547 (const_string "vecsimple")
9548 (const_string "mfjmpr")
9549 (const_string "mtjmpr")
9551 (const_string "vecsimple")
9552 (const_string "mftgpr")
9553 (const_string "mffgpr")])
9554 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4,4,4")])
9556 ;; Generate all one-bits and clear left or right.
9557 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9559 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9560 (match_operand:DI 1 "mask64_operand" ""))]
9561 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9562 [(set (match_dup 0) (const_int -1))
9564 (and:DI (rotate:DI (match_dup 0)
9569 ;; Split a load of a large constant into the appropriate five-instruction
9570 ;; sequence. Handle anything in a constant number of insns.
9571 ;; When non-easy constants can go in the TOC, this should use
9572 ;; easy_fp_constant predicate.
9574 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9575 (match_operand:DI 1 "const_int_operand" ""))]
9576 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9577 [(set (match_dup 0) (match_dup 2))
9578 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9580 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9582 if (tem == operands[0])
9589 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9590 (match_operand:DI 1 "const_double_operand" ""))]
9591 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9592 [(set (match_dup 0) (match_dup 2))
9593 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9595 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9597 if (tem == operands[0])
9603 ;; TImode/PTImode is similar, except that we usually want to compute the
9604 ;; address into a register and use lsi/stsi (the exception is during reload).
9606 (define_insn "*mov<mode>_string"
9607 [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
9608 (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
9610 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9611 && (gpc_reg_operand (operands[0], <MODE>mode)
9612 || gpc_reg_operand (operands[1], <MODE>mode))"
9615 switch (which_alternative)
9621 return \"stswi %1,%P0,16\";
9625 /* If the address is not used in the output, we can use lsi. Otherwise,
9626 fall through to generating four loads. */
9628 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
9629 return \"lswi %0,%P1,16\";
9630 /* ... fall through ... */
9637 [(set_attr "type" "store_ux,store_ux,load_ux,load_ux,*,*")
9638 (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
9639 (const_string "always")
9640 (const_string "conditional")))])
9642 (define_insn "*mov<mode>_ppc64"
9643 [(set (match_operand:TI2 0 "nonimmediate_operand" "=Y,r,r")
9644 (match_operand:TI2 1 "input_operand" "r,Y,r"))]
9646 && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
9647 && (gpc_reg_operand (operands[0], <MODE>mode)
9648 || gpc_reg_operand (operands[1], <MODE>mode)))"
9650 [(set_attr "type" "store,load,*")])
9653 [(set (match_operand:TI2 0 "gpc_reg_operand" "")
9654 (match_operand:TI2 1 "const_double_operand" ""))]
9656 [(set (match_dup 2) (match_dup 4))
9657 (set (match_dup 3) (match_dup 5))]
9660 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9662 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9664 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9666 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9667 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9669 else if (GET_CODE (operands[1]) == CONST_INT)
9671 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
9672 operands[5] = operands[1];
9679 [(set (match_operand:TI2 0 "nonimmediate_operand" "")
9680 (match_operand:TI2 1 "input_operand" ""))]
9682 && gpr_or_gpr_p (operands[0], operands[1])"
9684 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
9686 (define_expand "load_multiple"
9687 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9688 (match_operand:SI 1 "" ""))
9689 (use (match_operand:SI 2 "" ""))])]
9690 "TARGET_STRING && !TARGET_POWERPC64"
9698 /* Support only loading a constant number of fixed-point registers from
9699 memory and only bother with this if more than two; the machine
9700 doesn't support more than eight. */
9701 if (GET_CODE (operands[2]) != CONST_INT
9702 || INTVAL (operands[2]) <= 2
9703 || INTVAL (operands[2]) > 8
9704 || GET_CODE (operands[1]) != MEM
9705 || GET_CODE (operands[0]) != REG
9706 || REGNO (operands[0]) >= 32)
9709 count = INTVAL (operands[2]);
9710 regno = REGNO (operands[0]);
9712 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9713 op1 = replace_equiv_address (operands[1],
9714 force_reg (SImode, XEXP (operands[1], 0)));
9716 for (i = 0; i < count; i++)
9717 XVECEXP (operands[3], 0, i)
9718 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9719 adjust_address_nv (op1, SImode, i * 4));
9722 (define_insn "*ldmsi8"
9723 [(match_parallel 0 "load_multiple_operation"
9724 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9725 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9726 (set (match_operand:SI 3 "gpc_reg_operand" "")
9727 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9728 (set (match_operand:SI 4 "gpc_reg_operand" "")
9729 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9730 (set (match_operand:SI 5 "gpc_reg_operand" "")
9731 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9732 (set (match_operand:SI 6 "gpc_reg_operand" "")
9733 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9734 (set (match_operand:SI 7 "gpc_reg_operand" "")
9735 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9736 (set (match_operand:SI 8 "gpc_reg_operand" "")
9737 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9738 (set (match_operand:SI 9 "gpc_reg_operand" "")
9739 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9740 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9742 { return rs6000_output_load_multiple (operands); }"
9743 [(set_attr "type" "load_ux")
9744 (set_attr "length" "32")])
9746 (define_insn "*ldmsi7"
9747 [(match_parallel 0 "load_multiple_operation"
9748 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9749 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9750 (set (match_operand:SI 3 "gpc_reg_operand" "")
9751 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9752 (set (match_operand:SI 4 "gpc_reg_operand" "")
9753 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9754 (set (match_operand:SI 5 "gpc_reg_operand" "")
9755 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9756 (set (match_operand:SI 6 "gpc_reg_operand" "")
9757 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9758 (set (match_operand:SI 7 "gpc_reg_operand" "")
9759 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9760 (set (match_operand:SI 8 "gpc_reg_operand" "")
9761 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9762 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9764 { return rs6000_output_load_multiple (operands); }"
9765 [(set_attr "type" "load_ux")
9766 (set_attr "length" "32")])
9768 (define_insn "*ldmsi6"
9769 [(match_parallel 0 "load_multiple_operation"
9770 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9771 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9772 (set (match_operand:SI 3 "gpc_reg_operand" "")
9773 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9774 (set (match_operand:SI 4 "gpc_reg_operand" "")
9775 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9776 (set (match_operand:SI 5 "gpc_reg_operand" "")
9777 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9778 (set (match_operand:SI 6 "gpc_reg_operand" "")
9779 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9780 (set (match_operand:SI 7 "gpc_reg_operand" "")
9781 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9782 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9784 { return rs6000_output_load_multiple (operands); }"
9785 [(set_attr "type" "load_ux")
9786 (set_attr "length" "32")])
9788 (define_insn "*ldmsi5"
9789 [(match_parallel 0 "load_multiple_operation"
9790 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9791 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9792 (set (match_operand:SI 3 "gpc_reg_operand" "")
9793 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9794 (set (match_operand:SI 4 "gpc_reg_operand" "")
9795 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9796 (set (match_operand:SI 5 "gpc_reg_operand" "")
9797 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9798 (set (match_operand:SI 6 "gpc_reg_operand" "")
9799 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9800 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9802 { return rs6000_output_load_multiple (operands); }"
9803 [(set_attr "type" "load_ux")
9804 (set_attr "length" "32")])
9806 (define_insn "*ldmsi4"
9807 [(match_parallel 0 "load_multiple_operation"
9808 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9809 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9810 (set (match_operand:SI 3 "gpc_reg_operand" "")
9811 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9812 (set (match_operand:SI 4 "gpc_reg_operand" "")
9813 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9814 (set (match_operand:SI 5 "gpc_reg_operand" "")
9815 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9816 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9818 { return rs6000_output_load_multiple (operands); }"
9819 [(set_attr "type" "load_ux")
9820 (set_attr "length" "32")])
9822 (define_insn "*ldmsi3"
9823 [(match_parallel 0 "load_multiple_operation"
9824 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9825 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9826 (set (match_operand:SI 3 "gpc_reg_operand" "")
9827 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9828 (set (match_operand:SI 4 "gpc_reg_operand" "")
9829 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9830 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9832 { return rs6000_output_load_multiple (operands); }"
9833 [(set_attr "type" "load_ux")
9834 (set_attr "length" "32")])
9836 (define_expand "store_multiple"
9837 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9838 (match_operand:SI 1 "" ""))
9839 (clobber (scratch:SI))
9840 (use (match_operand:SI 2 "" ""))])]
9841 "TARGET_STRING && !TARGET_POWERPC64"
9850 /* Support only storing a constant number of fixed-point registers to
9851 memory and only bother with this if more than two; the machine
9852 doesn't support more than eight. */
9853 if (GET_CODE (operands[2]) != CONST_INT
9854 || INTVAL (operands[2]) <= 2
9855 || INTVAL (operands[2]) > 8
9856 || GET_CODE (operands[0]) != MEM
9857 || GET_CODE (operands[1]) != REG
9858 || REGNO (operands[1]) >= 32)
9861 count = INTVAL (operands[2]);
9862 regno = REGNO (operands[1]);
9864 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9865 to = force_reg (SImode, XEXP (operands[0], 0));
9866 op0 = replace_equiv_address (operands[0], to);
9868 XVECEXP (operands[3], 0, 0)
9869 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9870 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9871 gen_rtx_SCRATCH (SImode));
9873 for (i = 1; i < count; i++)
9874 XVECEXP (operands[3], 0, i + 1)
9875 = gen_rtx_SET (VOIDmode,
9876 adjust_address_nv (op0, SImode, i * 4),
9877 gen_rtx_REG (SImode, regno + i));
9880 (define_insn "*stmsi8"
9881 [(match_parallel 0 "store_multiple_operation"
9882 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9883 (match_operand:SI 2 "gpc_reg_operand" "r"))
9884 (clobber (match_scratch:SI 3 "=X"))
9885 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9886 (match_operand:SI 4 "gpc_reg_operand" "r"))
9887 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9888 (match_operand:SI 5 "gpc_reg_operand" "r"))
9889 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9890 (match_operand:SI 6 "gpc_reg_operand" "r"))
9891 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9892 (match_operand:SI 7 "gpc_reg_operand" "r"))
9893 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9894 (match_operand:SI 8 "gpc_reg_operand" "r"))
9895 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9896 (match_operand:SI 9 "gpc_reg_operand" "r"))
9897 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
9898 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
9899 "TARGET_STRING && XVECLEN (operands[0], 0) == 9"
9901 [(set_attr "type" "store_ux")
9902 (set_attr "cell_micro" "always")])
9904 (define_insn "*stmsi7"
9905 [(match_parallel 0 "store_multiple_operation"
9906 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9907 (match_operand:SI 2 "gpc_reg_operand" "r"))
9908 (clobber (match_scratch:SI 3 "=X"))
9909 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9910 (match_operand:SI 4 "gpc_reg_operand" "r"))
9911 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9912 (match_operand:SI 5 "gpc_reg_operand" "r"))
9913 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9914 (match_operand:SI 6 "gpc_reg_operand" "r"))
9915 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9916 (match_operand:SI 7 "gpc_reg_operand" "r"))
9917 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9918 (match_operand:SI 8 "gpc_reg_operand" "r"))
9919 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
9920 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
9921 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9923 [(set_attr "type" "store_ux")
9924 (set_attr "cell_micro" "always")])
9926 (define_insn "*stmsi6"
9927 [(match_parallel 0 "store_multiple_operation"
9928 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9929 (match_operand:SI 2 "gpc_reg_operand" "r"))
9930 (clobber (match_scratch:SI 3 "=X"))
9931 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9932 (match_operand:SI 4 "gpc_reg_operand" "r"))
9933 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9934 (match_operand:SI 5 "gpc_reg_operand" "r"))
9935 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9936 (match_operand:SI 6 "gpc_reg_operand" "r"))
9937 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9938 (match_operand:SI 7 "gpc_reg_operand" "r"))
9939 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
9940 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
9941 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9943 [(set_attr "type" "store_ux")
9944 (set_attr "cell_micro" "always")])
9946 (define_insn "*stmsi5"
9947 [(match_parallel 0 "store_multiple_operation"
9948 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9949 (match_operand:SI 2 "gpc_reg_operand" "r"))
9950 (clobber (match_scratch:SI 3 "=X"))
9951 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9952 (match_operand:SI 4 "gpc_reg_operand" "r"))
9953 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9954 (match_operand:SI 5 "gpc_reg_operand" "r"))
9955 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9956 (match_operand:SI 6 "gpc_reg_operand" "r"))
9957 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
9958 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
9959 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9961 [(set_attr "type" "store_ux")
9962 (set_attr "cell_micro" "always")])
9964 (define_insn "*stmsi4"
9965 [(match_parallel 0 "store_multiple_operation"
9966 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9967 (match_operand:SI 2 "gpc_reg_operand" "r"))
9968 (clobber (match_scratch:SI 3 "=X"))
9969 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9970 (match_operand:SI 4 "gpc_reg_operand" "r"))
9971 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9972 (match_operand:SI 5 "gpc_reg_operand" "r"))
9973 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
9974 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
9975 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9977 [(set_attr "type" "store_ux")
9978 (set_attr "cell_micro" "always")])
9980 (define_insn "*stmsi3"
9981 [(match_parallel 0 "store_multiple_operation"
9982 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9983 (match_operand:SI 2 "gpc_reg_operand" "r"))
9984 (clobber (match_scratch:SI 3 "=X"))
9985 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
9986 (match_operand:SI 4 "gpc_reg_operand" "r"))
9987 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
9988 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
9989 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9991 [(set_attr "type" "store_ux")
9992 (set_attr "cell_micro" "always")])
9994 (define_expand "setmemsi"
9995 [(parallel [(set (match_operand:BLK 0 "" "")
9996 (match_operand 2 "const_int_operand" ""))
9997 (use (match_operand:SI 1 "" ""))
9998 (use (match_operand:SI 3 "" ""))])]
10002 /* If value to set is not zero, use the library routine. */
10003 if (operands[2] != const0_rtx)
10006 if (expand_block_clear (operands))
10012 ;; String/block move insn.
10013 ;; Argument 0 is the destination
10014 ;; Argument 1 is the source
10015 ;; Argument 2 is the length
10016 ;; Argument 3 is the alignment
10018 (define_expand "movmemsi"
10019 [(parallel [(set (match_operand:BLK 0 "" "")
10020 (match_operand:BLK 1 "" ""))
10021 (use (match_operand:SI 2 "" ""))
10022 (use (match_operand:SI 3 "" ""))])]
10026 if (expand_block_move (operands))
10032 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
10033 ;; register allocator doesn't have a clue about allocating 8 word registers.
10034 ;; rD/rS = r5 is preferred, efficient form.
10035 (define_expand "movmemsi_8reg"
10036 [(parallel [(set (match_operand 0 "" "")
10037 (match_operand 1 "" ""))
10038 (use (match_operand 2 "" ""))
10039 (use (match_operand 3 "" ""))
10040 (clobber (reg:SI 5))
10041 (clobber (reg:SI 6))
10042 (clobber (reg:SI 7))
10043 (clobber (reg:SI 8))
10044 (clobber (reg:SI 9))
10045 (clobber (reg:SI 10))
10046 (clobber (reg:SI 11))
10047 (clobber (reg:SI 12))
10048 (clobber (match_scratch:SI 4 ""))])]
10053 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10054 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10055 (use (match_operand:SI 2 "immediate_operand" "i"))
10056 (use (match_operand:SI 3 "immediate_operand" "i"))
10057 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10058 (clobber (reg:SI 6))
10059 (clobber (reg:SI 7))
10060 (clobber (reg:SI 8))
10061 (clobber (reg:SI 9))
10062 (clobber (reg:SI 10))
10063 (clobber (reg:SI 11))
10064 (clobber (reg:SI 12))
10065 (clobber (match_scratch:SI 5 "=X"))]
10067 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
10068 || INTVAL (operands[2]) == 0)
10069 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
10070 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
10071 && REGNO (operands[4]) == 5"
10072 "lswi %4,%1,%2\;stswi %4,%0,%2"
10073 [(set_attr "type" "store_ux")
10074 (set_attr "cell_micro" "always")
10075 (set_attr "length" "8")])
10077 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
10078 ;; register allocator doesn't have a clue about allocating 6 word registers.
10079 ;; rD/rS = r5 is preferred, efficient form.
10080 (define_expand "movmemsi_6reg"
10081 [(parallel [(set (match_operand 0 "" "")
10082 (match_operand 1 "" ""))
10083 (use (match_operand 2 "" ""))
10084 (use (match_operand 3 "" ""))
10085 (clobber (reg:SI 5))
10086 (clobber (reg:SI 6))
10087 (clobber (reg:SI 7))
10088 (clobber (reg:SI 8))
10089 (clobber (reg:SI 9))
10090 (clobber (reg:SI 10))
10091 (clobber (match_scratch:SI 4 ""))])]
10096 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10097 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10098 (use (match_operand:SI 2 "immediate_operand" "i"))
10099 (use (match_operand:SI 3 "immediate_operand" "i"))
10100 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10101 (clobber (reg:SI 6))
10102 (clobber (reg:SI 7))
10103 (clobber (reg:SI 8))
10104 (clobber (reg:SI 9))
10105 (clobber (reg:SI 10))
10106 (clobber (match_scratch:SI 5 "=X"))]
10108 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
10109 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
10110 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
10111 && REGNO (operands[4]) == 5"
10112 "lswi %4,%1,%2\;stswi %4,%0,%2"
10113 [(set_attr "type" "store_ux")
10114 (set_attr "cell_micro" "always")
10115 (set_attr "length" "8")])
10117 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
10118 ;; problems with TImode.
10119 ;; rD/rS = r5 is preferred, efficient form.
10120 (define_expand "movmemsi_4reg"
10121 [(parallel [(set (match_operand 0 "" "")
10122 (match_operand 1 "" ""))
10123 (use (match_operand 2 "" ""))
10124 (use (match_operand 3 "" ""))
10125 (clobber (reg:SI 5))
10126 (clobber (reg:SI 6))
10127 (clobber (reg:SI 7))
10128 (clobber (reg:SI 8))
10129 (clobber (match_scratch:SI 4 ""))])]
10134 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10135 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10136 (use (match_operand:SI 2 "immediate_operand" "i"))
10137 (use (match_operand:SI 3 "immediate_operand" "i"))
10138 (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r"))
10139 (clobber (reg:SI 6))
10140 (clobber (reg:SI 7))
10141 (clobber (reg:SI 8))
10142 (clobber (match_scratch:SI 5 "=X"))]
10144 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
10145 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
10146 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
10147 && REGNO (operands[4]) == 5"
10148 "lswi %4,%1,%2\;stswi %4,%0,%2"
10149 [(set_attr "type" "store_ux")
10150 (set_attr "cell_micro" "always")
10151 (set_attr "length" "8")])
10153 ;; Move up to 8 bytes at a time.
10154 (define_expand "movmemsi_2reg"
10155 [(parallel [(set (match_operand 0 "" "")
10156 (match_operand 1 "" ""))
10157 (use (match_operand 2 "" ""))
10158 (use (match_operand 3 "" ""))
10159 (clobber (match_scratch:DI 4 ""))
10160 (clobber (match_scratch:SI 5 ""))])]
10161 "TARGET_STRING && ! TARGET_POWERPC64"
10165 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
10166 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
10167 (use (match_operand:SI 2 "immediate_operand" "i"))
10168 (use (match_operand:SI 3 "immediate_operand" "i"))
10169 (clobber (match_scratch:DI 4 "=&r"))
10170 (clobber (match_scratch:SI 5 "=X"))]
10171 "TARGET_STRING && ! TARGET_POWERPC64
10172 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
10173 "lswi %4,%1,%2\;stswi %4,%0,%2"
10174 [(set_attr "type" "store_ux")
10175 (set_attr "cell_micro" "always")
10176 (set_attr "length" "8")])
10178 ;; Move up to 4 bytes at a time.
10179 (define_expand "movmemsi_1reg"
10180 [(parallel [(set (match_operand 0 "" "")
10181 (match_operand 1 "" ""))
10182 (use (match_operand 2 "" ""))
10183 (use (match_operand 3 "" ""))
10184 (clobber (match_scratch:SI 4 ""))
10185 (clobber (match_scratch:SI 5 ""))])]
10190 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
10191 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
10192 (use (match_operand:SI 2 "immediate_operand" "i"))
10193 (use (match_operand:SI 3 "immediate_operand" "i"))
10194 (clobber (match_scratch:SI 4 "=&r"))
10195 (clobber (match_scratch:SI 5 "=X"))]
10196 "TARGET_STRING && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
10197 "lswi %4,%1,%2\;stswi %4,%0,%2"
10198 [(set_attr "type" "store_ux")
10199 (set_attr "cell_micro" "always")
10200 (set_attr "length" "8")])
10202 ;; Define insns that do load or store with update. Some of these we can
10203 ;; get by using pre-decrement or pre-increment, but the hardware can also
10204 ;; do cases where the increment is not the size of the object.
10206 ;; In all these cases, we use operands 0 and 1 for the register being
10207 ;; incremented because those are the operands that local-alloc will
10208 ;; tie and these are the pair most likely to be tieable (and the ones
10209 ;; that will benefit the most).
10211 (define_insn "*movdi_update1"
10212 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10213 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10214 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10215 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10216 (plus:DI (match_dup 1) (match_dup 2)))]
10217 "TARGET_POWERPC64 && TARGET_UPDATE
10218 && (!avoiding_indexed_address_p (DImode)
10219 || !gpc_reg_operand (operands[2], DImode))"
10223 [(set_attr "type" "load_ux,load_u")])
10225 (define_insn "movdi_<mode>_update"
10226 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10227 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10228 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10229 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10230 (plus:P (match_dup 1) (match_dup 2)))]
10231 "TARGET_POWERPC64 && TARGET_UPDATE
10232 && (!avoiding_indexed_address_p (Pmode)
10233 || !gpc_reg_operand (operands[2], Pmode)
10234 || (REG_P (operands[0])
10235 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10239 [(set_attr "type" "store_ux,store_u")])
10241 ;; This pattern is only conditional on TARGET_POWERPC64, as it is
10242 ;; needed for stack allocation, even if the user passes -mno-update.
10243 (define_insn "movdi_<mode>_update_stack"
10244 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
10245 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
10246 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10247 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
10248 (plus:P (match_dup 1) (match_dup 2)))]
10253 [(set_attr "type" "store_ux,store_u")])
10255 (define_insn "*movsi_update1"
10256 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10257 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10258 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10259 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10260 (plus:SI (match_dup 1) (match_dup 2)))]
10262 && (!avoiding_indexed_address_p (SImode)
10263 || !gpc_reg_operand (operands[2], SImode))"
10267 [(set_attr "type" "load_ux,load_u")])
10269 (define_insn "*movsi_update2"
10270 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10272 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10273 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10274 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10275 (plus:DI (match_dup 1) (match_dup 2)))]
10276 "TARGET_POWERPC64 && rs6000_gen_cell_microcode
10277 && !avoiding_indexed_address_p (DImode)"
10279 [(set_attr "type" "load_ext_ux")])
10281 (define_insn "movsi_update"
10282 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10283 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10284 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10285 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10286 (plus:SI (match_dup 1) (match_dup 2)))]
10288 && (!avoiding_indexed_address_p (SImode)
10289 || !gpc_reg_operand (operands[2], SImode)
10290 || (REG_P (operands[0])
10291 && REGNO (operands[0]) == STACK_POINTER_REGNUM))"
10295 [(set_attr "type" "store_ux,store_u")])
10297 ;; This is an unconditional pattern; needed for stack allocation, even
10298 ;; if the user passes -mno-update.
10299 (define_insn "movsi_update_stack"
10300 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10301 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10302 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10303 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10304 (plus:SI (match_dup 1) (match_dup 2)))]
10309 [(set_attr "type" "store_ux,store_u")])
10311 (define_insn "*movhi_update1"
10312 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10313 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10314 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10315 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10316 (plus:SI (match_dup 1) (match_dup 2)))]
10318 && (!avoiding_indexed_address_p (SImode)
10319 || !gpc_reg_operand (operands[2], SImode))"
10323 [(set_attr "type" "load_ux,load_u")])
10325 (define_insn "*movhi_update2"
10326 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10328 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10329 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10330 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10331 (plus:SI (match_dup 1) (match_dup 2)))]
10333 && (!avoiding_indexed_address_p (SImode)
10334 || !gpc_reg_operand (operands[2], SImode))"
10338 [(set_attr "type" "load_ux,load_u")])
10340 (define_insn "*movhi_update3"
10341 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10343 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10344 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10345 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10346 (plus:SI (match_dup 1) (match_dup 2)))]
10347 "TARGET_UPDATE && rs6000_gen_cell_microcode
10348 && (!avoiding_indexed_address_p (SImode)
10349 || !gpc_reg_operand (operands[2], SImode))"
10353 [(set_attr "type" "load_ext_ux,load_ext_u")])
10355 (define_insn "*movhi_update4"
10356 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10357 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10358 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10359 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10360 (plus:SI (match_dup 1) (match_dup 2)))]
10362 && (!avoiding_indexed_address_p (SImode)
10363 || !gpc_reg_operand (operands[2], SImode))"
10367 [(set_attr "type" "store_ux,store_u")])
10369 (define_insn "*movqi_update1"
10370 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10371 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10372 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10373 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10374 (plus:SI (match_dup 1) (match_dup 2)))]
10376 && (!avoiding_indexed_address_p (SImode)
10377 || !gpc_reg_operand (operands[2], SImode))"
10381 [(set_attr "type" "load_ux,load_u")])
10383 (define_insn "*movqi_update2"
10384 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10386 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10387 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10388 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10389 (plus:SI (match_dup 1) (match_dup 2)))]
10391 && (!avoiding_indexed_address_p (SImode)
10392 || !gpc_reg_operand (operands[2], SImode))"
10396 [(set_attr "type" "load_ux,load_u")])
10398 (define_insn "*movqi_update3"
10399 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10400 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10401 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10402 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10403 (plus:SI (match_dup 1) (match_dup 2)))]
10405 && (!avoiding_indexed_address_p (SImode)
10406 || !gpc_reg_operand (operands[2], SImode))"
10410 [(set_attr "type" "store_ux,store_u")])
10412 (define_insn "*movsf_update1"
10413 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10414 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10415 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10416 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10417 (plus:SI (match_dup 1) (match_dup 2)))]
10418 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10419 && (!avoiding_indexed_address_p (SImode)
10420 || !gpc_reg_operand (operands[2], SImode))"
10424 [(set_attr "type" "fpload_ux,fpload_u")])
10426 (define_insn "*movsf_update2"
10427 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10428 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10429 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10430 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10431 (plus:SI (match_dup 1) (match_dup 2)))]
10432 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT && TARGET_UPDATE
10433 && (!avoiding_indexed_address_p (SImode)
10434 || !gpc_reg_operand (operands[2], SImode))"
10438 [(set_attr "type" "fpstore_ux,fpstore_u")])
10440 (define_insn "*movsf_update3"
10441 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10442 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10443 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10444 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10445 (plus:SI (match_dup 1) (match_dup 2)))]
10446 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10447 && (!avoiding_indexed_address_p (SImode)
10448 || !gpc_reg_operand (operands[2], SImode))"
10452 [(set_attr "type" "load_ux,load_u")])
10454 (define_insn "*movsf_update4"
10455 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10456 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10457 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10458 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10459 (plus:SI (match_dup 1) (match_dup 2)))]
10460 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE
10461 && (!avoiding_indexed_address_p (SImode)
10462 || !gpc_reg_operand (operands[2], SImode))"
10466 [(set_attr "type" "store_ux,store_u")])
10468 (define_insn "*movdf_update1"
10469 [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
10470 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10471 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10472 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10473 (plus:SI (match_dup 1) (match_dup 2)))]
10474 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10475 && (!avoiding_indexed_address_p (SImode)
10476 || !gpc_reg_operand (operands[2], SImode))"
10480 [(set_attr "type" "fpload_ux,fpload_u")])
10482 (define_insn "*movdf_update2"
10483 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10484 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10485 (match_operand:DF 3 "gpc_reg_operand" "d,d"))
10486 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10487 (plus:SI (match_dup 1) (match_dup 2)))]
10488 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
10489 && (!avoiding_indexed_address_p (SImode)
10490 || !gpc_reg_operand (operands[2], SImode))"
10494 [(set_attr "type" "fpstore_ux,fpstore_u")])
10497 ;; After inserting conditional returns we can sometimes have
10498 ;; unnecessary register moves. Unfortunately we cannot have a
10499 ;; modeless peephole here, because some single SImode sets have early
10500 ;; clobber outputs. Although those sets expand to multi-ppc-insn
10501 ;; sequences, using get_attr_length here will smash the operands
10502 ;; array. Neither is there an early_cobbler_p predicate.
10503 ;; Disallow subregs for E500 so we don't munge frob_di_df_2.
10505 [(set (match_operand:DF 0 "gpc_reg_operand" "")
10506 (match_operand:DF 1 "any_operand" ""))
10507 (set (match_operand:DF 2 "gpc_reg_operand" "")
10509 "!(TARGET_E500_DOUBLE && GET_CODE (operands[2]) == SUBREG)
10510 && peep2_reg_dead_p (2, operands[0])"
10511 [(set (match_dup 2) (match_dup 1))])
10514 [(set (match_operand:SF 0 "gpc_reg_operand" "")
10515 (match_operand:SF 1 "any_operand" ""))
10516 (set (match_operand:SF 2 "gpc_reg_operand" "")
10518 "peep2_reg_dead_p (2, operands[0])"
10519 [(set (match_dup 2) (match_dup 1))])
10524 ;; Mode attributes for different ABIs.
10525 (define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
10526 (define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
10527 (define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
10528 (define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
10530 (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
10531 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10532 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10533 (match_operand 4 "" "g")))
10534 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10535 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10537 (clobber (reg:SI LR_REGNO))]
10538 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10540 if (TARGET_CMODEL != CMODEL_SMALL)
10541 return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
10544 return "addi %0,%1,%2@got@tlsgd\;bl %z3\;nop";
10546 "&& TARGET_TLS_MARKERS"
10547 [(set (match_dup 0)
10548 (unspec:TLSmode [(match_dup 1)
10551 (parallel [(set (match_dup 0)
10552 (call (mem:TLSmode (match_dup 3))
10554 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10555 (clobber (reg:SI LR_REGNO))])]
10557 [(set_attr "type" "two")
10558 (set (attr "length")
10559 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10563 (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
10564 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10565 (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
10566 (match_operand 4 "" "g")))
10567 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10568 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10570 (clobber (reg:SI LR_REGNO))]
10571 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10575 if (TARGET_SECURE_PLT && flag_pic == 2)
10576 return "addi %0,%1,%2@got@tlsgd\;bl %z3+32768@plt";
10578 return "addi %0,%1,%2@got@tlsgd\;bl %z3@plt";
10581 return "addi %0,%1,%2@got@tlsgd\;bl %z3";
10583 "&& TARGET_TLS_MARKERS"
10584 [(set (match_dup 0)
10585 (unspec:TLSmode [(match_dup 1)
10588 (parallel [(set (match_dup 0)
10589 (call (mem:TLSmode (match_dup 3))
10591 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
10592 (clobber (reg:SI LR_REGNO))])]
10594 [(set_attr "type" "two")
10595 (set_attr "length" "8")])
10597 (define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
10598 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10599 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10600 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10602 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10603 "addi %0,%1,%2@got@tlsgd"
10604 "&& TARGET_CMODEL != CMODEL_SMALL"
10605 [(set (match_dup 3)
10607 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
10609 (lo_sum:TLSmode (match_dup 3)
10610 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)))]
10613 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10615 [(set (attr "length")
10616 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10620 (define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
10621 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10623 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10624 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10626 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10627 "addis %0,%1,%2@got@tlsgd@ha"
10628 [(set_attr "length" "4")])
10630 (define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
10631 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10632 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10633 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10635 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10636 "addi %0,%1,%2@got@tlsgd@l"
10637 [(set_attr "length" "4")])
10639 (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
10640 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10641 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10642 (match_operand 2 "" "g")))
10643 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10645 (clobber (reg:SI LR_REGNO))]
10646 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
10647 "bl %z1(%3@tlsgd)\;nop"
10648 [(set_attr "type" "branch")
10649 (set_attr "length" "8")])
10651 (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
10652 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10653 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10654 (match_operand 2 "" "g")))
10655 (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
10657 (clobber (reg:SI LR_REGNO))]
10658 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10662 if (TARGET_SECURE_PLT && flag_pic == 2)
10663 return "bl %z1+32768(%3@tlsgd)@plt";
10664 return "bl %z1(%3@tlsgd)@plt";
10666 return "bl %z1(%3@tlsgd)";
10668 [(set_attr "type" "branch")
10669 (set_attr "length" "4")])
10671 (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
10672 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10673 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10674 (match_operand 3 "" "g")))
10675 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10677 (clobber (reg:SI LR_REGNO))]
10678 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
10680 if (TARGET_CMODEL != CMODEL_SMALL)
10681 return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
10684 return "addi %0,%1,%&@got@tlsld\;bl %z2\;nop";
10686 "&& TARGET_TLS_MARKERS"
10687 [(set (match_dup 0)
10688 (unspec:TLSmode [(match_dup 1)]
10690 (parallel [(set (match_dup 0)
10691 (call (mem:TLSmode (match_dup 2))
10693 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10694 (clobber (reg:SI LR_REGNO))])]
10696 [(set_attr "type" "two")
10697 (set (attr "length")
10698 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10702 (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
10703 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10704 (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
10705 (match_operand 3 "" "g")))
10706 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10708 (clobber (reg:SI LR_REGNO))]
10709 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
10713 if (TARGET_SECURE_PLT && flag_pic == 2)
10714 return "addi %0,%1,%&@got@tlsld\;bl %z2+32768@plt";
10716 return "addi %0,%1,%&@got@tlsld\;bl %z2@plt";
10719 return "addi %0,%1,%&@got@tlsld\;bl %z2";
10721 "&& TARGET_TLS_MARKERS"
10722 [(set (match_dup 0)
10723 (unspec:TLSmode [(match_dup 1)]
10725 (parallel [(set (match_dup 0)
10726 (call (mem:TLSmode (match_dup 2))
10728 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10729 (clobber (reg:SI LR_REGNO))])]
10731 [(set_attr "length" "8")])
10733 (define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
10734 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10735 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10737 "HAVE_AS_TLS && TARGET_TLS_MARKERS"
10738 "addi %0,%1,%&@got@tlsld"
10739 "&& TARGET_CMODEL != CMODEL_SMALL"
10740 [(set (match_dup 2)
10742 (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
10744 (lo_sum:TLSmode (match_dup 2)
10745 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
10748 operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10750 [(set (attr "length")
10751 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10755 (define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
10756 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10758 (unspec:TLSmode [(const_int 0)
10759 (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
10761 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10762 "addis %0,%1,%&@got@tlsld@ha"
10763 [(set_attr "length" "4")])
10765 (define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
10766 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10767 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10768 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)))]
10769 "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
10770 "addi %0,%1,%&@got@tlsld@l"
10771 [(set_attr "length" "4")])
10773 (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
10774 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10775 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10776 (match_operand 2 "" "g")))
10777 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10778 (clobber (reg:SI LR_REGNO))]
10779 "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
10780 "bl %z1(%&@tlsld)\;nop"
10781 [(set_attr "type" "branch")
10782 (set_attr "length" "8")])
10784 (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
10785 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10786 (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
10787 (match_operand 2 "" "g")))
10788 (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
10789 (clobber (reg:SI LR_REGNO))]
10790 "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
10794 if (TARGET_SECURE_PLT && flag_pic == 2)
10795 return "bl %z1+32768(%&@tlsld)@plt";
10796 return "bl %z1(%&@tlsld)@plt";
10798 return "bl %z1(%&@tlsld)";
10800 [(set_attr "type" "branch")
10801 (set_attr "length" "4")])
10803 (define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
10804 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10805 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10806 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10807 UNSPEC_TLSDTPREL))]
10809 "addi %0,%1,%2@dtprel")
10811 (define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
10812 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10813 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10814 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10815 UNSPEC_TLSDTPRELHA))]
10817 "addis %0,%1,%2@dtprel@ha")
10819 (define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
10820 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10821 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10822 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10823 UNSPEC_TLSDTPRELLO))]
10825 "addi %0,%1,%2@dtprel@l")
10827 (define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
10828 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10829 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10830 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10831 UNSPEC_TLSGOTDTPREL))]
10833 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
10834 "&& TARGET_CMODEL != CMODEL_SMALL"
10835 [(set (match_dup 3)
10837 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
10839 (lo_sum:TLSmode (match_dup 3)
10840 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
10843 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10845 [(set (attr "length")
10846 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10850 (define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
10851 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10853 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10854 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10855 UNSPEC_TLSGOTDTPREL)))]
10856 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10857 "addis %0,%1,%2@got@dtprel@ha"
10858 [(set_attr "length" "4")])
10860 (define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
10861 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10862 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10863 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10864 UNSPEC_TLSGOTDTPREL)))]
10865 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10866 "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)"
10867 [(set_attr "length" "4")])
10869 (define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
10870 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10871 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10872 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10875 "addi %0,%1,%2@tprel")
10877 (define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
10878 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10879 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10880 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10881 UNSPEC_TLSTPRELHA))]
10883 "addis %0,%1,%2@tprel@ha")
10885 (define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
10886 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10887 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10888 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10889 UNSPEC_TLSTPRELLO))]
10891 "addi %0,%1,%2@tprel@l")
10893 ;; "b" output constraint here and on tls_tls input to support linker tls
10894 ;; optimization. The linker may edit the instructions emitted by a
10895 ;; tls_got_tprel/tls_tls pair to addis,addi.
10896 (define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
10897 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10898 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10899 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10900 UNSPEC_TLSGOTTPREL))]
10902 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
10903 "&& TARGET_CMODEL != CMODEL_SMALL"
10904 [(set (match_dup 3)
10906 (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
10908 (lo_sum:TLSmode (match_dup 3)
10909 (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGOTTPREL)))]
10912 operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
10914 [(set (attr "length")
10915 (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
10919 (define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
10920 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
10922 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10923 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10924 UNSPEC_TLSGOTTPREL)))]
10925 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10926 "addis %0,%1,%2@got@tprel@ha"
10927 [(set_attr "length" "4")])
10929 (define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
10930 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10931 (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
10932 (unspec:TLSmode [(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10933 UNSPEC_TLSGOTTPREL)))]
10934 "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
10935 "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)"
10936 [(set_attr "length" "4")])
10938 (define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
10939 [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
10940 (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
10941 (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
10943 "TARGET_ELF && HAVE_AS_TLS"
10944 "add %0,%1,%2@tls")
10946 (define_expand "tls_get_tpointer"
10947 [(set (match_operand:SI 0 "gpc_reg_operand" "")
10948 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))]
10949 "TARGET_XCOFF && HAVE_AS_TLS"
10952 emit_insn (gen_tls_get_tpointer_internal ());
10953 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
10957 (define_insn "tls_get_tpointer_internal"
10959 (unspec:SI [(const_int 0)] UNSPEC_TLSTLS))
10960 (clobber (reg:SI LR_REGNO))]
10961 "TARGET_XCOFF && HAVE_AS_TLS"
10962 "bla __get_tpointer")
10964 (define_expand "tls_get_addr<mode>"
10965 [(set (match_operand:P 0 "gpc_reg_operand" "")
10966 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "")
10967 (match_operand:P 2 "gpc_reg_operand" "")] UNSPEC_TLSTLS))]
10968 "TARGET_XCOFF && HAVE_AS_TLS"
10971 emit_move_insn (gen_rtx_REG (Pmode, 3), operands[1]);
10972 emit_move_insn (gen_rtx_REG (Pmode, 4), operands[2]);
10973 emit_insn (gen_tls_get_addr_internal<mode> ());
10974 emit_move_insn (operands[0], gen_rtx_REG (Pmode, 3));
10978 (define_insn "tls_get_addr_internal<mode>"
10980 (unspec:P [(reg:P 3) (reg:P 4)] UNSPEC_TLSTLS))
10981 (clobber (reg:P 0))
10982 (clobber (reg:P 4))
10983 (clobber (reg:P 5))
10984 (clobber (reg:P 11))
10985 (clobber (reg:CC CR0_REGNO))
10986 (clobber (reg:P LR_REGNO))]
10987 "TARGET_XCOFF && HAVE_AS_TLS"
10988 "bla __tls_get_addr")
10990 ;; Next come insns related to the calling sequence.
10992 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10993 ;; We move the back-chain and decrement the stack pointer.
10995 (define_expand "allocate_stack"
10996 [(set (match_operand 0 "gpc_reg_operand" "")
10997 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10999 (minus (reg 1) (match_dup 1)))]
11002 { rtx chain = gen_reg_rtx (Pmode);
11003 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
11005 rtx insn, par, set, mem;
11007 emit_move_insn (chain, stack_bot);
11009 /* Check stack bounds if necessary. */
11010 if (crtl->limit_stack)
11013 available = expand_binop (Pmode, sub_optab,
11014 stack_pointer_rtx, stack_limit_rtx,
11015 NULL_RTX, 1, OPTAB_WIDEN);
11016 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
11019 if (GET_CODE (operands[1]) != CONST_INT
11020 || INTVAL (operands[1]) < -32767
11021 || INTVAL (operands[1]) > 32768)
11023 neg_op0 = gen_reg_rtx (Pmode);
11025 emit_insn (gen_negsi2 (neg_op0, operands[1]));
11027 emit_insn (gen_negdi2 (neg_op0, operands[1]));
11030 neg_op0 = GEN_INT (- INTVAL (operands[1]));
11032 insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
11033 : gen_movdi_di_update_stack))
11034 (stack_pointer_rtx, stack_pointer_rtx, neg_op0,
11036 /* Since we didn't use gen_frame_mem to generate the MEM, grab
11037 it now and set the alias set/attributes. The above gen_*_update
11038 calls will generate a PARALLEL with the MEM set being the first
11040 par = PATTERN (insn);
11041 gcc_assert (GET_CODE (par) == PARALLEL);
11042 set = XVECEXP (par, 0, 0);
11043 gcc_assert (GET_CODE (set) == SET);
11044 mem = SET_DEST (set);
11045 gcc_assert (MEM_P (mem));
11046 MEM_NOTRAP_P (mem) = 1;
11047 set_mem_alias_set (mem, get_frame_alias_set ());
11049 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
11053 ;; These patterns say how to save and restore the stack pointer. We need not
11054 ;; save the stack pointer at function level since we are careful to
11055 ;; preserve the backchain. At block level, we have to restore the backchain
11056 ;; when we restore the stack pointer.
11058 ;; For nonlocal gotos, we must save both the stack pointer and its
11059 ;; backchain and restore both. Note that in the nonlocal case, the
11060 ;; save area is a memory location.
11062 (define_expand "save_stack_function"
11063 [(match_operand 0 "any_operand" "")
11064 (match_operand 1 "any_operand" "")]
11068 (define_expand "restore_stack_function"
11069 [(match_operand 0 "any_operand" "")
11070 (match_operand 1 "any_operand" "")]
11074 ;; Adjust stack pointer (op0) to a new value (op1).
11075 ;; First copy old stack backchain to new location, and ensure that the
11076 ;; scheduler won't reorder the sp assignment before the backchain write.
11077 (define_expand "restore_stack_block"
11078 [(set (match_dup 2) (match_dup 3))
11079 (set (match_dup 4) (match_dup 2))
11081 (set (match_operand 0 "register_operand" "")
11082 (match_operand 1 "register_operand" ""))]
11088 operands[1] = force_reg (Pmode, operands[1]);
11089 operands[2] = gen_reg_rtx (Pmode);
11090 operands[3] = gen_frame_mem (Pmode, operands[0]);
11091 operands[4] = gen_frame_mem (Pmode, operands[1]);
11092 p = rtvec_alloc (1);
11093 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11094 gen_frame_mem (BLKmode, operands[0]),
11096 operands[5] = gen_rtx_PARALLEL (VOIDmode, p);
11099 (define_expand "save_stack_nonlocal"
11100 [(set (match_dup 3) (match_dup 4))
11101 (set (match_operand 0 "memory_operand" "") (match_dup 3))
11102 (set (match_dup 2) (match_operand 1 "register_operand" ""))]
11106 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11108 /* Copy the backchain to the first word, sp to the second. */
11109 operands[0] = adjust_address_nv (operands[0], Pmode, 0);
11110 operands[2] = adjust_address_nv (operands[0], Pmode, units_per_word);
11111 operands[3] = gen_reg_rtx (Pmode);
11112 operands[4] = gen_frame_mem (Pmode, operands[1]);
11115 (define_expand "restore_stack_nonlocal"
11116 [(set (match_dup 2) (match_operand 1 "memory_operand" ""))
11117 (set (match_dup 3) (match_dup 4))
11118 (set (match_dup 5) (match_dup 2))
11120 (set (match_operand 0 "register_operand" "") (match_dup 3))]
11124 int units_per_word = (TARGET_32BIT) ? 4 : 8;
11127 /* Restore the backchain from the first word, sp from the second. */
11128 operands[2] = gen_reg_rtx (Pmode);
11129 operands[3] = gen_reg_rtx (Pmode);
11130 operands[1] = adjust_address_nv (operands[1], Pmode, 0);
11131 operands[4] = adjust_address_nv (operands[1], Pmode, units_per_word);
11132 operands[5] = gen_frame_mem (Pmode, operands[3]);
11133 p = rtvec_alloc (1);
11134 RTVEC_ELT (p, 0) = gen_rtx_SET (VOIDmode,
11135 gen_frame_mem (BLKmode, operands[0]),
11137 operands[6] = gen_rtx_PARALLEL (VOIDmode, p);
11140 ;; TOC register handling.
11142 ;; Code to initialize the TOC register...
11144 (define_insn "load_toc_aix_si"
11145 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11146 (unspec:SI [(const_int 0)] UNSPEC_TOC))
11147 (use (reg:SI 2))])]
11148 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
11152 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11153 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11154 operands[2] = gen_rtx_REG (Pmode, 2);
11155 return \"lwz %0,%1(%2)\";
11157 [(set_attr "type" "load")])
11159 (define_insn "load_toc_aix_di"
11160 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11161 (unspec:DI [(const_int 0)] UNSPEC_TOC))
11162 (use (reg:DI 2))])]
11163 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
11167 #ifdef TARGET_RELOCATABLE
11168 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
11169 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
11171 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
11174 strcat (buf, \"@toc\");
11175 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
11176 operands[2] = gen_rtx_REG (Pmode, 2);
11177 return \"ld %0,%1(%2)\";
11179 [(set_attr "type" "load")])
11181 (define_insn "load_toc_v4_pic_si"
11182 [(set (reg:SI LR_REGNO)
11183 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
11184 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
11185 "bl _GLOBAL_OFFSET_TABLE_@local-4"
11186 [(set_attr "type" "branch")
11187 (set_attr "length" "4")])
11189 (define_expand "load_toc_v4_PIC_1"
11190 [(parallel [(set (reg:SI LR_REGNO)
11191 (match_operand:SI 0 "immediate_operand" "s"))
11192 (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
11193 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
11194 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11197 (define_insn "load_toc_v4_PIC_1_normal"
11198 [(set (reg:SI LR_REGNO)
11199 (match_operand:SI 0 "immediate_operand" "s"))
11200 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11201 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
11202 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11203 "bcl 20,31,%0\\n%0:"
11204 [(set_attr "type" "branch")
11205 (set_attr "length" "4")])
11207 (define_insn "load_toc_v4_PIC_1_476"
11208 [(set (reg:SI LR_REGNO)
11209 (match_operand:SI 0 "immediate_operand" "s"))
11210 (use (unspec [(match_dup 0)] UNSPEC_TOC))]
11211 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
11212 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
11216 static char templ[32];
11218 get_ppc476_thunk_name (name);
11219 sprintf (templ, \"bl %s\\n%%0:\", name);
11222 [(set_attr "type" "branch")
11223 (set_attr "length" "4")])
11225 (define_expand "load_toc_v4_PIC_1b"
11226 [(parallel [(set (reg:SI LR_REGNO)
11227 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11228 (label_ref (match_operand 1 "" ""))]
11231 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11234 (define_insn "load_toc_v4_PIC_1b_normal"
11235 [(set (reg:SI LR_REGNO)
11236 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11237 (label_ref (match_operand 1 "" ""))]
11240 "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11241 "bcl 20,31,$+8\;.long %0-$"
11242 [(set_attr "type" "branch")
11243 (set_attr "length" "8")])
11245 (define_insn "load_toc_v4_PIC_1b_476"
11246 [(set (reg:SI LR_REGNO)
11247 (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
11248 (label_ref (match_operand 1 "" ""))]
11251 "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11255 static char templ[32];
11257 get_ppc476_thunk_name (name);
11258 sprintf (templ, \"bl %s\\n\\tb $+8\\n\\t.long %%0-$\", name);
11261 [(set_attr "type" "branch")
11262 (set_attr "length" "16")])
11264 (define_insn "load_toc_v4_PIC_2"
11265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11266 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11267 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
11268 (match_operand:SI 3 "immediate_operand" "s")))))]
11269 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
11271 [(set_attr "type" "load")])
11273 (define_insn "load_toc_v4_PIC_3b"
11274 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11275 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11277 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11278 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
11279 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11280 "addis %0,%1,%2-%3@ha")
11282 (define_insn "load_toc_v4_PIC_3c"
11283 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11284 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
11285 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
11286 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
11287 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
11288 "addi %0,%1,%2-%3@l")
11290 ;; If the TOC is shared over a translation unit, as happens with all
11291 ;; the kinds of PIC that we support, we need to restore the TOC
11292 ;; pointer only when jumping over units of translation.
11293 ;; On Darwin, we need to reload the picbase.
11295 (define_expand "builtin_setjmp_receiver"
11296 [(use (label_ref (match_operand 0 "" "")))]
11297 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
11298 || (TARGET_TOC && TARGET_MINIMAL_TOC)
11299 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
11303 if (DEFAULT_ABI == ABI_DARWIN)
11305 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
11306 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
11310 crtl->uses_pic_offset_table = 1;
11311 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
11312 CODE_LABEL_NUMBER (operands[0]));
11313 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
11315 emit_insn (gen_load_macho_picbase (tmplabrtx));
11316 emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
11317 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
11321 rs6000_emit_load_toc_table (FALSE);
11325 ;; Largetoc support
11326 (define_insn "*largetoc_high"
11327 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11329 (unspec [(match_operand:DI 1 "" "")
11330 (match_operand:DI 2 "gpc_reg_operand" "b")]
11332 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11333 "addis %0,%2,%1@toc@ha")
11335 (define_insn "*largetoc_high_aix<mode>"
11336 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11338 (unspec [(match_operand:P 1 "" "")
11339 (match_operand:P 2 "gpc_reg_operand" "b")]
11341 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11342 "addis %0,%1@u(%2)")
11344 (define_insn "*largetoc_high_plus"
11345 [(set (match_operand:DI 0 "gpc_reg_operand" "=b*r")
11348 (unspec [(match_operand:DI 1 "" "")
11349 (match_operand:DI 2 "gpc_reg_operand" "b")]
11351 (match_operand 3 "const_int_operand" "n"))))]
11352 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11353 "addis %0,%2,%1+%3@toc@ha")
11355 (define_insn "*largetoc_high_plus_aix<mode>"
11356 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11359 (unspec [(match_operand:P 1 "" "")
11360 (match_operand:P 2 "gpc_reg_operand" "b")]
11362 (match_operand 3 "const_int_operand" "n"))))]
11363 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11364 "addis %0,%1+%3@u(%2)")
11366 (define_insn "*largetoc_low"
11367 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11368 (lo_sum:DI (match_operand:DI 1 "gpc_reg_operand" "b,!*r")
11369 (match_operand:DI 2 "" "")))]
11370 "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL"
11375 (define_insn "*largetoc_low_aix<mode>"
11376 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
11377 (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
11378 (match_operand:P 2 "" "")))]
11379 "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL"
11382 (define_insn_and_split "*tocref<mode>"
11383 [(set (match_operand:P 0 "gpc_reg_operand" "=b*r")
11384 (match_operand:P 1 "small_toc_ref" "R"))]
11387 "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
11388 [(set (match_dup 0) (high:P (match_dup 1)))
11389 (set (match_dup 0) (lo_sum:P (match_dup 0) (match_dup 1)))])
11391 ;; Elf specific ways of loading addresses for non-PIC code.
11392 ;; The output of this could be r0, but we make a very strong
11393 ;; preference for a base register because it will usually
11394 ;; be needed there.
11395 (define_insn "elf_high"
11396 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
11397 (high:SI (match_operand 1 "" "")))]
11398 "TARGET_ELF && ! TARGET_64BIT"
11401 (define_insn "elf_low"
11402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11403 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
11404 (match_operand 2 "" "")))]
11405 "TARGET_ELF && ! TARGET_64BIT"
11410 ;; Call and call_value insns
11411 (define_expand "call"
11412 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11413 (match_operand 1 "" ""))
11414 (use (match_operand 2 "" ""))
11415 (clobber (reg:SI LR_REGNO))])]
11420 if (MACHOPIC_INDIRECT)
11421 operands[0] = machopic_indirect_call_target (operands[0]);
11424 gcc_assert (GET_CODE (operands[0]) == MEM);
11425 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11427 operands[0] = XEXP (operands[0], 0);
11429 if (GET_CODE (operands[0]) != SYMBOL_REF
11430 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
11431 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
11433 if (INTVAL (operands[2]) & CALL_LONG)
11434 operands[0] = rs6000_longcall_ref (operands[0]);
11436 switch (DEFAULT_ABI)
11440 operands[0] = force_reg (Pmode, operands[0]);
11444 /* AIX function pointers are really pointers to a three word
11446 rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
11450 gcc_unreachable ();
11455 (define_expand "call_value"
11456 [(parallel [(set (match_operand 0 "" "")
11457 (call (mem:SI (match_operand 1 "address_operand" ""))
11458 (match_operand 2 "" "")))
11459 (use (match_operand 3 "" ""))
11460 (clobber (reg:SI LR_REGNO))])]
11465 if (MACHOPIC_INDIRECT)
11466 operands[1] = machopic_indirect_call_target (operands[1]);
11469 gcc_assert (GET_CODE (operands[1]) == MEM);
11470 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
11472 operands[1] = XEXP (operands[1], 0);
11474 if (GET_CODE (operands[1]) != SYMBOL_REF
11475 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
11476 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
11478 if (INTVAL (operands[3]) & CALL_LONG)
11479 operands[1] = rs6000_longcall_ref (operands[1]);
11481 switch (DEFAULT_ABI)
11485 operands[1] = force_reg (Pmode, operands[1]);
11489 /* AIX function pointers are really pointers to a three word
11491 rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
11495 gcc_unreachable ();
11500 ;; Call to function in current module. No TOC pointer reload needed.
11501 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11502 ;; either the function was not prototyped, or it was prototyped as a
11503 ;; variable argument function. It is > 0 if FP registers were passed
11504 ;; and < 0 if they were not.
11506 (define_insn "*call_local32"
11507 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11508 (match_operand 1 "" "g,g"))
11509 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11510 (clobber (reg:SI LR_REGNO))]
11511 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11514 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11515 output_asm_insn (\"crxor 6,6,6\", operands);
11517 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11518 output_asm_insn (\"creqv 6,6,6\", operands);
11520 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11522 [(set_attr "type" "branch")
11523 (set_attr "length" "4,8")])
11525 (define_insn "*call_local64"
11526 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11527 (match_operand 1 "" "g,g"))
11528 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11529 (clobber (reg:SI LR_REGNO))]
11530 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11533 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11534 output_asm_insn (\"crxor 6,6,6\", operands);
11536 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11537 output_asm_insn (\"creqv 6,6,6\", operands);
11539 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
11541 [(set_attr "type" "branch")
11542 (set_attr "length" "4,8")])
11544 (define_insn "*call_value_local32"
11545 [(set (match_operand 0 "" "")
11546 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11547 (match_operand 2 "" "g,g")))
11548 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11549 (clobber (reg:SI LR_REGNO))]
11550 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11553 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11554 output_asm_insn (\"crxor 6,6,6\", operands);
11556 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11557 output_asm_insn (\"creqv 6,6,6\", operands);
11559 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11561 [(set_attr "type" "branch")
11562 (set_attr "length" "4,8")])
11565 (define_insn "*call_value_local64"
11566 [(set (match_operand 0 "" "")
11567 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11568 (match_operand 2 "" "g,g")))
11569 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11570 (clobber (reg:SI LR_REGNO))]
11571 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11574 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11575 output_asm_insn (\"crxor 6,6,6\", operands);
11577 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11578 output_asm_insn (\"creqv 6,6,6\", operands);
11580 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
11582 [(set_attr "type" "branch")
11583 (set_attr "length" "4,8")])
11585 ;; Call to indirect functions with the AIX abi using a 3 word descriptor.
11586 ;; Operand0 is the addresss of the function to call
11587 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
11588 ;; Operand2 is the location in the function descriptor to load r2 from
11589 ;; Operand3 is the stack location to hold the current TOC pointer
11591 (define_insn "call_indirect_aix<ptrsize>"
11592 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11593 (match_operand 1 "" "g,g"))
11594 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11595 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11596 (use (reg:P STATIC_CHAIN_REGNUM))
11597 (clobber (reg:P LR_REGNO))]
11598 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11599 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11600 [(set_attr "type" "jmpreg")
11601 (set_attr "length" "12")])
11603 ;; Like call_indirect_aix<ptrsize>, but no use of the static chain
11604 ;; Operand0 is the addresss of the function to call
11605 ;; Operand1 is the flag for System V.4 for unprototyped or FP registers
11606 ;; Operand2 is the location in the function descriptor to load r2 from
11607 ;; Operand3 is the stack location to hold the current TOC pointer
11609 (define_insn "call_indirect_aix<ptrsize>_nor11"
11610 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
11611 (match_operand 1 "" "g,g"))
11612 (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
11613 (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11614 (clobber (reg:P LR_REGNO))]
11615 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11616 "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
11617 [(set_attr "type" "jmpreg")
11618 (set_attr "length" "12")])
11620 ;; Operand0 is the return result of the function
11621 ;; Operand1 is the addresss of the function to call
11622 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
11623 ;; Operand3 is the location in the function descriptor to load r2 from
11624 ;; Operand4 is the stack location to hold the current TOC pointer
11626 (define_insn "call_value_indirect_aix<ptrsize>"
11627 [(set (match_operand 0 "" "")
11628 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11629 (match_operand 2 "" "g,g")))
11630 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11631 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
11632 (use (reg:P STATIC_CHAIN_REGNUM))
11633 (clobber (reg:P LR_REGNO))]
11634 "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11635 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
11636 [(set_attr "type" "jmpreg")
11637 (set_attr "length" "12")])
11639 ;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
11640 ;; Operand0 is the return result of the function
11641 ;; Operand1 is the addresss of the function to call
11642 ;; Operand2 is the flag for System V.4 for unprototyped or FP registers
11643 ;; Operand3 is the location in the function descriptor to load r2 from
11644 ;; Operand4 is the stack location to hold the current TOC pointer
11646 (define_insn "call_value_indirect_aix<ptrsize>_nor11"
11647 [(set (match_operand 0 "" "")
11648 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
11649 (match_operand 2 "" "g,g")))
11650 (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
11651 (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
11652 (clobber (reg:P LR_REGNO))]
11653 "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
11654 "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
11655 [(set_attr "type" "jmpreg")
11656 (set_attr "length" "12")])
11658 ;; Call to function which may be in another module. Restore the TOC
11659 ;; pointer (r2) after the call unless this is System V.
11660 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
11661 ;; either the function was not prototyped, or it was prototyped as a
11662 ;; variable argument function. It is > 0 if FP registers were passed
11663 ;; and < 0 if they were not.
11665 (define_insn "*call_nonlocal_aix32"
11666 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11667 (match_operand 1 "" "g"))
11668 (use (match_operand:SI 2 "immediate_operand" "O"))
11669 (clobber (reg:SI LR_REGNO))]
11671 && DEFAULT_ABI == ABI_AIX
11672 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11674 [(set_attr "type" "branch")
11675 (set_attr "length" "8")])
11677 (define_insn "*call_nonlocal_aix64"
11678 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11679 (match_operand 1 "" "g"))
11680 (use (match_operand:SI 2 "immediate_operand" "O"))
11681 (clobber (reg:SI LR_REGNO))]
11683 && DEFAULT_ABI == ABI_AIX
11684 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11686 [(set_attr "type" "branch")
11687 (set_attr "length" "8")])
11689 (define_insn "*call_value_nonlocal_aix32"
11690 [(set (match_operand 0 "" "")
11691 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11692 (match_operand 2 "" "g")))
11693 (use (match_operand:SI 3 "immediate_operand" "O"))
11694 (clobber (reg:SI LR_REGNO))]
11696 && DEFAULT_ABI == ABI_AIX
11697 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11699 [(set_attr "type" "branch")
11700 (set_attr "length" "8")])
11702 (define_insn "*call_value_nonlocal_aix64"
11703 [(set (match_operand 0 "" "")
11704 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11705 (match_operand 2 "" "g")))
11706 (use (match_operand:SI 3 "immediate_operand" "O"))
11707 (clobber (reg:SI LR_REGNO))]
11709 && DEFAULT_ABI == ABI_AIX
11710 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11712 [(set_attr "type" "branch")
11713 (set_attr "length" "8")])
11715 ;; A function pointer under System V is just a normal pointer
11716 ;; operands[0] is the function pointer
11717 ;; operands[1] is the stack size to clean up
11718 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
11719 ;; which indicates how to set cr1
11721 (define_insn "*call_indirect_nonlocal_sysv<mode>"
11722 [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
11723 (match_operand 1 "" "g,g,g,g"))
11724 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
11725 (clobber (reg:SI LR_REGNO))]
11726 "DEFAULT_ABI == ABI_V4
11727 || DEFAULT_ABI == ABI_DARWIN"
11729 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11730 output_asm_insn ("crxor 6,6,6", operands);
11732 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11733 output_asm_insn ("creqv 6,6,6", operands);
11737 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11738 (set_attr "length" "4,4,8,8")])
11740 (define_insn_and_split "*call_nonlocal_sysv<mode>"
11741 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11742 (match_operand 1 "" "g,g"))
11743 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11744 (clobber (reg:SI LR_REGNO))]
11745 "(DEFAULT_ABI == ABI_DARWIN
11746 || (DEFAULT_ABI == ABI_V4
11747 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
11749 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11750 output_asm_insn ("crxor 6,6,6", operands);
11752 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11753 output_asm_insn ("creqv 6,6,6", operands);
11756 return output_call(insn, operands, 0, 2);
11758 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11760 gcc_assert (!TARGET_SECURE_PLT);
11761 return "bl %z0@plt";
11767 "DEFAULT_ABI == ABI_V4
11768 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11769 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11770 [(parallel [(call (mem:SI (match_dup 0))
11772 (use (match_dup 2))
11773 (use (match_dup 3))
11774 (clobber (reg:SI LR_REGNO))])]
11776 operands[3] = pic_offset_table_rtx;
11778 [(set_attr "type" "branch,branch")
11779 (set_attr "length" "4,8")])
11781 (define_insn "*call_nonlocal_sysv_secure<mode>"
11782 [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
11783 (match_operand 1 "" "g,g"))
11784 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11785 (use (match_operand:SI 3 "register_operand" "r,r"))
11786 (clobber (reg:SI LR_REGNO))]
11787 "(DEFAULT_ABI == ABI_V4
11788 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[0])
11789 && (INTVAL (operands[2]) & CALL_LONG) == 0)"
11791 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11792 output_asm_insn ("crxor 6,6,6", operands);
11794 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11795 output_asm_insn ("creqv 6,6,6", operands);
11798 /* The magic 32768 offset here and in the other sysv call insns
11799 corresponds to the offset of r30 in .got2, as given by LCTOC1.
11800 See sysv4.h:toc_section. */
11801 return "bl %z0+32768@plt";
11803 return "bl %z0@plt";
11805 [(set_attr "type" "branch,branch")
11806 (set_attr "length" "4,8")])
11808 (define_insn "*call_value_indirect_nonlocal_sysv<mode>"
11809 [(set (match_operand 0 "" "")
11810 (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
11811 (match_operand 2 "" "g,g,g,g")))
11812 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
11813 (clobber (reg:SI LR_REGNO))]
11814 "DEFAULT_ABI == ABI_V4
11815 || DEFAULT_ABI == ABI_DARWIN"
11817 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11818 output_asm_insn ("crxor 6,6,6", operands);
11820 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11821 output_asm_insn ("creqv 6,6,6", operands);
11825 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
11826 (set_attr "length" "4,4,8,8")])
11828 (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
11829 [(set (match_operand 0 "" "")
11830 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11831 (match_operand 2 "" "g,g")))
11832 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11833 (clobber (reg:SI LR_REGNO))]
11834 "(DEFAULT_ABI == ABI_DARWIN
11835 || (DEFAULT_ABI == ABI_V4
11836 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
11838 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11839 output_asm_insn ("crxor 6,6,6", operands);
11841 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11842 output_asm_insn ("creqv 6,6,6", operands);
11845 return output_call(insn, operands, 1, 3);
11847 if (DEFAULT_ABI == ABI_V4 && flag_pic)
11849 gcc_assert (!TARGET_SECURE_PLT);
11850 return "bl %z1@plt";
11856 "DEFAULT_ABI == ABI_V4
11857 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11858 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11859 [(parallel [(set (match_dup 0)
11860 (call (mem:SI (match_dup 1))
11862 (use (match_dup 3))
11863 (use (match_dup 4))
11864 (clobber (reg:SI LR_REGNO))])]
11866 operands[4] = pic_offset_table_rtx;
11868 [(set_attr "type" "branch,branch")
11869 (set_attr "length" "4,8")])
11871 (define_insn "*call_value_nonlocal_sysv_secure<mode>"
11872 [(set (match_operand 0 "" "")
11873 (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
11874 (match_operand 2 "" "g,g")))
11875 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11876 (use (match_operand:SI 4 "register_operand" "r,r"))
11877 (clobber (reg:SI LR_REGNO))]
11878 "(DEFAULT_ABI == ABI_V4
11879 && TARGET_SECURE_PLT && flag_pic && !SYMBOL_REF_LOCAL_P (operands[1])
11880 && (INTVAL (operands[3]) & CALL_LONG) == 0)"
11882 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11883 output_asm_insn ("crxor 6,6,6", operands);
11885 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11886 output_asm_insn ("creqv 6,6,6", operands);
11889 return "bl %z1+32768@plt";
11891 return "bl %z1@plt";
11893 [(set_attr "type" "branch,branch")
11894 (set_attr "length" "4,8")])
11896 ;; Call subroutine returning any type.
11897 (define_expand "untyped_call"
11898 [(parallel [(call (match_operand 0 "" "")
11900 (match_operand 1 "" "")
11901 (match_operand 2 "" "")])]
11907 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11909 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11911 rtx set = XVECEXP (operands[2], 0, i);
11912 emit_move_insn (SET_DEST (set), SET_SRC (set));
11915 /* The optimizer does not know that the call sets the function value
11916 registers we stored in the result block. We avoid problems by
11917 claiming that all hard registers are used and clobbered at this
11919 emit_insn (gen_blockage ());
11924 ;; sibling call patterns
11925 (define_expand "sibcall"
11926 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11927 (match_operand 1 "" ""))
11928 (use (match_operand 2 "" ""))
11929 (use (reg:SI LR_REGNO))
11935 if (MACHOPIC_INDIRECT)
11936 operands[0] = machopic_indirect_call_target (operands[0]);
11939 gcc_assert (GET_CODE (operands[0]) == MEM);
11940 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
11942 operands[0] = XEXP (operands[0], 0);
11945 ;; this and similar patterns must be marked as using LR, otherwise
11946 ;; dataflow will try to delete the store into it. This is true
11947 ;; even when the actual reg to jump to is in CTR, when LR was
11948 ;; saved and restored around the PIC-setting BCL.
11949 (define_insn "*sibcall_local32"
11950 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11951 (match_operand 1 "" "g,g"))
11952 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11953 (use (reg:SI LR_REGNO))
11955 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11958 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11959 output_asm_insn (\"crxor 6,6,6\", operands);
11961 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11962 output_asm_insn (\"creqv 6,6,6\", operands);
11964 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11966 [(set_attr "type" "branch")
11967 (set_attr "length" "4,8")])
11969 (define_insn "*sibcall_local64"
11970 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11971 (match_operand 1 "" "g,g"))
11972 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11973 (use (reg:SI LR_REGNO))
11975 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11978 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11979 output_asm_insn (\"crxor 6,6,6\", operands);
11981 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11982 output_asm_insn (\"creqv 6,6,6\", operands);
11984 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11986 [(set_attr "type" "branch")
11987 (set_attr "length" "4,8")])
11989 (define_insn "*sibcall_value_local32"
11990 [(set (match_operand 0 "" "")
11991 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11992 (match_operand 2 "" "g,g")))
11993 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11994 (use (reg:SI LR_REGNO))
11996 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11999 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12000 output_asm_insn (\"crxor 6,6,6\", operands);
12002 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12003 output_asm_insn (\"creqv 6,6,6\", operands);
12005 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12007 [(set_attr "type" "branch")
12008 (set_attr "length" "4,8")])
12011 (define_insn "*sibcall_value_local64"
12012 [(set (match_operand 0 "" "")
12013 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
12014 (match_operand 2 "" "g,g")))
12015 (use (match_operand:SI 3 "immediate_operand" "O,n"))
12016 (use (reg:SI LR_REGNO))
12018 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
12021 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12022 output_asm_insn (\"crxor 6,6,6\", operands);
12024 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12025 output_asm_insn (\"creqv 6,6,6\", operands);
12027 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
12029 [(set_attr "type" "branch")
12030 (set_attr "length" "4,8")])
12032 (define_insn "*sibcall_nonlocal_aix<mode>"
12033 [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
12034 (match_operand 1 "" "g,g"))
12035 (use (match_operand:SI 2 "immediate_operand" "O,O"))
12036 (use (reg:SI LR_REGNO))
12038 "DEFAULT_ABI == ABI_AIX
12039 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12043 [(set_attr "type" "branch")
12044 (set_attr "length" "4")])
12046 (define_insn "*sibcall_value_nonlocal_aix<mode>"
12047 [(set (match_operand 0 "" "")
12048 (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
12049 (match_operand 2 "" "g,g")))
12050 (use (match_operand:SI 3 "immediate_operand" "O,O"))
12051 (use (reg:SI LR_REGNO))
12053 "DEFAULT_ABI == ABI_AIX
12054 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12058 [(set_attr "type" "branch")
12059 (set_attr "length" "4")])
12061 (define_insn "*sibcall_nonlocal_sysv<mode>"
12062 [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
12063 (match_operand 1 "" ""))
12064 (use (match_operand 2 "immediate_operand" "O,n,O,n"))
12065 (use (reg:SI LR_REGNO))
12067 "(DEFAULT_ABI == ABI_DARWIN
12068 || DEFAULT_ABI == ABI_V4)
12069 && (INTVAL (operands[2]) & CALL_LONG) == 0"
12072 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
12073 output_asm_insn (\"crxor 6,6,6\", operands);
12075 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
12076 output_asm_insn (\"creqv 6,6,6\", operands);
12078 if (which_alternative >= 2)
12080 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12082 gcc_assert (!TARGET_SECURE_PLT);
12083 return \"b %z0@plt\";
12088 [(set_attr "type" "branch")
12089 (set_attr "length" "4,8,4,8")])
12091 (define_expand "sibcall_value"
12092 [(parallel [(set (match_operand 0 "register_operand" "")
12093 (call (mem:SI (match_operand 1 "address_operand" ""))
12094 (match_operand 2 "" "")))
12095 (use (match_operand 3 "" ""))
12096 (use (reg:SI LR_REGNO))
12102 if (MACHOPIC_INDIRECT)
12103 operands[1] = machopic_indirect_call_target (operands[1]);
12106 gcc_assert (GET_CODE (operands[1]) == MEM);
12107 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
12109 operands[1] = XEXP (operands[1], 0);
12112 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
12113 [(set (match_operand 0 "" "")
12114 (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
12115 (match_operand 2 "" "")))
12116 (use (match_operand:SI 3 "immediate_operand" "O,n,O,n"))
12117 (use (reg:SI LR_REGNO))
12119 "(DEFAULT_ABI == ABI_DARWIN
12120 || DEFAULT_ABI == ABI_V4)
12121 && (INTVAL (operands[3]) & CALL_LONG) == 0"
12124 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
12125 output_asm_insn (\"crxor 6,6,6\", operands);
12127 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
12128 output_asm_insn (\"creqv 6,6,6\", operands);
12130 if (which_alternative >= 2)
12132 else if (DEFAULT_ABI == ABI_V4 && flag_pic)
12134 gcc_assert (!TARGET_SECURE_PLT);
12135 return \"b %z1@plt\";
12140 [(set_attr "type" "branch")
12141 (set_attr "length" "4,8,4,8")])
12143 (define_expand "sibcall_epilogue"
12144 [(use (const_int 0))]
12147 if (!TARGET_SCHED_PROLOG)
12148 emit_insn (gen_blockage ());
12149 rs6000_emit_epilogue (TRUE);
12153 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
12154 ;; all of memory. This blocks insns from being moved across this point.
12156 (define_insn "blockage"
12157 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
12161 (define_expand "probe_stack"
12162 [(set (match_operand 0 "memory_operand" "=m")
12163 (unspec [(const_int 0)] UNSPEC_PROBE_STACK))]
12167 emit_insn (gen_probe_stack_di (operands[0]));
12169 emit_insn (gen_probe_stack_si (operands[0]));
12173 (define_insn "probe_stack_<mode>"
12174 [(set (match_operand:P 0 "memory_operand" "=m")
12175 (unspec:P [(const_int 0)] UNSPEC_PROBE_STACK))]
12178 operands[1] = gen_rtx_REG (Pmode, 0);
12179 return "st<wd>%U0%X0 %1,%0";
12181 [(set (attr "type")
12183 (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
12184 (const_string "store_ux")
12186 (match_test "update_address_mem (operands[0], VOIDmode)")
12187 (const_string "store_u")
12188 (const_string "store"))))
12189 (set_attr "length" "4")])
12191 (define_insn "probe_stack_range<P:mode>"
12192 [(set (match_operand:P 0 "register_operand" "=r")
12193 (unspec_volatile:P [(match_operand:P 1 "register_operand" "0")
12194 (match_operand:P 2 "register_operand" "r")]
12195 UNSPECV_PROBE_STACK_RANGE))]
12197 "* return output_probe_stack_range (operands[0], operands[2]);"
12198 [(set_attr "type" "three")])
12200 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
12201 ;; signed & unsigned, and one type of branch.
12203 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
12204 ;; insns, and branches.
12206 (define_expand "cbranch<mode>4"
12207 [(use (match_operator 0 "rs6000_cbranch_operator"
12208 [(match_operand:GPR 1 "gpc_reg_operand" "")
12209 (match_operand:GPR 2 "reg_or_short_operand" "")]))
12210 (use (match_operand 3 ""))]
12214 /* Take care of the possibility that operands[2] might be negative but
12215 this might be a logical operation. That insn doesn't exist. */
12216 if (GET_CODE (operands[2]) == CONST_INT
12217 && INTVAL (operands[2]) < 0)
12219 operands[2] = force_reg (<MODE>mode, operands[2]);
12220 operands[0] = gen_rtx_fmt_ee (GET_CODE (operands[0]),
12221 GET_MODE (operands[0]),
12222 operands[1], operands[2]);
12225 rs6000_emit_cbranch (<MODE>mode, operands);
12229 (define_expand "cbranch<mode>4"
12230 [(use (match_operator 0 "rs6000_cbranch_operator"
12231 [(match_operand:FP 1 "gpc_reg_operand" "")
12232 (match_operand:FP 2 "gpc_reg_operand" "")]))
12233 (use (match_operand 3 ""))]
12237 rs6000_emit_cbranch (<MODE>mode, operands);
12241 (define_expand "cstore<mode>4"
12242 [(use (match_operator 1 "rs6000_cbranch_operator"
12243 [(match_operand:GPR 2 "gpc_reg_operand" "")
12244 (match_operand:GPR 3 "reg_or_short_operand" "")]))
12245 (clobber (match_operand:SI 0 "register_operand"))]
12249 /* Take care of the possibility that operands[3] might be negative but
12250 this might be a logical operation. That insn doesn't exist. */
12251 if (GET_CODE (operands[3]) == CONST_INT
12252 && INTVAL (operands[3]) < 0)
12254 operands[3] = force_reg (<MODE>mode, operands[3]);
12255 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
12256 GET_MODE (operands[1]),
12257 operands[2], operands[3]);
12260 /* For SNE, we would prefer that the xor/abs sequence be used for integers.
12261 For SEQ, likewise, except that comparisons with zero should be done
12262 with an scc insns. However, due to the order that combine see the
12263 resulting insns, we must, in fact, allow SEQ for integers. Fail in
12264 the cases we don't want to handle or are best handled by portable
12266 if (GET_CODE (operands[1]) == NE)
12268 if ((GET_CODE (operands[1]) == LT || GET_CODE (operands[1]) == LE
12269 || GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == GE)
12270 && operands[3] == const0_rtx)
12272 rs6000_emit_sCOND (<MODE>mode, operands);
12276 (define_expand "cstore<mode>4"
12277 [(use (match_operator 1 "rs6000_cbranch_operator"
12278 [(match_operand:FP 2 "gpc_reg_operand" "")
12279 (match_operand:FP 3 "gpc_reg_operand" "")]))
12280 (clobber (match_operand:SI 0 "register_operand"))]
12284 rs6000_emit_sCOND (<MODE>mode, operands);
12289 (define_expand "stack_protect_set"
12290 [(match_operand 0 "memory_operand" "")
12291 (match_operand 1 "memory_operand" "")]
12294 #ifdef TARGET_THREAD_SSP_OFFSET
12295 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12296 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12297 operands[1] = gen_rtx_MEM (Pmode, addr);
12300 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
12302 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
12306 (define_insn "stack_protect_setsi"
12307 [(set (match_operand:SI 0 "memory_operand" "=m")
12308 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
12309 (set (match_scratch:SI 2 "=&r") (const_int 0))]
12311 "lwz%U1%X1 %2,%1\;stw%U0%X0 %2,%0\;li %2,0"
12312 [(set_attr "type" "three")
12313 (set_attr "length" "12")])
12315 (define_insn "stack_protect_setdi"
12316 [(set (match_operand:DI 0 "memory_operand" "=Y")
12317 (unspec:DI [(match_operand:DI 1 "memory_operand" "Y")] UNSPEC_SP_SET))
12318 (set (match_scratch:DI 2 "=&r") (const_int 0))]
12320 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;li %2,0"
12321 [(set_attr "type" "three")
12322 (set_attr "length" "12")])
12324 (define_expand "stack_protect_test"
12325 [(match_operand 0 "memory_operand" "")
12326 (match_operand 1 "memory_operand" "")
12327 (match_operand 2 "" "")]
12330 rtx test, op0, op1;
12331 #ifdef TARGET_THREAD_SSP_OFFSET
12332 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
12333 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
12334 operands[1] = gen_rtx_MEM (Pmode, addr);
12337 op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]), UNSPEC_SP_TEST);
12338 test = gen_rtx_EQ (VOIDmode, op0, op1);
12339 emit_jump_insn (gen_cbranchsi4 (test, op0, op1, operands[2]));
12343 (define_insn "stack_protect_testsi"
12344 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12345 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
12346 (match_operand:SI 2 "memory_operand" "m,m")]
12348 (set (match_scratch:SI 4 "=r,r") (const_int 0))
12349 (clobber (match_scratch:SI 3 "=&r,&r"))]
12352 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12353 lwz%U1%X1 %3,%1\;lwz%U2%X2 %4,%2\;cmplw %0,%3,%4\;li %3,0\;li %4,0"
12354 [(set_attr "length" "16,20")])
12356 (define_insn "stack_protect_testdi"
12357 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
12358 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "Y,Y")
12359 (match_operand:DI 2 "memory_operand" "Y,Y")]
12361 (set (match_scratch:DI 4 "=r,r") (const_int 0))
12362 (clobber (match_scratch:DI 3 "=&r,&r"))]
12365 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;li %4,0
12366 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;li %3,0\;li %4,0"
12367 [(set_attr "length" "16,20")])
12370 ;; Here are the actual compare insns.
12371 (define_insn "*cmp<mode>_internal1"
12372 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
12373 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
12374 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
12376 "cmp<wd>%I2 %0,%1,%2"
12377 [(set_attr "type" "cmp")])
12379 ;; If we are comparing a register for equality with a large constant,
12380 ;; we can do this with an XOR followed by a compare. But this is profitable
12381 ;; only if the large constant is only used for the comparison (and in this
12382 ;; case we already have a register to reuse as scratch).
12384 ;; For 64-bit registers, we could only do so if the constant's bit 15 is clear:
12385 ;; otherwise we'd need to XOR with FFFFFFFF????0000 which is not available.
12388 [(set (match_operand:SI 0 "register_operand")
12389 (match_operand:SI 1 "logical_const_operand" ""))
12390 (set (match_dup 0) (match_operator:SI 3 "boolean_or_operator"
12392 (match_operand:SI 2 "logical_const_operand" "")]))
12393 (set (match_operand:CC 4 "cc_reg_operand" "")
12394 (compare:CC (match_operand:SI 5 "gpc_reg_operand" "")
12397 (if_then_else (match_operator 6 "equality_operator"
12398 [(match_dup 4) (const_int 0)])
12399 (match_operand 7 "" "")
12400 (match_operand 8 "" "")))]
12401 "peep2_reg_dead_p (3, operands[0])
12402 && peep2_reg_dead_p (4, operands[4])"
12403 [(set (match_dup 0) (xor:SI (match_dup 5) (match_dup 9)))
12404 (set (match_dup 4) (compare:CC (match_dup 0) (match_dup 10)))
12405 (set (pc) (if_then_else (match_dup 6) (match_dup 7) (match_dup 8)))]
12408 /* Get the constant we are comparing against, and see what it looks like
12409 when sign-extended from 16 to 32 bits. Then see what constant we could
12410 XOR with SEXTC to get the sign-extended value. */
12411 rtx cnst = simplify_const_binary_operation (GET_CODE (operands[3]),
12413 operands[1], operands[2]);
12414 HOST_WIDE_INT c = INTVAL (cnst);
12415 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
12416 HOST_WIDE_INT xorv = c ^ sextc;
12418 operands[9] = GEN_INT (xorv);
12419 operands[10] = GEN_INT (sextc);
12422 (define_insn "*cmpsi_internal2"
12423 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12424 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12425 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
12427 "cmplw%I2 %0,%1,%b2"
12428 [(set_attr "type" "cmp")])
12430 (define_insn "*cmpdi_internal2"
12431 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
12432 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
12433 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
12435 "cmpld%I2 %0,%1,%b2"
12436 [(set_attr "type" "cmp")])
12438 ;; The following two insns don't exist as single insns, but if we provide
12439 ;; them, we can swap an add and compare, which will enable us to overlap more
12440 ;; of the required delay between a compare and branch. We generate code for
12441 ;; them by splitting.
12444 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12445 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
12446 (match_operand:SI 2 "short_cint_operand" "i")))
12447 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12448 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12451 [(set_attr "length" "8")])
12454 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
12455 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
12456 (match_operand:SI 2 "u_short_cint_operand" "i")))
12457 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
12458 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
12461 [(set_attr "length" "8")])
12464 [(set (match_operand:CC 3 "cc_reg_operand" "")
12465 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
12466 (match_operand:SI 2 "short_cint_operand" "")))
12467 (set (match_operand:SI 0 "gpc_reg_operand" "")
12468 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12470 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
12471 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12474 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
12475 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
12476 (match_operand:SI 2 "u_short_cint_operand" "")))
12477 (set (match_operand:SI 0 "gpc_reg_operand" "")
12478 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
12480 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
12481 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
12483 (define_insn "*cmpsf_internal1"
12484 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12485 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
12486 (match_operand:SF 2 "gpc_reg_operand" "f")))]
12487 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
12489 [(set_attr "type" "fpcompare")])
12491 (define_insn "*cmpdf_internal1"
12492 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12493 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
12494 (match_operand:DF 2 "gpc_reg_operand" "d")))]
12495 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
12496 && !VECTOR_UNIT_VSX_P (DFmode)"
12498 [(set_attr "type" "fpcompare")])
12500 ;; Only need to compare second words if first words equal
12501 (define_insn "*cmptf_internal1"
12502 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12503 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12504 (match_operand:TF 2 "gpc_reg_operand" "d")))]
12505 "!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
12506 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12507 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
12508 [(set_attr "type" "fpcompare")
12509 (set_attr "length" "12")])
12511 (define_insn_and_split "*cmptf_internal2"
12512 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
12513 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
12514 (match_operand:TF 2 "gpc_reg_operand" "d")))
12515 (clobber (match_scratch:DF 3 "=d"))
12516 (clobber (match_scratch:DF 4 "=d"))
12517 (clobber (match_scratch:DF 5 "=d"))
12518 (clobber (match_scratch:DF 6 "=d"))
12519 (clobber (match_scratch:DF 7 "=d"))
12520 (clobber (match_scratch:DF 8 "=d"))
12521 (clobber (match_scratch:DF 9 "=d"))
12522 (clobber (match_scratch:DF 10 "=d"))
12523 (clobber (match_scratch:GPR 11 "=b"))]
12524 "!TARGET_IEEEQUAD && TARGET_XL_COMPAT
12525 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
12527 "&& reload_completed"
12528 [(set (match_dup 3) (match_dup 14))
12529 (set (match_dup 4) (match_dup 15))
12530 (set (match_dup 9) (abs:DF (match_dup 5)))
12531 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
12532 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
12533 (label_ref (match_dup 12))
12535 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
12536 (set (pc) (label_ref (match_dup 13)))
12538 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
12539 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
12540 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
12541 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 4)))
12544 REAL_VALUE_TYPE rv;
12545 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
12546 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
12548 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
12549 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
12550 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
12551 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
12552 operands[12] = gen_label_rtx ();
12553 operands[13] = gen_label_rtx ();
12555 operands[14] = force_const_mem (DFmode,
12556 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
12557 operands[15] = force_const_mem (DFmode,
12558 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
12563 tocref = create_TOC_reference (XEXP (operands[14], 0), operands[11]);
12564 operands[14] = gen_const_mem (DFmode, tocref);
12565 tocref = create_TOC_reference (XEXP (operands[15], 0), operands[11]);
12566 operands[15] = gen_const_mem (DFmode, tocref);
12567 set_mem_alias_set (operands[14], get_TOC_alias_set ());
12568 set_mem_alias_set (operands[15], get_TOC_alias_set ());
12572 ;; Now we have the scc insns. We can do some combinations because of the
12573 ;; way the machine works.
12575 ;; Note that this is probably faster if we can put an insn between the
12576 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
12577 ;; cases the insns below which don't use an intermediate CR field will
12578 ;; be used instead.
12580 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12581 (match_operator:SI 1 "scc_comparison_operator"
12582 [(match_operand 2 "cc_reg_operand" "y")
12585 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12586 [(set (attr "type")
12587 (cond [(match_test "TARGET_MFCRF")
12588 (const_string "mfcrf")
12590 (const_string "mfcr")))
12591 (set_attr "length" "8")])
12593 ;; Same as above, but get the GT bit.
12594 (define_insn "move_from_CR_gt_bit"
12595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12596 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
12597 "TARGET_HARD_FLOAT && !TARGET_FPRS"
12598 "mfcr %0\;rlwinm %0,%0,%D1,31,31"
12599 [(set_attr "type" "mfcr")
12600 (set_attr "length" "8")])
12602 ;; Same as above, but get the OV/ORDERED bit.
12603 (define_insn "move_from_CR_ov_bit"
12604 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12605 (unspec:SI [(match_operand:CC 1 "cc_reg_operand" "y")]
12608 "mfcr %0\;rlwinm %0,%0,%t1,1"
12609 [(set_attr "type" "mfcr")
12610 (set_attr "length" "8")])
12613 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12614 (match_operator:DI 1 "scc_comparison_operator"
12615 [(match_operand 2 "cc_reg_operand" "y")
12618 "mfcr %0%Q2\;rlwinm %0,%0,%J1,1"
12619 [(set (attr "type")
12620 (cond [(match_test "TARGET_MFCRF")
12621 (const_string "mfcrf")
12623 (const_string "mfcr")))
12624 (set_attr "length" "8")])
12627 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12628 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12629 [(match_operand 2 "cc_reg_operand" "y,y")
12632 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
12633 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12636 mfcr %3%Q2\;rlwinm. %3,%3,%J1,1
12638 [(set_attr "type" "delayed_compare")
12639 (set_attr "length" "8,16")])
12642 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12643 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
12644 [(match_operand 2 "cc_reg_operand" "")
12647 (set (match_operand:SI 3 "gpc_reg_operand" "")
12648 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
12649 "TARGET_32BIT && reload_completed"
12650 [(set (match_dup 3)
12651 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
12653 (compare:CC (match_dup 3)
12658 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12659 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12660 [(match_operand 2 "cc_reg_operand" "y")
12662 (match_operand:SI 3 "const_int_operand" "n")))]
12666 int is_bit = ccr_bit (operands[1], 1);
12667 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12670 if (is_bit >= put_bit)
12671 count = is_bit - put_bit;
12673 count = 32 - (put_bit - is_bit);
12675 operands[4] = GEN_INT (count);
12676 operands[5] = GEN_INT (put_bit);
12678 return \"mfcr %0%Q2\;rlwinm %0,%0,%4,%5,%5\";
12680 [(set (attr "type")
12681 (cond [(match_test "TARGET_MFCRF")
12682 (const_string "mfcrf")
12684 (const_string "mfcr")))
12685 (set_attr "length" "8")])
12688 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12690 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12691 [(match_operand 2 "cc_reg_operand" "y,y")
12693 (match_operand:SI 3 "const_int_operand" "n,n"))
12695 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
12696 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12701 int is_bit = ccr_bit (operands[1], 1);
12702 int put_bit = 31 - (INTVAL (operands[3]) & 31);
12705 /* Force split for non-cc0 compare. */
12706 if (which_alternative == 1)
12709 if (is_bit >= put_bit)
12710 count = is_bit - put_bit;
12712 count = 32 - (put_bit - is_bit);
12714 operands[5] = GEN_INT (count);
12715 operands[6] = GEN_INT (put_bit);
12717 return \"mfcr %4%Q2\;rlwinm. %4,%4,%5,%6,%6\";
12719 [(set_attr "type" "delayed_compare")
12720 (set_attr "length" "8,16")])
12723 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
12725 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
12726 [(match_operand 2 "cc_reg_operand" "")
12728 (match_operand:SI 3 "const_int_operand" ""))
12730 (set (match_operand:SI 4 "gpc_reg_operand" "")
12731 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12734 [(set (match_dup 4)
12735 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
12738 (compare:CC (match_dup 4)
12742 ;; There is a 3 cycle delay between consecutive mfcr instructions
12743 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
12746 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12747 (match_operator:SI 1 "scc_comparison_operator"
12748 [(match_operand 2 "cc_reg_operand" "y")
12750 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
12751 (match_operator:SI 4 "scc_comparison_operator"
12752 [(match_operand 5 "cc_reg_operand" "y")
12754 "REGNO (operands[2]) != REGNO (operands[5])"
12755 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12756 [(set_attr "type" "mfcr")
12757 (set_attr "length" "12")])
12760 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12761 (match_operator:DI 1 "scc_comparison_operator"
12762 [(match_operand 2 "cc_reg_operand" "y")
12764 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
12765 (match_operator:DI 4 "scc_comparison_operator"
12766 [(match_operand 5 "cc_reg_operand" "y")
12768 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
12769 "mfcr %3\;rlwinm %0,%3,%J1,1\;rlwinm %3,%3,%J4,1"
12770 [(set_attr "type" "mfcr")
12771 (set_attr "length" "12")])
12773 ;; There are some scc insns that can be done directly, without a compare.
12774 ;; These are faster because they don't involve the communications between
12775 ;; the FXU and branch units. In fact, we will be replacing all of the
12776 ;; integer scc insns here or in the portable methods in emit_store_flag.
12778 ;; Also support (neg (scc ..)) since that construct is used to replace
12779 ;; branches, (plus (scc ..) ..) since that construct is common and
12780 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
12781 ;; cases where it is no more expensive than (neg (scc ..)).
12783 ;; Have reload force a constant into a register for the simple insns that
12784 ;; otherwise won't accept constants. We do this because it is faster than
12785 ;; the cmp/mfcr sequence we would otherwise generate.
12787 (define_mode_attr scc_eq_op2 [(SI "rKLI")
12790 (define_insn_and_split "*eq<mode>"
12791 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
12792 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
12793 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))]
12797 [(set (match_dup 0)
12798 (clz:GPR (match_dup 3)))
12800 (lshiftrt:GPR (match_dup 0) (match_dup 4)))]
12802 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12804 /* Use output operand as intermediate. */
12805 operands[3] = operands[0];
12807 if (logical_operand (operands[2], <MODE>mode))
12808 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12809 gen_rtx_XOR (<MODE>mode,
12810 operands[1], operands[2])));
12812 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
12813 gen_rtx_PLUS (<MODE>mode, operands[1],
12814 negate_rtx (<MODE>mode,
12818 operands[3] = operands[1];
12820 operands[4] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12823 (define_insn_and_split "*eq<mode>_compare"
12824 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
12826 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
12827 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
12829 (set (match_operand:P 0 "gpc_reg_operand" "=r")
12830 (eq:P (match_dup 1) (match_dup 2)))]
12834 [(set (match_dup 0)
12835 (clz:P (match_dup 4)))
12836 (parallel [(set (match_dup 3)
12837 (compare:CC (lshiftrt:P (match_dup 0) (match_dup 5))
12840 (lshiftrt:P (match_dup 0) (match_dup 5)))])]
12842 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12844 /* Use output operand as intermediate. */
12845 operands[4] = operands[0];
12847 if (logical_operand (operands[2], <MODE>mode))
12848 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12849 gen_rtx_XOR (<MODE>mode,
12850 operands[1], operands[2])));
12852 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
12853 gen_rtx_PLUS (<MODE>mode, operands[1],
12854 negate_rtx (<MODE>mode,
12858 operands[4] = operands[1];
12860 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
12863 ;; We have insns of the form shown by the first define_insn below. If
12864 ;; there is something inside the comparison operation, we must split it.
12866 [(set (match_operand:SI 0 "gpc_reg_operand" "")
12867 (plus:SI (match_operator 1 "comparison_operator"
12868 [(match_operand:SI 2 "" "")
12869 (match_operand:SI 3
12870 "reg_or_cint_operand" "")])
12871 (match_operand:SI 4 "gpc_reg_operand" "")))
12872 (clobber (match_operand:SI 5 "register_operand" ""))]
12873 "! gpc_reg_operand (operands[2], SImode)"
12874 [(set (match_dup 5) (match_dup 2))
12875 (set (match_dup 0) (plus:SI (match_op_dup 1 [(match_dup 5) (match_dup 3)])
12878 (define_insn "*plus_eqsi"
12879 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
12880 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12881 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
12882 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
12885 xor %0,%1,%2\;subfic %0,%0,0\;addze %0,%3
12886 subfic %0,%1,0\;addze %0,%3
12887 xori %0,%1,%b2\;subfic %0,%0,0\;addze %0,%3
12888 xoris %0,%1,%u2\;subfic %0,%0,0\;addze %0,%3
12889 subfic %0,%1,%2\;subfic %0,%0,0\;addze %0,%3"
12890 [(set_attr "type" "three,two,three,three,three")
12891 (set_attr "length" "12,8,12,12,12")])
12893 (define_insn "*compare_plus_eqsi"
12894 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12897 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12898 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12899 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12901 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12902 "TARGET_32BIT && optimize_size"
12904 xor %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12905 subfic %4,%1,0\;addze. %4,%3
12906 xori %4,%1,%b2\;subfic %4,%4,0\;addze. %4,%3
12907 xoris %4,%1,%u2\;subfic %4,%4,0\;addze. %4,%3
12908 subfic %4,%1,%2\;subfic %4,%4,0\;addze. %4,%3
12914 [(set_attr "type" "compare")
12915 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12918 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12921 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12922 (match_operand:SI 2 "scc_eq_operand" ""))
12923 (match_operand:SI 3 "gpc_reg_operand" ""))
12925 (clobber (match_scratch:SI 4 ""))]
12926 "TARGET_32BIT && optimize_size && reload_completed"
12927 [(set (match_dup 4)
12928 (plus:SI (eq:SI (match_dup 1)
12932 (compare:CC (match_dup 4)
12936 (define_insn "*plus_eqsi_compare"
12937 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12940 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12941 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
12942 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12944 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12945 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12946 "TARGET_32BIT && optimize_size"
12948 xor %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12949 subfic %0,%1,0\;addze. %0,%3
12950 xori %0,%1,%b2\;subfic %0,%0,0\;addze. %0,%3
12951 xoris %0,%1,%u2\;subfic %0,%0,0\;addze. %0,%3
12952 subfic %0,%1,%2\;subfic %0,%0,0\;addze. %0,%3
12958 [(set_attr "type" "compare")
12959 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12962 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12965 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12966 (match_operand:SI 2 "scc_eq_operand" ""))
12967 (match_operand:SI 3 "gpc_reg_operand" ""))
12969 (set (match_operand:SI 0 "gpc_reg_operand" "")
12970 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12971 "TARGET_32BIT && optimize_size && reload_completed"
12972 [(set (match_dup 0)
12973 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12975 (compare:CC (match_dup 0)
12979 (define_insn "*neg_eq0<mode>"
12980 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12981 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "r")
12984 "addic %0,%1,-1\;subfe %0,%0,%0"
12985 [(set_attr "type" "two")
12986 (set_attr "length" "8")])
12988 (define_insn_and_split "*neg_eq<mode>"
12989 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
12990 (neg:P (eq:P (match_operand:P 1 "gpc_reg_operand" "%r")
12991 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))))]
12995 [(set (match_dup 0) (neg:P (eq:P (match_dup 3) (const_int 0))))]
12997 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
12999 /* Use output operand as intermediate. */
13000 operands[3] = operands[0];
13002 if (logical_operand (operands[2], <MODE>mode))
13003 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13004 gen_rtx_XOR (<MODE>mode,
13005 operands[1], operands[2])));
13007 emit_insn (gen_rtx_SET (VOIDmode, operands[3],
13008 gen_rtx_PLUS (<MODE>mode, operands[1],
13009 negate_rtx (<MODE>mode,
13013 operands[3] = operands[1];
13016 (define_insn "*ne0_<mode>"
13017 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13018 (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13020 (clobber (match_scratch:P 2 "=&r"))]
13021 "!(TARGET_32BIT && TARGET_ISEL)"
13022 "addic %2,%1,-1\;subfe %0,%2,%1"
13023 [(set_attr "type" "two")
13024 (set_attr "length" "8")])
13026 (define_insn "*plus_ne0_<mode>"
13027 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13028 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r")
13030 (match_operand:P 2 "gpc_reg_operand" "r")))
13031 (clobber (match_scratch:P 3 "=&r"))]
13033 "addic %3,%1,-1\;addze %0,%2"
13034 [(set_attr "type" "two")
13035 (set_attr "length" "8")])
13037 (define_insn "*compare_plus_ne0_<mode>"
13038 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13039 (compare:CC (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13041 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13043 (clobber (match_scratch:P 3 "=&r,&r"))
13044 (clobber (match_scratch:P 4 "=X,&r"))]
13047 addic %3,%1,-1\;addze. %3,%2
13049 [(set_attr "type" "compare")
13050 (set_attr "length" "8,12")])
13053 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13054 (compare:CC (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13056 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13057 (clobber (match_scratch:P 3 ""))
13058 (clobber (match_scratch:P 4 ""))]
13060 [(parallel [(set (match_dup 3)
13061 (plus:P (ne:P (match_dup 1)
13064 (clobber (match_dup 4))])
13066 (compare:CC (match_dup 3)
13071 (define_insn "*compare_plus_ne0_<mode>_1"
13072 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
13073 (compare:CCEQ (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13075 (neg:P (match_operand:P 2 "gpc_reg_operand" "r,r"))))
13076 (clobber (match_scratch:P 3 "=&r,&r"))
13077 (clobber (match_scratch:P 4 "=X,&r"))]
13080 addic %3,%1,-1\;addze. %3,%2
13082 [(set_attr "type" "compare")
13083 (set_attr "length" "8,12")])
13086 [(set (match_operand:CCEQ 0 "cc_reg_not_micro_cr0_operand" "")
13087 (compare:CCEQ (ne:P (match_operand:SI 1 "gpc_reg_operand" "")
13089 (neg:P (match_operand:P 2 "gpc_reg_operand" ""))))
13090 (clobber (match_scratch:P 3 ""))
13091 (clobber (match_scratch:P 4 ""))]
13093 [(parallel [(set (match_dup 3)
13094 (plus:P (ne:P (match_dup 1)
13097 (clobber (match_dup 4))])
13099 (compare:CC (match_dup 3)
13103 (define_insn "*plus_ne0_<mode>_compare"
13104 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13106 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13108 (match_operand:P 2 "gpc_reg_operand" "r,r"))
13110 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13111 (plus:P (ne:P (match_dup 1)
13114 (clobber (match_scratch:P 3 "=&r,&r"))]
13117 addic %3,%1,-1\;addze. %0,%2
13119 [(set_attr "type" "compare")
13120 (set_attr "length" "8,12")])
13123 [(set (match_operand:CC 4 "cc_reg_not_micro_cr0_operand" "")
13125 (plus:P (ne:P (match_operand:P 1 "gpc_reg_operand" "")
13127 (match_operand:P 2 "gpc_reg_operand" ""))
13129 (set (match_operand:P 0 "gpc_reg_operand" "")
13130 (plus:P (ne:P (match_dup 1)
13133 (clobber (match_scratch:P 3 ""))]
13135 [(parallel [(set (match_dup 0)
13136 (plus:P (ne:P (match_dup 1)
13139 (clobber (match_dup 3))])
13141 (compare:CC (match_dup 0)
13145 (define_insn "*leu<mode>"
13146 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13147 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13148 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13150 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
13151 [(set_attr "type" "three")
13152 (set_attr "length" "12")])
13154 (define_insn "*leu<mode>_compare"
13155 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13157 (leu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13158 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13160 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13161 (leu:P (match_dup 1) (match_dup 2)))]
13164 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
13166 [(set_attr "type" "compare")
13167 (set_attr "length" "12,16")])
13170 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13172 (leu:P (match_operand:P 1 "gpc_reg_operand" "")
13173 (match_operand:P 2 "reg_or_short_operand" ""))
13175 (set (match_operand:P 0 "gpc_reg_operand" "")
13176 (leu:P (match_dup 1) (match_dup 2)))]
13178 [(set (match_dup 0)
13179 (leu:P (match_dup 1) (match_dup 2)))
13181 (compare:CC (match_dup 0)
13185 (define_insn "*plus_leu<mode>"
13186 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13187 (plus:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13188 (match_operand:P 2 "reg_or_short_operand" "rI"))
13189 (match_operand:P 3 "gpc_reg_operand" "r")))]
13191 "subf%I2c %0,%1,%2\;addze %0,%3"
13192 [(set_attr "type" "two")
13193 (set_attr "length" "8")])
13196 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13198 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13199 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13200 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13202 (clobber (match_scratch:SI 4 "=&r,&r"))]
13205 subf%I2c %4,%1,%2\;addze. %4,%3
13207 [(set_attr "type" "compare")
13208 (set_attr "length" "8,12")])
13211 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13213 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13214 (match_operand:SI 2 "reg_or_short_operand" ""))
13215 (match_operand:SI 3 "gpc_reg_operand" ""))
13217 (clobber (match_scratch:SI 4 ""))]
13218 "TARGET_32BIT && reload_completed"
13219 [(set (match_dup 4)
13220 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
13223 (compare:CC (match_dup 4)
13228 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13230 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13231 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13232 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13234 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13235 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13238 subf%I2c %0,%1,%2\;addze. %0,%3
13240 [(set_attr "type" "compare")
13241 (set_attr "length" "8,12")])
13244 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13246 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13247 (match_operand:SI 2 "reg_or_short_operand" ""))
13248 (match_operand:SI 3 "gpc_reg_operand" ""))
13250 (set (match_operand:SI 0 "gpc_reg_operand" "")
13251 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13252 "TARGET_32BIT && reload_completed"
13253 [(set (match_dup 0)
13254 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13256 (compare:CC (match_dup 0)
13260 (define_insn "*neg_leu<mode>"
13261 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13262 (neg:P (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13263 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13265 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;nand %0,%0,%0"
13266 [(set_attr "type" "three")
13267 (set_attr "length" "12")])
13269 (define_insn "*and_neg_leu<mode>"
13270 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13272 (leu:P (match_operand:P 1 "gpc_reg_operand" "r")
13273 (match_operand:P 2 "reg_or_short_operand" "rI")))
13274 (match_operand:P 3 "gpc_reg_operand" "r")))]
13276 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc %0,%3,%0"
13277 [(set_attr "type" "three")
13278 (set_attr "length" "12")])
13281 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13284 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13285 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13286 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13288 (clobber (match_scratch:SI 4 "=&r,&r"))]
13291 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;andc. %4,%3,%4
13293 [(set_attr "type" "compare")
13294 (set_attr "length" "12,16")])
13297 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13300 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13301 (match_operand:SI 2 "reg_or_short_operand" "")))
13302 (match_operand:SI 3 "gpc_reg_operand" ""))
13304 (clobber (match_scratch:SI 4 ""))]
13305 "TARGET_32BIT && reload_completed"
13306 [(set (match_dup 4)
13307 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13310 (compare:CC (match_dup 4)
13315 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13318 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13319 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
13320 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13322 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13323 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13326 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;andc. %0,%3,%0
13328 [(set_attr "type" "compare")
13329 (set_attr "length" "12,16")])
13332 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13335 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13336 (match_operand:SI 2 "reg_or_short_operand" "")))
13337 (match_operand:SI 3 "gpc_reg_operand" ""))
13339 (set (match_operand:SI 0 "gpc_reg_operand" "")
13340 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13341 "TARGET_32BIT && reload_completed"
13342 [(set (match_dup 0)
13343 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
13346 (compare:CC (match_dup 0)
13350 (define_insn_and_split "*ltu<mode>"
13351 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13352 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13353 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13357 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13358 (set (match_dup 0) (neg:P (match_dup 0)))]
13361 (define_insn_and_split "*ltu<mode>_compare"
13362 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13364 (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13365 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13367 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13368 (ltu:P (match_dup 1) (match_dup 2)))]
13372 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13373 (parallel [(set (match_dup 3)
13374 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13375 (set (match_dup 0) (neg:P (match_dup 0)))])]
13378 (define_insn_and_split "*plus_ltu<mode>"
13379 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,r")
13380 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13381 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13382 (match_operand:P 3 "reg_or_short_operand" "rI,rI")))]
13385 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13386 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13387 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13390 (define_insn_and_split "*plus_ltu<mode>_compare"
13391 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13393 (plus:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13394 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13395 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13397 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13398 (plus:P (ltu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13401 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13402 [(set (match_dup 0) (neg:P (ltu:P (match_dup 1) (match_dup 2))))
13403 (parallel [(set (match_dup 4)
13404 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13406 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13409 (define_insn "*neg_ltu<mode>"
13410 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13411 (neg:P (ltu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13412 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))))]
13415 subfc %0,%2,%1\;subfe %0,%0,%0
13416 addic %0,%1,%n2\;subfe %0,%0,%0"
13417 [(set_attr "type" "two")
13418 (set_attr "length" "8")])
13420 (define_insn "*geu<mode>"
13421 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13422 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13423 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))]
13426 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13427 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13428 [(set_attr "type" "three")
13429 (set_attr "length" "12")])
13431 (define_insn "*geu<mode>_compare"
13432 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13434 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13435 (match_operand:P 2 "reg_or_neg_short_operand" "r,P,r,P"))
13437 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
13438 (geu:P (match_dup 1) (match_dup 2)))]
13441 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
13442 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
13445 [(set_attr "type" "compare")
13446 (set_attr "length" "12,12,16,16")])
13449 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13451 (geu:P (match_operand:P 1 "gpc_reg_operand" "")
13452 (match_operand:P 2 "reg_or_neg_short_operand" ""))
13454 (set (match_operand:P 0 "gpc_reg_operand" "")
13455 (geu:P (match_dup 1) (match_dup 2)))]
13457 [(set (match_dup 0)
13458 (geu:P (match_dup 1) (match_dup 2)))
13460 (compare:CC (match_dup 0)
13464 (define_insn "*plus_geu<mode>"
13465 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13466 (plus:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13467 (match_operand:P 2 "reg_or_neg_short_operand" "r,P"))
13468 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13471 subfc %0,%2,%1\;addze %0,%3
13472 addic %0,%1,%n2\;addze %0,%3"
13473 [(set_attr "type" "two")
13474 (set_attr "length" "8")])
13477 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13479 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13480 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13481 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13483 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13486 subfc %4,%2,%1\;addze. %4,%3
13487 addic %4,%1,%n2\;addze. %4,%3
13490 [(set_attr "type" "compare")
13491 (set_attr "length" "8,8,12,12")])
13494 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13496 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13497 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13498 (match_operand:SI 3 "gpc_reg_operand" ""))
13500 (clobber (match_scratch:SI 4 ""))]
13501 "TARGET_32BIT && reload_completed"
13502 [(set (match_dup 4)
13503 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13506 (compare:CC (match_dup 4)
13511 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13513 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13514 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13515 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13517 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13518 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13521 subfc %0,%2,%1\;addze. %0,%3
13522 addic %0,%1,%n2\;addze. %0,%3
13525 [(set_attr "type" "compare")
13526 (set_attr "length" "8,8,12,12")])
13529 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13531 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13532 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13533 (match_operand:SI 3 "gpc_reg_operand" ""))
13535 (set (match_operand:SI 0 "gpc_reg_operand" "")
13536 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13537 "TARGET_32BIT && reload_completed"
13538 [(set (match_dup 0)
13539 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13541 (compare:CC (match_dup 0)
13545 (define_insn "*neg_geu<mode>"
13546 [(set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13547 (neg:P (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13548 (match_operand:P 2 "reg_or_short_operand" "r,I"))))]
13551 subfc %0,%2,%1\;subfe %0,%0,%0\;nand %0,%0,%0
13552 subfic %0,%1,-1\;add%I2c %0,%0,%2\;subfe %0,%0,%0"
13553 [(set_attr "type" "three")
13554 (set_attr "length" "12")])
13556 (define_insn "*and_neg_geu<mode>"
13557 [(set (match_operand:P 0 "gpc_reg_operand" "=&r,&r")
13559 (geu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13560 (match_operand:P 2 "reg_or_neg_short_operand" "r,P")))
13561 (match_operand:P 3 "gpc_reg_operand" "r,r")))]
13564 subfc %0,%2,%1\;subfe %0,%0,%0\;andc %0,%3,%0
13565 addic %0,%1,%n2\;subfe %0,%0,%0\;andc %0,%3,%0"
13566 [(set_attr "type" "three")
13567 (set_attr "length" "12")])
13570 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13573 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13574 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13575 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13577 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13580 subfc %4,%2,%1\;subfe %4,%4,%4\;andc. %4,%3,%4
13581 addic %4,%1,%n2\;subfe %4,%4,%4\;andc. %4,%3,%4
13584 [(set_attr "type" "compare")
13585 (set_attr "length" "12,12,16,16")])
13588 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13591 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13592 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13593 (match_operand:SI 3 "gpc_reg_operand" ""))
13595 (clobber (match_scratch:SI 4 ""))]
13596 "TARGET_32BIT && reload_completed"
13597 [(set (match_dup 4)
13598 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13601 (compare:CC (match_dup 4)
13606 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13609 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13610 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13611 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13613 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13614 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13617 subfc %0,%2,%1\;subfe %0,%0,%0\;andc. %0,%3,%0
13618 addic %0,%1,%n2\;subfe %0,%0,%0\;andc. %0,%3,%0
13621 [(set_attr "type" "compare")
13622 (set_attr "length" "12,12,16,16")])
13625 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13628 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13629 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13630 (match_operand:SI 3 "gpc_reg_operand" ""))
13632 (set (match_operand:SI 0 "gpc_reg_operand" "")
13633 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13634 "TARGET_32BIT && reload_completed"
13635 [(set (match_dup 0)
13636 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13638 (compare:CC (match_dup 0)
13642 (define_insn "*plus_gt0<mode>"
13643 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13644 (plus:P (gt:P (match_operand:P 1 "gpc_reg_operand" "r")
13646 (match_operand:P 2 "gpc_reg_operand" "r")))]
13648 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13649 [(set_attr "type" "three")
13650 (set_attr "length" "12")])
13653 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13655 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13657 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13659 (clobber (match_scratch:SI 3 "=&r,&r"))]
13662 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13664 [(set_attr "type" "compare")
13665 (set_attr "length" "12,16")])
13668 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13670 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13672 (match_operand:SI 2 "gpc_reg_operand" ""))
13674 (clobber (match_scratch:SI 3 ""))]
13675 "TARGET_32BIT && reload_completed"
13676 [(set (match_dup 3)
13677 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13680 (compare:CC (match_dup 3)
13685 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13687 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13689 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13691 (clobber (match_scratch:DI 3 "=&r,&r"))]
13694 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13696 [(set_attr "type" "compare")
13697 (set_attr "length" "12,16")])
13700 [(set (match_operand:CC 0 "cc_reg_not_micro_cr0_operand" "")
13702 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13704 (match_operand:DI 2 "gpc_reg_operand" ""))
13706 (clobber (match_scratch:DI 3 ""))]
13707 "TARGET_64BIT && reload_completed"
13708 [(set (match_dup 3)
13709 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13712 (compare:CC (match_dup 3)
13717 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13719 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13721 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13723 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13724 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13727 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13729 [(set_attr "type" "compare")
13730 (set_attr "length" "12,16")])
13733 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13735 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13737 (match_operand:SI 2 "gpc_reg_operand" ""))
13739 (set (match_operand:SI 0 "gpc_reg_operand" "")
13740 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13741 "TARGET_32BIT && reload_completed"
13742 [(set (match_dup 0)
13743 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13745 (compare:CC (match_dup 0)
13750 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13752 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13754 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13756 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13757 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13760 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13762 [(set_attr "type" "compare")
13763 (set_attr "length" "12,16")])
13766 [(set (match_operand:CC 3 "cc_reg_not_micro_cr0_operand" "")
13768 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13770 (match_operand:DI 2 "gpc_reg_operand" ""))
13772 (set (match_operand:DI 0 "gpc_reg_operand" "")
13773 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13774 "TARGET_64BIT && reload_completed"
13775 [(set (match_dup 0)
13776 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13778 (compare:CC (match_dup 0)
13782 (define_insn_and_split "*gtu<mode>"
13783 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13784 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13785 (match_operand:P 2 "reg_or_short_operand" "rI")))]
13789 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13790 (set (match_dup 0) (neg:P (match_dup 0)))]
13793 (define_insn_and_split "*gtu<mode>_compare"
13794 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13796 (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r")
13797 (match_operand:P 2 "reg_or_short_operand" "rI,rI"))
13799 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
13800 (gtu:P (match_dup 1) (match_dup 2)))]
13804 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13805 (parallel [(set (match_dup 3)
13806 (compare:CC (neg:P (match_dup 0)) (const_int 0)))
13807 (set (match_dup 0) (neg:P (match_dup 0)))])]
13810 (define_insn_and_split "*plus_gtu<mode>"
13811 [(set (match_operand:P 0 "gpc_reg_operand" "=&r")
13812 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13813 (match_operand:P 2 "reg_or_short_operand" "rI"))
13814 (match_operand:P 3 "reg_or_short_operand" "rI")))]
13817 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13818 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13819 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))]
13822 (define_insn_and_split "*plus_gtu<mode>_compare"
13823 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13825 (plus:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r,r,r,r")
13826 (match_operand:P 2 "reg_or_short_operand" "I,r,I,r"))
13827 (match_operand:P 3 "gpc_reg_operand" "r,r,r,r"))
13829 (set (match_operand:P 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13830 (plus:P (gtu:P (match_dup 1) (match_dup 2)) (match_dup 3)))]
13833 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13834 [(set (match_dup 0) (neg:P (gtu:P (match_dup 1) (match_dup 2))))
13835 (parallel [(set (match_dup 4)
13836 (compare:CC (minus:P (match_dup 3) (match_dup 0))
13838 (set (match_dup 0) (minus:P (match_dup 3) (match_dup 0)))])]
13841 (define_insn "*neg_gtu<mode>"
13842 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
13843 (neg:P (gtu:P (match_operand:P 1 "gpc_reg_operand" "r")
13844 (match_operand:P 2 "reg_or_short_operand" "rI"))))]
13846 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13847 [(set_attr "type" "two")
13848 (set_attr "length" "8")])
13851 ;; Define both directions of branch and return. If we need a reload
13852 ;; register, we'd rather use CR0 since it is much easier to copy a
13853 ;; register CC value to there.
13857 (if_then_else (match_operator 1 "branch_comparison_operator"
13859 "cc_reg_operand" "y")
13861 (label_ref (match_operand 0 "" ""))
13866 return output_cbranch (operands[1], \"%l0\", 0, insn);
13868 [(set_attr "type" "branch")])
13872 (if_then_else (match_operator 0 "branch_comparison_operator"
13874 "cc_reg_operand" "y")
13881 return output_cbranch (operands[0], NULL, 0, insn);
13883 [(set_attr "type" "jmpreg")
13884 (set_attr "length" "4")])
13888 (if_then_else (match_operator 1 "branch_comparison_operator"
13890 "cc_reg_operand" "y")
13893 (label_ref (match_operand 0 "" ""))))]
13897 return output_cbranch (operands[1], \"%l0\", 1, insn);
13899 [(set_attr "type" "branch")])
13903 (if_then_else (match_operator 0 "branch_comparison_operator"
13905 "cc_reg_operand" "y")
13912 return output_cbranch (operands[0], NULL, 1, insn);
13914 [(set_attr "type" "jmpreg")
13915 (set_attr "length" "4")])
13917 ;; Logic on condition register values.
13919 ; This pattern matches things like
13920 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13921 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13923 ; which are generated by the branch logic.
13924 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13926 (define_insn "*cceq_ior_compare"
13927 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13928 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13929 [(match_operator:SI 2
13930 "branch_positive_comparison_operator"
13932 "cc_reg_operand" "y,y")
13934 (match_operator:SI 4
13935 "branch_positive_comparison_operator"
13937 "cc_reg_operand" "0,y")
13941 "cr%q1 %E0,%j2,%j4"
13942 [(set_attr "type" "cr_logical,delayed_cr")])
13944 ; Why is the constant -1 here, but 1 in the previous pattern?
13945 ; Because ~1 has all but the low bit set.
13947 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13948 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13949 [(not:SI (match_operator:SI 2
13950 "branch_positive_comparison_operator"
13952 "cc_reg_operand" "y,y")
13954 (match_operator:SI 4
13955 "branch_positive_comparison_operator"
13957 "cc_reg_operand" "0,y")
13961 "cr%q1 %E0,%j2,%j4"
13962 [(set_attr "type" "cr_logical,delayed_cr")])
13964 (define_insn "*cceq_rev_compare"
13965 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13966 (compare:CCEQ (match_operator:SI 1
13967 "branch_positive_comparison_operator"
13969 "cc_reg_operand" "0,y")
13974 [(set_attr "type" "cr_logical,delayed_cr")])
13976 ;; If we are comparing the result of two comparisons, this can be done
13977 ;; using creqv or crxor.
13979 (define_insn_and_split ""
13980 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13981 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13982 [(match_operand 2 "cc_reg_operand" "y")
13984 (match_operator 3 "branch_comparison_operator"
13985 [(match_operand 4 "cc_reg_operand" "y")
13990 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13994 int positive_1, positive_2;
13996 positive_1 = branch_positive_comparison_operator (operands[1],
13997 GET_MODE (operands[1]));
13998 positive_2 = branch_positive_comparison_operator (operands[3],
13999 GET_MODE (operands[3]));
14002 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
14003 GET_CODE (operands[1])),
14005 operands[2], const0_rtx);
14006 else if (GET_MODE (operands[1]) != SImode)
14007 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
14008 operands[2], const0_rtx);
14011 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
14012 GET_CODE (operands[3])),
14014 operands[4], const0_rtx);
14015 else if (GET_MODE (operands[3]) != SImode)
14016 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
14017 operands[4], const0_rtx);
14019 if (positive_1 == positive_2)
14021 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14022 operands[5] = constm1_rtx;
14026 operands[5] = const1_rtx;
14030 ;; Unconditional branch and return.
14032 (define_insn "jump"
14034 (label_ref (match_operand 0 "" "")))]
14037 [(set_attr "type" "branch")])
14039 (define_insn "<return_str>return"
14043 [(set_attr "type" "jmpreg")])
14045 (define_expand "indirect_jump"
14046 [(set (pc) (match_operand 0 "register_operand" ""))])
14048 (define_insn "*indirect_jump<mode>"
14049 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
14054 [(set_attr "type" "jmpreg")])
14056 ;; Table jump for switch statements:
14057 (define_expand "tablejump"
14058 [(use (match_operand 0 "" ""))
14059 (use (label_ref (match_operand 1 "" "")))]
14064 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14066 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14070 (define_expand "tablejumpsi"
14071 [(set (match_dup 3)
14072 (plus:SI (match_operand:SI 0 "" "")
14074 (parallel [(set (pc) (match_dup 3))
14075 (use (label_ref (match_operand 1 "" "")))])]
14078 { operands[0] = force_reg (SImode, operands[0]);
14079 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14080 operands[3] = gen_reg_rtx (SImode);
14083 (define_expand "tablejumpdi"
14084 [(set (match_dup 4)
14085 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
14087 (plus:DI (match_dup 4)
14089 (parallel [(set (pc) (match_dup 3))
14090 (use (label_ref (match_operand 1 "" "")))])]
14093 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14094 operands[3] = gen_reg_rtx (DImode);
14095 operands[4] = gen_reg_rtx (DImode);
14098 (define_insn "*tablejump<mode>_internal1"
14100 (match_operand:P 0 "register_operand" "c,*l"))
14101 (use (label_ref (match_operand 1 "" "")))]
14106 [(set_attr "type" "jmpreg")])
14113 (define_insn "group_ending_nop"
14114 [(unspec [(const_int 0)] UNSPEC_GRP_END_NOP)]
14118 if (rs6000_cpu_attr == CPU_POWER6)
14119 return \"ori 1,1,0\";
14120 return \"ori 2,2,0\";
14123 ;; Define the subtract-one-and-jump insns, starting with the template
14124 ;; so loop.c knows what to generate.
14126 (define_expand "doloop_end"
14127 [(use (match_operand 0 "" "")) ; loop pseudo
14128 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14129 (use (match_operand 2 "" "")) ; max iterations
14130 (use (match_operand 3 "" "")) ; loop level
14131 (use (match_operand 4 "" "")) ; label
14132 (use (match_operand 5 "" ""))] ; flag: 1 if loop entered at top, else 0
14136 /* Only use this on innermost loops. */
14137 if (INTVAL (operands[3]) > 1)
14141 if (GET_MODE (operands[0]) != DImode)
14143 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14147 if (GET_MODE (operands[0]) != SImode)
14149 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14154 (define_expand "ctr<mode>"
14155 [(parallel [(set (pc)
14156 (if_then_else (ne (match_operand:P 0 "register_operand" "")
14158 (label_ref (match_operand 1 "" ""))
14161 (plus:P (match_dup 0)
14163 (clobber (match_scratch:CC 2 ""))
14164 (clobber (match_scratch:P 3 ""))])]
14168 ;; We need to be able to do this for any operand, including MEM, or we
14169 ;; will cause reload to blow up since we don't allow output reloads on
14171 ;; For the length attribute to be calculated correctly, the
14172 ;; label MUST be operand 0.
14174 (define_insn "*ctr<mode>_internal1"
14176 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14178 (label_ref (match_operand 0 "" ""))
14180 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14181 (plus:P (match_dup 1)
14183 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14184 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14188 if (which_alternative != 0)
14190 else if (get_attr_length (insn) == 4)
14191 return \"bdnz %l0\";
14193 return \"bdz $+8\;b %l0\";
14195 [(set_attr "type" "branch")
14196 (set_attr "length" "*,12,16,16")])
14198 (define_insn "*ctr<mode>_internal2"
14200 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14203 (label_ref (match_operand 0 "" ""))))
14204 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14205 (plus:P (match_dup 1)
14207 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14208 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14212 if (which_alternative != 0)
14214 else if (get_attr_length (insn) == 4)
14215 return \"bdz %l0\";
14217 return \"bdnz $+8\;b %l0\";
14219 [(set_attr "type" "branch")
14220 (set_attr "length" "*,12,16,16")])
14222 ;; Similar but use EQ
14224 (define_insn "*ctr<mode>_internal5"
14226 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14228 (label_ref (match_operand 0 "" ""))
14230 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14231 (plus:P (match_dup 1)
14233 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14234 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14238 if (which_alternative != 0)
14240 else if (get_attr_length (insn) == 4)
14241 return \"bdz %l0\";
14243 return \"bdnz $+8\;b %l0\";
14245 [(set_attr "type" "branch")
14246 (set_attr "length" "*,12,16,16")])
14248 (define_insn "*ctr<mode>_internal6"
14250 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
14253 (label_ref (match_operand 0 "" ""))))
14254 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l")
14255 (plus:P (match_dup 1)
14257 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
14258 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
14262 if (which_alternative != 0)
14264 else if (get_attr_length (insn) == 4)
14265 return \"bdnz %l0\";
14267 return \"bdz $+8\;b %l0\";
14269 [(set_attr "type" "branch")
14270 (set_attr "length" "*,12,16,16")])
14272 ;; Now the splitters if we could not allocate the CTR register
14276 (if_then_else (match_operator 2 "comparison_operator"
14277 [(match_operand:P 1 "gpc_reg_operand" "")
14279 (match_operand 5 "" "")
14280 (match_operand 6 "" "")))
14281 (set (match_operand:P 0 "gpc_reg_operand" "")
14282 (plus:P (match_dup 1) (const_int -1)))
14283 (clobber (match_scratch:CC 3 ""))
14284 (clobber (match_scratch:P 4 ""))]
14286 [(parallel [(set (match_dup 3)
14287 (compare:CC (plus:P (match_dup 1)
14291 (plus:P (match_dup 1)
14293 (set (pc) (if_then_else (match_dup 7)
14297 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14298 operands[3], const0_rtx); }")
14302 (if_then_else (match_operator 2 "comparison_operator"
14303 [(match_operand:P 1 "gpc_reg_operand" "")
14305 (match_operand 5 "" "")
14306 (match_operand 6 "" "")))
14307 (set (match_operand:P 0 "nonimmediate_operand" "")
14308 (plus:P (match_dup 1) (const_int -1)))
14309 (clobber (match_scratch:CC 3 ""))
14310 (clobber (match_scratch:P 4 ""))]
14311 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
14312 [(parallel [(set (match_dup 3)
14313 (compare:CC (plus:P (match_dup 1)
14317 (plus:P (match_dup 1)
14321 (set (pc) (if_then_else (match_dup 7)
14325 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
14326 operands[3], const0_rtx); }")
14328 (define_insn "trap"
14329 [(trap_if (const_int 1) (const_int 0))]
14332 [(set_attr "type" "trap")])
14334 (define_expand "ctrap<mode>4"
14335 [(trap_if (match_operator 0 "ordered_comparison_operator"
14336 [(match_operand:GPR 1 "register_operand")
14337 (match_operand:GPR 2 "reg_or_short_operand")])
14338 (match_operand 3 "zero_constant" ""))]
14343 [(trap_if (match_operator 0 "ordered_comparison_operator"
14344 [(match_operand:GPR 1 "register_operand" "r")
14345 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
14348 "t<wd>%V0%I2 %1,%2"
14349 [(set_attr "type" "trap")])
14351 ;; Insns related to generating the function prologue and epilogue.
14353 (define_expand "prologue"
14354 [(use (const_int 0))]
14357 rs6000_emit_prologue ();
14358 if (!TARGET_SCHED_PROLOG)
14359 emit_insn (gen_blockage ());
14363 (define_insn "*movesi_from_cr_one"
14364 [(match_parallel 0 "mfcr_operation"
14365 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14366 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
14367 (match_operand 3 "immediate_operand" "n")]
14368 UNSPEC_MOVESI_FROM_CR))])]
14374 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14376 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14377 operands[4] = GEN_INT (mask);
14378 output_asm_insn (\"mfcr %1,%4\", operands);
14382 [(set_attr "type" "mfcrf")])
14384 (define_insn "movesi_from_cr"
14385 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14386 (unspec:SI [(reg:CC CR0_REGNO) (reg:CC CR1_REGNO)
14387 (reg:CC CR2_REGNO) (reg:CC CR3_REGNO)
14388 (reg:CC CR4_REGNO) (reg:CC CR5_REGNO)
14389 (reg:CC CR6_REGNO) (reg:CC CR7_REGNO)]
14390 UNSPEC_MOVESI_FROM_CR))]
14393 [(set_attr "type" "mfcr")])
14395 (define_insn "*stmw"
14396 [(match_parallel 0 "stmw_operation"
14397 [(set (match_operand:SI 1 "memory_operand" "=m")
14398 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14401 [(set_attr "type" "store_ux")])
14403 ; The following comment applies to:
14407 ; return_and_restore_gpregs*
14408 ; return_and_restore_fpregs*
14409 ; return_and_restore_fpregs_aix*
14411 ; The out-of-line save / restore functions expects one input argument.
14412 ; Since those are not standard call_insn's, we must avoid using
14413 ; MATCH_OPERAND for that argument. That way the register rename
14414 ; optimization will not try to rename this register.
14415 ; Each pattern is repeated for each possible register number used in
14416 ; various ABIs (r11, r1, and for some functions r12)
14418 (define_insn "*save_gpregs_<mode>_r11"
14419 [(match_parallel 0 "any_parallel_operand"
14420 [(clobber (reg:P 65))
14421 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14423 (set (match_operand:P 2 "memory_operand" "=m")
14424 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14427 [(set_attr "type" "branch")
14428 (set_attr "length" "4")])
14430 (define_insn "*save_gpregs_<mode>_r12"
14431 [(match_parallel 0 "any_parallel_operand"
14432 [(clobber (reg:P 65))
14433 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14435 (set (match_operand:P 2 "memory_operand" "=m")
14436 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14439 [(set_attr "type" "branch")
14440 (set_attr "length" "4")])
14442 (define_insn "*save_gpregs_<mode>_r1"
14443 [(match_parallel 0 "any_parallel_operand"
14444 [(clobber (reg:P 65))
14445 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14447 (set (match_operand:P 2 "memory_operand" "=m")
14448 (match_operand:P 3 "gpc_reg_operand" "r"))])]
14451 [(set_attr "type" "branch")
14452 (set_attr "length" "4")])
14454 (define_insn "*save_fpregs_<mode>_r11"
14455 [(match_parallel 0 "any_parallel_operand"
14456 [(clobber (reg:P 65))
14457 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14459 (set (match_operand:DF 2 "memory_operand" "=m")
14460 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14463 [(set_attr "type" "branch")
14464 (set_attr "length" "4")])
14466 (define_insn "*save_fpregs_<mode>_r12"
14467 [(match_parallel 0 "any_parallel_operand"
14468 [(clobber (reg:P 65))
14469 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14471 (set (match_operand:DF 2 "memory_operand" "=m")
14472 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14475 [(set_attr "type" "branch")
14476 (set_attr "length" "4")])
14478 (define_insn "*save_fpregs_<mode>_r1"
14479 [(match_parallel 0 "any_parallel_operand"
14480 [(clobber (reg:P 65))
14481 (use (match_operand:P 1 "symbol_ref_operand" "s"))
14483 (set (match_operand:DF 2 "memory_operand" "=m")
14484 (match_operand:DF 3 "gpc_reg_operand" "d"))])]
14487 [(set_attr "type" "branch")
14488 (set_attr "length" "4")])
14490 ; This is to explain that changes to the stack pointer should
14491 ; not be moved over loads from or stores to stack memory.
14492 (define_insn "stack_tie"
14493 [(match_parallel 0 "tie_operand"
14494 [(set (mem:BLK (reg 1)) (const_int 0))])]
14497 [(set_attr "length" "0")])
14499 (define_expand "epilogue"
14500 [(use (const_int 0))]
14503 if (!TARGET_SCHED_PROLOG)
14504 emit_insn (gen_blockage ());
14505 rs6000_emit_epilogue (FALSE);
14509 ; On some processors, doing the mtcrf one CC register at a time is
14510 ; faster (like on the 604e). On others, doing them all at once is
14511 ; faster; for instance, on the 601 and 750.
14513 (define_expand "movsi_to_cr_one"
14514 [(set (match_operand:CC 0 "cc_reg_operand" "")
14515 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "")
14516 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
14518 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14520 (define_insn "*movsi_to_cr"
14521 [(match_parallel 0 "mtcrf_operation"
14522 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14523 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14524 (match_operand 3 "immediate_operand" "n")]
14525 UNSPEC_MOVESI_TO_CR))])]
14531 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14532 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14533 operands[4] = GEN_INT (mask);
14534 return \"mtcrf %4,%2\";
14536 [(set_attr "type" "mtcr")])
14538 (define_insn "*mtcrfsi"
14539 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14540 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14541 (match_operand 2 "immediate_operand" "n")]
14542 UNSPEC_MOVESI_TO_CR))]
14543 "GET_CODE (operands[0]) == REG
14544 && CR_REGNO_P (REGNO (operands[0]))
14545 && GET_CODE (operands[2]) == CONST_INT
14546 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14548 [(set_attr "type" "mtcr")])
14550 ; The load-multiple instructions have similar properties.
14551 ; Note that "load_multiple" is a name known to the machine-independent
14552 ; code that actually corresponds to the PowerPC load-string.
14554 (define_insn "*lmw"
14555 [(match_parallel 0 "lmw_operation"
14556 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14557 (match_operand:SI 2 "memory_operand" "m"))])]
14560 [(set_attr "type" "load_ux")
14561 (set_attr "cell_micro" "always")])
14563 (define_insn "*return_internal_<mode>"
14565 (use (match_operand:P 0 "register_operand" "lc"))]
14568 [(set_attr "type" "jmpreg")])
14570 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14571 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
14573 ; The following comment applies to:
14577 ; return_and_restore_gpregs*
14578 ; return_and_restore_fpregs*
14579 ; return_and_restore_fpregs_aix*
14581 ; The out-of-line save / restore functions expects one input argument.
14582 ; Since those are not standard call_insn's, we must avoid using
14583 ; MATCH_OPERAND for that argument. That way the register rename
14584 ; optimization will not try to rename this register.
14585 ; Each pattern is repeated for each possible register number used in
14586 ; various ABIs (r11, r1, and for some functions r12)
14588 (define_insn "*restore_gpregs_<mode>_r11"
14589 [(match_parallel 0 "any_parallel_operand"
14590 [(clobber (match_operand:P 1 "register_operand" "=l"))
14591 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14593 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14594 (match_operand:P 4 "memory_operand" "m"))])]
14597 [(set_attr "type" "branch")
14598 (set_attr "length" "4")])
14600 (define_insn "*restore_gpregs_<mode>_r12"
14601 [(match_parallel 0 "any_parallel_operand"
14602 [(clobber (match_operand:P 1 "register_operand" "=l"))
14603 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14605 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14606 (match_operand:P 4 "memory_operand" "m"))])]
14609 [(set_attr "type" "branch")
14610 (set_attr "length" "4")])
14612 (define_insn "*restore_gpregs_<mode>_r1"
14613 [(match_parallel 0 "any_parallel_operand"
14614 [(clobber (match_operand:P 1 "register_operand" "=l"))
14615 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14617 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14618 (match_operand:P 4 "memory_operand" "m"))])]
14621 [(set_attr "type" "branch")
14622 (set_attr "length" "4")])
14624 (define_insn "*return_and_restore_gpregs_<mode>_r11"
14625 [(match_parallel 0 "any_parallel_operand"
14627 (clobber (match_operand:P 1 "register_operand" "=l"))
14628 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14630 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14631 (match_operand:P 4 "memory_operand" "m"))])]
14634 [(set_attr "type" "branch")
14635 (set_attr "length" "4")])
14637 (define_insn "*return_and_restore_gpregs_<mode>_r12"
14638 [(match_parallel 0 "any_parallel_operand"
14640 (clobber (match_operand:P 1 "register_operand" "=l"))
14641 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14643 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14644 (match_operand:P 4 "memory_operand" "m"))])]
14647 [(set_attr "type" "branch")
14648 (set_attr "length" "4")])
14650 (define_insn "*return_and_restore_gpregs_<mode>_r1"
14651 [(match_parallel 0 "any_parallel_operand"
14653 (clobber (match_operand:P 1 "register_operand" "=l"))
14654 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14656 (set (match_operand:P 3 "gpc_reg_operand" "=r")
14657 (match_operand:P 4 "memory_operand" "m"))])]
14660 [(set_attr "type" "branch")
14661 (set_attr "length" "4")])
14663 (define_insn "*return_and_restore_fpregs_<mode>_r11"
14664 [(match_parallel 0 "any_parallel_operand"
14666 (clobber (match_operand:P 1 "register_operand" "=l"))
14667 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14669 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14670 (match_operand:DF 4 "memory_operand" "m"))])]
14673 [(set_attr "type" "branch")
14674 (set_attr "length" "4")])
14676 (define_insn "*return_and_restore_fpregs_<mode>_r12"
14677 [(match_parallel 0 "any_parallel_operand"
14679 (clobber (match_operand:P 1 "register_operand" "=l"))
14680 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14682 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14683 (match_operand:DF 4 "memory_operand" "m"))])]
14686 [(set_attr "type" "branch")
14687 (set_attr "length" "4")])
14689 (define_insn "*return_and_restore_fpregs_<mode>_r1"
14690 [(match_parallel 0 "any_parallel_operand"
14692 (clobber (match_operand:P 1 "register_operand" "=l"))
14693 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14695 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14696 (match_operand:DF 4 "memory_operand" "m"))])]
14699 [(set_attr "type" "branch")
14700 (set_attr "length" "4")])
14702 (define_insn "*return_and_restore_fpregs_aix_<mode>_r11"
14703 [(match_parallel 0 "any_parallel_operand"
14705 (use (match_operand:P 1 "register_operand" "l"))
14706 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14708 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14709 (match_operand:DF 4 "memory_operand" "m"))])]
14712 [(set_attr "type" "branch")
14713 (set_attr "length" "4")])
14715 (define_insn "*return_and_restore_fpregs_aix_<mode>_r1"
14716 [(match_parallel 0 "any_parallel_operand"
14718 (use (match_operand:P 1 "register_operand" "l"))
14719 (use (match_operand:P 2 "symbol_ref_operand" "s"))
14721 (set (match_operand:DF 3 "gpc_reg_operand" "=d")
14722 (match_operand:DF 4 "memory_operand" "m"))])]
14725 [(set_attr "type" "branch")
14726 (set_attr "length" "4")])
14728 ; This is used in compiling the unwind routines.
14729 (define_expand "eh_return"
14730 [(use (match_operand 0 "general_operand" ""))]
14735 emit_insn (gen_eh_set_lr_si (operands[0]));
14737 emit_insn (gen_eh_set_lr_di (operands[0]));
14741 ; We can't expand this before we know where the link register is stored.
14742 (define_insn "eh_set_lr_<mode>"
14743 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14745 (clobber (match_scratch:P 1 "=&b"))]
14750 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14751 (clobber (match_scratch 1 ""))]
14756 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14760 (define_insn "prefetch"
14761 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14762 (match_operand:SI 1 "const_int_operand" "n")
14763 (match_operand:SI 2 "const_int_operand" "n"))]
14767 if (GET_CODE (operands[0]) == REG)
14768 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14769 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14771 [(set_attr "type" "load")])
14773 (define_insn "bpermd_<mode>"
14774 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14775 (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
14776 (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
14779 [(set_attr "type" "integer")])
14782 ;; Builtin fma support. Handle
14783 ;; Note that the conditions for expansion are in the FMA_F iterator.
14785 (define_expand "fma<mode>4"
14786 [(set (match_operand:FMA_F 0 "register_operand" "")
14788 (match_operand:FMA_F 1 "register_operand" "")
14789 (match_operand:FMA_F 2 "register_operand" "")
14790 (match_operand:FMA_F 3 "register_operand" "")))]
14794 ; Altivec only has fma and nfms.
14795 (define_expand "fms<mode>4"
14796 [(set (match_operand:FMA_F 0 "register_operand" "")
14798 (match_operand:FMA_F 1 "register_operand" "")
14799 (match_operand:FMA_F 2 "register_operand" "")
14800 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" ""))))]
14801 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14804 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
14805 (define_expand "fnma<mode>4"
14806 [(set (match_operand:FMA_F 0 "register_operand" "")
14809 (match_operand:FMA_F 1 "register_operand" "")
14810 (match_operand:FMA_F 2 "register_operand" "")
14811 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14812 "!HONOR_SIGNED_ZEROS (<MODE>mode)"
14815 ;; If signed zeros are ignored, -(a * b + c) = -a * b - c.
14816 (define_expand "fnms<mode>4"
14817 [(set (match_operand:FMA_F 0 "register_operand" "")
14820 (match_operand:FMA_F 1 "register_operand" "")
14821 (match_operand:FMA_F 2 "register_operand" "")
14822 (match_operand:FMA_F 3 "register_operand" ""))))]
14823 "!HONOR_SIGNED_ZEROS (<MODE>mode) && !VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14826 ; Not an official optab name, but used from builtins.
14827 (define_expand "nfma<mode>4"
14828 [(set (match_operand:FMA_F 0 "register_operand" "")
14831 (match_operand:FMA_F 1 "register_operand" "")
14832 (match_operand:FMA_F 2 "register_operand" "")
14833 (match_operand:FMA_F 3 "register_operand" ""))))]
14834 "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
14837 ; Not an official optab name, but used from builtins.
14838 (define_expand "nfms<mode>4"
14839 [(set (match_operand:FMA_F 0 "register_operand" "")
14842 (match_operand:FMA_F 1 "register_operand" "")
14843 (match_operand:FMA_F 2 "register_operand" "")
14844 (neg:FMA_F (match_operand:FMA_F 3 "register_operand" "")))))]
14848 (define_expand "rs6000_get_timebase"
14849 [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
14852 if (TARGET_POWERPC64)
14853 emit_insn (gen_rs6000_mftb_di (operands[0]));
14855 emit_insn (gen_rs6000_get_timebase_ppc32 (operands[0]));
14859 (define_insn "rs6000_get_timebase_ppc32"
14860 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
14861 (unspec_volatile:DI [(const_int 0)] UNSPECV_MFTB))
14862 (clobber (match_scratch:SI 1 "=r"))
14863 (clobber (match_scratch:CC 2 "=y"))]
14864 "!TARGET_POWERPC64"
14866 if (WORDS_BIG_ENDIAN)
14869 return "mfspr %0,269\;"
14877 return "mftbu %0\;"
14886 return "mfspr %L0,269\;"
14894 return "mftbu %L0\;"
14902 (define_insn "rs6000_mftb_<mode>"
14903 [(set (match_operand:P 0 "gpc_reg_operand" "=r")
14904 (unspec_volatile:P [(const_int 0)] UNSPECV_MFTB))]
14908 return "mfspr %0,268";
14915 (include "sync.md")
14916 (include "vector.md")
14918 (include "altivec.md")
14921 (include "paired.md")