1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 ;; MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(UNSPEC_FRSP 0) ; frsp for POWER machines
31 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
32 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
33 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
35 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
37 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
38 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
41 (UNSPEC_MOVESI_FROM_CR 19)
42 (UNSPEC_MOVESI_TO_CR 20)
44 (UNSPEC_TLSDTPRELHA 22)
45 (UNSPEC_TLSDTPRELLO 23)
46 (UNSPEC_TLSGOTDTPREL 24)
48 (UNSPEC_TLSTPRELHA 26)
49 (UNSPEC_TLSTPRELLO 27)
50 (UNSPEC_TLSGOTTPREL 28)
52 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
53 (UNSPEC_MV_CR_GT 31) ; move_from_CR_eq_bit
58 ;; UNSPEC_VOLATILE usage
63 (UNSPECV_EH_RR 9) ; eh_reg_restore
66 ;; Define an insn type attribute. This is used in function unit delay
68 (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,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"
69 (const_string "integer"))
72 ; '(pc)' in the following doesn't include the instruction itself; it is
73 ; calculated as if the instruction had zero size.
74 (define_attr "length" ""
75 (if_then_else (eq_attr "type" "branch")
76 (if_then_else (and (ge (minus (match_dup 0) (pc))
78 (lt (minus (match_dup 0) (pc))
84 ;; Processor type -- this attribute must exactly match the processor_type
85 ;; enumeration in rs6000.h.
87 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
88 (const (symbol_ref "rs6000_cpu_attr")))
90 (automata_option "ndfa")
103 (include "power4.md")
104 (include "power5.md")
106 (include "predicates.md")
108 (include "darwin.md")
111 ;; This mode macro allows :P to be used for patterns that operate on
112 ;; pointer-sized quantities. Exactly one of the two alternatives will match.
113 (define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
115 ;; Start with fixed-point load and store insns. Here we put only the more
116 ;; complex forms. Basic data transfer is done later.
118 (define_expand "zero_extendqidi2"
119 [(set (match_operand:DI 0 "gpc_reg_operand" "")
120 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
125 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
126 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
131 [(set_attr "type" "load,*")])
134 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
135 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
137 (clobber (match_scratch:DI 2 "=r,r"))]
142 [(set_attr "type" "compare")
143 (set_attr "length" "4,8")])
146 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
147 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
149 (clobber (match_scratch:DI 2 ""))]
150 "TARGET_POWERPC64 && reload_completed"
152 (zero_extend:DI (match_dup 1)))
154 (compare:CC (match_dup 2)
159 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
160 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
162 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
163 (zero_extend:DI (match_dup 1)))]
168 [(set_attr "type" "compare")
169 (set_attr "length" "4,8")])
172 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
173 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
175 (set (match_operand:DI 0 "gpc_reg_operand" "")
176 (zero_extend:DI (match_dup 1)))]
177 "TARGET_POWERPC64 && reload_completed"
179 (zero_extend:DI (match_dup 1)))
181 (compare:CC (match_dup 0)
185 (define_insn "extendqidi2"
186 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
187 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
192 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
193 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
195 (clobber (match_scratch:DI 2 "=r,r"))]
200 [(set_attr "type" "compare")
201 (set_attr "length" "4,8")])
204 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
205 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
207 (clobber (match_scratch:DI 2 ""))]
208 "TARGET_POWERPC64 && reload_completed"
210 (sign_extend:DI (match_dup 1)))
212 (compare:CC (match_dup 2)
217 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
218 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
220 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
221 (sign_extend:DI (match_dup 1)))]
226 [(set_attr "type" "compare")
227 (set_attr "length" "4,8")])
230 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
231 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
233 (set (match_operand:DI 0 "gpc_reg_operand" "")
234 (sign_extend:DI (match_dup 1)))]
235 "TARGET_POWERPC64 && reload_completed"
237 (sign_extend:DI (match_dup 1)))
239 (compare:CC (match_dup 0)
243 (define_expand "zero_extendhidi2"
244 [(set (match_operand:DI 0 "gpc_reg_operand" "")
245 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
250 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
251 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
256 [(set_attr "type" "load,*")])
259 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
260 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
262 (clobber (match_scratch:DI 2 "=r,r"))]
267 [(set_attr "type" "compare")
268 (set_attr "length" "4,8")])
271 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
272 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
274 (clobber (match_scratch:DI 2 ""))]
275 "TARGET_POWERPC64 && reload_completed"
277 (zero_extend:DI (match_dup 1)))
279 (compare:CC (match_dup 2)
284 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
285 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
287 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
288 (zero_extend:DI (match_dup 1)))]
293 [(set_attr "type" "compare")
294 (set_attr "length" "4,8")])
297 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
298 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
300 (set (match_operand:DI 0 "gpc_reg_operand" "")
301 (zero_extend:DI (match_dup 1)))]
302 "TARGET_POWERPC64 && reload_completed"
304 (zero_extend:DI (match_dup 1)))
306 (compare:CC (match_dup 0)
310 (define_expand "extendhidi2"
311 [(set (match_operand:DI 0 "gpc_reg_operand" "")
312 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
317 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
318 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
323 [(set_attr "type" "load_ext,*")])
326 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
327 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
329 (clobber (match_scratch:DI 2 "=r,r"))]
334 [(set_attr "type" "compare")
335 (set_attr "length" "4,8")])
338 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
339 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
341 (clobber (match_scratch:DI 2 ""))]
342 "TARGET_POWERPC64 && reload_completed"
344 (sign_extend:DI (match_dup 1)))
346 (compare:CC (match_dup 2)
351 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
352 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
354 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
355 (sign_extend:DI (match_dup 1)))]
360 [(set_attr "type" "compare")
361 (set_attr "length" "4,8")])
364 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
365 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
367 (set (match_operand:DI 0 "gpc_reg_operand" "")
368 (sign_extend:DI (match_dup 1)))]
369 "TARGET_POWERPC64 && reload_completed"
371 (sign_extend:DI (match_dup 1)))
373 (compare:CC (match_dup 0)
377 (define_expand "zero_extendsidi2"
378 [(set (match_operand:DI 0 "gpc_reg_operand" "")
379 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
384 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
385 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
390 [(set_attr "type" "load,*")])
393 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
394 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
396 (clobber (match_scratch:DI 2 "=r,r"))]
401 [(set_attr "type" "compare")
402 (set_attr "length" "4,8")])
405 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
406 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
408 (clobber (match_scratch:DI 2 ""))]
409 "TARGET_POWERPC64 && reload_completed"
411 (zero_extend:DI (match_dup 1)))
413 (compare:CC (match_dup 2)
418 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
419 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
421 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
422 (zero_extend:DI (match_dup 1)))]
427 [(set_attr "type" "compare")
428 (set_attr "length" "4,8")])
431 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
432 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
434 (set (match_operand:DI 0 "gpc_reg_operand" "")
435 (zero_extend:DI (match_dup 1)))]
436 "TARGET_POWERPC64 && reload_completed"
438 (zero_extend:DI (match_dup 1)))
440 (compare:CC (match_dup 0)
444 (define_expand "extendsidi2"
445 [(set (match_operand:DI 0 "gpc_reg_operand" "")
446 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
451 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
452 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
457 [(set_attr "type" "load_ext,*")])
460 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
461 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
463 (clobber (match_scratch:DI 2 "=r,r"))]
468 [(set_attr "type" "compare")
469 (set_attr "length" "4,8")])
472 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
473 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
475 (clobber (match_scratch:DI 2 ""))]
476 "TARGET_POWERPC64 && reload_completed"
478 (sign_extend:DI (match_dup 1)))
480 (compare:CC (match_dup 2)
485 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
486 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
488 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
489 (sign_extend:DI (match_dup 1)))]
494 [(set_attr "type" "compare")
495 (set_attr "length" "4,8")])
498 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
499 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
501 (set (match_operand:DI 0 "gpc_reg_operand" "")
502 (sign_extend:DI (match_dup 1)))]
503 "TARGET_POWERPC64 && reload_completed"
505 (sign_extend:DI (match_dup 1)))
507 (compare:CC (match_dup 0)
511 (define_expand "zero_extendqisi2"
512 [(set (match_operand:SI 0 "gpc_reg_operand" "")
513 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
518 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
519 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
523 {rlinm|rlwinm} %0,%1,0,0xff"
524 [(set_attr "type" "load,*")])
527 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
528 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
530 (clobber (match_scratch:SI 2 "=r,r"))]
533 {andil.|andi.} %2,%1,0xff
535 [(set_attr "type" "compare")
536 (set_attr "length" "4,8")])
539 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
540 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
542 (clobber (match_scratch:SI 2 ""))]
545 (zero_extend:SI (match_dup 1)))
547 (compare:CC (match_dup 2)
552 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
553 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
555 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
556 (zero_extend:SI (match_dup 1)))]
559 {andil.|andi.} %0,%1,0xff
561 [(set_attr "type" "compare")
562 (set_attr "length" "4,8")])
565 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
566 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
568 (set (match_operand:SI 0 "gpc_reg_operand" "")
569 (zero_extend:SI (match_dup 1)))]
572 (zero_extend:SI (match_dup 1)))
574 (compare:CC (match_dup 0)
578 (define_expand "extendqisi2"
579 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
580 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
585 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
586 else if (TARGET_POWER)
587 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
589 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
593 (define_insn "extendqisi2_ppc"
594 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
595 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
600 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
601 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
603 (clobber (match_scratch:SI 2 "=r,r"))]
608 [(set_attr "type" "compare")
609 (set_attr "length" "4,8")])
612 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
613 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
615 (clobber (match_scratch:SI 2 ""))]
616 "TARGET_POWERPC && reload_completed"
618 (sign_extend:SI (match_dup 1)))
620 (compare:CC (match_dup 2)
625 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
626 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
628 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
629 (sign_extend:SI (match_dup 1)))]
634 [(set_attr "type" "compare")
635 (set_attr "length" "4,8")])
638 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
639 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
641 (set (match_operand:SI 0 "gpc_reg_operand" "")
642 (sign_extend:SI (match_dup 1)))]
643 "TARGET_POWERPC && reload_completed"
645 (sign_extend:SI (match_dup 1)))
647 (compare:CC (match_dup 0)
651 (define_expand "extendqisi2_power"
652 [(parallel [(set (match_dup 2)
653 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
655 (clobber (scratch:SI))])
656 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
657 (ashiftrt:SI (match_dup 2)
659 (clobber (scratch:SI))])]
662 { operands[1] = gen_lowpart (SImode, operands[1]);
663 operands[2] = gen_reg_rtx (SImode); }")
665 (define_expand "extendqisi2_no_power"
667 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
669 (set (match_operand:SI 0 "gpc_reg_operand" "")
670 (ashiftrt:SI (match_dup 2)
672 "! TARGET_POWER && ! TARGET_POWERPC"
674 { operands[1] = gen_lowpart (SImode, operands[1]);
675 operands[2] = gen_reg_rtx (SImode); }")
677 (define_expand "zero_extendqihi2"
678 [(set (match_operand:HI 0 "gpc_reg_operand" "")
679 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
684 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
685 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
689 {rlinm|rlwinm} %0,%1,0,0xff"
690 [(set_attr "type" "load,*")])
693 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
694 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
696 (clobber (match_scratch:HI 2 "=r,r"))]
699 {andil.|andi.} %2,%1,0xff
701 [(set_attr "type" "compare")
702 (set_attr "length" "4,8")])
705 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
706 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
708 (clobber (match_scratch:HI 2 ""))]
711 (zero_extend:HI (match_dup 1)))
713 (compare:CC (match_dup 2)
718 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
719 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
721 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
722 (zero_extend:HI (match_dup 1)))]
725 {andil.|andi.} %0,%1,0xff
727 [(set_attr "type" "compare")
728 (set_attr "length" "4,8")])
731 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
732 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
734 (set (match_operand:HI 0 "gpc_reg_operand" "")
735 (zero_extend:HI (match_dup 1)))]
738 (zero_extend:HI (match_dup 1)))
740 (compare:CC (match_dup 0)
744 (define_expand "extendqihi2"
745 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
746 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
751 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
752 else if (TARGET_POWER)
753 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
755 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
759 (define_insn "extendqihi2_ppc"
760 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
761 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
766 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
767 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
769 (clobber (match_scratch:HI 2 "=r,r"))]
774 [(set_attr "type" "compare")
775 (set_attr "length" "4,8")])
778 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
779 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
781 (clobber (match_scratch:HI 2 ""))]
782 "TARGET_POWERPC && reload_completed"
784 (sign_extend:HI (match_dup 1)))
786 (compare:CC (match_dup 2)
791 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
792 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
794 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
795 (sign_extend:HI (match_dup 1)))]
800 [(set_attr "type" "compare")
801 (set_attr "length" "4,8")])
804 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
805 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
807 (set (match_operand:HI 0 "gpc_reg_operand" "")
808 (sign_extend:HI (match_dup 1)))]
809 "TARGET_POWERPC && reload_completed"
811 (sign_extend:HI (match_dup 1)))
813 (compare:CC (match_dup 0)
817 (define_expand "extendqihi2_power"
818 [(parallel [(set (match_dup 2)
819 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
821 (clobber (scratch:SI))])
822 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
823 (ashiftrt:SI (match_dup 2)
825 (clobber (scratch:SI))])]
828 { operands[0] = gen_lowpart (SImode, operands[0]);
829 operands[1] = gen_lowpart (SImode, operands[1]);
830 operands[2] = gen_reg_rtx (SImode); }")
832 (define_expand "extendqihi2_no_power"
834 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
836 (set (match_operand:HI 0 "gpc_reg_operand" "")
837 (ashiftrt:SI (match_dup 2)
839 "! TARGET_POWER && ! TARGET_POWERPC"
841 { operands[0] = gen_lowpart (SImode, operands[0]);
842 operands[1] = gen_lowpart (SImode, operands[1]);
843 operands[2] = gen_reg_rtx (SImode); }")
845 (define_expand "zero_extendhisi2"
846 [(set (match_operand:SI 0 "gpc_reg_operand" "")
847 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
852 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
853 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
857 {rlinm|rlwinm} %0,%1,0,0xffff"
858 [(set_attr "type" "load,*")])
861 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
862 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
864 (clobber (match_scratch:SI 2 "=r,r"))]
867 {andil.|andi.} %2,%1,0xffff
869 [(set_attr "type" "compare")
870 (set_attr "length" "4,8")])
873 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
874 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
876 (clobber (match_scratch:SI 2 ""))]
879 (zero_extend:SI (match_dup 1)))
881 (compare:CC (match_dup 2)
886 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
887 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
889 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
890 (zero_extend:SI (match_dup 1)))]
893 {andil.|andi.} %0,%1,0xffff
895 [(set_attr "type" "compare")
896 (set_attr "length" "4,8")])
899 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
900 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
902 (set (match_operand:SI 0 "gpc_reg_operand" "")
903 (zero_extend:SI (match_dup 1)))]
906 (zero_extend:SI (match_dup 1)))
908 (compare:CC (match_dup 0)
912 (define_expand "extendhisi2"
913 [(set (match_operand:SI 0 "gpc_reg_operand" "")
914 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
919 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
920 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
925 [(set_attr "type" "load_ext,*")])
928 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
929 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
931 (clobber (match_scratch:SI 2 "=r,r"))]
936 [(set_attr "type" "compare")
937 (set_attr "length" "4,8")])
940 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
941 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
943 (clobber (match_scratch:SI 2 ""))]
946 (sign_extend:SI (match_dup 1)))
948 (compare:CC (match_dup 2)
953 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
954 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
956 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
957 (sign_extend:SI (match_dup 1)))]
962 [(set_attr "type" "compare")
963 (set_attr "length" "4,8")])
966 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
967 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
969 (set (match_operand:SI 0 "gpc_reg_operand" "")
970 (sign_extend:SI (match_dup 1)))]
973 (sign_extend:SI (match_dup 1)))
975 (compare:CC (match_dup 0)
979 ;; Fixed-point arithmetic insns.
981 ;; Discourage ai/addic because of carry but provide it in an alternative
982 ;; allowing register zero as source.
983 (define_expand "addsi3"
984 [(set (match_operand:SI 0 "gpc_reg_operand" "")
985 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
986 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
990 if (GET_CODE (operands[2]) == CONST_INT
991 && ! add_operand (operands[2], SImode))
993 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
994 ? operands[0] : gen_reg_rtx (SImode));
996 HOST_WIDE_INT val = INTVAL (operands[2]);
997 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
998 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1000 /* The ordering here is important for the prolog expander.
1001 When space is allocated from the stack, adding 'low' first may
1002 produce a temporary deallocation (which would be bad). */
1003 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
1004 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1009 (define_insn "*addsi3_internal1"
1010 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1011 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1012 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1016 {cal %0,%2(%1)|addi %0,%1,%2}
1018 {cau|addis} %0,%1,%v2"
1019 [(set_attr "length" "4,4,4,4")])
1021 (define_insn "addsi3_high"
1022 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1023 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1024 (high:SI (match_operand 2 "" ""))))]
1025 "TARGET_MACHO && !TARGET_64BIT"
1026 "{cau|addis} %0,%1,ha16(%2)"
1027 [(set_attr "length" "4")])
1029 (define_insn "*addsi3_internal2"
1030 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1031 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1032 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1034 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1037 {cax.|add.} %3,%1,%2
1038 {ai.|addic.} %3,%1,%2
1041 [(set_attr "type" "fast_compare,compare,compare,compare")
1042 (set_attr "length" "4,4,8,8")])
1045 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1046 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1047 (match_operand:SI 2 "reg_or_short_operand" ""))
1049 (clobber (match_scratch:SI 3 ""))]
1050 "TARGET_32BIT && reload_completed"
1052 (plus:SI (match_dup 1)
1055 (compare:CC (match_dup 3)
1059 (define_insn "*addsi3_internal3"
1060 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1061 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1062 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1064 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1065 (plus:SI (match_dup 1)
1069 {cax.|add.} %0,%1,%2
1070 {ai.|addic.} %0,%1,%2
1073 [(set_attr "type" "fast_compare,compare,compare,compare")
1074 (set_attr "length" "4,4,8,8")])
1077 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1078 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1079 (match_operand:SI 2 "reg_or_short_operand" ""))
1081 (set (match_operand:SI 0 "gpc_reg_operand" "")
1082 (plus:SI (match_dup 1) (match_dup 2)))]
1083 "TARGET_32BIT && reload_completed"
1085 (plus:SI (match_dup 1)
1088 (compare:CC (match_dup 0)
1092 ;; Split an add that we can't do in one insn into two insns, each of which
1093 ;; does one 16-bit part. This is used by combine. Note that the low-order
1094 ;; add should be last in case the result gets used in an address.
1097 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1098 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1099 (match_operand:SI 2 "non_add_cint_operand" "")))]
1101 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1102 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1105 HOST_WIDE_INT val = INTVAL (operands[2]);
1106 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1107 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1109 operands[3] = GEN_INT (rest);
1110 operands[4] = GEN_INT (low);
1113 (define_insn "one_cmplsi2"
1114 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1115 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1120 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1121 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1123 (clobber (match_scratch:SI 2 "=r,r"))]
1128 [(set_attr "type" "compare")
1129 (set_attr "length" "4,8")])
1132 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1133 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1135 (clobber (match_scratch:SI 2 ""))]
1136 "TARGET_32BIT && reload_completed"
1138 (not:SI (match_dup 1)))
1140 (compare:CC (match_dup 2)
1145 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1146 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1148 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1149 (not:SI (match_dup 1)))]
1154 [(set_attr "type" "compare")
1155 (set_attr "length" "4,8")])
1158 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1159 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1161 (set (match_operand:SI 0 "gpc_reg_operand" "")
1162 (not:SI (match_dup 1)))]
1163 "TARGET_32BIT && reload_completed"
1165 (not:SI (match_dup 1)))
1167 (compare:CC (match_dup 0)
1172 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1173 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1174 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1176 "{sf%I1|subf%I1c} %0,%2,%1")
1179 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1180 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1181 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1188 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1189 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1190 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1192 (clobber (match_scratch:SI 3 "=r,r"))]
1195 {sf.|subfc.} %3,%2,%1
1197 [(set_attr "type" "compare")
1198 (set_attr "length" "4,8")])
1201 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1202 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1203 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1205 (clobber (match_scratch:SI 3 "=r,r"))]
1206 "TARGET_POWERPC && TARGET_32BIT"
1210 [(set_attr "type" "fast_compare")
1211 (set_attr "length" "4,8")])
1214 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1215 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1216 (match_operand:SI 2 "gpc_reg_operand" ""))
1218 (clobber (match_scratch:SI 3 ""))]
1219 "TARGET_32BIT && reload_completed"
1221 (minus:SI (match_dup 1)
1224 (compare:CC (match_dup 3)
1229 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1230 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1231 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1233 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1234 (minus:SI (match_dup 1) (match_dup 2)))]
1237 {sf.|subfc.} %0,%2,%1
1239 [(set_attr "type" "compare")
1240 (set_attr "length" "4,8")])
1243 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1244 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1245 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1247 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1248 (minus:SI (match_dup 1)
1250 "TARGET_POWERPC && TARGET_32BIT"
1254 [(set_attr "type" "fast_compare")
1255 (set_attr "length" "4,8")])
1258 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1259 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1260 (match_operand:SI 2 "gpc_reg_operand" ""))
1262 (set (match_operand:SI 0 "gpc_reg_operand" "")
1263 (minus:SI (match_dup 1)
1265 "TARGET_32BIT && reload_completed"
1267 (minus:SI (match_dup 1)
1270 (compare:CC (match_dup 0)
1274 (define_expand "subsi3"
1275 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1276 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1277 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1281 if (GET_CODE (operands[2]) == CONST_INT)
1283 emit_insn (gen_addsi3 (operands[0], operands[1],
1284 negate_rtx (SImode, operands[2])));
1289 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1290 ;; instruction and some auxiliary computations. Then we just have a single
1291 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1294 (define_expand "sminsi3"
1296 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1297 (match_operand:SI 2 "reg_or_short_operand" ""))
1299 (minus:SI (match_dup 2) (match_dup 1))))
1300 (set (match_operand:SI 0 "gpc_reg_operand" "")
1301 (minus:SI (match_dup 2) (match_dup 3)))]
1302 "TARGET_POWER || TARGET_ISEL"
1307 operands[2] = force_reg (SImode, operands[2]);
1308 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1312 operands[3] = gen_reg_rtx (SImode);
1316 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1317 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1318 (match_operand:SI 2 "reg_or_short_operand" "")))
1319 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1322 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1324 (minus:SI (match_dup 2) (match_dup 1))))
1325 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1328 (define_expand "smaxsi3"
1330 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1331 (match_operand:SI 2 "reg_or_short_operand" ""))
1333 (minus:SI (match_dup 2) (match_dup 1))))
1334 (set (match_operand:SI 0 "gpc_reg_operand" "")
1335 (plus:SI (match_dup 3) (match_dup 1)))]
1336 "TARGET_POWER || TARGET_ISEL"
1341 operands[2] = force_reg (SImode, operands[2]);
1342 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1345 operands[3] = gen_reg_rtx (SImode);
1349 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1350 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1351 (match_operand:SI 2 "reg_or_short_operand" "")))
1352 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1355 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1357 (minus:SI (match_dup 2) (match_dup 1))))
1358 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1361 (define_expand "uminsi3"
1362 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1364 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1366 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1368 (minus:SI (match_dup 4) (match_dup 3))))
1369 (set (match_operand:SI 0 "gpc_reg_operand" "")
1370 (minus:SI (match_dup 2) (match_dup 3)))]
1371 "TARGET_POWER || TARGET_ISEL"
1376 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1379 operands[3] = gen_reg_rtx (SImode);
1380 operands[4] = gen_reg_rtx (SImode);
1381 operands[5] = GEN_INT (-2147483647 - 1);
1384 (define_expand "umaxsi3"
1385 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1387 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1389 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1391 (minus:SI (match_dup 4) (match_dup 3))))
1392 (set (match_operand:SI 0 "gpc_reg_operand" "")
1393 (plus:SI (match_dup 3) (match_dup 1)))]
1394 "TARGET_POWER || TARGET_ISEL"
1399 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1402 operands[3] = gen_reg_rtx (SImode);
1403 operands[4] = gen_reg_rtx (SImode);
1404 operands[5] = GEN_INT (-2147483647 - 1);
1408 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1409 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1410 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1412 (minus:SI (match_dup 2) (match_dup 1))))]
1417 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1419 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1420 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1422 (minus:SI (match_dup 2) (match_dup 1)))
1424 (clobber (match_scratch:SI 3 "=r,r"))]
1429 [(set_attr "type" "delayed_compare")
1430 (set_attr "length" "4,8")])
1433 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1435 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1436 (match_operand:SI 2 "reg_or_short_operand" ""))
1438 (minus:SI (match_dup 2) (match_dup 1)))
1440 (clobber (match_scratch:SI 3 ""))]
1441 "TARGET_POWER && reload_completed"
1443 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1445 (minus:SI (match_dup 2) (match_dup 1))))
1447 (compare:CC (match_dup 3)
1452 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1454 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1455 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1457 (minus:SI (match_dup 2) (match_dup 1)))
1459 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1460 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1462 (minus:SI (match_dup 2) (match_dup 1))))]
1467 [(set_attr "type" "delayed_compare")
1468 (set_attr "length" "4,8")])
1471 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1473 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1474 (match_operand:SI 2 "reg_or_short_operand" ""))
1476 (minus:SI (match_dup 2) (match_dup 1)))
1478 (set (match_operand:SI 0 "gpc_reg_operand" "")
1479 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1481 (minus:SI (match_dup 2) (match_dup 1))))]
1482 "TARGET_POWER && reload_completed"
1484 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1486 (minus:SI (match_dup 2) (match_dup 1))))
1488 (compare:CC (match_dup 0)
1492 ;; We don't need abs with condition code because such comparisons should
1494 (define_expand "abssi2"
1495 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1496 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1502 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1505 else if (! TARGET_POWER)
1507 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1512 (define_insn "*abssi2_power"
1513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1514 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1518 (define_insn_and_split "abssi2_isel"
1519 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1520 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1521 (clobber (match_scratch:SI 2 "=&b"))
1522 (clobber (match_scratch:CC 3 "=y"))]
1525 "&& reload_completed"
1526 [(set (match_dup 2) (neg:SI (match_dup 1)))
1528 (compare:CC (match_dup 1)
1531 (if_then_else:SI (ge (match_dup 3)
1537 (define_insn_and_split "abssi2_nopower"
1538 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1539 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1540 (clobber (match_scratch:SI 2 "=&r,&r"))]
1541 "! TARGET_POWER && ! TARGET_ISEL"
1543 "&& reload_completed"
1544 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1545 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1546 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1549 (define_insn "*nabs_power"
1550 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1551 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1555 (define_insn_and_split "*nabs_nopower"
1556 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1557 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1558 (clobber (match_scratch:SI 2 "=&r,&r"))]
1561 "&& reload_completed"
1562 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1563 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1564 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1567 (define_insn "negsi2"
1568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1569 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1574 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1575 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1577 (clobber (match_scratch:SI 2 "=r,r"))]
1582 [(set_attr "type" "fast_compare")
1583 (set_attr "length" "4,8")])
1586 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1587 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1589 (clobber (match_scratch:SI 2 ""))]
1590 "TARGET_32BIT && reload_completed"
1592 (neg:SI (match_dup 1)))
1594 (compare:CC (match_dup 2)
1599 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1600 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1602 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1603 (neg:SI (match_dup 1)))]
1608 [(set_attr "type" "fast_compare")
1609 (set_attr "length" "4,8")])
1612 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1613 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1615 (set (match_operand:SI 0 "gpc_reg_operand" "")
1616 (neg:SI (match_dup 1)))]
1617 "TARGET_32BIT && reload_completed"
1619 (neg:SI (match_dup 1)))
1621 (compare:CC (match_dup 0)
1625 (define_insn "clzsi2"
1626 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1627 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1629 "{cntlz|cntlzw} %0,%1")
1631 (define_expand "ctzsi2"
1633 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1634 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1636 (clobber (scratch:CC))])
1637 (set (match_dup 4) (clz:SI (match_dup 3)))
1638 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1639 (minus:SI (const_int 31) (match_dup 4)))]
1642 operands[2] = gen_reg_rtx (SImode);
1643 operands[3] = gen_reg_rtx (SImode);
1644 operands[4] = gen_reg_rtx (SImode);
1647 (define_expand "ffssi2"
1649 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1650 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1652 (clobber (scratch:CC))])
1653 (set (match_dup 4) (clz:SI (match_dup 3)))
1654 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1655 (minus:SI (const_int 32) (match_dup 4)))]
1658 operands[2] = gen_reg_rtx (SImode);
1659 operands[3] = gen_reg_rtx (SImode);
1660 operands[4] = gen_reg_rtx (SImode);
1663 (define_expand "mulsi3"
1664 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1665 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1666 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1671 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1673 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1677 (define_insn "mulsi3_mq"
1678 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1679 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1680 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1681 (clobber (match_scratch:SI 3 "=q,q"))]
1684 {muls|mullw} %0,%1,%2
1685 {muli|mulli} %0,%1,%2"
1687 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1688 (const_string "imul3")
1689 (match_operand:SI 2 "short_cint_operand" "")
1690 (const_string "imul2")]
1691 (const_string "imul")))])
1693 (define_insn "mulsi3_no_mq"
1694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1695 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1696 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1699 {muls|mullw} %0,%1,%2
1700 {muli|mulli} %0,%1,%2"
1702 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1703 (const_string "imul3")
1704 (match_operand:SI 2 "short_cint_operand" "")
1705 (const_string "imul2")]
1706 (const_string "imul")))])
1708 (define_insn "*mulsi3_mq_internal1"
1709 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1710 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1711 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1713 (clobber (match_scratch:SI 3 "=r,r"))
1714 (clobber (match_scratch:SI 4 "=q,q"))]
1717 {muls.|mullw.} %3,%1,%2
1719 [(set_attr "type" "imul_compare")
1720 (set_attr "length" "4,8")])
1723 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1724 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1725 (match_operand:SI 2 "gpc_reg_operand" ""))
1727 (clobber (match_scratch:SI 3 ""))
1728 (clobber (match_scratch:SI 4 ""))]
1729 "TARGET_POWER && reload_completed"
1730 [(parallel [(set (match_dup 3)
1731 (mult:SI (match_dup 1) (match_dup 2)))
1732 (clobber (match_dup 4))])
1734 (compare:CC (match_dup 3)
1738 (define_insn "*mulsi3_no_mq_internal1"
1739 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1740 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1741 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1743 (clobber (match_scratch:SI 3 "=r,r"))]
1746 {muls.|mullw.} %3,%1,%2
1748 [(set_attr "type" "imul_compare")
1749 (set_attr "length" "4,8")])
1752 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1753 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1754 (match_operand:SI 2 "gpc_reg_operand" ""))
1756 (clobber (match_scratch:SI 3 ""))]
1757 "! TARGET_POWER && reload_completed"
1759 (mult:SI (match_dup 1) (match_dup 2)))
1761 (compare:CC (match_dup 3)
1765 (define_insn "*mulsi3_mq_internal2"
1766 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1767 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1768 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1770 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1771 (mult:SI (match_dup 1) (match_dup 2)))
1772 (clobber (match_scratch:SI 4 "=q,q"))]
1775 {muls.|mullw.} %0,%1,%2
1777 [(set_attr "type" "imul_compare")
1778 (set_attr "length" "4,8")])
1781 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1782 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1783 (match_operand:SI 2 "gpc_reg_operand" ""))
1785 (set (match_operand:SI 0 "gpc_reg_operand" "")
1786 (mult:SI (match_dup 1) (match_dup 2)))
1787 (clobber (match_scratch:SI 4 ""))]
1788 "TARGET_POWER && reload_completed"
1789 [(parallel [(set (match_dup 0)
1790 (mult:SI (match_dup 1) (match_dup 2)))
1791 (clobber (match_dup 4))])
1793 (compare:CC (match_dup 0)
1797 (define_insn "*mulsi3_no_mq_internal2"
1798 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1799 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1800 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1802 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1803 (mult:SI (match_dup 1) (match_dup 2)))]
1806 {muls.|mullw.} %0,%1,%2
1808 [(set_attr "type" "imul_compare")
1809 (set_attr "length" "4,8")])
1812 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1813 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1814 (match_operand:SI 2 "gpc_reg_operand" ""))
1816 (set (match_operand:SI 0 "gpc_reg_operand" "")
1817 (mult:SI (match_dup 1) (match_dup 2)))]
1818 "! TARGET_POWER && reload_completed"
1820 (mult:SI (match_dup 1) (match_dup 2)))
1822 (compare:CC (match_dup 0)
1826 ;; Operand 1 is divided by operand 2; quotient goes to operand
1827 ;; 0 and remainder to operand 3.
1828 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1830 (define_expand "divmodsi4"
1831 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1832 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1833 (match_operand:SI 2 "gpc_reg_operand" "")))
1834 (set (match_operand:SI 3 "register_operand" "")
1835 (mod:SI (match_dup 1) (match_dup 2)))])]
1836 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1839 if (! TARGET_POWER && ! TARGET_POWERPC)
1841 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1842 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1843 emit_insn (gen_divss_call ());
1844 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1845 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1850 (define_insn "*divmodsi4_internal"
1851 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1852 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1853 (match_operand:SI 2 "gpc_reg_operand" "r")))
1854 (set (match_operand:SI 3 "register_operand" "=q")
1855 (mod:SI (match_dup 1) (match_dup 2)))]
1858 [(set_attr "type" "idiv")])
1860 (define_expand "udivsi3"
1861 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1862 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1863 (match_operand:SI 2 "gpc_reg_operand" "")))]
1864 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1867 if (! TARGET_POWER && ! TARGET_POWERPC)
1869 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1870 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1871 emit_insn (gen_quous_call ());
1872 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1875 else if (TARGET_POWER)
1877 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1882 (define_insn "udivsi3_mq"
1883 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1884 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1885 (match_operand:SI 2 "gpc_reg_operand" "r")))
1886 (clobber (match_scratch:SI 3 "=q"))]
1887 "TARGET_POWERPC && TARGET_POWER"
1889 [(set_attr "type" "idiv")])
1891 (define_insn "*udivsi3_no_mq"
1892 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1893 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1894 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1895 "TARGET_POWERPC && ! TARGET_POWER"
1897 [(set_attr "type" "idiv")])
1899 ;; For powers of two we can do srai/aze for divide and then adjust for
1900 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1901 ;; used; for PowerPC, force operands into register and do a normal divide;
1902 ;; for AIX common-mode, use quoss call on register operands.
1903 (define_expand "divsi3"
1904 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1905 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1906 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1910 if (GET_CODE (operands[2]) == CONST_INT
1911 && INTVAL (operands[2]) > 0
1912 && exact_log2 (INTVAL (operands[2])) >= 0)
1914 else if (TARGET_POWERPC)
1916 operands[2] = force_reg (SImode, operands[2]);
1919 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1923 else if (TARGET_POWER)
1927 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1928 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1929 emit_insn (gen_quoss_call ());
1930 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1935 (define_insn "divsi3_mq"
1936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1937 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1938 (match_operand:SI 2 "gpc_reg_operand" "r")))
1939 (clobber (match_scratch:SI 3 "=q"))]
1940 "TARGET_POWERPC && TARGET_POWER"
1942 [(set_attr "type" "idiv")])
1944 (define_insn "*divsi3_no_mq"
1945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1946 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1947 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1948 "TARGET_POWERPC && ! TARGET_POWER"
1950 [(set_attr "type" "idiv")])
1952 (define_expand "modsi3"
1953 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1954 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1955 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1963 if (GET_CODE (operands[2]) != CONST_INT
1964 || INTVAL (operands[2]) <= 0
1965 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1968 temp1 = gen_reg_rtx (SImode);
1969 temp2 = gen_reg_rtx (SImode);
1971 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1972 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1973 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1978 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1979 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1980 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1982 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1983 [(set_attr "type" "two")
1984 (set_attr "length" "8")])
1987 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1988 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1989 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1991 (clobber (match_scratch:SI 3 "=r,r"))]
1994 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1996 [(set_attr "type" "compare")
1997 (set_attr "length" "8,12")])
2000 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2001 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2002 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2004 (clobber (match_scratch:SI 3 ""))]
2007 (div:SI (match_dup 1) (match_dup 2)))
2009 (compare:CC (match_dup 3)
2014 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2015 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2016 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2018 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2019 (div:SI (match_dup 1) (match_dup 2)))]
2022 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2024 [(set_attr "type" "compare")
2025 (set_attr "length" "8,12")])
2028 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2029 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2030 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2032 (set (match_operand:SI 0 "gpc_reg_operand" "")
2033 (div:SI (match_dup 1) (match_dup 2)))]
2036 (div:SI (match_dup 1) (match_dup 2)))
2038 (compare:CC (match_dup 0)
2043 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2046 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2048 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2049 (match_operand:SI 3 "gpc_reg_operand" "r")))
2050 (set (match_operand:SI 2 "register_operand" "=*q")
2053 (zero_extend:DI (match_dup 1)) (const_int 32))
2054 (zero_extend:DI (match_dup 4)))
2058 [(set_attr "type" "idiv")])
2060 ;; To do unsigned divide we handle the cases of the divisor looking like a
2061 ;; negative number. If it is a constant that is less than 2**31, we don't
2062 ;; have to worry about the branches. So make a few subroutines here.
2064 ;; First comes the normal case.
2065 (define_expand "udivmodsi4_normal"
2066 [(set (match_dup 4) (const_int 0))
2067 (parallel [(set (match_operand:SI 0 "" "")
2068 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2070 (zero_extend:DI (match_operand:SI 1 "" "")))
2071 (match_operand:SI 2 "" "")))
2072 (set (match_operand:SI 3 "" "")
2073 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2075 (zero_extend:DI (match_dup 1)))
2079 { operands[4] = gen_reg_rtx (SImode); }")
2081 ;; This handles the branches.
2082 (define_expand "udivmodsi4_tests"
2083 [(set (match_operand:SI 0 "" "") (const_int 0))
2084 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2085 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2086 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2087 (label_ref (match_operand:SI 4 "" "")) (pc)))
2088 (set (match_dup 0) (const_int 1))
2089 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2090 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2091 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2092 (label_ref (match_dup 4)) (pc)))]
2095 { operands[5] = gen_reg_rtx (CCUNSmode);
2096 operands[6] = gen_reg_rtx (CCmode);
2099 (define_expand "udivmodsi4"
2100 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2101 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2102 (match_operand:SI 2 "reg_or_cint_operand" "")))
2103 (set (match_operand:SI 3 "gpc_reg_operand" "")
2104 (umod:SI (match_dup 1) (match_dup 2)))])]
2112 if (! TARGET_POWERPC)
2114 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2115 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2116 emit_insn (gen_divus_call ());
2117 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2118 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2125 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2127 operands[2] = force_reg (SImode, operands[2]);
2128 label = gen_label_rtx ();
2129 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2130 operands[3], label));
2133 operands[2] = force_reg (SImode, operands[2]);
2135 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2143 ;; AIX architecture-independent common-mode multiply (DImode),
2144 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2145 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2146 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2147 ;; assumed unused if generating common-mode, so ignore.
2148 (define_insn "mulh_call"
2151 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2152 (sign_extend:DI (reg:SI 4)))
2154 (clobber (match_scratch:SI 0 "=l"))]
2155 "! TARGET_POWER && ! TARGET_POWERPC"
2157 [(set_attr "type" "imul")])
2159 (define_insn "mull_call"
2161 (mult:DI (sign_extend:DI (reg:SI 3))
2162 (sign_extend:DI (reg:SI 4))))
2163 (clobber (match_scratch:SI 0 "=l"))
2164 (clobber (reg:SI 0))]
2165 "! TARGET_POWER && ! TARGET_POWERPC"
2167 [(set_attr "type" "imul")])
2169 (define_insn "divss_call"
2171 (div:SI (reg:SI 3) (reg:SI 4)))
2173 (mod:SI (reg:SI 3) (reg:SI 4)))
2174 (clobber (match_scratch:SI 0 "=l"))
2175 (clobber (reg:SI 0))]
2176 "! TARGET_POWER && ! TARGET_POWERPC"
2178 [(set_attr "type" "idiv")])
2180 (define_insn "divus_call"
2182 (udiv:SI (reg:SI 3) (reg:SI 4)))
2184 (umod:SI (reg:SI 3) (reg:SI 4)))
2185 (clobber (match_scratch:SI 0 "=l"))
2186 (clobber (reg:SI 0))
2187 (clobber (match_scratch:CC 1 "=x"))
2188 (clobber (reg:CC 69))]
2189 "! TARGET_POWER && ! TARGET_POWERPC"
2191 [(set_attr "type" "idiv")])
2193 (define_insn "quoss_call"
2195 (div:SI (reg:SI 3) (reg:SI 4)))
2196 (clobber (match_scratch:SI 0 "=l"))]
2197 "! TARGET_POWER && ! TARGET_POWERPC"
2199 [(set_attr "type" "idiv")])
2201 (define_insn "quous_call"
2203 (udiv:SI (reg:SI 3) (reg:SI 4)))
2204 (clobber (match_scratch:SI 0 "=l"))
2205 (clobber (reg:SI 0))
2206 (clobber (match_scratch:CC 1 "=x"))
2207 (clobber (reg:CC 69))]
2208 "! TARGET_POWER && ! TARGET_POWERPC"
2210 [(set_attr "type" "idiv")])
2212 ;; Logical instructions
2213 ;; The logical instructions are mostly combined by using match_operator,
2214 ;; but the plain AND insns are somewhat different because there is no
2215 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2216 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2218 (define_insn "andsi3"
2219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2220 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2221 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2222 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2226 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2227 {andil.|andi.} %0,%1,%b2
2228 {andiu.|andis.} %0,%1,%u2"
2229 [(set_attr "type" "*,*,compare,compare")])
2231 ;; Note to set cr's other than cr0 we do the and immediate and then
2232 ;; the test again -- this avoids a mfcr which on the higher end
2233 ;; machines causes an execution serialization
2235 (define_insn "*andsi3_internal2"
2236 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2237 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2238 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2240 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2241 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2245 {andil.|andi.} %3,%1,%b2
2246 {andiu.|andis.} %3,%1,%u2
2247 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2252 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2253 (set_attr "length" "4,4,4,4,8,8,8,8")])
2255 (define_insn "*andsi3_internal3"
2256 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2257 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2258 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2260 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2261 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2265 {andil.|andi.} %3,%1,%b2
2266 {andiu.|andis.} %3,%1,%u2
2267 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2272 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2273 (set_attr "length" "8,4,4,4,8,8,8,8")])
2276 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2277 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2278 (match_operand:SI 2 "and_operand" ""))
2280 (clobber (match_scratch:SI 3 ""))
2281 (clobber (match_scratch:CC 4 ""))]
2283 [(parallel [(set (match_dup 3)
2284 (and:SI (match_dup 1)
2286 (clobber (match_dup 4))])
2288 (compare:CC (match_dup 3)
2292 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2293 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2296 [(set (match_operand:CC 0 "cc_reg_operand" "")
2297 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2298 (match_operand:SI 2 "gpc_reg_operand" ""))
2300 (clobber (match_scratch:SI 3 ""))
2301 (clobber (match_scratch:CC 4 ""))]
2302 "TARGET_POWERPC64 && reload_completed"
2303 [(parallel [(set (match_dup 3)
2304 (and:SI (match_dup 1)
2306 (clobber (match_dup 4))])
2308 (compare:CC (match_dup 3)
2312 (define_insn "*andsi3_internal4"
2313 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2314 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2315 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2317 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2318 (and:SI (match_dup 1)
2320 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2324 {andil.|andi.} %0,%1,%b2
2325 {andiu.|andis.} %0,%1,%u2
2326 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2331 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2332 (set_attr "length" "4,4,4,4,8,8,8,8")])
2334 (define_insn "*andsi3_internal5"
2335 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2336 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2337 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2339 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2340 (and:SI (match_dup 1)
2342 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2346 {andil.|andi.} %0,%1,%b2
2347 {andiu.|andis.} %0,%1,%u2
2348 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2353 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2354 (set_attr "length" "8,4,4,4,8,8,8,8")])
2357 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2358 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2359 (match_operand:SI 2 "and_operand" ""))
2361 (set (match_operand:SI 0 "gpc_reg_operand" "")
2362 (and:SI (match_dup 1)
2364 (clobber (match_scratch:CC 4 ""))]
2366 [(parallel [(set (match_dup 0)
2367 (and:SI (match_dup 1)
2369 (clobber (match_dup 4))])
2371 (compare:CC (match_dup 0)
2376 [(set (match_operand:CC 3 "cc_reg_operand" "")
2377 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2378 (match_operand:SI 2 "gpc_reg_operand" ""))
2380 (set (match_operand:SI 0 "gpc_reg_operand" "")
2381 (and:SI (match_dup 1)
2383 (clobber (match_scratch:CC 4 ""))]
2384 "TARGET_POWERPC64 && reload_completed"
2385 [(parallel [(set (match_dup 0)
2386 (and:SI (match_dup 1)
2388 (clobber (match_dup 4))])
2390 (compare:CC (match_dup 0)
2394 ;; Handle the PowerPC64 rlwinm corner case
2396 (define_insn_and_split "*andsi3_internal6"
2397 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2398 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2399 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2404 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2407 (rotate:SI (match_dup 0) (match_dup 5)))]
2410 int mb = extract_MB (operands[2]);
2411 int me = extract_ME (operands[2]);
2412 operands[3] = GEN_INT (me + 1);
2413 operands[5] = GEN_INT (32 - (me + 1));
2414 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2416 [(set_attr "length" "8")])
2418 (define_expand "iorsi3"
2419 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2420 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2421 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2425 if (GET_CODE (operands[2]) == CONST_INT
2426 && ! logical_operand (operands[2], SImode))
2428 HOST_WIDE_INT value = INTVAL (operands[2]);
2429 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2430 ? operands[0] : gen_reg_rtx (SImode));
2432 emit_insn (gen_iorsi3 (tmp, operands[1],
2433 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2434 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2439 (define_expand "xorsi3"
2440 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2441 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2442 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2446 if (GET_CODE (operands[2]) == CONST_INT
2447 && ! logical_operand (operands[2], SImode))
2449 HOST_WIDE_INT value = INTVAL (operands[2]);
2450 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2451 ? operands[0] : gen_reg_rtx (SImode));
2453 emit_insn (gen_xorsi3 (tmp, operands[1],
2454 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2455 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2460 (define_insn "*boolsi3_internal1"
2461 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2462 (match_operator:SI 3 "boolean_or_operator"
2463 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2464 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2468 {%q3il|%q3i} %0,%1,%b2
2469 {%q3iu|%q3is} %0,%1,%u2")
2471 (define_insn "*boolsi3_internal2"
2472 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2473 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2474 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2475 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2477 (clobber (match_scratch:SI 3 "=r,r"))]
2482 [(set_attr "type" "compare")
2483 (set_attr "length" "4,8")])
2486 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2487 (compare:CC (match_operator:SI 4 "boolean_operator"
2488 [(match_operand:SI 1 "gpc_reg_operand" "")
2489 (match_operand:SI 2 "gpc_reg_operand" "")])
2491 (clobber (match_scratch:SI 3 ""))]
2492 "TARGET_32BIT && reload_completed"
2493 [(set (match_dup 3) (match_dup 4))
2495 (compare:CC (match_dup 3)
2499 (define_insn "*boolsi3_internal3"
2500 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2501 (compare:CC (match_operator:SI 4 "boolean_operator"
2502 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2503 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2505 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2511 [(set_attr "type" "compare")
2512 (set_attr "length" "4,8")])
2515 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2516 (compare:CC (match_operator:SI 4 "boolean_operator"
2517 [(match_operand:SI 1 "gpc_reg_operand" "")
2518 (match_operand:SI 2 "gpc_reg_operand" "")])
2520 (set (match_operand:SI 0 "gpc_reg_operand" "")
2522 "TARGET_32BIT && reload_completed"
2523 [(set (match_dup 0) (match_dup 4))
2525 (compare:CC (match_dup 0)
2529 ;; Split a logical operation that we can't do in one insn into two insns,
2530 ;; each of which does one 16-bit part. This is used by combine.
2533 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2534 (match_operator:SI 3 "boolean_or_operator"
2535 [(match_operand:SI 1 "gpc_reg_operand" "")
2536 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2538 [(set (match_dup 0) (match_dup 4))
2539 (set (match_dup 0) (match_dup 5))]
2543 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2544 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2546 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2547 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2551 (define_insn "*boolcsi3_internal1"
2552 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2553 (match_operator:SI 3 "boolean_operator"
2554 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2555 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2559 (define_insn "*boolcsi3_internal2"
2560 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2561 (compare:CC (match_operator:SI 4 "boolean_operator"
2562 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2563 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2565 (clobber (match_scratch:SI 3 "=r,r"))]
2570 [(set_attr "type" "compare")
2571 (set_attr "length" "4,8")])
2574 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2575 (compare:CC (match_operator:SI 4 "boolean_operator"
2576 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2577 (match_operand:SI 2 "gpc_reg_operand" "")])
2579 (clobber (match_scratch:SI 3 ""))]
2580 "TARGET_32BIT && reload_completed"
2581 [(set (match_dup 3) (match_dup 4))
2583 (compare:CC (match_dup 3)
2587 (define_insn "*boolcsi3_internal3"
2588 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2589 (compare:CC (match_operator:SI 4 "boolean_operator"
2590 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2591 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2593 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2599 [(set_attr "type" "compare")
2600 (set_attr "length" "4,8")])
2603 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2604 (compare:CC (match_operator:SI 4 "boolean_operator"
2605 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2606 (match_operand:SI 2 "gpc_reg_operand" "")])
2608 (set (match_operand:SI 0 "gpc_reg_operand" "")
2610 "TARGET_32BIT && reload_completed"
2611 [(set (match_dup 0) (match_dup 4))
2613 (compare:CC (match_dup 0)
2617 (define_insn "*boolccsi3_internal1"
2618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2619 (match_operator:SI 3 "boolean_operator"
2620 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2621 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2625 (define_insn "*boolccsi3_internal2"
2626 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2627 (compare:CC (match_operator:SI 4 "boolean_operator"
2628 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2629 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2631 (clobber (match_scratch:SI 3 "=r,r"))]
2636 [(set_attr "type" "compare")
2637 (set_attr "length" "4,8")])
2640 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2641 (compare:CC (match_operator:SI 4 "boolean_operator"
2642 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2643 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2645 (clobber (match_scratch:SI 3 ""))]
2646 "TARGET_32BIT && reload_completed"
2647 [(set (match_dup 3) (match_dup 4))
2649 (compare:CC (match_dup 3)
2653 (define_insn "*boolccsi3_internal3"
2654 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2655 (compare:CC (match_operator:SI 4 "boolean_operator"
2656 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2657 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2659 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2665 [(set_attr "type" "compare")
2666 (set_attr "length" "4,8")])
2669 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2670 (compare:CC (match_operator:SI 4 "boolean_operator"
2671 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2672 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2674 (set (match_operand:SI 0 "gpc_reg_operand" "")
2676 "TARGET_32BIT && reload_completed"
2677 [(set (match_dup 0) (match_dup 4))
2679 (compare:CC (match_dup 0)
2683 ;; maskir insn. We need four forms because things might be in arbitrary
2684 ;; orders. Don't define forms that only set CR fields because these
2685 ;; would modify an input register.
2687 (define_insn "*maskir_internal1"
2688 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2689 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2690 (match_operand:SI 1 "gpc_reg_operand" "0"))
2691 (and:SI (match_dup 2)
2692 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2696 (define_insn "*maskir_internal2"
2697 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2698 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2699 (match_operand:SI 1 "gpc_reg_operand" "0"))
2700 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2705 (define_insn "*maskir_internal3"
2706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2707 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2708 (match_operand:SI 3 "gpc_reg_operand" "r"))
2709 (and:SI (not:SI (match_dup 2))
2710 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2714 (define_insn "*maskir_internal4"
2715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2716 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2717 (match_operand:SI 2 "gpc_reg_operand" "r"))
2718 (and:SI (not:SI (match_dup 2))
2719 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2723 (define_insn "*maskir_internal5"
2724 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2726 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2727 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2728 (and:SI (match_dup 2)
2729 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2731 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2732 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2733 (and:SI (match_dup 2) (match_dup 3))))]
2738 [(set_attr "type" "compare")
2739 (set_attr "length" "4,8")])
2742 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2744 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2745 (match_operand:SI 1 "gpc_reg_operand" ""))
2746 (and:SI (match_dup 2)
2747 (match_operand:SI 3 "gpc_reg_operand" "")))
2749 (set (match_operand:SI 0 "gpc_reg_operand" "")
2750 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2751 (and:SI (match_dup 2) (match_dup 3))))]
2752 "TARGET_POWER && reload_completed"
2754 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2755 (and:SI (match_dup 2) (match_dup 3))))
2757 (compare:CC (match_dup 0)
2761 (define_insn "*maskir_internal6"
2762 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2764 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2765 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2766 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2769 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2770 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2771 (and:SI (match_dup 3) (match_dup 2))))]
2776 [(set_attr "type" "compare")
2777 (set_attr "length" "4,8")])
2780 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2782 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2783 (match_operand:SI 1 "gpc_reg_operand" ""))
2784 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2787 (set (match_operand:SI 0 "gpc_reg_operand" "")
2788 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2789 (and:SI (match_dup 3) (match_dup 2))))]
2790 "TARGET_POWER && reload_completed"
2792 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2793 (and:SI (match_dup 3) (match_dup 2))))
2795 (compare:CC (match_dup 0)
2799 (define_insn "*maskir_internal7"
2800 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2802 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2803 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2804 (and:SI (not:SI (match_dup 2))
2805 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2807 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2808 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2809 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2814 [(set_attr "type" "compare")
2815 (set_attr "length" "4,8")])
2818 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2820 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2821 (match_operand:SI 3 "gpc_reg_operand" ""))
2822 (and:SI (not:SI (match_dup 2))
2823 (match_operand:SI 1 "gpc_reg_operand" "")))
2825 (set (match_operand:SI 0 "gpc_reg_operand" "")
2826 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2827 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2828 "TARGET_POWER && reload_completed"
2830 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2831 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2833 (compare:CC (match_dup 0)
2837 (define_insn "*maskir_internal8"
2838 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2840 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2841 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2842 (and:SI (not:SI (match_dup 2))
2843 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2845 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2846 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2847 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2852 [(set_attr "type" "compare")
2853 (set_attr "length" "4,8")])
2856 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2858 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2859 (match_operand:SI 2 "gpc_reg_operand" ""))
2860 (and:SI (not:SI (match_dup 2))
2861 (match_operand:SI 1 "gpc_reg_operand" "")))
2863 (set (match_operand:SI 0 "gpc_reg_operand" "")
2864 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2865 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2866 "TARGET_POWER && reload_completed"
2868 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2869 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2871 (compare:CC (match_dup 0)
2875 ;; Rotate and shift insns, in all their variants. These support shifts,
2876 ;; field inserts and extracts, and various combinations thereof.
2877 (define_expand "insv"
2878 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2879 (match_operand:SI 1 "const_int_operand" "")
2880 (match_operand:SI 2 "const_int_operand" ""))
2881 (match_operand 3 "gpc_reg_operand" ""))]
2885 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2886 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2887 compiler if the address of the structure is taken later. */
2888 if (GET_CODE (operands[0]) == SUBREG
2889 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2892 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2893 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2895 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2899 (define_insn "insvsi"
2900 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2901 (match_operand:SI 1 "const_int_operand" "i")
2902 (match_operand:SI 2 "const_int_operand" "i"))
2903 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2907 int start = INTVAL (operands[2]) & 31;
2908 int size = INTVAL (operands[1]) & 31;
2910 operands[4] = GEN_INT (32 - start - size);
2911 operands[1] = GEN_INT (start + size - 1);
2912 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2914 [(set_attr "type" "insert_word")])
2916 (define_insn "*insvsi_internal1"
2917 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2918 (match_operand:SI 1 "const_int_operand" "i")
2919 (match_operand:SI 2 "const_int_operand" "i"))
2920 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2921 (match_operand:SI 4 "const_int_operand" "i")))]
2922 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2925 int shift = INTVAL (operands[4]) & 31;
2926 int start = INTVAL (operands[2]) & 31;
2927 int size = INTVAL (operands[1]) & 31;
2929 operands[4] = GEN_INT (shift - start - size);
2930 operands[1] = GEN_INT (start + size - 1);
2931 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2933 [(set_attr "type" "insert_word")])
2935 (define_insn "*insvsi_internal2"
2936 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2937 (match_operand:SI 1 "const_int_operand" "i")
2938 (match_operand:SI 2 "const_int_operand" "i"))
2939 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2940 (match_operand:SI 4 "const_int_operand" "i")))]
2941 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2944 int shift = INTVAL (operands[4]) & 31;
2945 int start = INTVAL (operands[2]) & 31;
2946 int size = INTVAL (operands[1]) & 31;
2948 operands[4] = GEN_INT (32 - shift - start - size);
2949 operands[1] = GEN_INT (start + size - 1);
2950 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2952 [(set_attr "type" "insert_word")])
2954 (define_insn "*insvsi_internal3"
2955 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2956 (match_operand:SI 1 "const_int_operand" "i")
2957 (match_operand:SI 2 "const_int_operand" "i"))
2958 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2959 (match_operand:SI 4 "const_int_operand" "i")))]
2960 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2963 int shift = INTVAL (operands[4]) & 31;
2964 int start = INTVAL (operands[2]) & 31;
2965 int size = INTVAL (operands[1]) & 31;
2967 operands[4] = GEN_INT (32 - shift - start - size);
2968 operands[1] = GEN_INT (start + size - 1);
2969 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2971 [(set_attr "type" "insert_word")])
2973 (define_insn "*insvsi_internal4"
2974 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2975 (match_operand:SI 1 "const_int_operand" "i")
2976 (match_operand:SI 2 "const_int_operand" "i"))
2977 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2978 (match_operand:SI 4 "const_int_operand" "i")
2979 (match_operand:SI 5 "const_int_operand" "i")))]
2980 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2983 int extract_start = INTVAL (operands[5]) & 31;
2984 int extract_size = INTVAL (operands[4]) & 31;
2985 int insert_start = INTVAL (operands[2]) & 31;
2986 int insert_size = INTVAL (operands[1]) & 31;
2988 /* Align extract field with insert field */
2989 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
2990 operands[1] = GEN_INT (insert_start + insert_size - 1);
2991 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
2993 [(set_attr "type" "insert_word")])
2995 ;; combine patterns for rlwimi
2996 (define_insn "*insvsi_internal5"
2997 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2998 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
2999 (match_operand:SI 1 "mask_operand" "i"))
3000 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3001 (match_operand:SI 2 "const_int_operand" "i"))
3002 (match_operand:SI 5 "mask_operand" "i"))))]
3003 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3006 int me = extract_ME(operands[5]);
3007 int mb = extract_MB(operands[5]);
3008 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3009 operands[2] = GEN_INT(mb);
3010 operands[1] = GEN_INT(me);
3011 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3013 [(set_attr "type" "insert_word")])
3015 (define_insn "*insvsi_internal6"
3016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3017 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3018 (match_operand:SI 2 "const_int_operand" "i"))
3019 (match_operand:SI 5 "mask_operand" "i"))
3020 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3021 (match_operand:SI 1 "mask_operand" "i"))))]
3022 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3025 int me = extract_ME(operands[5]);
3026 int mb = extract_MB(operands[5]);
3027 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3028 operands[2] = GEN_INT(mb);
3029 operands[1] = GEN_INT(me);
3030 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3032 [(set_attr "type" "insert_word")])
3034 (define_insn "insvdi"
3035 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3036 (match_operand:SI 1 "const_int_operand" "i")
3037 (match_operand:SI 2 "const_int_operand" "i"))
3038 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3042 int start = INTVAL (operands[2]) & 63;
3043 int size = INTVAL (operands[1]) & 63;
3045 operands[1] = GEN_INT (64 - start - size);
3046 return \"rldimi %0,%3,%H1,%H2\";
3049 (define_insn "*insvdi_internal2"
3050 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3051 (match_operand:SI 1 "const_int_operand" "i")
3052 (match_operand:SI 2 "const_int_operand" "i"))
3053 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3054 (match_operand:SI 4 "const_int_operand" "i")))]
3056 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3059 int shift = INTVAL (operands[4]) & 63;
3060 int start = (INTVAL (operands[2]) & 63) - 32;
3061 int size = INTVAL (operands[1]) & 63;
3063 operands[4] = GEN_INT (64 - shift - start - size);
3064 operands[2] = GEN_INT (start);
3065 operands[1] = GEN_INT (start + size - 1);
3066 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3069 (define_insn "*insvdi_internal3"
3070 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3071 (match_operand:SI 1 "const_int_operand" "i")
3072 (match_operand:SI 2 "const_int_operand" "i"))
3073 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3074 (match_operand:SI 4 "const_int_operand" "i")))]
3076 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3079 int shift = INTVAL (operands[4]) & 63;
3080 int start = (INTVAL (operands[2]) & 63) - 32;
3081 int size = INTVAL (operands[1]) & 63;
3083 operands[4] = GEN_INT (64 - shift - start - size);
3084 operands[2] = GEN_INT (start);
3085 operands[1] = GEN_INT (start + size - 1);
3086 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3089 (define_expand "extzv"
3090 [(set (match_operand 0 "gpc_reg_operand" "")
3091 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3092 (match_operand:SI 2 "const_int_operand" "")
3093 (match_operand:SI 3 "const_int_operand" "")))]
3097 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3098 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3099 compiler if the address of the structure is taken later. */
3100 if (GET_CODE (operands[0]) == SUBREG
3101 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3104 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3105 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3107 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3111 (define_insn "extzvsi"
3112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3113 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3114 (match_operand:SI 2 "const_int_operand" "i")
3115 (match_operand:SI 3 "const_int_operand" "i")))]
3119 int start = INTVAL (operands[3]) & 31;
3120 int size = INTVAL (operands[2]) & 31;
3122 if (start + size >= 32)
3123 operands[3] = const0_rtx;
3125 operands[3] = GEN_INT (start + size);
3126 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3129 (define_insn "*extzvsi_internal1"
3130 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3131 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3132 (match_operand:SI 2 "const_int_operand" "i,i")
3133 (match_operand:SI 3 "const_int_operand" "i,i"))
3135 (clobber (match_scratch:SI 4 "=r,r"))]
3139 int start = INTVAL (operands[3]) & 31;
3140 int size = INTVAL (operands[2]) & 31;
3142 /* Force split for non-cc0 compare. */
3143 if (which_alternative == 1)
3146 /* If the bit-field being tested fits in the upper or lower half of a
3147 word, it is possible to use andiu. or andil. to test it. This is
3148 useful because the condition register set-use delay is smaller for
3149 andi[ul]. than for rlinm. This doesn't work when the starting bit
3150 position is 0 because the LT and GT bits may be set wrong. */
3152 if ((start > 0 && start + size <= 16) || start >= 16)
3154 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3155 - (1 << (16 - (start & 15) - size))));
3157 return \"{andiu.|andis.} %4,%1,%3\";
3159 return \"{andil.|andi.} %4,%1,%3\";
3162 if (start + size >= 32)
3163 operands[3] = const0_rtx;
3165 operands[3] = GEN_INT (start + size);
3166 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3168 [(set_attr "type" "compare")
3169 (set_attr "length" "4,8")])
3172 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3173 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3174 (match_operand:SI 2 "const_int_operand" "")
3175 (match_operand:SI 3 "const_int_operand" ""))
3177 (clobber (match_scratch:SI 4 ""))]
3180 (zero_extract:SI (match_dup 1) (match_dup 2)
3183 (compare:CC (match_dup 4)
3187 (define_insn "*extzvsi_internal2"
3188 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3189 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3190 (match_operand:SI 2 "const_int_operand" "i,i")
3191 (match_operand:SI 3 "const_int_operand" "i,i"))
3193 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3194 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3198 int start = INTVAL (operands[3]) & 31;
3199 int size = INTVAL (operands[2]) & 31;
3201 /* Force split for non-cc0 compare. */
3202 if (which_alternative == 1)
3205 /* Since we are using the output value, we can't ignore any need for
3206 a shift. The bit-field must end at the LSB. */
3207 if (start >= 16 && start + size == 32)
3209 operands[3] = GEN_INT ((1 << size) - 1);
3210 return \"{andil.|andi.} %0,%1,%3\";
3213 if (start + size >= 32)
3214 operands[3] = const0_rtx;
3216 operands[3] = GEN_INT (start + size);
3217 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3219 [(set_attr "type" "compare")
3220 (set_attr "length" "4,8")])
3223 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3224 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3225 (match_operand:SI 2 "const_int_operand" "")
3226 (match_operand:SI 3 "const_int_operand" ""))
3228 (set (match_operand:SI 0 "gpc_reg_operand" "")
3229 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3232 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3234 (compare:CC (match_dup 0)
3238 (define_insn "extzvdi"
3239 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3240 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3241 (match_operand:SI 2 "const_int_operand" "i")
3242 (match_operand:SI 3 "const_int_operand" "i")))]
3246 int start = INTVAL (operands[3]) & 63;
3247 int size = INTVAL (operands[2]) & 63;
3249 if (start + size >= 64)
3250 operands[3] = const0_rtx;
3252 operands[3] = GEN_INT (start + size);
3253 operands[2] = GEN_INT (64 - size);
3254 return \"rldicl %0,%1,%3,%2\";
3257 (define_insn "*extzvdi_internal1"
3258 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3259 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3260 (match_operand:SI 2 "const_int_operand" "i")
3261 (match_operand:SI 3 "const_int_operand" "i"))
3263 (clobber (match_scratch:DI 4 "=r"))]
3267 int start = INTVAL (operands[3]) & 63;
3268 int size = INTVAL (operands[2]) & 63;
3270 if (start + size >= 64)
3271 operands[3] = const0_rtx;
3273 operands[3] = GEN_INT (start + size);
3274 operands[2] = GEN_INT (64 - size);
3275 return \"rldicl. %4,%1,%3,%2\";
3277 [(set_attr "type" "compare")])
3279 (define_insn "*extzvdi_internal2"
3280 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3281 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3282 (match_operand:SI 2 "const_int_operand" "i")
3283 (match_operand:SI 3 "const_int_operand" "i"))
3285 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3286 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3290 int start = INTVAL (operands[3]) & 63;
3291 int size = INTVAL (operands[2]) & 63;
3293 if (start + size >= 64)
3294 operands[3] = const0_rtx;
3296 operands[3] = GEN_INT (start + size);
3297 operands[2] = GEN_INT (64 - size);
3298 return \"rldicl. %0,%1,%3,%2\";
3300 [(set_attr "type" "compare")])
3302 (define_insn "rotlsi3"
3303 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3304 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3305 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3307 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3309 (define_insn "*rotlsi3_internal2"
3310 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3311 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3312 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3314 (clobber (match_scratch:SI 3 "=r,r"))]
3317 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3319 [(set_attr "type" "delayed_compare")
3320 (set_attr "length" "4,8")])
3323 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3324 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3325 (match_operand:SI 2 "reg_or_cint_operand" ""))
3327 (clobber (match_scratch:SI 3 ""))]
3330 (rotate:SI (match_dup 1) (match_dup 2)))
3332 (compare:CC (match_dup 3)
3336 (define_insn "*rotlsi3_internal3"
3337 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3338 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")