1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 91-98, 1999 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GNU CC.
7 ;; GNU CC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU CC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU CC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; Define an insn type attribute. This is used in function unit delay
26 (define_attr "type" "integer,load,store,fpload,fpstore,imul,idiv,branch,compare,delayed_compare,fpcompare,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg"
27 (const_string "integer"))
30 (define_attr "length" ""
31 (if_then_else (eq_attr "type" "branch")
32 (if_then_else (and (ge (minus (pc) (match_dup 0))
34 (lt (minus (pc) (match_dup 0))
40 ;; Processor type -- this attribute must exactly match the processor_type
41 ;; enumeration in rs6000.h.
43 (define_attr "cpu" "rios1,rios2,mpccore,ppc403,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc750"
44 (const (symbol_ref "rs6000_cpu_attr")))
46 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
47 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
49 ; Load/Store Unit -- pure PowerPC only
50 ; (POWER and 601 use Integer Unit)
51 (define_function_unit "lsu" 1 0
52 (and (eq_attr "type" "load")
53 (eq_attr "cpu" "mpccore,ppc603,ppc604,ppc604e,ppc620,ppc750"))
56 (define_function_unit "lsu" 1 0
57 (and (eq_attr "type" "store,fpstore")
58 (eq_attr "cpu" "mpccore,ppc603,ppc604,ppc604e,ppc620,ppc750"))
61 (define_function_unit "lsu" 1 0
62 (and (eq_attr "type" "fpload")
63 (eq_attr "cpu" "mpccore,ppc603,ppc750"))
66 (define_function_unit "lsu" 1 0
67 (and (eq_attr "type" "fpload")
68 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
71 (define_function_unit "iu" 1 0
72 (and (eq_attr "type" "load")
73 (eq_attr "cpu" "rios1,ppc403,ppc601"))
76 (define_function_unit "iu" 1 0
77 (and (eq_attr "type" "store,fpstore")
78 (eq_attr "cpu" "rios1,ppc403,ppc601"))
81 (define_function_unit "fpu" 1 0
82 (and (eq_attr "type" "fpstore")
83 (eq_attr "cpu" "rios1,ppc601"))
86 (define_function_unit "iu" 1 0
87 (and (eq_attr "type" "fpload")
88 (eq_attr "cpu" "rios1"))
91 (define_function_unit "iu" 1 0
92 (and (eq_attr "type" "fpload")
93 (eq_attr "cpu" "ppc601"))
96 (define_function_unit "iu2" 2 0
97 (and (eq_attr "type" "load,fpload")
98 (eq_attr "cpu" "rios2"))
101 (define_function_unit "iu2" 2 0
102 (and (eq_attr "type" "store,fpstore")
103 (eq_attr "cpu" "rios2"))
106 ; Integer Unit (RIOS1, PPC601, PPC603)
107 (define_function_unit "iu" 1 0
108 (and (eq_attr "type" "integer")
109 (eq_attr "cpu" "rios1,mpccore,ppc403,ppc601,ppc603"))
112 (define_function_unit "iu" 1 0
113 (and (eq_attr "type" "imul")
114 (eq_attr "cpu" "ppc403"))
117 (define_function_unit "iu" 1 0
118 (and (eq_attr "type" "imul")
119 (eq_attr "cpu" "rios1,ppc601,ppc603"))
122 (define_function_unit "iu" 1 0
123 (and (eq_attr "type" "idiv")
124 (eq_attr "cpu" "rios1"))
127 (define_function_unit "iu" 1 0
128 (and (eq_attr "type" "idiv")
129 (eq_attr "cpu" "ppc403"))
132 (define_function_unit "iu" 1 0
133 (and (eq_attr "type" "idiv")
134 (eq_attr "cpu" "ppc601"))
137 (define_function_unit "iu" 1 0
138 (and (eq_attr "type" "idiv")
139 (eq_attr "cpu" "ppc603"))
142 ; RIOS2 has two integer units: a primary one which can perform all
143 ; operations and a secondary one which is fed in lock step with the first
144 ; and can perform "simple" integer operations.
145 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
146 ; for the complex insns.
147 (define_function_unit "iu2" 2 0
148 (and (eq_attr "type" "integer")
149 (eq_attr "cpu" "rios2"))
152 (define_function_unit "iu2" 2 0
153 (and (eq_attr "type" "imul")
154 (eq_attr "cpu" "rios2"))
157 (define_function_unit "iu2" 2 0
158 (and (eq_attr "type" "idiv")
159 (eq_attr "cpu" "rios2"))
162 (define_function_unit "imuldiv" 1 0
163 (and (eq_attr "type" "imul")
164 (eq_attr "cpu" "rios2"))
167 (define_function_unit "imuldiv" 1 0
168 (and (eq_attr "type" "idiv")
169 (eq_attr "cpu" "rios2"))
172 ; MPCCORE has separate IMUL/IDIV unit for multicycle instructions
173 ; Divide latency varies greatly from 2-11, use 6 as average
174 (define_function_unit "imuldiv" 1 0
175 (and (eq_attr "type" "imul")
176 (eq_attr "cpu" "mpccore"))
179 (define_function_unit "imuldiv" 1 0
180 (and (eq_attr "type" "idiv")
181 (eq_attr "cpu" "mpccore"))
184 ; PPC604{,e} has two units that perform integer operations
185 ; and one unit for divide/multiply operations (and move
187 (define_function_unit "iu2" 2 0
188 (and (eq_attr "type" "integer")
189 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
192 (define_function_unit "imuldiv" 1 0
193 (and (eq_attr "type" "imul")
194 (eq_attr "cpu" "ppc604,ppc620"))
197 (define_function_unit "imuldiv" 1 0
198 (and (eq_attr "type" "imul")
199 (eq_attr "cpu" "ppc604e"))
202 (define_function_unit "imuldiv" 1 0
203 (and (eq_attr "type" "idiv")
204 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
207 ; PPC750 has two integer units: a primary one which can perform all
208 ; operations and a secondary one which is fed in lock step with the first
209 ; and can perform "simple" integer operations.
210 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
211 ; for the complex insns.
212 (define_function_unit "iu2" 2 0
213 (and (eq_attr "type" "integer")
214 (eq_attr "cpu" "ppc750"))
217 (define_function_unit "iu2" 2 0
218 (and (eq_attr "type" "imul")
219 (eq_attr "cpu" "ppc750"))
222 (define_function_unit "imuldiv" 1 0
223 (and (eq_attr "type" "imul")
224 (eq_attr "cpu" "ppc750"))
227 (define_function_unit "imuldiv" 1 0
228 (and (eq_attr "type" "idiv")
229 (eq_attr "cpu" "ppc750"))
232 ; compare is done on integer unit, but feeds insns which
233 ; execute on the branch unit.
234 (define_function_unit "iu" 1 0
235 (and (eq_attr "type" "compare")
236 (eq_attr "cpu" "rios1"))
239 (define_function_unit "iu" 1 0
240 (and (eq_attr "type" "delayed_compare")
241 (eq_attr "cpu" "rios1"))
244 (define_function_unit "iu" 1 0
245 (and (eq_attr "type" "compare,delayed_compare")
246 (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc750"))
249 (define_function_unit "iu2" 2 0
250 (and (eq_attr "type" "compare,delayed_compare")
251 (eq_attr "cpu" "rios2"))
254 (define_function_unit "iu2" 2 0
255 (and (eq_attr "type" "compare,delayed_compare")
256 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc750"))
259 ; fp compare uses fp unit
260 (define_function_unit "fpu" 1 0
261 (and (eq_attr "type" "fpcompare")
262 (eq_attr "cpu" "rios1"))
265 ; rios1 and rios2 have different fpcompare delays
266 (define_function_unit "fpu2" 2 0
267 (and (eq_attr "type" "fpcompare")
268 (eq_attr "cpu" "rios2"))
271 ; on ppc601 and ppc603, fpcompare takes also 2 cycles from
273 ; here we do not define delays, just occupy the unit. The dependencies
274 ; will be assigned by the fpcompare definition in the fpu.
275 (define_function_unit "iu" 1 0
276 (and (eq_attr "type" "fpcompare")
277 (eq_attr "cpu" "ppc601,ppc603"))
280 ; fp compare uses fp unit
281 (define_function_unit "fpu" 1 0
282 (and (eq_attr "type" "fpcompare")
283 (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc750"))
286 (define_function_unit "fpu" 1 0
287 (and (eq_attr "type" "fpcompare")
288 (eq_attr "cpu" "mpccore"))
291 (define_function_unit "bpu" 1 0
292 (and (eq_attr "type" "mtjmpr")
293 (eq_attr "cpu" "rios1,rios2"))
296 (define_function_unit "bpu" 1 0
297 (and (eq_attr "type" "mtjmpr")
298 (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc750"))
301 ; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
302 (define_function_unit "bpu" 1 0
303 (eq_attr "type" "jmpreg")
306 (define_function_unit "bpu" 1 0
307 (eq_attr "type" "branch")
310 ; Floating Point Unit
311 (define_function_unit "fpu" 1 0
312 (and (eq_attr "type" "fp,dmul")
313 (eq_attr "cpu" "rios1"))
316 (define_function_unit "fpu" 1 0
317 (and (eq_attr "type" "fp")
318 (eq_attr "cpu" "mpccore"))
321 (define_function_unit "fpu" 1 0
322 (and (eq_attr "type" "fp")
323 (eq_attr "cpu" "ppc601"))
326 (define_function_unit "fpu" 1 0
327 (and (eq_attr "type" "fp")
328 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620,ppc750"))
331 (define_function_unit "fpu" 1 0
332 (and (eq_attr "type" "dmul")
333 (eq_attr "cpu" "mpccore"))
336 (define_function_unit "fpu" 1 0
337 (and (eq_attr "type" "dmul")
338 (eq_attr "cpu" "ppc601"))
342 (define_function_unit "fpu" 1 0
343 (and (eq_attr "type" "dmul")
344 (eq_attr "cpu" "ppc603,ppc750"))
347 (define_function_unit "fpu" 1 0
348 (and (eq_attr "type" "dmul")
349 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
352 (define_function_unit "fpu" 1 0
353 (and (eq_attr "type" "sdiv,ddiv")
354 (eq_attr "cpu" "rios1"))
357 (define_function_unit "fpu" 1 0
358 (and (eq_attr "type" "sdiv")
359 (eq_attr "cpu" "ppc601"))
362 (define_function_unit "fpu" 1 0
363 (and (eq_attr "type" "sdiv")
364 (eq_attr "cpu" "mpccore"))
367 (define_function_unit "fpu" 1 0
368 (and (eq_attr "type" "sdiv")
369 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620"))
372 (define_function_unit "fpu" 1 0
373 (and (eq_attr "type" "ddiv")
374 (eq_attr "cpu" "mpccore"))
377 (define_function_unit "fpu" 1 0
378 (and (eq_attr "type" "ddiv")
379 (eq_attr "cpu" "ppc601,ppc604,ppc604e,ppc620,ppc750"))
382 (define_function_unit "fpu" 1 0
383 (and (eq_attr "type" "ddiv")
384 (eq_attr "cpu" "ppc603"))
387 (define_function_unit "fpu" 1 0
388 (and (eq_attr "type" "ssqrt")
389 (eq_attr "cpu" "ppc620"))
392 (define_function_unit "fpu" 1 0
393 (and (eq_attr "type" "dsqrt")
394 (eq_attr "cpu" "ppc620"))
397 ; RIOS2 has two symmetric FPUs.
398 (define_function_unit "fpu2" 2 0
399 (and (eq_attr "type" "fp")
400 (eq_attr "cpu" "rios2"))
403 (define_function_unit "fpu2" 2 0
404 (and (eq_attr "type" "dmul")
405 (eq_attr "cpu" "rios2"))
408 (define_function_unit "fpu2" 2 0
409 (and (eq_attr "type" "sdiv,ddiv")
410 (eq_attr "cpu" "rios2"))
413 (define_function_unit "fpu2" 2 0
414 (and (eq_attr "type" "ssqrt,dsqrt")
415 (eq_attr "cpu" "rios2"))
419 ;; Start with fixed-point load and store insns. Here we put only the more
420 ;; complex forms. Basic data transfer is done later.
422 (define_expand "zero_extendqidi2"
423 [(set (match_operand:DI 0 "gpc_reg_operand" "")
424 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
429 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
430 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
435 [(set_attr "type" "load,*")])
438 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
439 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
441 (clobber (match_scratch:DI 2 "=r,r"))]
446 [(set_attr "type" "compare")
447 (set_attr "length" "4,8")])
450 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
451 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
453 (clobber (match_scratch:DI 2 "=r"))]
454 "TARGET_POWERPC64 && reload_completed"
456 (zero_extend:DI (match_dup 1)))
458 (compare:CC (match_dup 2)
463 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
464 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
466 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
467 (zero_extend:DI (match_dup 1)))]
472 [(set_attr "type" "compare")
473 (set_attr "length" "4,8")])
476 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
477 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
479 (set (match_operand:DI 0 "gpc_reg_operand" "")
480 (zero_extend:DI (match_dup 1)))]
481 "TARGET_POWERPC64 && reload_completed"
483 (zero_extend:DI (match_dup 1)))
485 (compare:CC (match_dup 0)
489 (define_insn "extendqidi2"
490 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
491 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
496 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
497 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
499 (clobber (match_scratch:DI 2 "=r,r"))]
504 [(set_attr "type" "compare")
505 (set_attr "length" "4,8")])
508 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
509 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
511 (clobber (match_scratch:DI 2 ""))]
512 "TARGET_POWERPC64 && reload_completed"
514 (sign_extend:DI (match_dup 1)))
516 (compare:CC (match_dup 2)
521 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
522 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
524 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
525 (sign_extend:DI (match_dup 1)))]
530 [(set_attr "type" "compare")
531 (set_attr "length" "4,8")])
534 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
535 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
537 (set (match_operand:DI 0 "gpc_reg_operand" "")
538 (sign_extend:DI (match_dup 1)))]
539 "TARGET_POWERPC64 && reload_completed"
541 (sign_extend:DI (match_dup 1)))
543 (compare:CC (match_dup 0)
547 (define_expand "zero_extendhidi2"
548 [(set (match_operand:DI 0 "gpc_reg_operand" "")
549 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
554 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
555 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
560 [(set_attr "type" "load,*")])
563 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
564 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
566 (clobber (match_scratch:DI 2 "=r,r"))]
571 [(set_attr "type" "compare")
572 (set_attr "length" "4,8")])
575 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
576 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
578 (clobber (match_scratch:DI 2 ""))]
579 "TARGET_POWERPC64 && reload_completed"
581 (zero_extend:DI (match_dup 1)))
583 (compare:CC (match_dup 2)
588 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
589 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
591 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
592 (zero_extend:DI (match_dup 1)))]
597 [(set_attr "type" "compare")
598 (set_attr "length" "4,8")])
601 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
602 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
604 (set (match_operand:DI 0 "gpc_reg_operand" "")
605 (zero_extend:DI (match_dup 1)))]
606 "TARGET_POWERPC64 && reload_completed"
608 (zero_extend:DI (match_dup 1)))
610 (compare:CC (match_dup 0)
614 (define_expand "extendhidi2"
615 [(set (match_operand:DI 0 "gpc_reg_operand" "")
616 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
621 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
622 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
627 [(set_attr "type" "load,*")])
630 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
631 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
633 (clobber (match_scratch:DI 2 "=r,r"))]
638 [(set_attr "type" "compare")
639 (set_attr "length" "4,8")])
642 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
643 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
645 (clobber (match_scratch:DI 2 ""))]
646 "TARGET_POWERPC64 && reload_completed"
648 (sign_extend:DI (match_dup 1)))
650 (compare:CC (match_dup 2)
655 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
656 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
658 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
659 (sign_extend:DI (match_dup 1)))]
664 [(set_attr "type" "compare")
665 (set_attr "length" "4,8")])
668 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
669 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
671 (set (match_operand:DI 0 "gpc_reg_operand" "")
672 (sign_extend:DI (match_dup 1)))]
673 "TARGET_POWERPC64 && reload_completed"
675 (sign_extend:DI (match_dup 1)))
677 (compare:CC (match_dup 0)
681 (define_expand "zero_extendsidi2"
682 [(set (match_operand:DI 0 "gpc_reg_operand" "")
683 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
688 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
689 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
694 [(set_attr "type" "load,*")])
697 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
698 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
700 (clobber (match_scratch:DI 2 "=r,r"))]
705 [(set_attr "type" "compare")
706 (set_attr "length" "4,8")])
709 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
710 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
712 (clobber (match_scratch:DI 2 ""))]
713 "TARGET_POWERPC64 && reload_completed"
715 (zero_extend:DI (match_dup 1)))
717 (compare:CC (match_dup 2)
722 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
723 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
725 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
726 (zero_extend:DI (match_dup 1)))]
731 [(set_attr "type" "compare")
732 (set_attr "length" "4,8")])
735 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
736 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
738 (set (match_operand:DI 0 "gpc_reg_operand" "")
739 (zero_extend:DI (match_dup 1)))]
740 "TARGET_POWERPC64 && reload_completed"
742 (zero_extend:DI (match_dup 1)))
744 (compare:CC (match_dup 0)
748 (define_expand "extendsidi2"
749 [(set (match_operand:DI 0 "gpc_reg_operand" "")
750 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
755 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
756 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
761 [(set_attr "type" "load,*")])
764 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
765 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
767 (clobber (match_scratch:DI 2 "=r,r"))]
772 [(set_attr "type" "compare")
773 (set_attr "length" "4,8")])
776 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
777 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
779 (clobber (match_scratch:DI 2 ""))]
780 "TARGET_POWERPC64 && reload_completed"
782 (sign_extend:DI (match_dup 1)))
784 (compare:CC (match_dup 2)
789 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
790 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
792 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
793 (sign_extend:DI (match_dup 1)))]
798 [(set_attr "type" "compare")
799 (set_attr "length" "4,8")])
802 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
803 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
805 (set (match_operand:DI 0 "gpc_reg_operand" "")
806 (sign_extend:DI (match_dup 1)))]
807 "TARGET_POWERPC64 && reload_completed"
809 (sign_extend:DI (match_dup 1)))
811 (compare:CC (match_dup 0)
815 (define_expand "zero_extendqisi2"
816 [(set (match_operand:SI 0 "gpc_reg_operand" "")
817 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
822 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
823 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
827 {rlinm|rlwinm} %0,%1,0,0xff"
828 [(set_attr "type" "load,*")])
831 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
832 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
834 (clobber (match_scratch:SI 2 "=r,r"))]
837 {andil.|andi.} %2,%1,0xff
839 [(set_attr "type" "compare")
840 (set_attr "length" "4,8")])
843 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
844 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
846 (clobber (match_scratch:SI 2 ""))]
849 (zero_extend:SI (match_dup 1)))
851 (compare:CC (match_dup 2)
856 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
857 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
859 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
860 (zero_extend:SI (match_dup 1)))]
863 {andil.|andi.} %0,%1,0xff
865 [(set_attr "type" "compare")
866 (set_attr "length" "4,8")])
869 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
870 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
872 (set (match_operand:SI 0 "gpc_reg_operand" "")
873 (zero_extend:SI (match_dup 1)))]
876 (zero_extend:SI (match_dup 1)))
878 (compare:CC (match_dup 0)
882 (define_expand "extendqisi2"
883 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
884 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
889 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
890 else if (TARGET_POWER)
891 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
893 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
897 (define_insn "extendqisi2_ppc"
898 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
899 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
904 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
905 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
907 (clobber (match_scratch:SI 2 "=r,r"))]
912 [(set_attr "type" "compare")
913 (set_attr "length" "4,8")])
916 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
917 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
919 (clobber (match_scratch:SI 2 ""))]
920 "TARGET_POWERPC && reload_completed"
922 (sign_extend:SI (match_dup 1)))
924 (compare:CC (match_dup 2)
929 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
930 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
932 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
933 (sign_extend:SI (match_dup 1)))]
938 [(set_attr "type" "compare")
939 (set_attr "length" "4,8")])
942 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
943 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
945 (set (match_operand:SI 0 "gpc_reg_operand" "")
946 (sign_extend:SI (match_dup 1)))]
947 "TARGET_POWERPC && reload_completed"
949 (sign_extend:SI (match_dup 1)))
951 (compare:CC (match_dup 0)
955 (define_expand "extendqisi2_power"
956 [(parallel [(set (match_dup 2)
957 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
959 (clobber (scratch:SI))])
960 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
961 (ashiftrt:SI (match_dup 2)
963 (clobber (scratch:SI))])]
966 { operands[1] = gen_lowpart (SImode, operands[1]);
967 operands[2] = gen_reg_rtx (SImode); }")
969 (define_expand "extendqisi2_no_power"
971 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
973 (set (match_operand:SI 0 "gpc_reg_operand" "")
974 (ashiftrt:SI (match_dup 2)
976 "! TARGET_POWER && ! TARGET_POWERPC"
978 { operands[1] = gen_lowpart (SImode, operands[1]);
979 operands[2] = gen_reg_rtx (SImode); }")
981 (define_expand "zero_extendqihi2"
982 [(set (match_operand:HI 0 "gpc_reg_operand" "")
983 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
988 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
989 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
993 {rlinm|rlwinm} %0,%1,0,0xff"
994 [(set_attr "type" "load,*")])
997 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
998 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1000 (clobber (match_scratch:HI 2 "=r,r"))]
1003 {andil.|andi.} %2,%1,0xff
1005 [(set_attr "type" "compare")
1006 (set_attr "length" "4,8")])
1009 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1010 (compare:CC (zero_extend:HI (match_operand:HI 1 "gpc_reg_operand" ""))
1012 (clobber (match_scratch:SI 2 ""))]
1015 (zero_extend:SI (match_dup 1)))
1017 (compare:CC (match_dup 3)
1023 if (GET_CODE (operands[2]) == REG)
1028 else if (GET_CODE (operands[2]) == SUBREG)
1030 reg = SUBREG_REG (operands[2]);
1031 offset = SUBREG_WORD (operands[2]);
1036 operands[3] = gen_rtx_SUBREG (SImode, reg, offset);
1040 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1041 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1043 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1044 (zero_extend:HI (match_dup 1)))]
1047 {andil.|andi.} %0,%1,0xff
1049 [(set_attr "type" "compare")
1050 (set_attr "length" "4,8")])
1053 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1054 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1056 (set (match_operand:HI 0 "gpc_reg_operand" "")
1057 (zero_extend:HI (match_dup 1)))]
1060 (zero_extend:HI (match_dup 1)))
1062 (compare:CC (match_dup 3)
1068 if (GET_CODE (operands[0]) == REG)
1073 else if (GET_CODE (operands[2]) == SUBREG)
1075 reg = SUBREG_REG (operands[2]);
1076 offset = SUBREG_WORD (operands[2]);
1081 operands[3] = gen_rtx_SUBREG (SImode, reg, offset);
1084 (define_expand "extendqihi2"
1085 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
1086 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
1091 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
1092 else if (TARGET_POWER)
1093 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
1095 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
1099 (define_insn "extendqihi2_ppc"
1100 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1101 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1106 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1107 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1109 (clobber (match_scratch:HI 2 "=r,r"))]
1114 [(set_attr "type" "compare")
1115 (set_attr "length" "4,8")])
1118 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1119 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1121 (clobber (match_scratch:HI 2 ""))]
1122 "TARGET_POWERPC && reload_completed"
1124 (zero_extend:HI (match_dup 1)))
1126 (compare:CC (match_dup 3)
1132 if (GET_CODE (operands[2]) == REG)
1137 else if (GET_CODE (operands[2]) == SUBREG)
1139 reg = SUBREG_REG (operands[2]);
1140 offset = SUBREG_WORD (operands[2]);
1145 operands[3] = gen_rtx_SUBREG (SImode, reg, offset);
1149 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1150 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1152 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1153 (sign_extend:HI (match_dup 1)))]
1158 [(set_attr "type" "compare")
1159 (set_attr "length" "4,8")])
1162 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1163 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1165 (set (match_operand:HI 0 "gpc_reg_operand" "")
1166 (sign_extend:HI (match_dup 1)))]
1167 "TARGET_POWERPC && reload_completed"
1169 (zero_extend:HI (match_dup 1)))
1171 (compare:CC (match_dup 3)
1177 if (GET_CODE (operands[0]) == REG)
1182 else if (GET_CODE (operands[0]) == SUBREG)
1184 reg = SUBREG_REG (operands[0]);
1185 offset = SUBREG_WORD (operands[0]);
1190 operands[3] = gen_rtx_SUBREG (SImode, reg, offset);
1193 (define_expand "extendqihi2_power"
1194 [(parallel [(set (match_dup 2)
1195 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1197 (clobber (scratch:SI))])
1198 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
1199 (ashiftrt:SI (match_dup 2)
1201 (clobber (scratch:SI))])]
1204 { operands[0] = gen_lowpart (SImode, operands[0]);
1205 operands[1] = gen_lowpart (SImode, operands[1]);
1206 operands[2] = gen_reg_rtx (SImode); }")
1208 (define_expand "extendqihi2_no_power"
1210 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1212 (set (match_operand:HI 0 "gpc_reg_operand" "")
1213 (ashiftrt:SI (match_dup 2)
1215 "! TARGET_POWER && ! TARGET_POWERPC"
1217 { operands[0] = gen_lowpart (SImode, operands[0]);
1218 operands[1] = gen_lowpart (SImode, operands[1]);
1219 operands[2] = gen_reg_rtx (SImode); }")
1221 (define_expand "zero_extendhisi2"
1222 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1223 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1229 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1233 {rlinm|rlwinm} %0,%1,0,0xffff"
1234 [(set_attr "type" "load,*")])
1237 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1238 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1240 (clobber (match_scratch:SI 2 "=r,r"))]
1243 {andil.|andi.} %2,%1,0xffff
1245 [(set_attr "type" "compare")
1246 (set_attr "length" "4,8")])
1249 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1250 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1252 (clobber (match_scratch:SI 2 ""))]
1255 (zero_extend:SI (match_dup 1)))
1257 (compare:CC (match_dup 2)
1262 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1263 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1265 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1266 (zero_extend:SI (match_dup 1)))]
1269 {andil.|andi.} %0,%1,0xffff
1271 [(set_attr "type" "compare")
1272 (set_attr "length" "4,8")])
1275 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1276 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1278 (set (match_operand:SI 0 "gpc_reg_operand" "")
1279 (zero_extend:SI (match_dup 1)))]
1282 (zero_extend:SI (match_dup 1)))
1284 (compare:CC (match_dup 0)
1288 (define_expand "extendhisi2"
1289 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1290 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1295 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1296 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1301 [(set_attr "type" "load,*")])
1304 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1305 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1307 (clobber (match_scratch:SI 2 "=r,r"))]
1310 {exts.|extsh.} %2,%1
1312 [(set_attr "type" "compare")
1313 (set_attr "length" "4,8")])
1316 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "=x,?y")
1317 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1319 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1320 (sign_extend:SI (match_dup 1)))]
1323 {exts.|extsh.} %0,%1
1325 [(set_attr "type" "compare")
1326 (set_attr "length" "4,8")])
1329 [(set (match_operand:CC 2 "cc_reg_operand" "")
1330 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1332 (set (match_operand:SI 0 "gpc_reg_operand" "")
1333 (sign_extend:SI (match_dup 1)))]
1336 (sign_extend:SI (match_dup 1)))
1338 (compare:CC (match_dup 0)
1343 ;; Fixed-point arithmetic insns.
1345 ;; Discourage ai/addic because of carry but provide it in an alternative
1346 ;; allowing register zero as source.
1347 (define_expand "addsi3"
1348 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1349 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1350 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1354 if (GET_CODE (operands[2]) == CONST_INT && !add_operand (operands[2], SImode))
1356 rtx tmp = ((reload_in_progress || reload_completed
1357 || rtx_equal_p (operands[0], operands[1]))
1358 ? operands[0] : gen_reg_rtx (SImode));
1360 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
1361 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
1364 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
1366 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (high)));
1367 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1372 (define_insn "*addsi3_internal1"
1373 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1374 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1375 (match_operand:SI 2 "add_operand" "r,I,I,J")))]
1379 {cal %0,%2(%1)|addi %0,%1,%2}
1381 {cau|addis} %0,%1,%v2"
1382 [(set_attr "length" "4,4,4,4")])
1384 (define_insn "*addsi3_internal2"
1385 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1386 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1387 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1389 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1392 {cax.|add.} %3,%1,%2
1393 {ai.|addic.} %3,%1,%2
1396 [(set_attr "type" "compare")
1397 (set_attr "length" "4,4,8,8")])
1400 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1401 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1402 (match_operand:SI 2 "reg_or_short_operand" ""))
1404 (clobber (match_scratch:SI 3 ""))]
1407 (plus:SI (match_dup 1)
1410 (compare:CC (match_dup 3)
1414 (define_insn "*addsi3_internal3"
1415 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1416 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1417 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1419 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1420 (plus:SI (match_dup 1)
1424 {cax.|add.} %0,%1,%2
1425 {ai.|addic.} %0,%1,%2
1428 [(set_attr "type" "compare")
1429 (set_attr "length" "4,4,8,8")])
1432 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1433 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1434 (match_operand:SI 2 "reg_or_short_operand" ""))
1436 (set (match_operand:SI 0 "gpc_reg_operand" "")
1437 (plus:SI (match_dup 1) (match_dup 2)))]
1440 (plus:SI (match_dup 1)
1443 (compare:CC (match_dup 0)
1447 ;; Split an add that we can't do in one insn into two insns, each of which
1448 ;; does one 16-bit part. This is used by combine. Note that the low-order
1449 ;; add should be last in case the result gets used in an address.
1452 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1453 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1454 (match_operand:SI 2 "non_add_cint_operand" "")))]
1456 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1457 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1460 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
1461 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
1464 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
1466 operands[3] = GEN_INT (high);
1467 operands[4] = GEN_INT (low);
1470 (define_insn "one_cmplsi2"
1471 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1472 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1477 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1478 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1480 (clobber (match_scratch:SI 2 "=r,r"))]
1485 [(set_attr "type" "compare")
1486 (set_attr "length" "4,8")])
1489 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1490 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1492 (clobber (match_scratch:SI 2 ""))]
1495 (not:SI (match_dup 1)))
1497 (compare:CC (match_dup 2)
1502 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1503 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1505 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1506 (not:SI (match_dup 1)))]
1511 [(set_attr "type" "compare")
1512 (set_attr "length" "4,8")])
1515 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1516 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1518 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1519 (not:SI (match_dup 1)))]
1522 (not:SI (match_dup 1)))
1524 (compare:CC (match_dup 0)
1529 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1530 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1531 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1533 "{sf%I1|subf%I1c} %0,%2,%1")
1536 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1537 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1538 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1545 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1546 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1547 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1549 (clobber (match_scratch:SI 3 "=r,r"))]
1552 {sf.|subfc.} %3,%2,%1
1554 [(set_attr "type" "compare")
1555 (set_attr "length" "4,8")])
1558 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1559 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1560 (match_operand:SI 2 "gpc_reg_operand" ""))
1562 (clobber (match_scratch:SI 3 ""))]
1563 "! TARGET_POWERPC && reload_completed"
1565 (minus:SI (match_dup 1)
1568 (compare:CC (match_dup 3)
1573 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1574 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1575 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1577 (clobber (match_scratch:SI 3 "=r,r"))]
1582 [(set_attr "type" "compare")
1583 (set_attr "length" "4,8")])
1586 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1587 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1588 (match_operand:SI 2 "gpc_reg_operand" ""))
1590 (clobber (match_scratch:SI 3 ""))]
1591 "TARGET_POWERPC && reload_completed"
1593 (minus:SI (match_dup 1)
1596 (compare:CC (match_dup 3)
1601 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1602 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1603 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1605 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1606 (minus:SI (match_dup 1) (match_dup 2)))]
1609 {sf.|subfc.} %0,%2,%1
1611 [(set_attr "type" "compare")
1612 (set_attr "length" "4,8")])
1615 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1616 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1617 (match_operand:SI 2 "gpc_reg_operand" ""))
1619 (set (match_operand:SI 0 "gpc_reg_operand" "")
1620 (minus:SI (match_dup 1)
1624 (minus:SI (match_dup 1)
1627 (compare:CC (match_dup 0)
1632 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1633 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1634 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1636 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1637 (minus:SI (match_dup 1)
1641 [(set_attr "type" "compare")
1642 (set_attr "length" "4,8")])
1645 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1646 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1647 (match_operand:SI 2 "reg_or_short_operand" ""))
1649 (set (match_operand:SI 0 "gpc_reg_operand" "")
1650 (minus:SI (match_dup 1)
1652 "TARGET_POWERPC && reload_completed"
1654 (minus:SI (match_dup 1)
1657 (compare:CC (match_dup 0)
1661 (define_expand "subsi3"
1662 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1663 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1664 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1668 if (GET_CODE (operands[2]) == CONST_INT)
1670 emit_insn (gen_addsi3 (operands[0], operands[1],
1671 negate_rtx (SImode, operands[2])));
1676 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1677 ;; instruction and some auxiliary computations. Then we just have a single
1678 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1681 (define_expand "sminsi3"
1683 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1684 (match_operand:SI 2 "reg_or_short_operand" ""))
1686 (minus:SI (match_dup 2) (match_dup 1))))
1687 (set (match_operand:SI 0 "gpc_reg_operand" "")
1688 (minus:SI (match_dup 2) (match_dup 3)))]
1691 { operands[3] = gen_reg_rtx (SImode); }")
1694 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1695 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1696 (match_operand:SI 2 "reg_or_short_operand" "")))
1697 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1700 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1702 (minus:SI (match_dup 2) (match_dup 1))))
1703 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1706 (define_expand "smaxsi3"
1708 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1709 (match_operand:SI 2 "reg_or_short_operand" ""))
1711 (minus:SI (match_dup 2) (match_dup 1))))
1712 (set (match_operand:SI 0 "gpc_reg_operand" "")
1713 (plus:SI (match_dup 3) (match_dup 1)))]
1716 { operands[3] = gen_reg_rtx (SImode); }")
1719 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1720 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1721 (match_operand:SI 2 "reg_or_short_operand" "")))
1722 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1725 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1727 (minus:SI (match_dup 2) (match_dup 1))))
1728 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1731 (define_expand "uminsi3"
1732 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1734 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1736 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1738 (minus:SI (match_dup 4) (match_dup 3))))
1739 (set (match_operand:SI 0 "gpc_reg_operand" "")
1740 (minus:SI (match_dup 2) (match_dup 3)))]
1744 operands[3] = gen_reg_rtx (SImode);
1745 operands[4] = gen_reg_rtx (SImode);
1746 operands[5] = GEN_INT (-2147483647 - 1);
1749 (define_expand "umaxsi3"
1750 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1752 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1754 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1756 (minus:SI (match_dup 4) (match_dup 3))))
1757 (set (match_operand:SI 0 "gpc_reg_operand" "")
1758 (plus:SI (match_dup 3) (match_dup 1)))]
1762 operands[3] = gen_reg_rtx (SImode);
1763 operands[4] = gen_reg_rtx (SImode);
1764 operands[5] = GEN_INT (-2147483647 - 1);
1768 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1769 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1770 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1772 (minus:SI (match_dup 2) (match_dup 1))))]
1777 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1779 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1780 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1782 (minus:SI (match_dup 2) (match_dup 1)))
1784 (clobber (match_scratch:SI 3 "=r,r"))]
1789 [(set_attr "type" "delayed_compare")
1790 (set_attr "length" "4,8")])
1793 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "=x,?y")
1795 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1796 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1798 (minus:SI (match_dup 2) (match_dup 1)))
1800 (clobber (match_scratch:SI 3 "=r,r"))]
1801 "TARGET_POWER && reload_completed"
1803 (if_then_else:SI (gt (match_dup 1)
1806 (minus:SI (match_dup 2)
1809 (compare:CC (match_dup 3)
1814 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1816 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1817 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1819 (minus:SI (match_dup 2) (match_dup 1)))
1821 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1822 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1824 (minus:SI (match_dup 2) (match_dup 1))))]
1827 [(set_attr "type" "delayed_compare")])
1830 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "=x,?y")
1832 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1833 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1835 (minus:SI (match_dup 2) (match_dup 1)))
1837 (set (match_operand:SI 0 "gpc_reg_operand" "")
1838 (if_then_else:SI (gt (match_dup 1)
1841 (minus:SI (match_dup 2)
1843 "TARGET_POWER && reload_completed"
1845 (if_then_else:SI (gt (match_dup 1)
1848 (minus:SI (match_dup 2)
1851 (compare:CC (match_dup 0)
1855 ;; We don't need abs with condition code because such comparisons should
1857 (define_expand "abssi2"
1858 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1859 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1865 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1870 (define_insn "abssi2_power"
1871 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1872 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1876 (define_insn "abssi2_nopower"
1877 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1878 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1879 (clobber (match_scratch:SI 2 "=&r,&r"))]
1883 return (TARGET_POWERPC)
1884 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0\"
1885 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%2,%0\";
1887 [(set_attr "length" "12")])
1890 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1891 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1892 (clobber (match_scratch:SI 2 "=&r,&r"))]
1893 "!TARGET_POWER && reload_completed"
1894 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1895 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1896 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1899 (define_insn "*nabs_power"
1900 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1901 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1905 (define_insn "*nabs_no_power"
1906 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1907 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1908 (clobber (match_scratch:SI 2 "=&r,&r"))]
1912 return (TARGET_POWERPC)
1913 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2\"
1914 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%0,%2\";
1916 [(set_attr "length" "12")])
1919 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1920 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1921 (clobber (match_scratch:SI 2 "=&r,&r"))]
1922 "!TARGET_POWER && reload_completed"
1923 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1924 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1925 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1928 (define_insn "negsi2"
1929 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1930 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1935 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1936 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1938 (clobber (match_scratch:SI 2 "=r,r"))]
1943 [(set_attr "type" "compare")
1944 (set_attr "length" "4,8")])
1947 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1948 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1950 (clobber (match_scratch:SI 2 ""))]
1953 (neg:SI (match_dup 1)))
1955 (compare:CC (match_dup 2)
1960 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1961 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1963 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1964 (neg:SI (match_dup 1)))]
1969 [(set_attr "type" "compare")
1970 (set_attr "length" "4,8")])
1973 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1974 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1976 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1977 (neg:SI (match_dup 1)))]
1980 (neg:SI (match_dup 1)))
1982 (compare:CC (match_dup 0)
1986 (define_insn "ffssi2"
1987 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
1988 (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1990 "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
1991 [(set_attr "length" "16")])
1993 (define_expand "mulsi3"
1994 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1995 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1996 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2001 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2003 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2007 (define_insn "mulsi3_mq"
2008 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2009 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2010 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2011 (clobber (match_scratch:SI 3 "=q,q"))]
2014 {muls|mullw} %0,%1,%2
2015 {muli|mulli} %0,%1,%2"
2016 [(set_attr "type" "imul")])
2018 (define_insn "mulsi3_no_mq"
2019 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2020 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2021 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2024 {muls|mullw} %0,%1,%2
2025 {muli|mulli} %0,%1,%2"
2026 [(set_attr "type" "imul")])
2029 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2030 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2031 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2033 (clobber (match_scratch:SI 3 "=r,r"))
2034 (clobber (match_scratch:SI 4 "=q,q"))]
2037 {muls.|mullw.} %3,%1,%2
2039 [(set_attr "type" "delayed_compare")
2040 (set_attr "length" "4,8")])
2043 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2044 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2045 (match_operand:SI 2 "gpc_reg_operand" ""))
2047 (clobber (match_scratch:SI 3 ""))
2048 (clobber (match_scratch:SI 4 ""))]
2049 "TARGET_POWER && reload_completed"
2050 [(parallel [(set (match_dup 3)
2051 (mult:SI (match_dup 1)
2053 (clobber (match_dup 4))])
2055 (compare:CC (match_dup 3)
2060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2061 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2062 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2064 (clobber (match_scratch:SI 3 "=r,r"))]
2067 {muls.|mullw.} %3,%1,%2
2069 [(set_attr "type" "delayed_compare")
2070 (set_attr "length" "4,8")])
2073 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2074 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2075 (match_operand:SI 2 "gpc_reg_operand" ""))
2077 (clobber (match_scratch:SI 3 ""))]
2080 (mult:SI (match_dup 1)
2083 (compare:CC (match_dup 3)
2088 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2089 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2090 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2092 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2093 (mult:SI (match_dup 1)
2095 (clobber (match_scratch:SI 4 "=q,q"))]
2098 {muls.|mullw.} %0,%1,%2
2100 [(set_attr "type" "delayed_compare")
2101 (set_attr "length" "4,8")])
2104 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2105 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2106 (match_operand:SI 2 "gpc_reg_operand" ""))
2108 (set (match_operand:SI 0 "gpc_reg_operand" "")
2109 (mult:SI (match_dup 1)
2111 (clobber (match_scratch:SI 4 ""))]
2112 "TARGET_POWER && reload_completed"
2113 [(parallel [(set (match_dup 0)
2114 (mult:SI (match_dup 1)
2116 (clobber (match_dup 4))])
2118 (compare:CC (match_dup 0)
2123 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2124 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2125 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2127 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2128 (mult:SI (match_dup 1) (match_dup 2)))]
2131 {muls.|mullw.} %0,%1,%2
2133 [(set_attr "type" "delayed_compare")
2134 (set_attr "length" "4,8")])
2137 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2138 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2139 (match_operand:SI 2 "gpc_reg_operand" ""))
2141 (set (match_operand:SI 0 "gpc_reg_operand" "")
2142 (mult:SI (match_dup 1)
2144 "!TARGET_POWER && reload_completed"
2146 (mult:SI (match_dup 1)
2149 (compare:CC (match_dup 0)
2153 ;; Operand 1 is divided by operand 2; quotient goes to operand
2154 ;; 0 and remainder to operand 3.
2155 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2157 (define_expand "divmodsi4"
2158 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2159 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2160 (match_operand:SI 2 "gpc_reg_operand" "")))
2161 (set (match_operand:SI 3 "gpc_reg_operand" "")
2162 (mod:SI (match_dup 1) (match_dup 2)))])]
2163 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2166 if (! TARGET_POWER && ! TARGET_POWERPC)
2168 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2169 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2170 emit_insn (gen_divss_call ());
2171 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2172 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2178 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2179 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2180 (match_operand:SI 2 "gpc_reg_operand" "r")))
2181 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
2182 (mod:SI (match_dup 1) (match_dup 2)))]
2185 [(set_attr "type" "idiv")])
2187 (define_expand "udivsi3"
2188 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2189 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2190 (match_operand:SI 2 "gpc_reg_operand" "")))]
2191 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2194 if (! TARGET_POWER && ! TARGET_POWERPC)
2196 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2197 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2198 emit_insn (gen_quous_call ());
2199 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2202 else if (TARGET_POWER)
2204 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2209 (define_insn "udivsi3_mq"
2210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2211 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2212 (match_operand:SI 2 "gpc_reg_operand" "r")))
2213 (clobber (match_scratch:SI 3 "=q"))]
2214 "TARGET_POWERPC && TARGET_POWER"
2216 [(set_attr "type" "idiv")])
2218 (define_insn "*udivsi3_no_mq"
2219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2220 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2221 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2222 "TARGET_POWERPC && ! TARGET_POWER"
2224 [(set_attr "type" "idiv")])
2226 ;; For powers of two we can do srai/aze for divide and then adjust for
2227 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2228 ;; used; for PowerPC, force operands into register and do a normal divide;
2229 ;; for AIX common-mode, use quoss call on register operands.
2230 (define_expand "divsi3"
2231 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2232 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2233 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2237 if (GET_CODE (operands[2]) == CONST_INT
2238 && exact_log2 (INTVAL (operands[2])) >= 0)
2240 else if (TARGET_POWERPC)
2242 operands[2] = force_reg (SImode, operands[2]);
2245 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2249 else if (TARGET_POWER)
2253 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2254 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2255 emit_insn (gen_quoss_call ());
2256 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2261 (define_insn "divsi3_mq"
2262 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2263 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2264 (match_operand:SI 2 "gpc_reg_operand" "r")))
2265 (clobber (match_scratch:SI 3 "=q"))]
2266 "TARGET_POWERPC && TARGET_POWER"
2268 [(set_attr "type" "idiv")])
2270 (define_insn "*divsi3_no_mq"
2271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2272 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2273 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2274 "TARGET_POWERPC && ! TARGET_POWER"
2276 [(set_attr "type" "idiv")])
2278 (define_expand "modsi3"
2279 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2280 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2281 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2285 int i = exact_log2 (INTVAL (operands[2]));
2289 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
2292 temp1 = gen_reg_rtx (SImode);
2293 temp2 = gen_reg_rtx (SImode);
2295 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
2296 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
2297 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
2302 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2303 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2304 (match_operand:SI 2 "const_int_operand" "N")))]
2305 "exact_log2 (INTVAL (operands[2])) >= 0"
2306 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
2307 [(set_attr "length" "8")])
2310 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2311 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2312 (match_operand:SI 2 "const_int_operand" "N,N"))
2314 (clobber (match_scratch:SI 3 "=r,r"))]
2315 "exact_log2 (INTVAL (operands[2])) >= 0"
2317 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
2319 [(set_attr "type" "compare")
2320 (set_attr "length" "8,12")])
2323 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2324 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2325 (match_operand:SI 2 "const_int_operand" ""))
2327 (clobber (match_scratch:SI 3 ""))]
2328 "reload_completed && exact_log2 (INTVAL (operands[2])) >= 0"
2330 (div:SI (match_dup 1)
2333 (compare:CC (match_dup 3)
2338 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2339 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2340 (match_operand:SI 2 "const_int_operand" "N,N"))
2342 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2343 (div:SI (match_dup 1)
2345 "exact_log2 (INTVAL (operands[2])) >= 0"
2347 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2349 [(set_attr "type" "compare")
2350 (set_attr "length" "8,12")])
2353 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2354 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2355 (match_operand:SI 2 "reg_or_short_operand" ""))
2357 (set (match_operand:SI 0 "gpc_reg_operand" "")
2358 (div:SI (match_dup 1)
2362 (div:SI (match_dup 1)
2365 (compare:CC (match_dup 3)
2370 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2373 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2375 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2376 (match_operand:SI 3 "gpc_reg_operand" "r")))
2377 (set (match_operand:SI 2 "register_operand" "=*q")
2380 (zero_extend:DI (match_dup 1)) (const_int 32))
2381 (zero_extend:DI (match_dup 4)))
2385 [(set_attr "type" "idiv")])
2387 ;; To do unsigned divide we handle the cases of the divisor looking like a
2388 ;; negative number. If it is a constant that is less than 2**31, we don't
2389 ;; have to worry about the branches. So make a few subroutines here.
2391 ;; First comes the normal case.
2392 (define_expand "udivmodsi4_normal"
2393 [(set (match_dup 4) (const_int 0))
2394 (parallel [(set (match_operand:SI 0 "" "")
2395 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2397 (zero_extend:DI (match_operand:SI 1 "" "")))
2398 (match_operand:SI 2 "" "")))
2399 (set (match_operand:SI 3 "" "")
2400 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2402 (zero_extend:DI (match_dup 1)))
2406 { operands[4] = gen_reg_rtx (SImode); }")
2408 ;; This handles the branches.
2409 (define_expand "udivmodsi4_tests"
2410 [(set (match_operand:SI 0 "" "") (const_int 0))
2411 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2412 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2413 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2414 (label_ref (match_operand:SI 4 "" "")) (pc)))
2415 (set (match_dup 0) (const_int 1))
2416 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2417 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2418 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2419 (label_ref (match_dup 4)) (pc)))]
2422 { operands[5] = gen_reg_rtx (CCUNSmode);
2423 operands[6] = gen_reg_rtx (CCmode);
2426 (define_expand "udivmodsi4"
2427 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2428 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2429 (match_operand:SI 2 "reg_or_cint_operand" "")))
2430 (set (match_operand:SI 3 "gpc_reg_operand" "")
2431 (umod:SI (match_dup 1) (match_dup 2)))])]
2439 if (! TARGET_POWERPC)
2441 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2442 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2443 emit_insn (gen_divus_call ());
2444 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2445 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2452 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2454 operands[2] = force_reg (SImode, operands[2]);
2455 label = gen_label_rtx ();
2456 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2457 operands[3], label));
2460 operands[2] = force_reg (SImode, operands[2]);
2462 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2470 ;; AIX architecture-independent common-mode multiply (DImode),
2471 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2472 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2473 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2474 ;; assumed unused if generating common-mode, so ignore.
2475 (define_insn "mulh_call"
2478 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2479 (sign_extend:DI (reg:SI 4)))
2481 (clobber (match_scratch:SI 0 "=l"))]
2482 "! TARGET_POWER && ! TARGET_POWERPC"
2484 [(set_attr "type" "imul")])
2486 (define_insn "mull_call"
2488 (mult:DI (sign_extend:DI (reg:SI 3))
2489 (sign_extend:DI (reg:SI 4))))
2490 (clobber (match_scratch:SI 0 "=l"))
2491 (clobber (reg:SI 0))]
2492 "! TARGET_POWER && ! TARGET_POWERPC"
2494 [(set_attr "type" "imul")])
2496 (define_insn "divss_call"
2498 (div:SI (reg:SI 3) (reg:SI 4)))
2500 (mod:SI (reg:SI 3) (reg:SI 4)))
2501 (clobber (match_scratch:SI 0 "=l"))
2502 (clobber (reg:SI 0))]
2503 "! TARGET_POWER && ! TARGET_POWERPC"
2505 [(set_attr "type" "idiv")])
2507 (define_insn "divus_call"
2509 (udiv:SI (reg:SI 3) (reg:SI 4)))
2511 (umod:SI (reg:SI 3) (reg:SI 4)))
2512 (clobber (match_scratch:SI 0 "=l"))
2513 (clobber (reg:SI 0))
2514 (clobber (match_scratch:CC 1 "=x"))
2515 (clobber (reg:CC 69))]
2516 "! TARGET_POWER && ! TARGET_POWERPC"
2518 [(set_attr "type" "idiv")])
2520 (define_insn "quoss_call"
2522 (div:SI (reg:SI 3) (reg:SI 4)))
2523 (clobber (match_scratch:SI 0 "=l"))]
2524 "! TARGET_POWER && ! TARGET_POWERPC"
2526 [(set_attr "type" "idiv")])
2528 (define_insn "quous_call"
2530 (udiv:SI (reg:SI 3) (reg:SI 4)))
2531 (clobber (match_scratch:SI 0 "=l"))
2532 (clobber (reg:SI 0))
2533 (clobber (match_scratch:CC 1 "=x"))
2534 (clobber (reg:CC 69))]
2535 "! TARGET_POWER && ! TARGET_POWERPC"
2537 [(set_attr "type" "idiv")])
2539 ;; Logical instructions
2540 (define_expand "andsi3"
2541 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2542 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2543 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
2544 (clobber (match_scratch:CC 3 "=X,X,x,x"))])]
2548 ;; If cr0 isn't available, and we want to do an andi, load the register into
2549 ;; the destination first.
2551 (define_insn "andsi3_internal1"
2552 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,&??r,&??r")
2553 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
2554 (match_operand:SI 2 "and_operand" "?r,L,K,J,K,J")))
2555 (clobber (match_operand:CC 3 "scratch_operand" "=X,X,x,x,X,X"))]
2559 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2560 {andil.|andi.} %0,%1,%b2
2561 {andiu.|andis.} %0,%1,%u2
2564 [(set_attr "length" "4,4,4,4,8,8")])
2567 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2568 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2569 (match_operand:SI 2 "const_int_operand" "")))
2570 (clobber (scratch:CC))]
2574 (parallel [(set (match_dup 0)
2575 (and:SI (match_dup 0)
2577 (clobber (scratch:CC))])]
2580 ;; Note to set cr's other than cr0 we do the and immediate and then
2581 ;; the test again -- this avoids a mcrf which on the higher end
2582 ;; machines causes an execution serialization
2584 (define_insn "*andsi3_internal2"
2585 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y,???y,???y")
2586 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
2587 (match_operand:SI 2 "and_operand" "r,K,J,L,r,K,J,L,K,L"))
2589 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r,&r,&r"))
2590 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X,X,X"))]
2594 {andil.|andi.} %3,%1,%b2
2595 {andiu.|andis.} %3,%1,%u2
2596 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2603 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare")
2604 (set_attr "length" "4,4,4,4,8,12,12,8,16,16")])
2607 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2608 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2609 (match_operand:SI 2 "and_operand" ""))
2611 (clobber (match_scratch:SI 3 ""))
2612 (clobber (match_scratch:CC 4 ""))]
2614 [(parallel [(set (match_dup 3)
2615 (and:SI (match_dup 1)
2617 (clobber (match_dup 4))])
2619 (compare:CC (match_dup 3)
2623 (define_insn "*andsi3_internal3"
2624 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y,???y,???y")
2625 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
2626 (match_operand:SI 2 "and_operand" "r,K,J,L,r,K,J,L,K,J"))
2628 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,&r,&r")
2629 (and:SI (match_dup 1)
2631 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X,X,X"))]
2635 {andil.|andi.} %0,%1,%b2
2636 {andiu.|andis.} %0,%1,%u2
2637 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2644 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare")])
2647 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2648 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2649 (match_operand:SI 2 "and_operand" ""))
2651 (set (match_operand:SI 0 "gpc_reg_operand" "")
2652 (and:SI (match_dup 1)
2654 (clobber (match_scratch:CC 4 ""))]
2656 [(parallel [(set (match_dup 0)
2657 (and:SI (match_dup 1)
2659 (clobber (match_dup 4))])
2661 (compare:CC (match_dup 0)
2665 (define_expand "iorsi3"
2666 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2667 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2668 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2672 if (GET_CODE (operands[2]) == CONST_INT
2673 && !logical_operand (operands[2], SImode))
2675 HOST_WIDE_INT value = INTVAL (operands[2]);
2676 rtx tmp = ((reload_in_progress || reload_completed
2677 || rtx_equal_p (operands[0], operands[1]))
2678 ? operands[0] : gen_reg_rtx (SImode));
2680 emit_insn (gen_iorsi3 (tmp, operands[1],
2681 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2682 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2687 (define_insn "*iorsi3_internal1"
2688 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2689 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2690 (match_operand:SI 2 "logical_operand" "r,K,J")))]
2694 {oril|ori} %0,%1,%b2
2695 {oriu|oris} %0,%1,%u2"
2696 [(set_attr "length" "4,4,4")])
2698 (define_insn "*iorsi3_internal2"
2699 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2700 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2701 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2703 (clobber (match_scratch:SI 3 "=r,r"))]
2708 [(set_attr "type" "compare")
2709 (set_attr "length" "4,8")])
2712 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2713 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2714 (match_operand:SI 2 "gpc_reg_operand" ""))
2716 (clobber (match_scratch:SI 3 ""))]
2719 (ior:SI (match_dup 1)
2722 (compare:CC (match_dup 3)
2726 (define_insn "*iorsi3_internal3"
2727 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2728 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2729 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2731 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2732 (ior:SI (match_dup 1)
2736 [(set_attr "type" "compare")])
2739 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2740 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2741 (match_operand:SI 2 "gpc_reg_operand" ""))
2743 (set (match_operand:SI 0 "gpc_reg_operand" "")
2744 (ior:SI (match_dup 1) (match_dup 2)))]
2747 (ior:SI (match_dup 1)
2750 (compare:CC (match_dup 0)
2754 ;; Split an IOR that we can't do in one insn into two insns, each of which
2755 ;; does one 16-bit part. This is used by combine.
2758 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2759 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2760 (match_operand:SI 2 "non_logical_cint_operand" "")))]
2762 [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
2763 (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
2766 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2767 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
2770 (define_expand "xorsi3"
2771 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2772 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2773 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2777 if (GET_CODE (operands[2]) == CONST_INT
2778 && !logical_operand (operands[2], SImode))
2780 HOST_WIDE_INT value = INTVAL (operands[2]);
2781 rtx tmp = ((reload_in_progress || reload_completed
2782 || rtx_equal_p (operands[0], operands[1]))
2783 ? operands[0] : gen_reg_rtx (SImode));
2785 emit_insn (gen_xorsi3 (tmp, operands[1],
2786 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2787 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2792 (define_insn "*xorsi3_internal1"
2793 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2794 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2795 (match_operand:SI 2 "logical_operand" "r,K,J")))]
2799 {xoril|xori} %0,%1,%b2
2800 {xoriu|xoris} %0,%1,%u2"
2801 [(set_attr "length" "4,4,4")])
2803 (define_insn "*xorsi3_internal2"
2804 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2805 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2806 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2808 (clobber (match_scratch:SI 3 "=r,r"))]
2813 [(set_attr "type" "compare")
2814 (set_attr "length" "4,8")])
2817 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2818 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2819 (match_operand:SI 2 "gpc_reg_operand" ""))
2821 (clobber (match_scratch:SI 3 ""))]
2824 (xor:SI (match_dup 1)
2827 (compare:CC (match_dup 3)
2831 (define_insn "*xorsi3_internal3"
2832 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2833 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2834 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2836 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2837 (xor:SI (match_dup 1)
2843 [(set_attr "type" "compare")
2844 (set_attr "length" "4,8")])
2847 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2848 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2849 (match_operand:SI 2 "gpc_reg_operand" ""))
2851 (set (match_operand:SI 0 "gpc_reg_operand" "")
2852 (xor:SI (match_dup 1) (match_dup 2)))]
2855 (xor:SI (match_dup 1)
2858 (compare:CC (match_dup 0)
2862 ;; Split an XOR that we can't do in one insn into two insns, each of which
2863 ;; does one 16-bit part. This is used by combine.
2866 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2867 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2868 (match_operand:SI 2 "non_logical_cint_operand" "")))]
2870 [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
2871 (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
2874 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2875 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
2878 (define_insn "*eqvsi3_internal1"
2879 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2880 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
2881 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
2885 (define_insn "*eqvsi3_internal2"
2886 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2887 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2888 (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2890 (clobber (match_scratch:SI 3 "=r,r"))]
2895 [(set_attr "type" "compare")
2896 (set_attr "length" "4,8")])
2899 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2900 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2901 (match_operand:SI 2 "gpc_reg_operand" "")))
2903 (clobber (match_scratch:SI 3 ""))]
2906 (not:SI (xor:SI (match_dup 1)
2909 (compare:CC (match_dup 3)
2913 (define_insn "*eqvsi3_internal3"
2914 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2915 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2916 (match_operand:SI 2 "gpc_reg_operand" "r,r")))
2918 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2919 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
2924 [(set_attr "type" "compare")
2925 (set_attr "length" "4,8")])
2928 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2929 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2930 (match_operand:SI 2 "reg_or_short_operand" "")))
2932 (set (match_operand:SI 0 "gpc_reg_operand" "")
2933 (not:SI (xor:SI (match_dup 1)
2937 (not:SI (xor:SI (match_dup 1)
2940 (compare:CC (match_dup 0)
2944 (define_insn "*andcsi3_internal1"
2945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2946 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2947 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2951 (define_insn "*andcsi3_internal2"
2952 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2953 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2954 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2956 (clobber (match_scratch:SI 3 "=r,r"))]
2961 [(set_attr "type" "compare")
2962 (set_attr "length" "4,8")])
2965 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2966 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2967 (match_operand:SI 2 "gpc_reg_operand" ""))
2969 (clobber (match_scratch:SI 3 ""))]
2972 (and:SI (not:SI (match_dup 1))
2975 (compare:CC (match_dup 3)
2979 (define_insn "*andcsi3_internal3"
2980 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2981 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2982 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2984 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2985 (and:SI (not:SI (match_dup 1))
2991 [(set_attr "type" "compare")
2992 (set_attr "length" "4,8")])
2995 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2996 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2997 (match_operand:SI 2 "gpc_reg_operand" ""))
2999 (set (match_operand:SI 0 "gpc_reg_operand" "")
3000 (and:SI (not:SI (match_dup 1))
3004 (and:SI (not:SI (match_dup 1))
3007 (compare:CC (match_dup 0)
3011 (define_insn "*iorcsi3_internal1"
3012 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3013 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3014 (match_operand:SI 2 "gpc_reg_operand" "r")))]
3018 (define_insn "*iorcsi3_internal2"
3019 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3020 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3021 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3023 (clobber (match_scratch:SI 3 "=r,r"))]
3028 [(set_attr "type" "compare")
3029 (set_attr "length" "4,8")])
3032 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3033 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3034 (match_operand:SI 2 "gpc_reg_operand" ""))
3036 (clobber (match_scratch:SI 3 ""))]
3039 (ior:SI (not:SI (match_dup 1))
3042 (compare:CC (match_dup 3)
3046 (define_insn "*iorcsi3_internal3"
3047 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3048 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3049 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3051 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3052 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
3057 [(set_attr "type" "compare")])
3060 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3061 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3062 (match_operand:SI 2 "gpc_reg_operand" ""))
3064 (set (match_operand:SI 0 "gpc_reg_operand" "")
3065 (ior:SI (not:SI (match_dup 1))
3069 (ior:SI (not:SI (match_dup 1))
3072 (compare:CC (match_dup 0)
3076 (define_insn "*nandsi3_internal1"
3077 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3078 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3079 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
3083 (define_insn "*nandsi3_internal2"
3084 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3085 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3086 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
3088 (clobber (match_scratch:SI 3 "=r,r"))]
3093 [(set_attr "type" "compare")
3094 (set_attr "length" "4,8")])
3097 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3098 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3099 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
3101 (clobber (match_scratch:SI 3 ""))]
3104 (ior:SI (not:SI (match_dup 1))
3105 (not:SI (match_dup 2))))
3107 (compare:CC (match_dup 3)
3111 (define_insn "*nandsi3_internal3"
3112 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3113 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3114 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
3116 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3117 (ior:SI (not:SI (match_dup 1))
3118 (not:SI (match_dup 2))))]
3123 [(set_attr "type" "compare")
3124 (set_attr "length" "4,8")])
3127 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3128 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3129 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
3131 (set (match_operand:SI 0 "gpc_reg_operand" "")
3132 (ior:SI (not:SI (match_dup 1))
3133 (not:SI (match_dup 2))))]
3136 (ior:SI (not:SI (match_dup 1))
3137 (not:SI (match_dup 2))))
3139 (compare:CC (match_dup 0)
3143 (define_insn "*norsi3_internal1"
3144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3145 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3146 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
3150 (define_insn "*norsi3_internal2"
3151 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3152 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3153 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
3155 (clobber (match_scratch:SI 3 "=r,r"))]
3160 [(set_attr "type" "compare")
3161 (set_attr "length" "4,8")])
3164 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3165 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3166 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
3168 (clobber (match_scratch:SI 3 ""))]
3171 (and:SI (not:SI (match_dup 1))
3172 (not:SI (match_dup 2))))
3174 (compare:CC (match_dup 3)
3178 (define_insn "*norsi3_internal3"
3179 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3180 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3181 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")))
3183 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3184 (and:SI (not:SI (match_dup 1))
3185 (not:SI (match_dup 2))))]
3190 [(set_attr "type" "compare")
3191 (set_attr "length" "4,8")])
3194 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3195 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3196 (not:SI (match_operand:SI 2 "gpc_reg_operand" "")))
3198 (set (match_operand:SI 0 "gpc_reg_operand" "")
3199 (and:SI (not:SI (match_dup 1))
3200 (not:SI (match_dup 2))))]
3203 (and:SI (not:SI (match_dup 1))
3204 (not:SI (match_dup 2))))
3206 (compare:CC (match_dup 0)
3210 ;; maskir insn. We need four forms because things might be in arbitrary
3211 ;; orders. Don't define forms that only set CR fields because these
3212 ;; would modify an input register.
3214 (define_insn "*maskir_internal1"
3215 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3216 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3217 (match_operand:SI 1 "gpc_reg_operand" "0"))
3218 (and:SI (match_dup 2)
3219 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3223 (define_insn "*maskir_internal2"
3224 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3225 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3226 (match_operand:SI 1 "gpc_reg_operand" "0"))
3227 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3232 (define_insn "*maskir_internal3"
3233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3234 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3235 (match_operand:SI 3 "gpc_reg_operand" "r"))
3236 (and:SI (not:SI (match_dup 2))
3237 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3241 (define_insn "*maskir_internal4"
3242 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3243 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3244 (match_operand:SI 2 "gpc_reg_operand" "r"))
3245 (and:SI (not:SI (match_dup 2))
3246 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3250 (define_insn "*maskir_internal5"
3251 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3253 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3254 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3255 (and:SI (match_dup 2)
3256 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3258 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3259 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3260 (and:SI (match_dup 2) (match_dup 3))))]
3265 [(set_attr "type" "compare")
3266 (set_attr "length" "4,8")])
3269 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3271 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3272 (match_operand:SI 1 "gpc_reg_operand" ""))
3273 (and:SI (match_dup 2)
3274 (match_operand:SI 3 "gpc_reg_operand" "")))
3276 (set (match_operand:SI 0 "gpc_reg_operand" "")
3277 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3278 (and:SI (match_dup 2) (match_dup 3))))]
3279 "TARGET_POWER && reload_completed"
3281 (ior:SI (and:SI (not:SI (match_dup 2))
3283 (and:SI (match_dup 2)
3286 (compare:CC (match_dup 0)
3291 (define_insn "*maskir_internal6"
3292 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3294 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3295 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3296 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3299 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3300 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3301 (and:SI (match_dup 3) (match_dup 2))))]
3306 [(set_attr "type" "compare")
3307 (set_attr "length" "4,8")])
3310 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3312 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3313 (match_operand:SI 1 "gpc_reg_operand" ""))
3314 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3317 (set (match_operand:SI 0 "gpc_reg_operand" "")
3318 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3319 (and:SI (match_dup 3) (match_dup 2))))]
3320 "TARGET_POWER && reload_completed"
3322 (ior:SI (and:SI (not:SI (match_dup 2))
3324 (and:SI (match_dup 3)
3327 (compare:CC (match_dup 0)
3331 (define_insn "*maskir_internal7"
3332 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3334 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3335 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3336 (and:SI (not:SI (match_dup 2))
3337 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3339 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3340 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3341 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3346 [(set_attr "type" "compare")
3347 (set_attr "length" "4,8")])
3350 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3352 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3353 (match_operand:SI 3 "gpc_reg_operand" ""))
3354 (and:SI (not:SI (match_dup 2))
3355 (match_operand:SI 1 "gpc_reg_operand" "")))
3357 (set (match_operand:SI 0 "gpc_reg_operand" "")
3358 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3359 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3362 (ior:SI (and:SI (match_dup 2)
3364 (and:SI (not:SI (match_dup 2))
3367 (compare:CC (match_dup 0)
3371 (define_insn "*maskir_internal8"
3372 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3374 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3375 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3376 (and:SI (not:SI (match_dup 2))
3377 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3379 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3380 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3381 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3386 [(set_attr "type" "compare")
3387 (set_attr "length" "4,8")])
3390 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3392 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3393 (match_operand:SI 2 "gpc_reg_operand" ""))
3394 (and:SI (not:SI (match_dup 2))
3395 (match_operand:SI 1 "gpc_reg_operand" "")))
3397 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3398 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3399 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3400 "TARGET_POWER && reload_completed"
3402 (ior:SI (and:SI (match_dup 3)
3404 (and:SI (not:SI (match_dup 2))
3407 (compare:CC (match_dup 0)
3412 ;; Rotate and shift insns, in all their variants. These support shifts,
3413 ;; field inserts and extracts, and various combinations thereof.
3414 (define_expand "insv"
3415 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3416 (match_operand:SI 1 "const_int_operand" "i")
3417 (match_operand:SI 2 "const_int_operand" "i"))
3418 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3422 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3423 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3424 compiler if the address of the structure is taken later. */
3425 if (GET_CODE (operands[0]) == SUBREG
3426 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3431 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3432 (match_operand:SI 1 "const_int_operand" "i")
3433 (match_operand:SI 2 "const_int_operand" "i"))
3434 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3438 int start = INTVAL (operands[2]) & 31;
3439 int size = INTVAL (operands[1]) & 31;
3441 operands[4] = GEN_INT (32 - start - size);
3442 operands[1] = GEN_INT (start + size - 1);
3443 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3447 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3448 (match_operand:SI 1 "const_int_operand" "i")
3449 (match_operand:SI 2 "const_int_operand" "i"))
3450 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3451 (match_operand:SI 4 "const_int_operand" "i")))]
3452 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3455 int shift = INTVAL (operands[4]) & 31;
3456 int start = INTVAL (operands[2]) & 31;
3457 int size = INTVAL (operands[1]) & 31;
3459 operands[4] = GEN_INT (shift - start - size);
3460 operands[1] = GEN_INT (start + size - 1);
3461 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3465 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3466 (match_operand:SI 1 "const_int_operand" "i")
3467 (match_operand:SI 2 "const_int_operand" "i"))
3468 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3469 (match_operand:SI 4 "const_int_operand" "i")))]
3470 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3473 int shift = INTVAL (operands[4]) & 31;
3474 int start = INTVAL (operands[2]) & 31;
3475 int size = INTVAL (operands[1]) & 31;
3477 operands[4] = GEN_INT (32 - shift - start - size);
3478 operands[1] = GEN_INT (start + size - 1);
3479 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3483 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3484 (match_operand:SI 1 "const_int_operand" "i")
3485 (match_operand:SI 2 "const_int_operand" "i"))
3486 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3487 (match_operand:SI 4 "const_int_operand" "i")))]
3488 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3491 int shift = INTVAL (operands[4]) & 31;
3492 int start = INTVAL (operands[2]) & 31;
3493 int size = INTVAL (operands[1]) & 31;
3495 operands[4] = GEN_INT (32 - shift - start - size);
3496 operands[1] = GEN_INT (start + size - 1);
3497 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3501 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3502 (match_operand:SI 1 "const_int_operand" "i")
3503 (match_operand:SI 2 "const_int_operand" "i"))
3504 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3505 (match_operand:SI 4 "const_int_operand" "i")
3506 (match_operand:SI 5 "const_int_operand" "i")))]
3507 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3510 int extract_start = INTVAL (operands[5]) & 31;
3511 int extract_size = INTVAL (operands[4]) & 31;
3512 int insert_start = INTVAL (operands[2]) & 31;
3513 int insert_size = INTVAL (operands[1]) & 31;
3515 /* Align extract field with insert field */
3516 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3517 operands[1] = GEN_INT (insert_start + insert_size - 1);
3518 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3522 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3523 (match_operand:DI 1 "const_int_operand" "i")
3524 (match_operand:DI 2 "const_int_operand" "i"))
3525 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3529 int start = INTVAL (operands[2]) & 63;
3530 int size = INTVAL (operands[1]) & 63;
3532 operands[2] = GEN_INT (64 - start - size);
3533 return \"rldimi %0,%3,%H2,%H1\";
3536 (define_expand "extzv"
3537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3538 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3539 (match_operand:SI 2 "const_int_operand" "i")
3540 (match_operand:SI 3 "const_int_operand" "i")))]
3544 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3545 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3546 compiler if the address of the structure is taken later. */
3547 if (GET_CODE (operands[0]) == SUBREG
3548 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3553 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3554 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3555 (match_operand:SI 2 "const_int_operand" "i")
3556 (match_operand:SI 3 "const_int_operand" "i")))]
3560 int start = INTVAL (operands[3]) & 31;
3561 int size = INTVAL (operands[2]) & 31;
3563 if (start + size >= 32)
3564 operands[3] = const0_rtx;
3566 operands[3] = GEN_INT (start + size);
3567 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3571 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3572 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3573 (match_operand:SI 2 "const_int_operand" "i,i")
3574 (match_operand:SI 3 "const_int_operand" "i,i"))
3576 (clobber (match_scratch:SI 4 "=r,r"))]
3580 int start = INTVAL (operands[3]) & 31;
3581 int size = INTVAL (operands[2]) & 31;
3583 /* Split insn if not setting cr0. */
3584 if (cc_reg_not_cr0_operand (operands[0], CCmode))
3587 /* If the bitfield being tested fits in the upper or lower half of a
3588 word, it is possible to use andiu. or andil. to test it. This is
3589 useful because the condition register set-use delay is smaller for
3590 andi[ul]. than for rlinm. This doesn't work when the starting bit
3591 position is 0 because the LT and GT bits may be set wrong. */
3593 if ((start > 0 && start + size <= 16) || start >= 16)
3595 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3596 - (1 << (16 - (start & 15) - size))));
3598 return \"{andiu.|andis.} %4,%1,%3\";
3600 return \"{andil.|andi.} %4,%1,%3\";
3603 if (start + size >= 32)
3604 operands[3] = const0_rtx;
3606 operands[3] = GEN_INT (start + size);
3607 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3609 [(set_attr "type" "compare")
3610 (set_attr "length" "4,8")])
3613 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3614 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3615 (match_operand:SI 2 "const_int_operand" "")
3616 (match_operand:SI 3 "const_int_operand" ""))
3618 (clobber (match_scratch:SI 4 ""))]
3621 (zero_extract:SI (match_dup 1)
3625 (compare:CC (match_dup 4)
3630 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3631 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3632 (match_operand:SI 2 "const_int_operand" "i,i")
3633 (match_operand:SI 3 "const_int_operand" "i,i"))
3635 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3636 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3640 int start = INTVAL (operands[3]) & 31;
3641 int size = INTVAL (operands[2]) & 31;
3643 /* Split insn if not setting cr0. */
3644 if (cc_reg_not_cr0_operand (operands[0], CCmode))
3647 if (start >= 16 && start + size == 32)
3649 operands[3] = GEN_INT ((1 << (32 - start)) - 1);
3650 return \"{andil.|andi.} %0,%1,%3\";
3653 if (start + size >= 32)
3654 operands[3] = const0_rtx;
3656 operands[3] = GEN_INT (start + size);
3657 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3659 [(set_attr "type" "delayed_compare")])
3662 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3663 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3664 (match_operand:SI 2 "const_int_operand" "")
3665 (match_operand:SI 3 "const_int_operand" ""))
3668 (zero_extract:SI (match_dup 1)
3673 (zero_extract:SI (match_dup 1)
3677 (compare:CC (match_dup 0)
3682 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3683 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3684 (match_operand:DI 2 "const_int_operand" "i")
3685 (match_operand:DI 3 "const_int_operand" "i")))]
3689 int start = INTVAL (operands[3]) & 63;
3690 int size = INTVAL (operands[2]) & 63;
3692 if (start + size >= 64)
3693 operands[3] = const0_rtx;
3695 operands[3] = GEN_INT (start + size);
3696 operands[2] = GEN_INT (64 - size);
3697 return \"rldicl %0,%1,%3,%2\";
3701 [(set (match_operand:CC 0 "gpc_reg_operand" "=x,?y")
3702 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
3703 (match_operand:DI 2 "const_int_operand" "i,i")
3704 (match_operand:DI 3 "const_int_operand" "i,i"))
3706 (clobber (match_scratch:DI 4 "=r,r"))]
3710 int start = INTVAL (operands[3]) & 63;
3711 int size = INTVAL (operands[2]) & 63;
3713 /* Split insn if not setting cr0. */
3714 if (cc_reg_not_cr0_operand (operands[0], CCmode))
3717 if (start + size >= 64)
3718 operands[3] = const0_rtx;
3720 operands[3] = GEN_INT (start + size);
3721 operands[2] = GEN_INT (64 - size);
3722 return \"rldicl. %4,%1,%3,%2\";
3726 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3727 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "")
3728 (match_operand:DI 2 "const_int_operand" "")
3729 (match_operand:DI 3 "const_int_operand" ""))
3731 (clobber (match_scratch:DI 4 ""))]
3734 (zero_extract:DI (match_dup 1)
3738 (compare:CC (match_dup 4)
3743 [(set (match_operand:CC 4 "gpc_reg_operand" "=x,?y")
3744 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
3745 (match_operand:DI 2 "const_int_operand" "i,i")
3746 (match_operand:DI 3 "const_int_operand" "i,i"))
3748 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3749 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3753 int start = INTVAL (operands[3]) & 63;
3754 int size = INTVAL (operands[2]) & 63;
3756 /* Split insn if not setting cr0. */
3757 if (cc_reg_not_cr0_operand (operands[0], CCmode))
3760 if (start + size >= 64)
3761 operands[3] = const0_rtx;
3763 operands[3] = GEN_INT (start + size);
3764 operands[2] = GEN_INT (64 - size);
3765 return \"rldicl. %0,%1,%3,%2\";
3769 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3770 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "")
3771 (match_operand:DI 2 "const_int_operand" "")
3772 (match_operand:DI 3 "const_int_operand" ""))
3775 (zero_extract:DI (match_dup 1)
3780 (zero_extract:DI (match_dup 1)
3784 (compare:CC (match_dup 0)
3788 (define_insn "rotlsi3"
3789 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3790 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3791 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3793 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3795 (define_insn "*rotlsi3_internal2"
3796 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3797 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3798 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3800 (clobber (match_scratch:SI 3 "=r,r"))]
3803 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3805 [(set_attr "type" "delayed_compare")
3806 (set_attr "length" "4,8")])
3809 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3810 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3811 (match_operand:SI 2 "reg_or_cint_operand" ""))
3813 (clobber (match_scratch:SI 3 ""))]
3816 (rotate:SI (match_dup 1)
3819 (compare:CC (match_dup 3)
3823 (define_insn "*rotlsi3_internal3"
3824 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3825 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3826 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3828 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3829 (rotate:SI (match_dup 1) (match_dup 2)))]
3832 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3834 [(set_attr "type" "delayed_compare")
3835 (set_attr "length" "4,8")])
3838 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3839 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3840 (match_operand:SI 2 "reg_or_cint_operand" ""))
3842 (set (match_operand:SI 0 "gpc_reg_operand" "")
3843 (rotate:SI (match_dup 1)
3847 (rotate:SI (match_dup 1)
3850 (compare:CC (match_dup 0)
3854 (define_insn "*rotlsi3_internal4"
3855 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3856 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3857 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3858 (match_operand:SI 3 "mask_operand" "L")))]
3860 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3862 (define_insn "*rotlsi3_internal5"
3863 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3865 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3866 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3867 (match_operand:SI 3 "mask_operand" "L,L"))
3869 (clobber (match_scratch:SI 4 "=r,r"))]
3872 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3874 [(set_attr "type" "delayed_compare")
3875 (set_attr "length" "4,8")])
3878 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3880 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3881 (match_operand:SI 2 "reg_or_cint_operand" ""))
3882 (match_operand:SI 3 "mask_operand" ""))
3884 (clobber (match_scratch:SI 4 ""))]
3887 (and:SI (rotate:SI (match_dup 1)
3891 (compare:CC (match_dup 4)
3895 (define_insn "*rotlsi3_internal6"
3896 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3898 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3899 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3900 (match_operand:SI 3 "mask_operand" "L,L"))
3902 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3903 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3906 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3908 [(set_attr "type" "delayed_compare")
3909 (set_attr "length" "4,8")])
3912 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3914 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3915 (match_operand:SI 2 "reg_or_cint_operand" ""))
3916 (match_operand:SI 3 "mask_operand" ""))
3918 (set (match_operand:SI 0 "gpc_reg_operand" "")
3920 (rotate:SI (match_dup 1)
3925 (and:SI (rotate:SI (match_dup 1)
3929 (compare:CC (match_dup 0)
3933 (define_insn "*rotlsi3_internal7"
3934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3937 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3938 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3940 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3942 (define_insn "*rotlsi3_internal8"
3943 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3944 (compare:CC (zero_extend:SI
3946 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3947 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3949 (clobber (match_scratch:SI 3 "=r,r"))]
3952 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3954 [(set_attr "type" "delayed_compare")
3955 (set_attr "length" "4,8")])
3958 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3959 (compare:CC (zero_extend:SI
3961 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3962 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3964 (clobber (match_scratch:SI 3 ""))]
3969 (rotate:SI (match_dup 1)
3972 (compare:CC (match_dup 3)
3976 (define_insn "*rotlsi3_internal9"
3977 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3978 (compare:CC (zero_extend:SI
3980 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3981 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3983 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3984 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3987 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3989 [(set_attr "type" "delayed_compare")
3990 (set_attr "length" "4,8")])
3993 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "=x,?y")
3994 (compare:CC (zero_extend:SI
3996 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3997 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3999 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4000 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4005 (rotate:SI (match_dup 1)
4008 (compare:CC (match_dup 0)
4012 (define_insn "*rotlsi3_internal10"
4013 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4016 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4017 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4019 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
4021 (define_insn "*rotlsi3_internal11"
4022 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4023 (compare:CC (zero_extend:SI
4025 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4026 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4028 (clobber (match_scratch:SI 3 "=r,r"))]
4031 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
4033 [(set_attr "type" "delayed_compare")
4034 (set_attr "length" "4,8")])
4037 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4038 (compare:CC (zero_extend:SI
4040 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4041 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4043 (clobber (match_scratch:SI 3 ""))]
4048 (rotate:SI (match_dup 1)
4051 (compare:CC (match_dup 3)
4055 (define_insn "*rotlsi3_internal12"
4056 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4057 (compare:CC (zero_extend:SI
4059 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4060 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4062 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4063 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4066 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
4068 [(set_attr "type" "delayed_compare")
4069 (set_attr "length" "4,8")])
4072 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "=x,?y")
4073 (compare:CC (zero_extend:SI
4075 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4076 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4078 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4079 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4084 (rotate:SI (match_dup 1)
4087 (compare:CC (match_dup 0)
4091 ;; Note that we use "sle." instead of "sl." so that we can set
4092 ;; SHIFT_COUNT_TRUNCATED.
4094 (define_expand "ashlsi3"
4095 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4096 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4097 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4102 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4104 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4108 (define_insn "ashlsi3_power"
4109 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4110 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4111 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4112 (clobber (match_scratch:SI 3 "=q,X"))]
4116 {sli|slwi} %0,%1,%h2"
4117 [(set_attr "length" "8")])
4119 (define_insn "ashlsi3_no_power"
4120 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4121 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4122 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4124 "{sl|slw}%I2 %0,%1,%h2"
4125 [(set_attr "length" "8")])
4128 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4129 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4130 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4132 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4133 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4137 {sli.|slwi.} %3,%1,%h2
4140 [(set_attr "type" "delayed_compare")
4141 (set_attr "length" "4,4,8,8")])
4144 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4145 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4146 (match_operand:SI 2 "reg_or_cint_operand" ""))
4148 (clobber (match_scratch:SI 3 ""))
4149 (clobber (match_scratch:SI 4 ""))]
4150 "TARGET_POWER && reload_completed"
4151 [(parallel [(set (match_dup 3)
4152 (ashift:SI (match_dup 1)
4154 (clobber (match_dup 4))])
4156 (compare:CC (match_dup 3)
4161 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4162 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4163 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4165 (clobber (match_scratch:SI 3 "=r,r"))]
4168 {sl|slw}%I2. %3,%1,%h2
4170 [(set_attr "type" "delayed_compare")
4171 (set_attr "length" "4,8")])
4174 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4175 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4176 (match_operand:SI 2 "reg_or_cint_operand" ""))
4178 (clobber (match_scratch:SI 3 ""))]
4179 "! TARGET_POWER && reload_completed"
4181 (ashift:SI (match_dup 1)
4184 (compare:CC (match_dup 3)
4189 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4190 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4191 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4193 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4194 (ashift:SI (match_dup 1) (match_dup 2)))
4195 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4199 {sli.|slwi.} %0,%1,%h2
4202 [(set_attr "type" "delayed_compare")])
4205 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4206 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4207 (match_operand:SI 2 "reg_or_cint_operand" ""))
4209 (set (match_operand:SI 0 "gpc_reg_operand" "")
4210 (ashift:SI (match_dup 1)
4212 (clobber (match_scratch:SI 4 ""))]
4213 "TARGET_POWER && reload_completed"
4214 [(parallel [(set (match_dup 0)
4215 (ashift:SI (match_dup 1)
4217 (clobber (match_dup 4))])
4219 (compare:CC (match_dup 0)
4224 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4225 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4226 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4228 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4229 (ashift:SI (match_dup 1) (match_dup 2)))]
4231 "{sl|slw}%I2. %0,%1,%h2"
4232 [(set_attr "type" "delayed_compare")])
4235 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4236 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4237 (match_operand:SI 2 "reg_or_cint_operand" ""))
4239 (set (match_operand:SI 0 "gpc_reg_operand" "")
4240 (ashift:SI (match_dup 1)
4242 "! TARGET_POWER && reload_completed"
4244 (ashift:SI (match_dup 1)
4247 (compare:CC (match_dup 0)
4252 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4253 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4254 (match_operand:SI 2 "const_int_operand" "i"))
4255 (match_operand:SI 3 "mask_operand" "L")))]
4256 "includes_lshift_p (operands[2], operands[3])"
4257 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4260 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4262 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4263 (match_operand:SI 2 "const_int_operand" "i,i"))
4264 (match_operand:SI 3 "mask_operand" "L,L"))
4266 (clobber (match_scratch:SI 4 "=r,r"))]
4267 "includes_lshift_p (operands[2], operands[3])"
4268 "{rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3"
4269 [(set_attr "type" "delayed_compare")])
4272 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4274 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4275 (match_operand:SI 2 "const_int_operand" ""))
4276 (match_operand:SI 3 "mask_operand" ""))
4278 (clobber (match_scratch:SI 4 ""))]
4279 "reload_completed && includes_lshift_p (operands[2], operands[3])"
4281 (and:SI (ashift:SI (match_dup 1)
4285 (compare:CC (match_dup 4)
4290 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4292 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4293 (match_operand:SI 2 "const_int_operand" "i,i"))
4294 (match_operand:SI 3 "mask_operand" "L,L"))
4296 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4297 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4298 "includes_lshift_p (operands[2], operands[3])"
4299 "{rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3"
4300 [(set_attr "type" "delayed_compare")])
4303 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4305 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4306 (match_operand:SI 2 "const_int_operand" ""))
4307 (match_operand:SI 3 "mask_operand" ""))
4309 (set (match_operand:SI 0 "gpc_reg_operand" "")
4310 (and:SI (ashift:SI (match_dup 1)
4313 "reload_completed && includes_lshift_p (operands[2], operands[3])"
4315 (and:SI (ashift:SI (match_dup 1)
4319 (compare:CC (match_dup 4)
4323 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4325 (define_expand "lshrsi3"
4326 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4327 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4328 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4333 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4335 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4339 (define_insn "lshrsi3_power"
4340 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4341 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4342 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4343 (clobber (match_scratch:SI 3 "=q,X,X"))]
4348 {s%A2i|s%A2wi} %0,%1,%h2")
4350 (define_insn "lshrsi3_no_power"
4351 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4352 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4353 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
4357 {sr|srw}%I2 %0,%1,%h2")
4360 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,y,?y")
4361 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4362 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4364 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4365 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4370 {s%A2i.|s%A2wi.} %3,%1,%h2
4374 [(set_attr "type" "delayed_compare")
4375 (set_attr "length" "4,4,4,8,8,8")])
4378 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4379 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4380 (match_operand:SI 2 "reg_or_cint_operand" ""))
4382 (clobber (match_scratch:SI 3 ""))
4383 (clobber (match_scratch:SI 4 ""))]
4384 "TARGET_POWER && reload_completed
4385 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
4386 [(parallel [(set (match_dup 3)
4387 (lshiftrt:SI (match_dup 1)
4389 (clobber (match_dup 4))])
4391 (compare:CC (match_dup 3)
4396 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,y,?y")
4397 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4398 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4400 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
4404 {sr|srw}%I2. %3,%1,%h2
4407 [(set_attr "type" "delayed_compare")
4408 (set_attr "length" "4,4,4,8")])
4411 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4412 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4413 (match_operand:SI 2 "reg_or_cint_operand" ""))
4415 (clobber (match_scratch:SI 3 ""))]
4416 "! TARGET_POWER && reload_completed
4417 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
4419 (lshiftrt:SI (match_dup 1)
4422 (compare:CC (match_dup 3)
4427 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y")
4428 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4429 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,rOi"))
4431 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4432 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4433 (clobber (match_scratch:SI 4 "=q,X,X,q"))]
4438 {s%A2i.|s%A2wi.} %0,%1,%h2
4440 [(set_attr "type" "delayed_compare")
4441 (set_attr "length" "4,4,4,8")])
4444 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4445 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4446 (match_operand:SI 2 "reg_or_cint_operand" ""))
4448 (set (match_operand:SI 0 "gpc_reg_operand" "")
4449 (lshiftrt:SI (match_dup 1)
4451 (clobber (match_scratch:SI 4 ""))]
4452 "TARGET_POWER && reload_completed"
4453 [(parallel [(set (match_dup 3)
4454 (lshiftrt:SI (match_dup 1)
4456 (clobber (match_dup 4))])
4458 (compare:CC (match_dup 3)
4463 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4464 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4465 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4467 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4468 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4472 {sr|srw}%I2. %0,%1,%h2
4475 [(set_attr "type" "delayed_compare")
4476 (set_attr "length" "4,4,8,8")])
4479 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4480 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4481 (match_operand:SI 2 "reg_or_cint_operand" ""))
4483 (set (match_operand:SI 0 "gpc_reg_operand" "")
4484 (lshiftrt:SI (match_dup 1)
4486 "! TARGET_POWER && reload_completed"
4488 (lshiftrt:SI (match_dup 1)
4491 (compare:CC (match_dup 0)
4496 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4497 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4498 (match_operand:SI 2 "const_int_operand" "i"))
4499 (match_operand:SI 3 "mask_operand" "L")))]
4500 "includes_rshift_p (operands[2], operands[3])"
4501 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4504 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4506 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4507 (match_operand:SI 2 "const_int_operand" "i,i"))
4508 (match_operand:SI 3 "mask_operand" "L,L"))
4510 (clobber (match_scratch:SI 4 "=r,r"))]
4511 "includes_rshift_p (operands[2], operands[3])"
4513 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4515 [(set_attr "type" "delayed_compare")
4516 (set_attr "length" "4,8")])
4519 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4521 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4522 (match_operand:SI 2 "const_int_operand" ""))
4523 (match_operand:SI 3 "mask_operand" ""))
4525 (clobber (match_scratch:SI 4 ""))]
4526 "reload_completed && includes_rshift_p (operands[2], operands[3])"
4528 (and:SI (lshiftrt:SI (match_dup 1)
4532 (compare:CC (match_dup 4)
4537 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4539 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4540 (match_operand:SI 2 "const_int_operand" "i,i"))
4541 (match_operand:SI 3 "mask_operand" "L,L"))
4543 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4544 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4545 "includes_rshift_p (operands[2], operands[3])"
4547 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4549 [(set_attr "type" "delayed_compare")
4550 (set_attr "length" "4,8")])
4553 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4555 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4556 (match_operand:SI 2 "const_int_operand" ""))
4557 (match_operand:SI 3 "mask_operand" ""))
4559 (set (match_operand:SI 0 "gpc_reg_operand" "")
4560 (and:SI (lshiftrt:SI (match_dup 1)
4563 "reload_completed && includes_rshift_p (operands[2], operands[3])"
4565 (and:SI (lshiftrt:SI (match_dup 1)
4569 (compare:CC (match_dup 4)
4574 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4577 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4578 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4579 "includes_rshift_p (operands[2], GEN_INT (255))"
4580 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4583 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4587 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4588 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4590 (clobber (match_scratch:SI 3 "=r,r"))]
4591 "includes_rshift_p (operands[2], GEN_INT (255))"
4593 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4595 [(set_attr "type" "delayed_compare")
4596 (set_attr "length" "4,8")])
4599 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4603 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4604 (match_operand:SI 2 "const_int_operand" "")) 0))
4606 (clobber (match_scratch:SI 3 ""))]
4607 "reload_completed && includes_rshift_p (operands[2], GEN_INT (255))"
4611 (lshiftrt:SI (match_dup 1)
4614 (compare:CC (match_dup 3)
4619 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4623 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4624 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4626 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4627 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4628 "includes_rshift_p (operands[2], GEN_INT (255))"
4630 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4632 [(set_attr "type" "delayed_compare")
4633 (set_attr "length" "4,8")])
4636 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4640 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4641 (match_operand:SI 2 "const_int_operand" "")) 0))
4643 (set (match_operand:SI 0 "gpc_reg_operand" "")
4646 (lshiftrt:SI (match_dup 1)
4647 (match_dup 2)) 0)))]
4648 "reload_completed && includes_rshift_p (operands[2], GEN_INT (255))"
4652 (lshiftrt:SI (match_dup 1)
4655 (compare:CC (match_dup 0)
4660 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4663 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4664 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4665 "includes_rshift_p (operands[2], GEN_INT (65535))"
4666 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4669 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4673 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4674 (match_operand:SI 2 "const_int_operand" "")) 0))
4676 (clobber (match_scratch:SI 3 ""))]
4677 "reload_completed && includes_rshift_p (operands[2], GEN_INT (255))"
4681 (lshiftrt:SI (match_dup 1)
4684 (compare:CC (match_dup 3)
4689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4693 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4694 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4696 (clobber (match_scratch:SI 3 "=r,r"))]
4697 "includes_rshift_p (operands[2], GEN_INT (65535))"
4699 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4701 [(set_attr "type" "delayed_compare")
4702 (set_attr "length" "4,8")])
4705 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4709 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4710 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4712 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4713 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4714 "includes_rshift_p (operands[2], GEN_INT (65535))"
4715 "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
4716 [(set_attr "type" "delayed_compare")])
4719 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4723 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4724 (match_operand:SI 2 "const_int_operand" "")) 0))
4726 (set (match_operand:SI 0 "gpc_reg_operand" "")
4729 (lshiftrt:SI (match_dup 1)
4730 (match_dup 2)) 0)))]
4731 "reload_completed && includes_rshift_p (operands[2], GEN_INT (255))"
4735 (lshiftrt:SI (match_dup 1)
4738 (compare:CC (match_dup 0)
4743 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4745 (match_operand:SI 1 "gpc_reg_operand" "r"))
4746 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4752 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4754 (match_operand:SI 1 "gpc_reg_operand" "r"))
4755 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4761 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4763 (match_operand:SI 1 "gpc_reg_operand" "r"))
4764 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4770 (define_expand "ashrsi3"
4771 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4772 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4773 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4778 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4780 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4784 (define_insn "ashrsi3_power"
4785 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4786 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4787 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4788 (clobber (match_scratch:SI 3 "=q,X"))]
4792 {srai|srawi} %0,%1,%h2")
4794 (define_insn "ashrsi3_no_power"
4795 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4796 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4797 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4799 "{sra|sraw}%I2 %0,%1,%h2")
4802 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4803 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4804 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4806 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4807 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4811 {srai.|srawi.} %3,%1,%h2
4814 [(set_attr "type" "delayed_compare")
4815 (set_attr "length" "4,4,8,8")])
4818 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4819 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4820 (match_operand:SI 2 "reg_or_cint_operand" ""))
4822 (clobber (match_scratch:SI 3 ""))
4823 (clobber (match_scratch:SI 4 ""))]
4824 "TARGET_POWER && reload_completed"
4825 [(parallel [(set (match_dup 3)
4826 (ashiftrt:SI (match_dup 1)
4828 (clobber (match_dup 4))])
4830 (compare:CC (match_dup 3)
4835 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4836 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4837 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4839 (clobber (match_scratch:SI 3 "=r,r"))]
4842 {sra|sraw}%I2. %3,%1,%h2
4844 [(set_attr "type" "delayed_compare")
4845 (set_attr "length" "4,8")])
4848 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4849 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4850 (match_operand:SI 2 "reg_or_cint_operand" ""))
4852 (clobber (match_scratch:SI 3 ""))]
4855 (ashiftrt:SI (match_dup 1)
4858 (compare:CC (match_dup 3)
4863 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4864 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4865 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4867 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4868 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4869 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4873 {srai.|srawi.} %0,%1,%h2
4876 [(set_attr "type" "delayed_compare")
4877 (set_attr "length" "4,4,8,8")])
4880 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4881 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4882 (match_operand:SI 2 "reg_or_cint_operand" ""))
4884 (set (match_operand:SI 0 "gpc_reg_operand" "")
4885 (ashiftrt:SI (match_dup 1)
4887 (clobber (match_scratch:SI 4 ""))]
4888 "TARGET_POWER && reload_completed"
4889 [(parallel [(set (match_dup 0)
4890 (ashiftrt:SI (match_dup 1)
4892 (clobber (match_dup 4))])
4894 (compare:CC (match_dup 0)
4899 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4900 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4901 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4903 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4904 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4907 {sra|sraw}%I2. %0,%1,%h2
4909 [(set_attr "type" "delayed_compare")
4910 (set_attr "length" "4,8")])
4913 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4914 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4915 (match_operand:SI 2 "reg_or_cint_operand" ""))
4917 (set (match_operand:SI 0 "gpc_reg_operand" "")
4918 (ashiftrt:SI (match_dup 1)
4920 "! TARGET_POWER && reload_completed"
4922 (ashiftrt:SI (match_dup 1)
4925 (compare:CC (match_dup 0)
4929 ;; Floating-point insns, excluding normal data motion.
4931 ;; PowerPC has a full set of single-precision floating point instructions.
4933 ;; For the POWER architecture, we pretend that we have both SFmode and
4934 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4935 ;; The only conversions we will do will be when storing to memory. In that
4936 ;; case, we will use the "frsp" instruction before storing.
4938 ;; Note that when we store into a single-precision memory location, we need to
4939 ;; use the frsp insn first. If the register being stored isn't dead, we
4940 ;; need a scratch register for the frsp. But this is difficult when the store
4941 ;; is done by reload. It is not incorrect to do the frsp on the register in
4942 ;; this case, we just lose precision that we would have otherwise gotten but
4943 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4945 (define_insn "extendsfdf2"
4946 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4947 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4951 if (REGNO (operands[0]) == REGNO (operands[1]))
4954 return \"fmr %0,%1\";
4956 [(set_attr "type" "fp")])
4958 (define_insn "truncdfsf2"
4959 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4960 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4963 [(set_attr "type" "fp")])
4965 (define_insn "aux_truncdfsf2"
4966 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4967 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
4968 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
4970 [(set_attr "type" "fp")])
4972 (define_insn "negsf2"
4973 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4974 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4977 [(set_attr "type" "fp")])
4979 (define_insn "abssf2"
4980 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4981 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4984 [(set_attr "type" "fp")])
4987 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4988 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4991 [(set_attr "type" "fp")])
4993 (define_expand "addsf3"
4994 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4995 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4996 (match_operand:SF 2 "gpc_reg_operand" "")))]
5001 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5002 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5003 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5004 "TARGET_POWERPC && TARGET_HARD_FLOAT"
5006 [(set_attr "type" "fp")])
5009 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5010 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5011 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5012 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
5013 "{fa|fadd} %0,%1,%2"
5014 [(set_attr "type" "fp")])
5016 (define_expand "subsf3"
5017 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5018 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5019 (match_operand:SF 2 "gpc_reg_operand" "")))]
5024 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5025 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5026 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5027 "TARGET_POWERPC && TARGET_HARD_FLOAT"
5029 [(set_attr "type" "fp")])
5032 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5033 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5034 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5035 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
5036 "{fs|fsub} %0,%1,%2"
5037 [(set_attr "type" "fp")])
5039 (define_expand "mulsf3"
5040 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5041 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5042 (match_operand:SF 2 "gpc_reg_operand" "")))]
5047 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5048 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5049 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5050 "TARGET_POWERPC && TARGET_HARD_FLOAT"
5052 [(set_attr "type" "fp")])
5055 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5056 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5057 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5058 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
5059 "{fm|fmul} %0,%1,%2"
5060 [(set_attr "type" "dmul")])
5062 (define_expand "divsf3"
5063 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5064 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5065 (match_operand:SF 2 "gpc_reg_operand" "")))]
5070 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5071 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5072 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5073 "TARGET_POWERPC && TARGET_HARD_FLOAT"
5075 [(set_attr "type" "sdiv")])
5078 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5079 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5080 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5081 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
5082 "{fd|fdiv} %0,%1,%2"
5083 [(set_attr "type" "ddiv")])
5086 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5087 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5088 (match_operand:SF 2 "gpc_reg_operand" "f"))
5089 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5090 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5091 "fmadds %0,%1,%2,%3"
5092 [(set_attr "type" "fp")])
5095 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5096 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5097 (match_operand:SF 2 "gpc_reg_operand" "f"))
5098 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5099 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5100 "{fma|fmadd} %0,%1,%2,%3"
5101 [(set_attr "type" "dmul")])
5104 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5105 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5106 (match_operand:SF 2 "gpc_reg_operand" "f"))
5107 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5108 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5109 "fmsubs %0,%1,%2,%3"
5110 [(set_attr "type" "fp")])
5113 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5114 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5115 (match_operand:SF 2 "gpc_reg_operand" "f"))
5116 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5117 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5118 "{fms|fmsub} %0,%1,%2,%3"
5119 [(set_attr "type" "dmul")])
5122 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5123 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5124 (match_operand:SF 2 "gpc_reg_operand" "f"))
5125 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5126 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5127 "fnmadds %0,%1,%2,%3"
5128 [(set_attr "type" "fp")])
5131 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5132 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5133 (match_operand:SF 2 "gpc_reg_operand" "f"))
5134 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5135 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5136 "{fnma|fnmadd} %0,%1,%2,%3"
5137 [(set_attr "type" "dmul")])
5140 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5141 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5142 (match_operand:SF 2 "gpc_reg_operand" "f"))
5143 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5144 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5145 "fnmsubs %0,%1,%2,%3"
5146 [(set_attr "type" "fp")])
5149 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5150 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5151 (match_operand:SF 2 "gpc_reg_operand" "f"))
5152 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5153 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5154 "{fnms|fnmsub} %0,%1,%2,%3"
5155 [(set_attr "type" "dmul")])
5157 (define_expand "sqrtsf2"
5158 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5159 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5160 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
5164 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5165 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5166 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
5168 [(set_attr "type" "ssqrt")])
5171 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5172 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5173 "TARGET_POWER2 && TARGET_HARD_FLOAT"
5175 [(set_attr "type" "dsqrt")])
5177 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5178 ;; fsel instruction and some auxiliary computations. Then we just have a
5179 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5181 (define_expand "maxsf3"
5183 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5184 (match_operand:SF 2 "gpc_reg_operand" "")))
5185 (set (match_operand:SF 0 "gpc_reg_operand" "")
5186 (if_then_else:SF (ge (match_dup 3)
5190 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5192 { operands[3] = gen_reg_rtx (SFmode); }")
5195 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5196 (smax:SF (match_operand:SF 1 "gpc_reg_operand" "")
5197 (match_operand:SF 2 "gpc_reg_operand" "")))
5198 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
5199 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5201 (minus:SF (match_dup 1) (match_dup 2)))
5203 (if_then_else:SF (ge (match_dup 3)
5209 (define_expand "minsf3"
5211 (minus:SF (match_operand:SF 2 "gpc_reg_operand" "")
5212 (match_operand:SF 1 "gpc_reg_operand" "")))
5213 (set (match_operand:SF 0 "gpc_reg_operand" "")
5214 (if_then_else:SF (ge (match_dup 3)
5218 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5220 { operands[3] = gen_reg_rtx (SFmode); }")
5223 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5224 (smin:SF (match_operand:SF 1 "gpc_reg_operand" "")
5225 (match_operand:SF 2 "gpc_reg_operand" "")))
5226 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
5227 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5229 (minus:SF (match_dup 2) (match_dup 1)))
5231 (if_then_else:SF (ge (match_dup 3)
5237 (define_expand "movsfcc"
5238 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5239 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5240 (match_operand:SF 2 "gpc_reg_operand" "f")
5241 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5242 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5246 enum rtx_code code = GET_CODE (operands[1]);
5247 if (! rs6000_compare_fp_p)
5251 case GE: case EQ: case NE:
5252 op0 = rs6000_compare_op0;
5253 op1 = rs6000_compare_op1;
5256 op0 = rs6000_compare_op1;
5257 op1 = rs6000_compare_op0;
5258 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
5261 op0 = rs6000_compare_op1;
5262 op1 = rs6000_compare_op0;
5265 op0 = rs6000_compare_op0;
5266 op1 = rs6000_compare_op1;
5267 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
5272 if (GET_MODE (rs6000_compare_op0) == DFmode)
5274 temp = gen_reg_rtx (DFmode);
5275 emit_insn (gen_subdf3 (temp, op0, op1));
5276 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[2], operands[3]));
5279 emit_insn (gen_negdf2 (temp, temp));
5280 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[0], operands[3]));
5282 else if (code == NE)
5284 emit_insn (gen_negdf2 (temp, temp));
5285 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[3], operands[0]));
5290 temp = gen_reg_rtx (SFmode);
5291 emit_insn (gen_subsf3 (temp, op0, op1));
5292 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[2], operands[3]));
5295 emit_insn (gen_negsf2 (temp, temp));
5296 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[0], operands[3]));
5298 else if (code == NE)
5300 emit_insn (gen_negsf2 (temp, temp));
5301 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[3], operands[0]));
5307 (define_insn "fselsfsf4"
5308 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5309 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5311 (match_operand:SF 2 "gpc_reg_operand" "f")
5312 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5313 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5315 [(set_attr "type" "fp")])
5317 (define_insn "fseldfsf4"
5318 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5319 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5321 (match_operand:SF 2 "gpc_reg_operand" "f")
5322 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5323 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5325 [(set_attr "type" "fp")])
5327 (define_insn "negdf2"
5328 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5329 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5332 [(set_attr "type" "fp")])
5334 (define_insn "absdf2"
5335 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5336 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5339 [(set_attr "type" "fp")])
5342 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5343 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5346 [(set_attr "type" "fp")])
5348 (define_insn "adddf3"
5349 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5350 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5351 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5353 "{fa|fadd} %0,%1,%2"
5354 [(set_attr "type" "fp")])
5356 (define_insn "subdf3"
5357 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5358 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5359 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5361 "{fs|fsub} %0,%1,%2"
5362 [(set_attr "type" "fp")])
5364 (define_insn "muldf3"
5365 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5366 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5367 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5369 "{fm|fmul} %0,%1,%2"
5370 [(set_attr "type" "dmul")])
5372 (define_insn "divdf3"
5373 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5374 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5375 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5377 "{fd|fdiv} %0,%1,%2"
5378 [(set_attr "type" "ddiv")])
5381 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5382 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5383 (match_operand:DF 2 "gpc_reg_operand" "f"))
5384 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5385 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5386 "{fma|fmadd} %0,%1,%2,%3"
5387 [(set_attr "type" "dmul")])
5390 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5391 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5392 (match_operand:DF 2 "gpc_reg_operand" "f"))
5393 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5394 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5395 "{fms|fmsub} %0,%1,%2,%3"
5396 [(set_attr "type" "dmul")])
5399 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5400 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5401 (match_operand:DF 2 "gpc_reg_operand" "f"))
5402 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5403 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5404 "{fnma|fnmadd} %0,%1,%2,%3"
5405 [(set_attr "type" "dmul")])
5408 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5409 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5410 (match_operand:DF 2 "gpc_reg_operand" "f"))
5411 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5412 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
5413 "{fnms|fnmsub} %0,%1,%2,%3"
5414 [(set_attr "type" "dmul")])
5416 (define_insn "sqrtdf2"
5417 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5418 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5419 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
5421 [(set_attr "type" "dsqrt")])
5423 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5424 ;; fsel instruction and some auxiliary computations. Then we just have a
5425 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5428 (define_expand "maxdf3"
5430 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5431 (match_operand:DF 2 "gpc_reg_operand" "")))
5432 (set (match_operand:DF 0 "gpc_reg_operand" "")
5433 (if_then_else:DF (ge (match_dup 3)
5437 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5439 { operands[3] = gen_reg_rtx (DFmode); }")
5442 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5443 (smax:DF (match_operand:DF 1 "gpc_reg_operand" "")
5444 (match_operand:DF 2 "gpc_reg_operand" "")))
5445 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
5446 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5448 (minus:DF (match_dup 1) (match_dup 2)))
5450 (if_then_else:DF (ge (match_dup 3)
5456 (define_expand "mindf3"
5458 (minus:DF (match_operand:DF 2 "gpc_reg_operand" "")
5459 (match_operand:DF 1 "gpc_reg_operand" "")))
5460 (set (match_operand:DF 0 "gpc_reg_operand" "")
5461 (if_then_else:DF (ge (match_dup 3)
5465 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5467 { operands[3] = gen_reg_rtx (DFmode); }")
5470 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5471 (smin:DF (match_operand:DF 1 "gpc_reg_operand" "")
5472 (match_operand:DF 2 "gpc_reg_operand" "")))
5473 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
5474 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5476 (minus:DF (match_dup 2) (match_dup 1)))
5478 (if_then_else:DF (ge (match_dup 3)
5484 (define_expand "movdfcc"
5485 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5486 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5487 (match_operand:DF 2 "gpc_reg_operand" "f")
5488 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5489 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5493 enum rtx_code code = GET_CODE (operands[1]);
5494 if (! rs6000_compare_fp_p)
5498 case GE: case EQ: case NE:
5499 op0 = rs6000_compare_op0;
5500 op1 = rs6000_compare_op1;
5503 op0 = rs6000_compare_op1;
5504 op1 = rs6000_compare_op0;
5505 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
5508 op0 = rs6000_compare_op1;
5509 op1 = rs6000_compare_op0;
5512 op0 = rs6000_compare_op0;
5513 op1 = rs6000_compare_op1;
5514 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
5519 if (GET_MODE (rs6000_compare_op0) == DFmode)
5521 temp = gen_reg_rtx (DFmode);
5522 emit_insn (gen_subdf3 (temp, op0, op1));
5523 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[2], operands[3]));
5526 emit_insn (gen_negdf2 (temp, temp));
5527 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[0], operands[3]));
5529 else if (code == NE)
5531 emit_insn (gen_negdf2 (temp, temp));
5532 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[3], operands[0]));
5537 temp = gen_reg_rtx (SFmode);
5538 emit_insn (gen_subsf3 (temp, op0, op1));
5539 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[2], operands[3]));
5542 emit_insn (gen_negsf2 (temp, temp));
5543 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[0], operands[3]));
5545 else if (code == NE)
5547 emit_insn (gen_negsf2 (temp, temp));
5548 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[3], operands[0]));
5554 (define_insn "fseldfdf4"
5555 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5556 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5558 (match_operand:DF 2 "gpc_reg_operand" "f")
5559 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5560 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
5562 [(set_attr "type" "fp")])
5564 (define_insn "fselsfdf4"
5565 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5566 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5568 (match_operand:DF 2 "gpc_reg_operand" "f")
5569 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5572 [(set_attr "type" "fp")])
5574 ;; Conversions to and from floating-point.
5576 (define_expand "floatsidf2"
5577 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5578 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5581 (clobber (match_dup 4))
5582 (clobber (match_dup 5))
5583 (clobber (reg:DF 76))])]
5587 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5588 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503601774854144\", DFmode));
5589 operands[4] = gen_reg_rtx (SImode);
5590 operands[5] = gen_reg_rtx (Pmode);
5593 (define_insn "*floatsidf2_internal"
5594 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5595 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5596 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5597 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5598 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
5599 (clobber (match_operand 5 "gpc_reg_operand" "=b"))
5600 (clobber (reg:DF 76))]
5603 [(set_attr "length" "24")])
5606 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5607 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5608 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5609 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5610 (clobber (match_operand:SI 4 "gpc_reg_operand" ""))
5611 (clobber (match_operand 5 "gpc_reg_operand" ""))
5612 (clobber (reg:DF 76))]
5615 (xor:SI (match_dup 1)
5618 (unspec [(const_int 0)] 11))
5620 (unspec [(match_dup 4)
5621 (match_dup 5)] 12)) ;; low word
5623 (unspec [(match_dup 2)
5625 (match_dup 7)] 13)) ;; high word
5627 (unspec [(match_dup 7)
5630 (minus:DF (match_dup 0)
5634 operands[6] = GEN_INT (0x80000000);
5635 operands[7] = gen_rtx_REG (DFmode, FPMEM_REGNUM);
5638 (define_expand "floatunssidf2"
5639 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5640 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5643 (clobber (match_dup 4))
5644 (clobber (reg:DF 76))])]
5648 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5649 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503599627370496\", DFmode));
5650 operands[4] = gen_reg_rtx (Pmode);
5653 (define_insn "*floatunssidf2_internal"
5654 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5655 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5656 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5657 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5658 (clobber (match_operand 4 "gpc_reg_operand" "=b"))
5659 (clobber (reg:DF 76))]
5662 [(set_attr "length" "20")])
5665 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5666 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5667 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5668 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5669 (clobber (match_operand 4 "gpc_reg_operand" ""))
5670 (clobber (reg:DF 76))]
5673 (unspec [(const_int 0)] 11))
5675 (unspec [(match_dup 1)
5676 (match_dup 4)] 12)) ;; low word
5678 (unspec [(match_dup 2)
5680 (match_dup 5)] 13)) ;; high word
5682 (unspec [(match_dup 5)
5685 (minus:DF (match_dup 0)
5687 "operands[5] = gen_rtx_REG (DFmode, FPMEM_REGNUM);")
5689 ;; Load up scratch register with base address + offset if needed
5690 (define_insn "*floatsidf2_loadaddr"
5691 [(set (match_operand 0 "gpc_reg_operand" "=b")
5692 (unspec [(const_int 0)] 11))]
5696 if (rs6000_fpmem_offset > 32760)
5700 xop[0] = operands[0];
5701 xop[1] = (frame_pointer_needed) ? frame_pointer_rtx : stack_pointer_rtx;
5702 xop[2] = GEN_INT ((rs6000_fpmem_offset >> 16) + ((rs6000_fpmem_offset & 0x8000) >> 15));
5703 output_asm_insn (\"{cau|addis} %0,%1,%2\", xop);
5708 [(set_attr "length" "4")])
5710 (define_insn "*floatsidf2_store1"
5712 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
5713 (match_operand 1 "gpc_reg_operand" "b")] 12))]
5719 if (rs6000_fpmem_offset > 32760)
5721 else if (frame_pointer_needed)
5722 indx = frame_pointer_rtx;
5724 indx = stack_pointer_rtx;
5726 operands[2] = gen_rtx_MEM (SImode,
5727 gen_rtx_PLUS (Pmode,
5729 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
5730 + ((WORDS_BIG_ENDIAN != 0) * 4))));
5732 return \"{st|stw} %0,%2\";
5734 [(set_attr "type" "store")])
5736 (define_insn "*floatsidf2_store2"
5738 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
5739 (match_operand 1 "gpc_reg_operand" "b")
5746 if (rs6000_fpmem_offset > 32760)
5748 else if (frame_pointer_needed)
5749 indx = frame_pointer_rtx;
5751 indx = stack_pointer_rtx;
5753 operands[2] = gen_rtx_MEM (SImode,
5754 gen_rtx_PLUS (Pmode,
5756 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
5757 + ((WORDS_BIG_ENDIAN == 0) * 4))));
5759 return \"{st|stw} %0,%2\";
5761 [(set_attr "type" "store")])
5763 (define_insn "*floatsidf2_load"
5764 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5765 (unspec [(reg:DF 76)
5766 (match_operand 1 "gpc_reg_operand" "b")] 14))]
5771 HOST_WIDE_INT offset = rs6000_fpmem_offset;
5773 if (rs6000_fpmem_offset > 32760)
5776 offset = (((offset & 0xffff) ^ 0x8000) - 0x8000);
5778 else if (frame_pointer_needed)
5779 indx = frame_pointer_rtx;
5781 indx = stack_pointer_rtx;
5783 operands[2] = gen_rtx_MEM (SImode,
5784 gen_rtx_PLUS (Pmode, indx, GEN_INT (offset)));
5786 return \"lfd %0,%2\";
5788 [(set_attr "type" "fpload")])
5790 (define_expand "fix_truncdfsi2"
5791 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5792 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5793 (clobber (match_dup 2))
5794 (clobber (match_dup 3))
5795 (clobber (match_dup 4))])]
5799 if (!TARGET_POWER2 && !TARGET_POWERPC)
5801 emit_insn (gen_trunc_call (operands[0], operands[1],
5802 gen_rtx_SYMBOL_REF (Pmode, RS6000_ITRUNC)));
5806 operands[2] = gen_reg_rtx (DImode);
5807 operands[3] = gen_reg_rtx (Pmode);
5808 operands[4] = gen_rtx_REG (DImode, FPMEM_REGNUM);
5811 (define_insn "*fix_truncdfsi2_internal"
5812 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5813 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5814 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5815 (clobber (match_operand 3 "gpc_reg_operand" "=b"))
5816 (clobber (reg:DI 76))]
5819 [(set_attr "length" "12")])
5822 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5823 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5824 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5825 (clobber (match_operand 3 "gpc_reg_operand" ""))
5826 (clobber (reg:DI 76))]
5829 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" ""))))
5831 (unspec [(const_int 0)] 11))
5833 (unspec [(match_dup 2)
5835 (set (match_operand:SI 0 "gpc_reg_operand" "")
5836 (unspec [(match_dup 4)
5837 (match_dup 3)] 16))]
5838 "operands[4] = gen_rtx_REG (DImode, FPMEM_REGNUM);")
5840 (define_insn "*fix_truncdfsi2_store"
5842 (unspec [(match_operand:DI 0 "gpc_reg_operand" "f")
5843 (match_operand 1 "gpc_reg_operand" "b")] 15))]
5844 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
5849 if (rs6000_fpmem_offset > 32760)
5851 else if (frame_pointer_needed)
5852 indx = frame_pointer_rtx;
5854 indx = stack_pointer_rtx;
5856 operands[2] = gen_rtx_MEM (DFmode,
5857 gen_rtx_PLUS (Pmode,
5859 GEN_INT ((((rs6000_fpmem_offset & 0xffff)
5860 ^ 0x8000) - 0x8000))));
5862 return \"stfd %0,%2\";
5864 [(set_attr "type" "fpstore")])
5866 (define_insn "*fix_truncdfsi2_load"
5867 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5868 (unspec [(reg:DI 76)
5869 (match_operand 1 "gpc_reg_operand" "b")] 16))]
5870 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
5875 if (rs6000_fpmem_offset > 32760)
5877 else if (frame_pointer_needed)
5878 indx = frame_pointer_rtx;
5880 indx = stack_pointer_rtx;
5882 operands[2] = gen_rtx_MEM (DFmode,
5883 gen_rtx_PLUS (Pmode,
5885 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
5886 + ((WORDS_BIG_ENDIAN) ? 4 : 0))));
5888 return \"{l|lwz} %0,%2\";
5890 [(set_attr "type" "load")])
5892 (define_expand "fixuns_truncdfsi2"
5893 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5894 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
5895 "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
5898 emit_insn (gen_trunc_call (operands[0], operands[1],
5899 gen_rtx_SYMBOL_REF (Pmode, RS6000_UITRUNC)));
5903 (define_expand "trunc_call"
5904 [(parallel [(set (match_operand:SI 0 "" "")
5905 (fix:SI (match_operand:DF 1 "" "")))
5906 (use (match_operand:SI 2 "" ""))])]
5910 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
5911 rtx first = XVECEXP (insns, 0, 0);
5912 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
5914 REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
5916 REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first, REG_NOTES (last));
5922 (define_expand "trunc_call_rtl"
5923 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
5925 (parallel [(set (reg:SI 3)
5926 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
5928 (clobber (scratch:SI))])
5929 (set (match_operand:SI 0 "gpc_reg_operand" "")
5934 rs6000_trunc_used = 1;
5937 (define_insn "*fctiwz"
5938 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5939 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5940 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
5941 "{fcirz|fctiwz} %0,%1"
5942 [(set_attr "type" "fp")])
5944 (define_insn "floatdidf2"
5945 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5946 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
5947 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5949 [(set_attr "type" "fp")])
5951 (define_insn "fix_truncdfdi2"
5952 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5953 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5954 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
5956 [(set_attr "type" "fp")])
5958 ;; Define the DImode operations that can be done in a small number
5959 ;; of instructions. The & constraints are to prevent the register
5960 ;; allocator from allocating registers that overlap with the inputs
5961 ;; (for example, having an input in 7,8 and an output in 6,7). We
5962 ;; also allow for the output being the same as one of the inputs.
5964 (define_insn "*adddi3_noppc64"
5965 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5966 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5967 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5968 "! TARGET_POWERPC64"
5971 if (WORDS_BIG_ENDIAN)
5972 return (GET_CODE (operands[2])) != CONST_INT
5973 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5974 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5976 return (GET_CODE (operands[2])) != CONST_INT
5977 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5978 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5980 [(set_attr "length" "8")])
5982 (define_insn "*subdi3_noppc64"
5983 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5984 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5985 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5986 "! TARGET_POWERPC64"
5989 if (WORDS_BIG_ENDIAN)
5990 return (GET_CODE (operands[1]) != CONST_INT)
5991 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5992 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5994 return (GET_CODE (operands[1]) != CONST_INT)
5995 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5996 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5998 [(set_attr "length" "8")])
6000 (define_insn "*negdi2_noppc64"
6001 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6002 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6003 "! TARGET_POWERPC64"
6006 return (WORDS_BIG_ENDIAN)
6007 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6008 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6010 [(set_attr "length" "8")])
6012 (define_expand "mulsidi3"
6013 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6014 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6015 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6016 "! TARGET_POWERPC64"
6019 if (! TARGET_POWER && ! TARGET_POWERPC)
6021 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6022 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6023 emit_insn (gen_mull_call ());
6024 if (WORDS_BIG_ENDIAN)
6025 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6028 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6029 gen_rtx_REG (SImode, 3));
6030 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6031 gen_rtx_REG (SImode, 4));
6035 else if (TARGET_POWER)
6037 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6042 (define_insn "mulsidi3_mq"
6043 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6044 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6045 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6046 (clobber (match_scratch:SI 3 "=q"))]
6048 "mul %0,%1,%2\;mfmq %L0"
6049 [(set_attr "type" "imul")
6050 (set_attr "length" "8")])
6052 (define_insn "*mulsidi3_no_mq"
6053 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6054 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6055 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6056 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6059 return (WORDS_BIG_ENDIAN)
6060 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6061 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6063 [(set_attr "type" "imul")
6064 (set_attr "length" "8")])
6067 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6068 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6069 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6070 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6073 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6074 (sign_extend:DI (match_dup 2)))
6077 (mult:SI (match_dup 1)
6081 int endian = (WORDS_BIG_ENDIAN == 0);
6082 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6083 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6086 (define_expand "umulsidi3"
6087 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6088 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6089 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6090 "TARGET_POWERPC && ! TARGET_POWERPC64"
6095 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6100 (define_insn "umulsidi3_mq"
6101 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6102 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6103 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6104 (clobber (match_scratch:SI 3 "=q"))]
6105 "TARGET_POWERPC && TARGET_POWER"
6108 return (WORDS_BIG_ENDIAN)
6109 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6110 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6112 [(set_attr "type" "imul")
6113 (set_attr "length" "8")])
6115 (define_insn "*umulsidi3_no_mq"
6116 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6117 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6118 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6119 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6122 return (WORDS_BIG_ENDIAN)
6123 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6124 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6126 [(set_attr "type" "imul")
6127 (set_attr "length" "8")])
6130 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6131 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6132 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6133 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6136 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6137 (zero_extend:DI (match_dup 2)))
6140 (mult:SI (match_dup 1)
6144 int endian = (WORDS_BIG_ENDIAN == 0);
6145 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6146 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6149 (define_expand "smulsi3_highpart"
6150 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6152 (lshiftrt:DI (mult:DI (sign_extend:DI
6153 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6155 (match_operand:SI 2 "gpc_reg_operand" "r")))
6160 if (! TARGET_POWER && ! TARGET_POWERPC)
6162 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6163 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6164 emit_insn (gen_mulh_call ());
6165 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6168 else if (TARGET_POWER)
6170 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6175 (define_insn "smulsi3_highpart_mq"
6176 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6178 (lshiftrt:DI (mult:DI (sign_extend:DI
6179 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6181 (match_operand:SI 2 "gpc_reg_operand" "r")))
6183 (clobber (match_scratch:SI 3 "=q"))]
6186 [(set_attr "type" "imul")])
6188 (define_insn "*smulsi3_highpart_no_mq"
6189 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6191 (lshiftrt:DI (mult:DI (sign_extend:DI
6192 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6194 (match_operand:SI 2 "gpc_reg_operand" "r")))
6196 "TARGET_POWERPC && ! TARGET_POWER"
6198 [(set_attr "type" "imul")])
6200 (define_expand "umulsi3_highpart"
6201 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6203 (lshiftrt:DI (mult:DI (zero_extend:DI
6204 (match_operand:SI 1 "gpc_reg_operand" ""))
6206 (match_operand:SI 2 "gpc_reg_operand" "")))
6213 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6218 (define_insn "umulsi3_highpart_mq"
6219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6221 (lshiftrt:DI (mult:DI (zero_extend:DI
6222 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6224 (match_operand:SI 2 "gpc_reg_operand" "r")))
6226 (clobber (match_scratch:SI 3 "=q"))]
6227 "TARGET_POWERPC && TARGET_POWER"
6229 [(set_attr "type" "imul")])
6231 (define_insn "*umulsi3_highpart_no_mq"
6232 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6234 (lshiftrt:DI (mult:DI (zero_extend:DI
6235 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6237 (match_operand:SI 2 "gpc_reg_operand" "r")))
6239 "TARGET_POWERPC && ! TARGET_POWER"
6241 [(set_attr "type" "imul")])
6243 ;; If operands 0 and 2 are in the same register, we have a problem. But
6244 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6245 ;; why we have the strange constraints below.
6246 (define_insn "ashldi3_power"
6247 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6248 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6249 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6250 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6253 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6254 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6255 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6256 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6257 [(set_attr "length" "8")])
6259 (define_insn "lshrdi3_power"
6260 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6261 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6262 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6263 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6266 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6267 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6268 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6269 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6270 [(set_attr "length" "8")])
6272 ;; Shift by a variable amount is too complex to be worth open-coding. We
6273 ;; just handle shifts by constants.
6274 (define_insn "ashrdi3_power"
6275 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6276 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6277 (match_operand:SI 2 "const_int_operand" "M,i")))
6278 (clobber (match_scratch:SI 3 "=X,q"))]
6281 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6282 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6283 [(set_attr "length" "8")])
6285 ;; PowerPC64 DImode operations.
6287 (define_expand "adddi3"
6288 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6289 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6290 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6294 if (! TARGET_POWERPC64)
6296 if (non_short_cint_operand (operands[2], DImode))
6300 if (GET_CODE (operands[2]) == CONST_INT
6301 && !add_operand (operands[2], DImode))
6303 rtx tmp = ((reload_in_progress || reload_completed
6304 || rtx_equal_p (operands[0], operands[1]))
6305 ? operands[0] : gen_reg_rtx (DImode));
6307 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
6308 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
6311 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
6313 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (high)));
6314 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
6319 ;; Discourage ai/addic because of carry but provide it in an alternative
6320 ;; allowing register zero as source.
6322 (define_insn "*adddi3_internal1"
6323 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
6324 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
6325 (match_operand:DI 2 "add_operand" "r,I,I,J")))]
6333 (define_insn "*adddi3_internal2"
6334 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6335 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
6336 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
6338 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6345 [(set_attr "type" "compare")
6346 (set_attr "length" "4,4,8,8")])
6349 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6350 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6351 (match_operand:DI 2 "reg_or_short_operand" ""))
6353 (clobber (match_scratch:DI 3 ""))]
6356 (plus:DI (match_dup 1)
6359 (compare:CC (match_dup 3)
6363 (define_insn "*adddi3_internal3"
6364 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6365 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
6366 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
6368 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6369 (plus:DI (match_dup 1) (match_dup 2)))]
6376 [(set_attr "type" "compare")
6377 (set_attr "length" "4,4,8,8")])
6380 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6381 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6382 (match_operand:DI 2 "reg_or_short_operand" ""))
6384 (set (match_operand:DI 0 "gpc_reg_operand" "")
6385 (plus:DI (match_dup 1)
6389 (plus:DI (match_dup 1)
6392 (compare:CC (match_dup 0)
6396 ;; Split an add that we can't do in one insn into two insns, each of which
6397 ;; does one 16-bit part. This is used by combine. Note that the low-order
6398 ;; add should be last in case the result gets used in an address.
6401 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6402 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6403 (match_operand:DI 2 "non_add_cint_operand" "")))]
6405 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
6406 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
6409 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
6410 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
6413 high+=0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
6415 operands[3] = GEN_INT (high);
6416 operands[4] = GEN_INT (low);
6419 (define_insn "one_cmpldi2"
6420 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6421 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6426 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6427 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6429 (clobber (match_scratch:DI 2 "=r,r"))]
6432 [(set_attr "type" "compare")
6433 (set_attr "length" "4,8")])
6436 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6437 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6439 (clobber (match_scratch:DI 2 ""))]
6442 (not:DI (match_dup 1)))
6444 (compare:CC (match_dup 2)
6449 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6450 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6452 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6453 (not:DI (match_dup 1)))]
6456 [(set_attr "type" "compare")])
6459 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6460 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6462 (set (match_operand:DI 0 "gpc_reg_operand" "")
6463 (not:DI (match_dup 1)))]
6464 "TARGET_POWERPC64 && reload_completed"
6466 (not:DI (match_dup 1)))
6468 (compare:CC (match_dup 0)
6473 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6474 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
6475 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
6482 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6483 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6484 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6486 (clobber (match_scratch:DI 3 "=r,r"))]
6489 [(set_attr "type" "compare")
6490 (set_attr "length" "4,8")])
6493 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6494 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6495 (match_operand:DI 2 "gpc_reg_operand" ""))
6497 (clobber (match_scratch:DI 3 ""))]
6498 "TARGET_POWERPC64 && reload_completed"
6500 (minus:DI (match_dup 1)
6503 (compare:CC (match_dup 3)
6508 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6509 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6510 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6512 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6513 (minus:DI (match_dup 1) (match_dup 2)))]
6516 [(set_attr "type" "compare")])
6519 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6520 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6521 (match_operand:DI 2 "gpc_reg_operand" ""))
6523 (set (match_operand:DI 0 "gpc_reg_operand" "")
6524 (minus:DI (match_dup 1)
6526 "TARGET_POWERPC64 && reload_completed"
6528 (minus:DI (match_dup 1)
6531 (compare:CC (match_dup 0)
6535 (define_expand "subdi3"
6536 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6537 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
6538 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6542 if (GET_CODE (operands[2]) == CONST_INT)
6544 emit_insn (gen_adddi3 (operands[0], operands[1],
6545 negate_rtx (DImode, operands[2])));
6550 (define_insn "absdi2"
6551 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6552 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6553 (clobber (match_scratch:DI 2 "=&r,&r"))]
6555 "sradi %2,%1,63\;xor %0,%2,%1\;subf %0,%2,%0"
6556 [(set_attr "length" "12")])
6559 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6560 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6561 (clobber (match_scratch:DI 2 "=&r,&r"))]
6562 "TARGET_POWERPC64 && reload_completed"
6563 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6564 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6565 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6569 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6570 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6571 (clobber (match_scratch:DI 2 "=&r,&r"))]
6573 "sradi %2,%1,63\;xor %0,%2,%1\;subf %0,%0,%2"
6574 [(set_attr "length" "12")])
6577 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6578 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6579 (clobber (match_scratch:DI 2 "=&r,&r"))]
6580 "TARGET_POWERPC64 && reload_completed"
6581 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6582 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6583 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6586 (define_expand "negdi2"
6587 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6588 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6593 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6594 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6599 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6600 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6602 (clobber (match_scratch:DI 2 "=r,r"))]
6607 [(set_attr "type" "compare")
6608 (set_attr "length" "4,8")])
6611 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6612 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6614 (clobber (match_scratch:DI 2 ""))]
6615 "TARGET_POWERPC64 && reload_completed"
6617 (neg:DI (match_dup 1)))
6619 (compare:CC (match_dup 2)
6624 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6625 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6627 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6628 (neg:DI (match_dup 1)))]
6633 [(set_attr "type" "compare")
6634 (set_attr "length" "4,8")])
6637 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6638 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6640 (set (match_operand:DI 0 "gpc_reg_operand" "")
6641 (neg:DI (match_dup 1)))]
6642 "TARGET_POWERPC64 && reload_completed"
6644 (neg:DI (match_dup 1)))
6646 (compare:CC (match_dup 0)
6650 (define_insn "ffsdi2"
6651 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6652 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6654 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
6655 [(set_attr "length" "16")])
6657 (define_insn "muldi3"
6658 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6659 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6660 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6663 [(set_attr "type" "imul")])
6665 (define_insn "smuldi3_highpart"
6666 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6668 (lshiftrt:TI (mult:TI (sign_extend:TI
6669 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6671 (match_operand:DI 2 "gpc_reg_operand" "r")))
6675 [(set_attr "type" "imul")])
6677 (define_insn "umuldi3_highpart"
6678 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6680 (lshiftrt:TI (mult:TI (zero_extend:TI
6681 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6683 (match_operand:DI 2 "gpc_reg_operand" "r")))
6687 [(set_attr "type" "imul")])
6689 (define_expand "divdi3"
6690 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6691 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6692 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6696 if (GET_CODE (operands[2]) == CONST_INT
6697 && exact_log2 (INTVAL (operands[2])) >= 0)
6700 operands[2] = force_reg (DImode, operands[2]);
6703 (define_expand "moddi3"
6704 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6705 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6706 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6710 int i = exact_log2 (INTVAL (operands[2]));
6714 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
6717 temp1 = gen_reg_rtx (DImode);
6718 temp2 = gen_reg_rtx (DImode);
6720 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6721 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6722 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6727 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6728 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6729 (match_operand:DI 2 "const_int_operand" "N")))]
6730 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
6731 "sradi %0,%1,%p2\;addze %0,%0"
6732 [(set_attr "length" "8")])
6735 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6736 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6737 (match_operand:DI 2 "const_int_operand" "N,N"))
6739 (clobber (match_scratch:DI 3 "=r,r"))]
6740 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
6742 sradi %3,%1,%p2\;addze. %3,%3
6744 [(set_attr "type" "compare")
6745 (set_attr "length" "8,12")])
6748 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6749 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6750 (match_operand:DI 2 "const_int_operand" ""))
6752 (clobber (match_scratch:DI 3 ""))]
6753 "TARGET_POWERPC64 && reload_completed && exact_log2 (INTVAL (operands[2])) >= 0"
6755 (div:DI (match_dup 1)
6758 (compare:CC (match_dup 3)
6763 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6764 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6765 (match_operand:DI 2 "const_int_operand" "N,N"))
6767 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6768 (div:DI (match_dup 1) (match_dup 2)))]
6769 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
6771 sradi %0,%1,%p2\;addze. %0,%0
6773 [(set_attr "type" "compare")
6774 (set_attr "length" "8,12")])
6777 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6778 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6779 (match_operand:DI 2 "const_int_operand" ""))
6781 (set (match_operand:DI 0 "gpc_reg_operand" "")
6782 (div:DI (match_dup 1)
6784 "TARGET_POWERPC64 && reload_completed && exact_log2 (INTVAL (operands[2])) >= 0"
6786 (div:DI (match_dup 1)
6789 (compare:CC (match_dup 0)
6794 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6795 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6796 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6799 [(set_attr "type" "idiv")])
6801 (define_insn "udivdi3"
6802 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6803 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6804 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6807 [(set_attr "type" "idiv")])
6809 (define_insn "rotldi3"
6810 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6811 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6812 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6814 "rld%I2cl %0,%1,%H2,0")
6816 (define_insn "*rotldi3_internal2"
6817 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6818 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6819 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6821 (clobber (match_scratch:DI 3 "=r,r"))]
6824 rld%I2cl. %3,%1,%H2,0
6826 [(set_attr "type" "delayed_compare")
6827 (set_attr "length" "4,8")])
6830 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6831 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6832 (match_operand:DI 2 "reg_or_cint_operand" ""))
6834 (clobber (match_scratch:DI 3 ""))]
6835 "TARGET_POWERPC64 && reload_completed"
6837 (rotate:DI (match_dup 1)
6840 (compare:CC (match_dup 3)
6844 (define_insn "*rotldi3_internal3"
6845 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6846 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6847 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6849 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6850 (rotate:DI (match_dup 1) (match_dup 2)))]
6853 rld%I2cl. %0,%1,%H2,0
6855 [(set_attr "type" "delayed_compare")
6856 (set_attr "length" "4,8")])
6859 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6860 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6861 (match_operand:DI 2 "reg_or_cint_operand" ""))
6863 (set (match_operand:DI 0 "gpc_reg_operand" "")
6864 (rotate:DI (match_dup 1)
6866 "TARGET_POWERPC64 && reload_completed"
6868 (rotate:DI (match_dup 1)
6871 (compare:CC (match_dup 0)
6875 (define_insn "*rotldi3_internal4"
6876 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6877 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6878 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6879 (match_operand:DI 3 "mask64_operand" "S")))]
6881 "rld%I2c%B3 %0,%1,%H2,%S3")
6883 (define_insn "*rotldi3_internal5"
6884 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6886 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6887 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6888 (match_operand:DI 3 "mask64_operand" "S,S"))
6890 (clobber (match_scratch:DI 4 "=r,r"))]
6893 rld%I2c%B3. %4,%1,%H2,%S3
6895 [(set_attr "type" "delayed_compare")
6896 (set_attr "length" "4,8")])
6899 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6901 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6902 (match_operand:DI 2 "reg_or_cint_operand" ""))
6903 (match_operand:DI 3 "mask64_operand" ""))
6905 (clobber (match_scratch:DI 4 ""))]
6906 "TARGET_POWERPC64 && reload_completed"
6909 (rotate:DI (match_dup 1)
6913 (compare:CC (match_dup 4)
6917 (define_insn "*rotldi3_internal6"
6918 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6920 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6921 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6922 (match_operand:DI 3 "mask64_operand" "S,S"))
6924 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6925 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6928 rld%I2c%B3. %0,%1,%H2,%S3
6930 [(set_attr "type" "delayed_compare")
6931 (set_attr "length" "4,8")])
6934 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6936 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6937 (match_operand:DI 2 "reg_or_cint_operand" ""))
6938 (match_operand:DI 3 "mask64_operand" ""))
6940 (set (match_operand:DI 0 "gpc_reg_operand" "")
6942 (rotate:DI (match_dup 1)
6945 "TARGET_POWERPC64 && reload_completed"
6948 (rotate:DI (match_dup 1)
6952 (compare:CC (match_dup 0)
6956 (define_insn "*rotldi3_internal7"
6957 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6960 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6961 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6963 "rld%I2cl %0,%1,%H2,56")
6965 (define_insn "*rotldi3_internal8"
6966 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6967 (compare:CC (zero_extend:DI
6969 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6970 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6972 (clobber (match_scratch:DI 3 "=r,r"))]
6975 rld%I2cl. %3,%1,%H2,56
6977 [(set_attr "type" "delayed_compare")
6978 (set_attr "length" "4,8")])
6981 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6982 (compare:CC (zero_extend:DI
6985 (match_operand:DI 1 "gpc_reg_operand" "")
6986 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6988 (clobber (match_scratch:DI 3 ""))]
6989 "TARGET_POWERPC64 && reload_completed"
6997 (compare:CC (match_dup 3)
7001 (define_insn "*rotldi3_internal9"
7002 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7003 (compare:CC (zero_extend:DI
7005 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7006 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7008 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7009 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7012 rld%I2cl. %0,%1,%H2,56
7014 [(set_attr "type" "delayed_compare")
7015 (set_attr "length" "4,8")])
7018 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7019 (compare:CC (zero_extend:DI
7022 (match_operand:DI 1 "gpc_reg_operand" "")
7023 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7025 (set (match_operand:DI 0 "gpc_reg_operand" "")
7030 (match_dup 2)) 0)))]
7031 "TARGET_POWERPC64 && reload_completed"
7039 (compare:CC (match_dup 0)
7043 (define_insn "*rotldi3_internal10"
7044 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7047 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7048 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
7050 "rld%I2cl %0,%1,%H2,48")
7052 (define_insn "*rotldi3_internal11"
7053 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7054 (compare:CC (zero_extend:DI
7056 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7057 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7059 (clobber (match_scratch:DI 3 "=r,r"))]
7062 rld%I2cl. %3,%1,%H2,48
7064 [(set_attr "type" "delayed_compare")
7065 (set_attr "length" "4,8")])
7068 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7069 (compare:CC (zero_extend:DI
7072 (match_operand:DI 1 "gpc_reg_operand" "")
7073 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7075 (clobber (match_scratch:DI 3 ""))]
7076 "TARGET_POWERPC64 && reload_completed"
7084 (compare:CC (match_dup 3)
7088 (define_insn "*rotldi3_internal12"
7089 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7090 (compare:CC (zero_extend:DI
7092 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7093 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7095 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7096 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7099 rld%I2cl. %0,%1,%H2,48
7101 [(set_attr "type" "delayed_compare")
7102 (set_attr "length" "4,8")])
7105 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7106 (compare:CC (zero_extend:DI
7109 (match_operand:DI 1 "gpc_reg_operand" "")
7110 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7112 (set (match_operand:DI 0 "gpc_reg_operand" "")
7117 (match_dup 2)) 0)))]
7118 "TARGET_POWERPC64 && reload_completed"
7126 (compare:CC (match_dup 0)
7130 (define_insn "*rotldi3_internal13"
7131 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7134 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7135 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
7137 "rld%I2cl %0,%1,%H2,32")
7139 (define_insn "*rotldi3_internal14"
7140 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7141 (compare:CC (zero_extend:DI
7143 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7144 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7146 (clobber (match_scratch:DI 3 "=r,r"))]
7149 rld%I2cl. %3,%1,%H2,32
7151 [(set_attr "type" "delayed_compare")
7152 (set_attr "length" "4,8")])
7155 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7156 (compare:CC (zero_extend:DI
7159 (match_operand:DI 1 "gpc_reg_operand" "")
7160 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7162 (clobber (match_scratch:DI 3 ""))]
7163 "TARGET_POWERPC64 && reload_completed"
7171 (compare:CC (match_dup 3)
7175 (define_insn "*rotldi3_internal15"
7176 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7177 (compare:CC (zero_extend:DI
7179 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7180 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7182 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7183 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7186 rld%I2cl. %0,%1,%H2,32
7188 [(set_attr "type" "delayed_compare")
7189 (set_attr "length" "4,8")])
7192 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7193 (compare:CC (zero_extend:DI
7196 (match_operand:DI 1 "gpc_reg_operand" "")
7197 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7199 (set (match_operand:DI 0 "gpc_reg_operand" "")
7204 (match_dup 2)) 0)))]
7205 "TARGET_POWERPC64 && reload_completed"
7213 (compare:CC (match_dup 0)
7217 (define_expand "ashldi3"
7218 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7219 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7220 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7221 "TARGET_POWERPC64 || TARGET_POWER"
7224 if (TARGET_POWERPC64)
7226 else if (TARGET_POWER)
7228 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7236 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7237 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7238 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7241 [(set_attr "length" "8")])
7244 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7245 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7246 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7248 (clobber (match_scratch:DI 3 "=r,r"))]
7253 [(set_attr "type" "delayed_compare")
7254 (set_attr "length" "4,8")])
7257 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7258 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7259 (match_operand:DI 2 "reg_or_cint_operand" ""))
7261 (clobber (match_scratch:DI 3 ""))]
7262 "TARGET_POWERPC64 && reload_completed"
7264 (ashift:DI (match_dup 1)
7267 (compare:CC (match_dup 3)
7272 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7273 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7274 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7276 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7277 (ashift:DI (match_dup 1) (match_dup 2)))]
7282 [(set_attr "type" "delayed_compare")
7283 (set_attr "length" "4,8")])
7286 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7287 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7288 (match_operand:DI 2 "reg_or_cint_operand" ""))
7290 (set (match_operand:DI 0 "gpc_reg_operand" "")
7291 (ashift:DI (match_dup 1)
7293 "TARGET_POWERPC64 && reload_completed"
7295 (ashift:DI (match_dup 1)
7298 (compare:CC (match_dup 0)
7302 (define_expand "lshrdi3"
7303 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7304 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7305 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7306 "TARGET_POWERPC64 || TARGET_POWER"
7309 if (TARGET_POWERPC64)
7311 else if (TARGET_POWER)
7313 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7321 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7322 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7323 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7328 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7329 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7330 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7332 (clobber (match_scratch:DI 3 "=r,r"))]
7337 [(set_attr "type" "delayed_compare")
7338 (set_attr "length" "4,8")])
7341 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7342 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7343 (match_operand:DI 2 "reg_or_cint_operand" ""))
7345 (clobber (match_scratch:DI 3 ""))]
7346 "TARGET_POWERPC64 && reload_completed"
7348 (lshiftrt:DI (match_dup 1)
7351 (compare:CC (match_dup 3)
7356 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7357 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7358 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7360 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7361 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7366 [(set_attr "type" "delayed_compare")
7367 (set_attr "length" "4,8")])
7370 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7371 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7372 (match_operand:DI 2 "reg_or_cint_operand" ""))
7374 (set (match_operand:DI 0 "gpc_reg_operand" "")
7375 (lshiftrt:DI (match_dup 1)
7377 "TARGET_POWERPC64 && reload_completed"
7379 (lshiftrt:DI (match_dup 1)
7382 (compare:CC (match_dup 0)
7386 (define_expand "ashrdi3"
7387 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7388 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7389 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7390 "TARGET_POWERPC64 || TARGET_POWER"
7393 if (TARGET_POWERPC64)
7395 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7397 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7405 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7406 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7407 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7409 "srad%I2 %0,%1,%H2")
7412 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7413 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7414 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7416 (clobber (match_scratch:DI 3 "=r,r"))]
7421 [(set_attr "type" "delayed_compare")
7422 (set_attr "length" "4,8")])
7425 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7426 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7427 (match_operand:DI 2 "reg_or_cint_operand" ""))
7429 (clobber (match_scratch:DI 3 ""))]
7430 "TARGET_POWERPC64 && reload_completed"
7432 (ashiftrt:DI (match_dup 1)
7435 (compare:CC (match_dup 3)
7440 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7441 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7442 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7444 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7445 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7450 [(set_attr "type" "delayed_compare")
7451 (set_attr "length" "4,8")])
7454 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7455 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7456 (match_operand:DI 2 "reg_or_cint_operand" ""))
7458 (set (match_operand:DI 0 "gpc_reg_operand" "")
7459 (ashiftrt (match_dup 1)
7461 "TARGET_POWERPC64 && reload_completed"
7463 (ashiftrt (match_dup 1)
7466 (compare:CC (match_dup 0)
7470 (define_expand "anddi3"
7471 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
7472 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
7473 (match_operand:DI 2 "and_operand" "?r,L,K,J")))
7474 (clobber (match_scratch:CC 3 "=X,X,x,x"))])]
7478 ;; If cr0 isn't available, and we want to do an andi, load the register into
7479 ;; the destination first.
7481 (define_insn "anddi3_internal1"
7482 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,&??r,&??r")
7483 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
7484 (match_operand:DI 2 "and_operand" "?r,L,K,J,K,J")))
7485 (clobber (match_operand:CC 3 "scratch_operand" "=X,X,x,x,X,X"))]
7489 {rlinm|rlwinm} %0,%1,0,%m2,%M2
7490 {andil.|andi.} %0,%1,%b2
7491 {andiu.|andis.} %0,%1,%u2
7494 [(set_attr "length" "4,4,4,4,8,8")])
7497 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7498 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7499 (match_operand:DI 2 "const_int_operand" "")))
7500 (clobber (scratch:CC))]
7504 (parallel [(set (match_dup 0)
7505 (and:DI (match_dup 0)
7507 (clobber (scratch:CC))])]
7510 ;; Note to set cr's other than cr0 we do the and immediate and then
7511 ;; the test again -- this avoids a mcrf which on the higher end
7512 ;; machines causes an execution serialization
7514 (define_insn "*anddi3_internal2"
7515 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y,???y,???y")
7516 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7517 (match_operand:DI 2 "and_operand" "r,K,J,L,r,K,J,L,K,L"))
7519 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,&r,&r"))
7520 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X,X,X"))]
7524 {andil.|andi.} %3,%1,%b2
7525 {andiu.|andis.} %3,%1,%u2
7526 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
7533 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare")
7534 (set_attr "length" "4,4,4,4,8,12,12,8,16,16")])
7537 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7538 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7539 (match_operand:DI 2 "and_operand" ""))
7541 (clobber (match_scratch:DI 3 ""))
7542 (clobber (match_scratch:CC 4 ""))]
7544 [(parallel [(set (match_dup 3)
7545 (and:DI (match_dup 1)
7547 (clobber (match_dup 4))])
7549 (compare:CC (match_dup 3)
7553 (define_insn "*anddi3_internal3"
7554 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y,???y,???y")
7555 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7556 (match_operand:DI 2 "and_operand" "r,K,J,L,r,K,J,L,K,J"))
7558 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,&r,&r")
7559 (and:DI (match_dup 1)
7561 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X,X,X"))]
7565 {andil.|andi.} %0,%1,%b2
7566 {andiu.|andis.} %0,%1,%u2
7567 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
7574 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare,compare")])
7577 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7578 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7579 (match_operand:DI 2 "and_operand" ""))
7581 (set (match_operand:DI 0 "gpc_reg_operand" "")
7582 (and:DI (match_dup 1)
7584 (clobber (match_scratch:CC 4 ""))]
7586 [(parallel [(set (match_dup 0)
7587 (and:DI (match_dup 1)
7589 (clobber (match_dup 4))])
7591 (compare:CC (match_dup 0)
7595 (define_expand "iordi3"
7596 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7597 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7598 (match_operand:DI 2 "reg_or_cint_operand" "")))]
7602 if (GET_CODE (operands[2]) == CONST_INT
7603 && !logical_operand (operands[2], DImode))
7605 HOST_WIDE_INT value = INTVAL (operands[2]);
7606 rtx tmp = ((reload_in_progress || reload_completed
7607 || rtx_equal_p (operands[0], operands[1]))
7608 ? operands[0] : gen_reg_rtx (DImode));
7610 emit_insn (gen_iordi3 (tmp, operands[1],
7611 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7612 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7617 (define_insn "*iordi3_internal1"
7618 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7619 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7620 (match_operand:DI 2 "logical_operand" "r,K,J")))]
7627 (define_insn "*iordi3_internal2"
7628 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7629 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7630 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7632 (clobber (match_scratch:DI 3 "=r,r"))]
7637 [(set_attr "type" "compare")
7638 (set_attr "length" "4,8")])
7641 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7642 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7643 (match_operand:DI 2 "gpc_reg_operand" ""))
7645 (clobber (match_scratch:DI 3 ""))]
7648 (ior:DI (match_dup 1)
7651 (compare:CC (match_dup 3)
7655 (define_insn "*iordi3_internal3"
7656 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7657 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7658 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7660 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7661 (ior:DI (match_dup 1) (match_dup 2)))]
7666 [(set_attr "type" "compare")
7667 (set_attr "length" "4,8")])
7670 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7671 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7672 (match_operand:DI 2 "gpc_reg_operand" ""))
7674 (set (match_operand:DI 0 "gpc_reg_operand" "")
7675 (ior:DI (match_dup 1) (match_dup 2)))]
7678 (ior:DI (match_dup 1)
7681 (compare:CC (match_dup 0)
7685 ;; Split an IOR that we can't do in one insn into two insns, each of which
7686 ;; does one 16-bit part. This is used by combine.
7689 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7690 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7691 (match_operand:DI 2 "non_logical_cint_operand" "")))]
7693 [(set (match_dup 0) (ior:DI (match_dup 1) (match_dup 3)))
7694 (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 4)))]
7697 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
7698 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
7701 (define_expand "xordi3"
7702 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7703 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7704 (match_operand:DI 2 "reg_or_cint_operand" "")))]
7708 if (GET_CODE (operands[2]) == CONST_INT
7709 && !logical_operand (operands[2], DImode))
7711 HOST_WIDE_INT value = INTVAL (operands[2]);
7712 rtx tmp = ((reload_in_progress || reload_completed
7713 || rtx_equal_p (operands[0], operands[1]))
7714 ? operands[0] : gen_reg_rtx (DImode));
7716 emit_insn (gen_xordi3 (tmp, operands[1],
7717 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7718 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7723 (define_insn "*xordi3_internal1"
7724 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7725 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7726 (match_operand:DI 2 "logical_operand" "r,K,J")))]
7733 (define_insn "*xordi3_internal2"
7734 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7735 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7736 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7738 (clobber (match_scratch:DI 3 "=r,r"))]
7743 [(set_attr "type" "compare")
7744 (set_attr "length" "4,8")])
7747 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7748 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7749 (match_operand:DI 2 "gpc_reg_operand" ""))
7751 (clobber (match_scratch:DI 3 ""))]
7754 (xor:DI (match_dup 1)
7757 (compare:CC (match_dup 3)
7761 (define_insn "*xordi3_internal3"
7762 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7763 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7764 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7766 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7767 (xor:DI (match_dup 1) (match_dup 2)))]
7772 [(set_attr "type" "compare")
7773 (set_attr "length" "4,8")])
7776 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7777 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7778 (match_operand:DI 2 "gpc_reg_operand" ""))
7780 (set (match_operand:DI 0 "gpc_reg_operand" "")
7781 (xor:DI (match_dup 1) (match_dup 2)))]
7784 (xor:DI (match_dup 1)
7787 (compare:CC (match_dup 0)
7791 ;; Split an XOR that we can't do in one insn into two insns, each of which
7792 ;; does one 16-bit part. This is used by combine.
7795 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7796 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7797 (match_operand:DI 2 "non_logical_cint_operand" "")))]
7799 [(set (match_dup 0) (xor:DI (match_dup 1) (match_dup 3)))
7800 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 4)))]
7803 operands[3] = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
7804 operands[4] = GEN_INT (INTVAL (operands[2]) & 0xffff);
7807 (define_insn "*eqvdi3_internal1"
7808 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7809 (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
7810 (match_operand:DI 2 "gpc_reg_operand" "r"))))]
7814 (define_insn "*eqvdi3_internal2"
7815 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7816 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7817 (match_operand:DI 2 "gpc_reg_operand" "r,r")))
7819 (clobber (match_scratch:DI 3 "=r,r"))]
7824 [(set_attr "type" "compare")
7825 (set_attr "length" "4,8")])
7828 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7829 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7830 (match_operand:DI 2 "gpc_reg_operand" "")))
7832 (clobber (match_scratch:DI 3 ""))]
7835 (not:DI (xor:DI (match_dup 1)
7838 (compare:CC (match_dup 3)
7842 (define_insn "*eqvdi3_internal3"
7843 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7844 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7845 (match_operand:DI 2 "gpc_reg_operand" "r,r")))
7847 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7848 (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
7853 [(set_attr "type" "compare")
7854 (set_attr "length" "4,8")])
7857 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7858 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7859 (match_operand:DI 2 "reg_or_short_operand" "")))
7861 (set (match_operand:DI 0 "gpc_reg_operand" "")
7862 (not:DI (xor:DI (match_dup 1)
7866 (not:DI (xor:DI (match_dup 1)
7869 (compare:CC (match_dup 0)
7873 (define_insn "*andcdi3_internal1"
7874 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7875 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7876 (match_operand:DI 2 "gpc_reg_operand" "r")))]
7880 (define_insn "*andcdi3_internal2"
7881 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7882 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7883 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7885 (clobber (match_scratch:DI 3 "=r,r"))]
7890 [(set_attr "type" "compare")
7891 (set_attr "length" "4,8")])
7894 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7895 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7896 (match_operand:DI 2 "gpc_reg_operand" ""))
7898 (clobber (match_scratch:DI 3 ""))]
7901 (and:DI (not:DI (match_dup 1))
7904 (compare:CC (match_dup 3)
7908 (define_insn "*andcdi3_internal3"
7909 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7910 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7911 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7913 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7914 (and:DI (not:DI (match_dup 1)) (match_dup 2)))]
7919 [(set_attr "type" "compare")
7920 (set_attr "length" "4,8")])
7923 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7924 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7925 (match_operand:DI 2 "gpc_reg_operand" ""))
7927 (set (match_operand:DI 0 "gpc_reg_operand" "")
7928 (and:DI (not:DI (match_dup 1))
7932 (and:DI (not:DI (match_dup 1))
7935 (compare:CC (match_dup 0)
7939 (define_insn "*iorcdi3_internal1"
7940 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7941 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7942 (match_operand:DI 2 "gpc_reg_operand" "r")))]
7946 (define_insn "*iorcdi3_inernal2"
7947 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7948 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7949 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7951 (clobber (match_scratch:DI 3 "=r,r"))]
7956 [(set_attr "type" "compare")
7957 (set_attr "length" "4,8")])
7960 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7961 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7962 (match_operand:DI 2 "gpc_reg_operand" ""))
7964 (clobber (match_scratch:DI 3 ""))]
7967 (ior:DI (not:DI (match_dup 1))
7970 (compare:CC (match_dup 3)
7974 (define_insn "*iorcdi3_internal3"
7975 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7976 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7977 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
7979 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7980 (ior:DI (not:DI (match_dup 1)) (match_dup 2)))]
7985 [(set_attr "type" "compare")
7986 (set_attr "length" "4,8")])
7989 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7990 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7991 (match_operand:DI 2 "gpc_reg_operand" ""))
7993 (set (match_operand:DI 0 "gpc_reg_operand" "")
7994 (ior:DI (not:DI (match_dup 1))
7998 (ior:DI (not:DI (match_dup 1))
8001 (compare:CC (match_dup 0)
8005 (define_insn "*nanddi3_internal1"
8006 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8007 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8008 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
8012 (define_insn "*nanddi3_internal2"
8013 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8014 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8015 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r")))
8017 (clobber (match_scratch:DI 3 "=r,r"))]
8022 [(set_attr "type" "compare")
8023 (set_attr "length" "4,8")])
8026 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8027 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8028 (not:DI (match_operand:DI 2 "gpc_reg_operand" "")))
8030 (clobber (match_scratch:DI 3 ""))]
8033 (ior:DI (not:DI (match_dup 1))
8034 (not:DI (match_dup 2))))
8036 (compare:CC (match_dup 3)
8040 (define_insn "*nanddi3_internal3"
8041 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8042 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8043 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r")))
8045 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8046 (ior:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
8051 [(set_attr "type" "compare")
8052 (set_attr "length" "4,8")])
8055 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8056 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8057 (not:DI (match_operand:DI 2 "gpc_reg_operand" "")))
8059 (set (match_operand:DI 0 "gpc_reg_operand" "")
8060 (ior:DI (not:DI (match_dup 1))
8061 (not:DI (match_dup 2))))]
8064 (ior:DI (not:DI (match_dup 1))
8065 (not:DI (match_dup 2))))
8067 (compare:CC (match_dup 0)
8071 (define_insn "*nordi3_internal1"
8072 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8073 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8074 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
8078 (define_insn "*nordi3_internal2"
8079 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8080 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8081 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r")))
8083 (clobber (match_scratch:DI 3 "=r,r"))]
8088 [(set_attr "type" "compare")
8089 (set_attr "length" "4,8")])
8092 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8093 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8094 (not:DI (match_operand:DI 2 "gpc_reg_operand" "")))
8096 (clobber (match_scratch:DI 3 ""))]
8099 (and:DI (not:DI (match_dup 1))
8100 (not:DI (match_dup 2))))
8102 (compare:CC (match_dup 3)
8106 (define_insn "*nordi3_internal3"
8107 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8108 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8109 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r")))
8111 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8112 (and:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
8117 [(set_attr "type" "compare")
8118 (set_attr "length" "4,8")])
8121 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8122 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8123 (not:DI (match_operand:DI 2 "gpc_reg_operand" "")))
8125 (set (match_operand:DI 0 "gpc_reg_operand" "")
8126 (and:DI (not:DI (match_dup 1))
8127 (not:DI (match_dup 2))))]
8130 (and:DI (not:DI (match_dup 1))
8131 (not:DI (match_dup 2))))
8133 (compare:CC (match_dup 0)
8138 ;; Now define ways of moving data around.
8140 ;; Elf specific ways of loading addresses for non-PIC code.
8141 ;; The output of this could be r0, but we limit it to base
8142 ;; registers, since almost all uses of this will need it
8143 ;; in a base register shortly.
8144 (define_insn "elf_high"
8145 [(set (match_operand:SI 0 "register_operand" "=b")
8146 (high:SI (match_operand 1 "" "")))]
8147 "TARGET_ELF && !TARGET_64BIT"
8148 "{liu|lis} %0,%1@ha")
8150 (define_insn "elf_low"
8151 [(set (match_operand:SI 0 "register_operand" "=r")
8152 (lo_sum:SI (match_operand:SI 1 "register_operand" "b")
8153 (match_operand 2 "" "")))]
8154 "TARGET_ELF && !TARGET_64BIT"
8155 "{cal|la} %0,%2@l(%1)")
8157 ;; Set up a register with a value from the GOT table
8159 (define_expand "movsi_got"
8160 [(set (match_operand:SI 0 "register_operand" "")
8161 (unspec [(match_operand:SI 1 "got_operand" "")
8163 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
8166 if (GET_CODE (operands[1]) == CONST)
8168 rtx offset = const0_rtx;
8169 HOST_WIDE_INT value;
8171 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8172 value = INTVAL (offset);
8175 rtx tmp = ((reload_in_progress || reload_completed)
8177 : gen_reg_rtx (Pmode));
8178 emit_insn (gen_movsi_got (tmp, operands[1]));
8179 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8184 operands[2] = rs6000_got_register (operands[1]);
8187 (define_insn "*movsi_got_internal"
8188 [(set (match_operand:SI 0 "register_operand" "=r")
8189 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
8190 (match_operand:SI 2 "register_operand" "b")] 8))]
8191 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
8192 "{l|lwz} %0,%a1@got(%2)"
8193 [(set_attr "type" "load")])
8195 ;; Sometimes, though, the GOT `register' will be on the stack. Deal with
8196 ;; this case specially.
8197 ;; Force final to split this insn (if it hasn't been split already) to
8198 ;; avoid having to create a suitable output template.
8199 (define_insn "*movsi_got_internal_mem"
8200 [(set (match_operand:SI 0 "register_operand" "=r")
8201 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
8202 (match_operand:SI 2 "memory_operand" "m")] 8))]
8203 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
8205 && (reload_in_progress || reload_completed)"
8207 [(set_attr "type" "load")
8208 (set_attr "length" "8")])
8210 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8211 ;; didn't get allocated to a hard register.
8213 [(set (match_operand:SI 0 "register_operand" "=r")
8214 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
8215 (match_operand:SI 2 "memory_operand" "m")] 8))]
8216 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
8218 && (reload_in_progress || reload_completed)"
8219 [(set (match_dup 0) (match_dup 2))
8220 (set (match_dup 0) (unspec [(match_dup 1)(match_dup 0)] 8))]
8223 ;; For SI, we special-case integers that can't be loaded in one insn. We
8224 ;; do the load 16-bits at a time. We could do this by loading from memory,
8225 ;; and this is even supposed to be faster, but it is simpler not to get
8226 ;; integers in the TOC.
8227 (define_expand "movsi"
8228 [(set (match_operand:SI 0 "general_operand" "")
8229 (match_operand:SI 1 "any_operand" ""))]
8233 if (GET_CODE (operands[0]) != REG)
8234 operands[1] = force_reg (SImode, operands[1]);
8236 /* Convert a move of a CONST_DOUBLE into a CONST_INT */
8237 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8238 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8240 /* Only a tiny bit of handling for CONSTANT_P_RTX is necessary. */
8241 if (GET_CODE (operands[1]) == CONST
8242 && GET_CODE (XEXP (operands[1], 0)) == CONSTANT_P_RTX)
8244 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
8248 /* Use default pattern for address of ELF small data */
8250 && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
8251 && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
8252 && small_data_operand (operands[1], SImode))
8254 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
8258 if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
8259 && flag_pic == 1 && got_operand (operands[1], SImode))
8261 emit_insn (gen_movsi_got (operands[0], operands[1]));
8265 if (TARGET_ELF && TARGET_NO_TOC && !TARGET_64BIT
8267 && CONSTANT_P (operands[1])
8268 && GET_CODE (operands[1]) != HIGH
8269 && GET_CODE (operands[1]) != CONST_INT)
8271 rtx target = (reload_completed || reload_in_progress)
8272 ? operands[0] : gen_reg_rtx (SImode);
8274 /* If this is a function address on -mcall-aixdesc or -mcall-nt,
8275 convert it to the address of the descriptor. */
8276 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
8277 && GET_CODE (operands[1]) == SYMBOL_REF
8278 && XSTR (operands[1], 0)[0] == '.')
8280 char *name = XSTR (operands[1], 0);
8282 while (*name == '.')
8284 new_ref = gen_rtx_SYMBOL_REF (Pmode, name);
8285 CONSTANT_POOL_ADDRESS_P (new_ref) = CONSTANT_POOL_ADDRESS_P (operands[1]);
8286 SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
8287 SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
8288 operands[1] = new_ref;
8291 emit_insn (gen_elf_high (target, operands[1]));
8292 emit_insn (gen_elf_low (operands[0], target, operands[1]));
8296 if (GET_CODE (operands[1]) == CONST
8297 && DEFAULT_ABI == ABI_NT
8298 && !side_effects_p (operands[0]))
8300 rtx const_term = const0_rtx;
8301 rtx sym = eliminate_constant_term (XEXP (operands[1], 0), &const_term);
8302 if (sym && GET_CODE (const_term) == CONST_INT
8303 && (GET_CODE (sym) == SYMBOL_REF || GET_CODE (sym) == LABEL_REF))
8305 unsigned HOST_WIDE_INT value = INTVAL (const_term);
8306 int new_reg_p = (flag_expensive_optimizations
8307 && !reload_completed
8308 && !reload_in_progress);
8309 rtx tmp1 = (new_reg_p && value != 0) ? gen_reg_rtx (SImode) : operands[0];
8311 emit_insn (gen_movsi (tmp1, sym));
8312 if (INTVAL (const_term) != 0)
8313 emit_insn (gen_addsi3 (operands[0], tmp1, GEN_INT (value)));
8317 rs6000_fatal_bad_address (operands[1]);
8320 if ((!TARGET_WINDOWS_NT || DEFAULT_ABI != ABI_NT)
8321 && CONSTANT_P (operands[1])
8322 && GET_CODE (operands[1]) != CONST_INT
8323 && GET_CODE (operands[1]) != HIGH
8324 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
8326 /* Emit a USE operation so that the constant isn't deleted if
8327 expensive optimizations are turned on because nobody
8328 references it. This should only be done for operands that
8329 contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
8330 This should not be done for operands that contain LABEL_REFs.
8331 For now, we just handle the obvious case. */
8332 if (GET_CODE (operands[1]) != LABEL_REF)
8333 emit_insn (gen_rtx_USE (VOIDmode, operands[1]));
8335 /* If we are to limit the number of things we put in the TOC and
8336 this is a symbol plus a constant we can add in one insn,
8337 just put the symbol in the TOC and add the constant. Don't do
8338 this if reload is in progress. */
8339 if (GET_CODE (operands[1]) == CONST
8340 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
8341 && GET_CODE (XEXP (operands[1], 0)) == PLUS
8342 && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
8343 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
8344 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
8345 && ! side_effects_p (operands[0]))
8347 rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
8348 rtx other = XEXP (XEXP (operands[1], 0), 1);
8350 emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
8354 operands[1] = force_const_mem (SImode, operands[1]);
8355 if (! memory_address_p (SImode, XEXP (operands[1], 0))
8356 && ! reload_in_progress)
8357 operands[1] = change_address (operands[1], SImode,
8358 XEXP (operands[1], 0));
8363 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h")
8364 (match_operand:SI 1 "input_operand" "r,U,m,r,I,J,n,R,*h,r,r,0"))]
8365 "gpc_reg_operand (operands[0], SImode)
8366 || gpc_reg_operand (operands[1], SImode)"
8370 {l%U1%X1|lwz%U1%X1} %0,%1
8371 {st%U0%X0|stw%U0%X0} %1,%0
8380 [(set_attr "type" "*,*,load,store,*,*,*,*,*,*,mtjmpr,*")
8381 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4")])
8383 ;; Split a load of a large constant into the appropriate two-insn
8387 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8388 (match_operand:SI 1 "const_int_operand" ""))]
8389 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8390 && (INTVAL (operands[1]) & 0xffff) != 0"
8394 (ior:SI (match_dup 0)
8398 operands[2] = GEN_INT (INTVAL (operands[1]) & 0xffff0000);
8399 operands[3] = GEN_INT (INTVAL (operands[1]) & 0xffff);
8403 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
8404 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r,r")
8406 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
8409 [(set_attr "type" "compare")])
8412 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8413 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8415 (set (match_operand:SI 0 "gpc_reg_operand" "")
8417 "reload_completed && rtx_equal_p (operands[0], operands[1])"
8419 (compare:CC (match_dup 1)
8424 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8425 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8427 (set (match_operand:SI 0 "gpc_reg_operand" "")
8429 "reload_completed && !rtx_equal_p (operands[0], operands[1])"
8431 (compare:CC (match_dup 1)
8438 (define_expand "movhi"
8439 [(set (match_operand:HI 0 "general_operand" "")
8440 (match_operand:HI 1 "any_operand" ""))]
8444 if (GET_CODE (operands[0]) != REG)
8445 operands[1] = force_reg (HImode, operands[1]);
8447 if (CONSTANT_P (operands[1])
8448 && GET_CODE (operands[1]) != CONST_INT)
8450 operands[1] = force_const_mem (HImode, operands[1]);
8451 if (! memory_address_p (HImode, XEXP (operands[1], 0))
8452 && ! reload_in_progress)
8453 operands[1] = change_address (operands[1], HImode,
8454 XEXP (operands[1], 0));
8459 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8460 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8461 "gpc_reg_operand (operands[0], HImode)
8462 || gpc_reg_operand (operands[1], HImode)"
8472 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
8474 (define_expand "movqi"
8475 [(set (match_operand:QI 0 "general_operand" "")
8476 (match_operand:QI 1 "any_operand" ""))]
8480 if (GET_CODE (operands[0]) != REG)
8481 operands[1] = force_reg (QImode, operands[1]);
8483 if (CONSTANT_P (operands[1])
8484 && GET_CODE (operands[1]) != CONST_INT)
8486 operands[1] = force_const_mem (QImode, operands[1]);
8487 if (! memory_address_p (QImode, XEXP (operands[1], 0))
8488 && ! reload_in_progress)
8489 operands[1] = change_address (operands[1], QImode,
8490 XEXP (operands[1], 0));
8495 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8496 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8497 "gpc_reg_operand (operands[0], QImode)
8498 || gpc_reg_operand (operands[1], QImode)"
8508 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
8510 ;; Here is how to move condition codes around. When we store CC data in
8511 ;; an integer register or memory, we store just the high-order 4 bits.
8512 ;; This lets us not shift in the most common case of CR0.
8513 (define_expand "movcc"
8514 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8515 (match_operand:CC 1 "nonimmediate_operand" ""))]
8520 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
8521 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
8522 "register_operand (operands[0], CCmode)
8523 || register_operand (operands[1], CCmode)"
8527 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8529 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8531 {l%U1%X1|lwz%U1%X1} %0,%1
8532 {st%U0%U1|stw%U0%U1} %1,%0"
8533 [(set_attr "type" "*,*,*,compare,*,*,load,store")
8534 (set_attr "length" "*,*,12,*,8,*,*,*")])
8536 ;; For floating-point, we normally deal with the floating-point registers
8537 ;; unless -msoft-float is used. The sole exception is that parameter passing
8538 ;; can produce floating-point values in fixed-point registers. Unless the
8539 ;; value is a simple constant or already in memory, we deal with this by
8540 ;; allocating memory and copying the value explicitly via that memory location.
8541 (define_expand "movsf"
8542 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8543 (match_operand:SF 1 "any_operand" ""))]
8547 /* If we are called from reload, we might be getting a SUBREG of a hard
8548 reg. So expand it. */
8549 if (GET_CODE (operands[0]) == SUBREG
8550 && GET_CODE (SUBREG_REG (operands[0])) == REG
8551 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
8552 operands[0] = alter_subreg (operands[0]);
8553 if (GET_CODE (operands[1]) == SUBREG
8554 && GET_CODE (SUBREG_REG (operands[1])) == REG
8555 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
8556 operands[1] = alter_subreg (operands[1]);
8558 if (GET_CODE (operands[0]) == MEM)
8560 /* If operands[1] is a register, it may have double-precision data
8561 in it, so truncate it to single precision. We need not do
8562 this for POWERPC. */
8563 if (! TARGET_POWERPC && TARGET_HARD_FLOAT
8564 && GET_CODE (operands[1]) == REG
8565 && (FP_REGNO_P (REGNO (operands[1]))
8566 || REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
8569 = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
8570 emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
8571 operands[1] = newreg;
8574 operands[1] = force_reg (SFmode, operands[1]);
8577 if (CONSTANT_P (operands[1]) && TARGET_HARD_FLOAT)
8579 operands[1] = force_const_mem (SFmode, operands[1]);
8580 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
8581 && ! reload_in_progress)
8582 operands[1] = change_address (operands[1], SFmode,
8583 XEXP (operands[1], 0));
8588 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8589 (match_operand:SF 1 "const_double_operand" ""))]
8591 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8592 || (GET_CODE (operands[0]) == SUBREG
8593 && GET_CODE (SUBREG_REG (operands[0])) == REG
8594 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8595 [(set (match_dup 2) (match_dup 3))]
8601 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8602 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8604 if (! TARGET_POWERPC64)
8605 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8607 operands[2] = gen_lowpart (SImode, operands[0]);
8609 operands[3] = GEN_INT(l);
8612 (define_insn "*movsf_hardfloat"
8613 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!r,!r")
8614 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,G,Fn"))]
8615 "(gpc_reg_operand (operands[0], SFmode)
8616 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
8619 {l%U1%X1|lwz%U1%X1} %0,%1
8620 {st%U0%X0|stw%U0%X0} %1,%0
8626 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*")
8627 (set_attr "length" "4,4,4,4,4,4,4,8")])
8629 (define_insn "*movsf_softfloat"
8630 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
8631 (match_operand:SF 1 "input_operand" "r,m,r,I,J,R,G,Fn"))]
8632 "(gpc_reg_operand (operands[0], SFmode)
8633 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
8636 {l%U1%X1|lwz%U1%X1} %0,%1
8637 {st%U0%X0|stw%U0%X0} %1,%0
8643 [(set_attr "type" "*,load,store,*,*,*,*,*")
8644 (set_attr "length" "4,4,4,4,4,4,4,8")])
8647 (define_expand "movdf"
8648 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8649 (match_operand:DF 1 "any_operand" ""))]
8653 if (GET_CODE (operands[0]) != REG)
8654 operands[1] = force_reg (DFmode, operands[1]);
8656 if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
8658 operands[1] = force_const_mem (DFmode, operands[1]);
8659 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
8660 && ! reload_in_progress)
8661 operands[1] = change_address (operands[1], DFmode,
8662 XEXP (operands[1], 0));
8667 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8668 (match_operand:DF 1 "const_int_operand" ""))]
8669 "! TARGET_POWERPC64 && reload_completed
8670 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8671 || (GET_CODE (operands[0]) == SUBREG
8672 && GET_CODE (SUBREG_REG (operands[0])) == REG
8673 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8674 [(set (match_dup 2) (match_dup 4))
8675 (set (match_dup 3) (match_dup 1))]
8678 int endian = (WORDS_BIG_ENDIAN == 0);
8679 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8680 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8681 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
8685 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8686 (match_operand:DF 1 "const_double_operand" ""))]
8687 "! TARGET_POWERPC64 && reload_completed
8688 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8689 || (GET_CODE (operands[0]) == SUBREG
8690 && GET_CODE (SUBREG_REG (operands[0])) == REG
8691 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8692 [(set (match_dup 2) (match_dup 4))
8693 (set (match_dup 3) (match_dup 5))]
8696 int endian = (WORDS_BIG_ENDIAN == 0);
8700 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8701 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8703 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8704 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8705 operands[4] = GEN_INT (l[endian]);
8706 operands[5] = GEN_INT (l[1 - endian]);
8710 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8711 (match_operand:DF 1 "easy_fp_constant" ""))]
8712 "TARGET_POWERPC64 && reload_completed
8713 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8714 || (GET_CODE (operands[0]) == SUBREG
8715 && GET_CODE (SUBREG_REG (operands[0])) == REG
8716 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8717 [(set (match_dup 2) (match_dup 3))]
8720 int endian = (WORDS_BIG_ENDIAN == 0);
8724 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8725 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8727 operands[2] = gen_lowpart (DImode, operands[0]);
8728 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8729 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8732 ;; Don't have reload use general registers to load a constant. First,
8733 ;; it might not work if the output operand is the equivalent of
8734 ;; a non-offsettable memref, but also it is less efficient than loading
8735 ;; the constant into an FP register, since it will probably be used there.
8736 ;; The "??" is a kludge until we can figure out a more reasonable way
8737 ;; of handling these non-offsettable values.
8738 (define_insn "*movdf_hardfloat32"
8739 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
8740 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
8741 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
8742 && (register_operand (operands[0], DFmode)
8743 || register_operand (operands[1], DFmode))"
8746 switch (which_alternative)
8751 /* We normally copy the low-numbered register first. However, if
8752 the first register operand 0 is the same as the second register of
8753 operand 1, we must copy in the opposite order. */
8754 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8755 return \"mr %L0,%L1\;mr %0,%1\";
8757 return \"mr %0,%1\;mr %L0,%L1\";
8759 /* If the low-address word is used in the address, we must load it
8760 last. Otherwise, load it first. Note that we cannot have
8761 auto-increment in that case since the address register is known to be
8763 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8765 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8767 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8769 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8775 return \"fmr %0,%1\";
8777 return \"lfd%U1%X1 %0,%1\";
8779 return \"stfd%U0%X0 %1,%0\";
8782 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
8783 (set_attr "length" "8,8,8,8,12,16,*,*,*")])
8785 (define_insn "*movdf_softfloat32"
8786 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8787 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8788 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
8789 && (register_operand (operands[0], DFmode)
8790 || register_operand (operands[1], DFmode))"
8793 switch (which_alternative)
8798 /* We normally copy the low-numbered register first. However, if
8799 the first register operand 0 is the same as the second register of
8800 operand 1, we must copy in the opposite order. */
8801 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8802 return \"mr %L0,%L1\;mr %0,%1\";
8804 return \"mr %0,%1\;mr %L0,%L1\";
8806 /* If the low-address word is used in the address, we must load it
8807 last. Otherwise, load it first. Note that we cannot have
8808 auto-increment in that case since the address register is known to be
8810 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8812 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8814 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8816 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8823 [(set_attr "type" "*,load,store,*,*,*")
8824 (set_attr "length" "8,8,8,8,12,16")])
8826 (define_insn "*movdf_hardfloat64"
8827 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,!r,!r,!r,f,f,m")
8828 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F,f,m,f"))]
8829 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
8830 && (register_operand (operands[0], DFmode)
8831 || register_operand (operands[1], DFmode))"
8842 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
8843 (set_attr "length" "4,4,4,8,12,16,4,4,4")])
8845 (define_insn "*movdf_softfloat64"
8846 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8847 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8848 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
8849 && (register_operand (operands[0], DFmode)
8850 || register_operand (operands[1], DFmode))"
8858 [(set_attr "type" "*,load,store,*,*,*")
8859 (set_attr "length" "*,*,*,8,12,16")])
8861 ;; Next come the multi-word integer load and store and the load and store
8863 (define_expand "movdi"
8864 [(set (match_operand:DI 0 "general_operand" "")
8865 (match_operand:DI 1 "any_operand" ""))]
8869 if (GET_CODE (operands[0]) != REG)
8870 operands[1] = force_reg (DImode, operands[1]);
8872 /* Convert a move of a CONST_DOUBLE into a CONST_INT
8873 only if sign-extended lower-half for 32-bit host. */
8874 if (GET_CODE (operands[1]) == CONST_DOUBLE
8875 #if HOST_BITS_PER_WIDE_INT == 32
8876 && ((CONST_DOUBLE_HIGH (operands[1]) == 0
8877 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) == 0)
8878 || (CONST_DOUBLE_HIGH (operands[1]) == 0xffffffff
8879 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0))
8882 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8884 /* Only a tiny bit of handling for CONSTANT_P_RTX is necessary. */
8885 if (GET_CODE (operands[1]) == CONST
8886 && GET_CODE (XEXP (operands[1], 0)) == CONSTANT_P_RTX)
8888 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
8893 && CONSTANT_P (operands[1])
8894 #if HOST_BITS_PER_WIDE_INT == 32
8895 && GET_CODE (operands[1]) != CONST_INT
8897 && ! easy_fp_constant (operands[1], DImode)
8898 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
8900 /* Emit a USE operation so that the constant isn't deleted if
8901 expensive optimizations are turned on because nobody
8902 references it. This should only be done for operands that
8903 contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
8904 This should not be done for operands that contain LABEL_REFs.
8905 For now, we just handle the obvious case. */
8906 if (GET_CODE (operands[1]) != LABEL_REF)
8907 emit_insn (gen_rtx_USE (VOIDmode, operands[1]));
8909 /* If we are to limit the number of things we put in the TOC and
8910 this is a symbol plus a constant we can add in one insn,
8911 just put the symbol in the TOC and add the constant. Don't do
8912 this if reload is in progress. */
8913 if (GET_CODE (operands[1]) == CONST
8914 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
8915 && GET_CODE (XEXP (operands[1], 0)) == PLUS
8916 && add_operand (XEXP (XEXP (operands[1], 0), 1), DImode)
8917 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
8918 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
8919 && ! side_effects_p (operands[0]))
8921 rtx sym = force_const_mem (DImode, XEXP (XEXP (operands[1], 0), 0));
8922 rtx other = XEXP (XEXP (operands[1], 0), 1);
8924 emit_insn (gen_adddi3 (operands[0], force_reg (DImode, sym), other));
8928 operands[1] = force_const_mem (DImode, operands[1]);
8929 if (! memory_address_p (DImode, XEXP (operands[1], 0))
8930 && ! reload_in_progress)
8931 operands[1] = change_address (operands[1], DImode,
8932 XEXP (operands[1], 0));
8936 (define_insn "*movdi_32"
8937 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8938 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8940 && (gpc_reg_operand (operands[0], DImode)
8941 || gpc_reg_operand (operands[1], DImode))"
8944 switch (which_alternative)
8949 /* We normally copy the low-numbered register first. However, if
8950 the first register operand 0 is the same as the second register of
8951 operand 1, we must copy in the opposite order. */
8952 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8953 return \"mr %L0,%L1\;mr %0,%1\";
8955 return \"mr %0,%1\;mr %L0,%L1\";
8957 /* If the low-address word is used in the address, we must load it
8958 last. Otherwise, load it first. Note that we cannot have
8959 auto-increment in that case since the address register is known to be
8961 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8963 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8965 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8967 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8969 return \"fmr %0,%1\";
8971 return \"lfd%U1%X1 %0,%1\";
8973 return \"stfd%U0%X0 %1,%0\";
8982 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
8983 (set_attr "length" "8,8,8,*,*,*,8,12,8,12,16")])
8986 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8987 (match_operand:DI 1 "const_int_operand" ""))]
8988 "! TARGET_POWERPC64 && reload_completed"
8989 [(set (match_dup 2) (match_dup 4))
8990 (set (match_dup 3) (match_dup 1))]
8993 operands[2] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN == 0);
8994 operands[3] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN != 0);
8995 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
8999 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9000 (match_operand:DI 1 "const_double_operand" ""))]
9001 "! TARGET_POWERPC64 && reload_completed"
9002 [(set (match_dup 2) (match_dup 4))
9003 (set (match_dup 3) (match_dup 5))]
9006 operands[2] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN == 0);
9007 operands[3] = gen_rtx_SUBREG (SImode, operands[0], WORDS_BIG_ENDIAN != 0);
9008 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9009 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9012 (define_insn "*movdi_64"
9013 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
9014 (match_operand:DI 1 "input_operand" "r,m,r,I,J,nF,R,f,m,f,*h,r,0"))]
9016 && (gpc_reg_operand (operands[0], DImode)
9017 || gpc_reg_operand (operands[1], DImode))"
9032 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
9033 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9036 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9037 (match_operand:DI 1 "const_double_operand" "F"))]
9038 "TARGET_POWERPC64 && GET_CODE (operands[1]) == CONST_DOUBLE
9039 && num_insns_constant (operands[1], DImode) == 1"
9042 return ((unsigned HOST_WIDE_INT)
9043 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9044 ? \"li %0,%1\" : \"lis %0,%v1\";
9048 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9049 (match_operand:DI 1 "const_int_operand" ""))]
9050 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9051 && num_insns_constant (operands[1], DImode) > 1"
9055 (ior:DI (match_dup 0)
9059 operands[2] = GEN_INT (INTVAL (operands[1]) & 0xffff0000);
9060 operands[3] = GEN_INT (INTVAL (operands[1]) & 0xffff);
9064 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9065 (match_operand:DI 1 "const_double_operand" ""))]
9066 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9067 && GET_CODE (operands[1]) == CONST_DOUBLE
9068 && ((CONST_DOUBLE_HIGH (operands[1]) == 0
9069 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) == 0)
9070 || (CONST_DOUBLE_HIGH (operands[1]) == 0xffffffff
9071 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0))"
9075 (ior:DI (match_dup 0)
9079 operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[1]) & 0xffff0000);
9080 operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[1]) & 0xffff);
9084 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9085 (match_operand:DI 1 "const_double_operand" ""))]
9086 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9087 && GET_CODE (operands[1]) == CONST_DOUBLE
9088 && CONST_DOUBLE_HIGH (operands[1]) == 0
9089 && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0"
9093 (zero_extend:DI (subreg:SI (match_dup 0) 0)))]
9095 { operands[2] = GEN_INT (CONST_DOUBLE_LOW (operands[1])); }")
9098 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9099 (match_operand:DI 1 "const_double_operand" ""))]
9100 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9101 && GET_CODE (operands[1]) == CONST_DOUBLE
9102 && CONST_DOUBLE_LOW (operands[1]) == 0"
9106 (ashift:DI (match_dup 0)
9109 { operands[2] = GEN_INT (CONST_DOUBLE_HIGH (operands[1])); }")
9111 ;; Generate all one-bits and clear left or right.
9112 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9114 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9115 (match_operand:DI 1 "mask64_operand" ""))]
9116 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9117 [(set (match_dup 0) (const_int -1))
9119 (and:DI (rotate:DI (match_dup 0)
9124 ;; Split a load of a large constant into the appropriate five-instruction
9125 ;; sequence. Handle anything in a constant number of insns.
9126 ;; When non-easy constants can go in the TOC, this should use
9127 ;; easy_fp_constant predicate.
9129 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9130 (match_operand:DI 1 "const_double_operand" ""))]
9131 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9135 (ashift:DI (match_dup 0)
9138 (ior:DI (match_dup 0)
9145 if (GET_CODE (operands[1]) == CONST_DOUBLE)
9147 low = CONST_DOUBLE_LOW (operands[1]);
9148 high = CONST_DOUBLE_HIGH (operands[1]);
9151 #if HOST_BITS_PER_WIDE_INT == 32
9153 low = INTVAL (operands[1]);
9154 high = (low < 0) ? ~0 : 0;
9158 low = INTVAL (operands[1]) & 0xffffffff;
9159 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
9163 operands[2] = GEN_INT (high);
9164 operands[3] = GEN_INT (low);
9168 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
9169 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r,r")
9171 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
9174 [(set_attr "type" "compare")])
9177 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
9178 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r,r")
9180 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
9183 [(set_attr "type" "compare")])
9186 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
9187 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
9189 (set (match_operand:DI 0 "gpc_reg_operand" "")
9191 "reload_completed && rtx_equal_p (operands[0], operands[1])"
9193 (compare:CC (match_dup 1)
9198 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
9199 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
9201 (set (match_operand:DI 0 "gpc_reg_operand" "")
9203 "reload_completed && !rtx_equal_p (operands[0], operands[1])"
9205 (compare:CC (match_dup 1)
9211 ;; TImode is similar, except that we usually want to compute the address into
9212 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9213 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9214 (define_expand "movti"
9215 [(parallel [(set (match_operand:TI 0 "general_operand" "")
9216 (match_operand:TI 1 "general_operand" ""))
9217 (clobber (scratch:SI))])]
9218 "TARGET_STRING || TARGET_POWERPC64"
9221 if (GET_CODE (operands[0]) == MEM)
9222 operands[1] = force_reg (TImode, operands[1]);
9224 if (GET_CODE (operands[0]) == MEM
9225 && GET_CODE (XEXP (operands[0], 0)) != REG
9226 && ! reload_in_progress)
9227 operands[0] = change_address (operands[0], TImode,
9228 copy_addr_to_reg (XEXP (operands[0], 0)));
9230 if (GET_CODE (operands[1]) == MEM
9231 && GET_CODE (XEXP (operands[1], 0)) != REG
9232 && ! reload_in_progress)
9233 operands[1] = change_address (operands[1], TImode,
9234 copy_addr_to_reg (XEXP (operands[1], 0)));
9237 ;; We say that MQ is clobbered in the last alternative because the first
9238 ;; alternative would never get used otherwise since it would need a reload
9239 ;; while the 2nd alternative would not. We put memory cases first so they
9240 ;; are preferred. Otherwise, we'd try to reload the output instead of
9241 ;; giving the SCRATCH mq.
9242 (define_insn "*movti_power"
9243 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
9244 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
9245 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
9246 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9247 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9250 switch (which_alternative)
9256 return \"{stsi|stswi} %1,%P0,16\";
9259 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
9262 /* Normally copy registers with lowest numbered register copied first.
9263 But copy in the other order if the first register of the output
9264 is the second, third, or fourth register in the input. */
9265 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
9266 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
9267 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
9269 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
9271 /* If the address is not used in the output, we can use lsi. Otherwise,
9272 fall through to generating four loads. */
9273 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
9274 return \"{lsi|lswi} %0,%P1,16\";
9275 /* ... fall through ... */
9277 /* If the address register is the same as the register for the lowest-
9278 addressed word, load it last. Similarly for the next two words.
9279 Otherwise load lowest address to highest. */
9280 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9282 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
9283 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
9284 REGNO (operands[0]) + 2, operands[1], 0))
9285 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
9286 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
9287 REGNO (operands[0]) + 3, operands[1], 0))
9288 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
9290 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
9293 [(set_attr "type" "store,store,*,load,load")
9294 (set_attr "length" "*,16,16,*,16")])
9296 (define_insn "*movti_string"
9297 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
9298 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
9299 (clobber (match_scratch:SI 2 "=X,X,X"))]
9300 "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
9301 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9304 switch (which_alternative)
9310 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
9313 /* Normally copy registers with lowest numbered register copied first.
9314 But copy in the other order if the first register of the output
9315 is the second, third, or fourth register in the input. */
9316 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
9317 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
9318 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
9320 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
9322 /* If the address register is the same as the register for the lowest-
9323 addressed word, load it last. Similarly for the next two words.
9324 Otherwise load lowest address to highest. */
9325 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9327 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
9328 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
9329 REGNO (operands[0]) + 2, operands[1], 0))
9330 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
9331 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
9332 REGNO (operands[0]) + 3, operands[1], 0))
9333 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
9335 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
9338 [(set_attr "type" "store,*,load")
9339 (set_attr "length" "16,16,16")])
9341 (define_insn "*movti_ppc64"
9342 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
9343 (match_operand:TI 1 "input_operand" "r,m,r"))]
9344 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9345 || gpc_reg_operand (operands[1], TImode))"
9348 switch (which_alternative)
9353 /* We normally copy the low-numbered register first. However, if
9354 the first register operand 0 is the same as the second register of
9355 operand 1, we must copy in the opposite order. */
9356 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9357 return \"mr %L0,%L1\;mr %0,%1\";
9359 return \"mr %0,%1\;mr %L0,%L1\";
9361 /* If the low-address word is used in the address, we must load it
9362 last. Otherwise, load it first. Note that we cannot have
9363 auto-increment in that case since the address register is known to be
9365 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9367 return \"ld %L0,%L1\;ld %0,%1\";
9369 return \"ld%U1 %0,%1\;ld %L0,%L1\";
9371 return \"std%U0 %1,%0\;std %L1,%L0\";
9374 [(set_attr "type" "*,load,store")
9375 (set_attr "length" "8,8,8")])
9377 (define_expand "load_multiple"
9378 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9379 (match_operand:SI 1 "" ""))
9380 (use (match_operand:SI 2 "" ""))])]
9389 /* Support only loading a constant number of fixed-point registers from
9390 memory and only bother with this if more than two; the machine
9391 doesn't support more than eight. */
9392 if (GET_CODE (operands[2]) != CONST_INT
9393 || INTVAL (operands[2]) <= 2
9394 || INTVAL (operands[2]) > 8
9395 || GET_CODE (operands[1]) != MEM
9396 || GET_CODE (operands[0]) != REG
9397 || REGNO (operands[0]) >= 32)
9400 count = INTVAL (operands[2]);
9401 regno = REGNO (operands[0]);
9403 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9404 from = force_reg (SImode, XEXP (operands[1], 0));
9406 for (i = 0; i < count; i++)
9407 XVECEXP (operands[3], 0, i)
9408 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9409 change_address (operands[1], SImode,
9410 plus_constant (from, i * 4)));
9414 [(match_parallel 0 "load_multiple_operation"
9415 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
9416 (mem:SI (match_operand:SI 2 "register_operand" "b")))])]
9420 /* We have to handle the case where the pseudo used to contain the address
9421 is assigned to one of the output registers. */
9423 int words = XVECLEN (operands[0], 0);
9426 if (XVECLEN (operands[0], 0) == 1)
9427 return \"{l|lwz} %1,0(%2)\";
9429 for (i = 0; i < words; i++)
9430 if (refers_to_regno_p (REGNO (operands[1]) + i,
9431 REGNO (operands[1]) + i + 1, operands[2], 0))
9435 xop[0] = operands[1];
9436 xop[1] = operands[2];
9437 xop[2] = GEN_INT (4 * (words-1));
9438 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
9443 xop[0] = operands[1];
9444 xop[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
9445 xop[2] = GEN_INT (4 * (words-1));
9446 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
9451 for (j = 0; j < words; j++)
9454 xop[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + j);
9455 xop[1] = operands[2];
9456 xop[2] = GEN_INT (j * 4);
9457 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
9459 xop[0] = operands[2];
9460 xop[1] = GEN_INT (i * 4);
9461 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
9466 return \"{lsi|lswi} %1,%2,%N0\";
9468 [(set_attr "type" "load")
9469 (set_attr "length" "32")])
9472 (define_expand "store_multiple"
9473 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9474 (match_operand:SI 1 "" ""))
9475 (clobber (scratch:SI))
9476 (use (match_operand:SI 2 "" ""))])]
9485 /* Support only storing a constant number of fixed-point registers to
9486 memory and only bother with this if more than two; the machine
9487 doesn't support more than eight. */
9488 if (GET_CODE (operands[2]) != CONST_INT
9489 || INTVAL (operands[2]) <= 2
9490 || INTVAL (operands[2]) > 8
9491 || GET_CODE (operands[0]) != MEM
9492 || GET_CODE (operands[1]) != REG
9493 || REGNO (operands[1]) >= 32)
9496 count = INTVAL (operands[2]);
9497 regno = REGNO (operands[1]);
9499 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9500 to = force_reg (SImode, XEXP (operands[0], 0));
9502 XVECEXP (operands[3], 0, 0)
9503 = gen_rtx_SET (VOIDmode, change_address (operands[0], SImode, to),
9505 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9506 gen_rtx_SCRATCH (SImode));
9508 for (i = 1; i < count; i++)
9509 XVECEXP (operands[3], 0, i + 1)
9510 = gen_rtx_SET (VOIDmode,
9511 change_address (operands[0], SImode,
9512 plus_constant (to, i * 4)),
9513 gen_rtx_REG (SImode, regno + i));
9517 [(match_parallel 0 "store_multiple_operation"
9518 [(set (match_operand:SI 1 "indirect_operand" "=Q")
9519 (match_operand:SI 2 "gpc_reg_operand" "r"))
9520 (clobber (match_scratch:SI 3 "=q"))])]
9521 "TARGET_STRING && TARGET_POWER"
9522 "{stsi|stswi} %2,%P1,%O0"
9523 [(set_attr "type" "store")])
9526 [(match_parallel 0 "store_multiple_operation"
9527 [(set (mem:SI (match_operand:SI 1 "register_operand" "b"))
9528 (match_operand:SI 2 "gpc_reg_operand" "r"))
9529 (clobber (match_scratch:SI 3 "X"))])]
9530 "TARGET_STRING && !TARGET_POWER"
9531 "{stsi|stswi} %2,%1,%O0"
9532 [(set_attr "type" "store")])
9535 ;; String/block move insn.
9536 ;; Argument 0 is the destination
9537 ;; Argument 1 is the source
9538 ;; Argument 2 is the length
9539 ;; Argument 3 is the alignment
9541 (define_expand "movstrsi"
9542 [(parallel [(set (match_operand:BLK 0 "" "")
9543 (match_operand:BLK 1 "" ""))
9544 (use (match_operand:SI 2 "" ""))
9545 (use (match_operand:SI 3 "" ""))])]
9549 if (expand_block_move (operands))
9555 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9556 ;; register allocator doesn't have a clue about allocating 8 word registers
9557 (define_expand "movstrsi_8reg"
9558 [(parallel [(set (match_operand 0 "" "")
9559 (match_operand 1 "" ""))
9560 (use (match_operand 2 "" ""))
9561 (use (match_operand 3 "" ""))
9562 (clobber (reg:SI 5))
9563 (clobber (reg:SI 6))
9564 (clobber (reg:SI 7))
9565 (clobber (reg:SI 8))
9566 (clobber (reg:SI 9))
9567 (clobber (reg:SI 10))
9568 (clobber (reg:SI 11))
9569 (clobber (reg:SI 12))
9570 (clobber (match_scratch:SI 4 ""))])]
9575 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9576 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9577 (use (match_operand:SI 2 "immediate_operand" "i"))
9578 (use (match_operand:SI 3 "immediate_operand" "i"))
9579 (clobber (match_operand:SI 4 "register_operand" "=r"))
9580 (clobber (reg:SI 6))
9581 (clobber (reg:SI 7))
9582 (clobber (reg:SI 8))
9583 (clobber (reg:SI 9))
9584 (clobber (reg:SI 10))
9585 (clobber (reg:SI 11))
9586 (clobber (reg:SI 12))
9587 (clobber (match_scratch:SI 5 "=q"))]
9588 "TARGET_STRING && TARGET_POWER
9589 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
9590 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9591 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9592 && REGNO (operands[4]) == 5"
9593 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9594 [(set_attr "type" "load")
9595 (set_attr "length" "8")])
9598 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9599 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9600 (use (match_operand:SI 2 "immediate_operand" "i"))
9601 (use (match_operand:SI 3 "immediate_operand" "i"))
9602 (clobber (match_operand:SI 4 "register_operand" "=r"))
9603 (clobber (reg:SI 6))
9604 (clobber (reg:SI 7))
9605 (clobber (reg:SI 8))
9606 (clobber (reg:SI 9))
9607 (clobber (reg:SI 10))
9608 (clobber (reg:SI 11))
9609 (clobber (reg:SI 12))
9610 (clobber (match_scratch:SI 5 "X"))]
9611 "TARGET_STRING && !TARGET_POWER
9612 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
9613 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9614 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9615 && REGNO (operands[4]) == 5"
9616 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9617 [(set_attr "type" "load")
9618 (set_attr "length" "8")])
9620 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9621 ;; register allocator doesn't have a clue about allocating 6 word registers
9622 (define_expand "movstrsi_6reg"
9623 [(parallel [(set (match_operand 0 "" "")
9624 (match_operand 1 "" ""))
9625 (use (match_operand 2 "" ""))
9626 (use (match_operand 3 "" ""))
9627 (clobber (reg:SI 7))
9628 (clobber (reg:SI 8))
9629 (clobber (reg:SI 9))
9630 (clobber (reg:SI 10))
9631 (clobber (reg:SI 11))
9632 (clobber (reg:SI 12))
9633 (clobber (match_scratch:SI 4 ""))])]
9638 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9639 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9640 (use (match_operand:SI 2 "immediate_operand" "i"))
9641 (use (match_operand:SI 3 "immediate_operand" "i"))
9642 (clobber (match_operand:SI 4 "register_operand" "=r"))
9643 (clobber (reg:SI 8))
9644 (clobber (reg:SI 9))
9645 (clobber (reg:SI 10))
9646 (clobber (reg:SI 11))
9647 (clobber (reg:SI 12))
9648 (clobber (match_scratch:SI 5 "=q"))]
9649 "TARGET_STRING && TARGET_POWER
9650 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9651 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
9652 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
9653 && REGNO (operands[4]) == 7"
9654 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9655 [(set_attr "type" "load")
9656 (set_attr "length" "8")])
9659 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9660 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9661 (use (match_operand:SI 2 "immediate_operand" "i"))
9662 (use (match_operand:SI 3 "immediate_operand" "i"))
9663 (clobber (match_operand:SI 4 "register_operand" "=r"))
9664 (clobber (reg:SI 8))
9665 (clobber (reg:SI 9))
9666 (clobber (reg:SI 10))
9667 (clobber (reg:SI 11))
9668 (clobber (reg:SI 12))
9669 (clobber (match_scratch:SI 5 "X"))]
9670 "TARGET_STRING && !TARGET_POWER
9671 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9672 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
9673 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
9674 && REGNO (operands[4]) == 7"
9675 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9676 [(set_attr "type" "load")
9677 (set_attr "length" "8")])
9679 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
9681 (define_expand "movstrsi_4reg"
9682 [(parallel [(set (match_operand 0 "" "")
9683 (match_operand 1 "" ""))
9684 (use (match_operand 2 "" ""))
9685 (use (match_operand 3 "" ""))
9686 (clobber (reg:SI 9))
9687 (clobber (reg:SI 10))
9688 (clobber (reg:SI 11))
9689 (clobber (reg:SI 12))
9690 (clobber (match_scratch:SI 4 ""))])]
9695 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9696 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9697 (use (match_operand:SI 2 "immediate_operand" "i"))
9698 (use (match_operand:SI 3 "immediate_operand" "i"))
9699 (clobber (match_operand:SI 4 "register_operand" "=r"))
9700 (clobber (reg:SI 10))
9701 (clobber (reg:SI 11))
9702 (clobber (reg:SI 12))
9703 (clobber (match_scratch:SI 5 "=q"))]
9704 "TARGET_STRING && TARGET_POWER
9705 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9706 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
9707 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
9708 && REGNO (operands[4]) == 9"
9709 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9710 [(set_attr "type" "load")
9711 (set_attr "length" "8")])
9714 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9715 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9716 (use (match_operand:SI 2 "immediate_operand" "i"))
9717 (use (match_operand:SI 3 "immediate_operand" "i"))
9718 (clobber (match_operand:SI 4 "register_operand" "=r"))
9719 (clobber (reg:SI 10))
9720 (clobber (reg:SI 11))
9721 (clobber (reg:SI 12))
9722 (clobber (match_scratch:SI 5 "X"))]
9723 "TARGET_STRING && !TARGET_POWER
9724 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9725 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
9726 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
9727 && REGNO (operands[4]) == 9"
9728 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9729 [(set_attr "type" "load")
9730 (set_attr "length" "8")])
9732 ;; Move up to 8 bytes at a time.
9733 (define_expand "movstrsi_2reg"
9734 [(parallel [(set (match_operand 0 "" "")
9735 (match_operand 1 "" ""))
9736 (use (match_operand 2 "" ""))
9737 (use (match_operand 3 "" ""))
9738 (clobber (match_scratch:DI 4 ""))
9739 (clobber (match_scratch:SI 5 ""))])]
9740 "TARGET_STRING && !TARGET_64BIT"
9744 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9745 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9746 (use (match_operand:SI 2 "immediate_operand" "i"))
9747 (use (match_operand:SI 3 "immediate_operand" "i"))
9748 (clobber (match_scratch:DI 4 "=&r"))
9749 (clobber (match_scratch:SI 5 "=q"))]
9750 "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
9751 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9752 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9753 [(set_attr "type" "load")
9754 (set_attr "length" "8")])
9757 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9758 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9759 (use (match_operand:SI 2 "immediate_operand" "i"))
9760 (use (match_operand:SI 3 "immediate_operand" "i"))
9761 (clobber (match_scratch:DI 4 "=&r"))
9762 (clobber (match_scratch:SI 5 "X"))]
9763 "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
9764 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9765 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9766 [(set_attr "type" "load")
9767 (set_attr "length" "8")])
9769 ;; Move up to 4 bytes at a time.
9770 (define_expand "movstrsi_1reg"
9771 [(parallel [(set (match_operand 0 "" "")
9772 (match_operand 1 "" ""))
9773 (use (match_operand 2 "" ""))
9774 (use (match_operand 3 "" ""))
9775 (clobber (match_scratch:SI 4 ""))
9776 (clobber (match_scratch:SI 5 ""))])]
9781 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9782 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9783 (use (match_operand:SI 2 "immediate_operand" "i"))
9784 (use (match_operand:SI 3 "immediate_operand" "i"))
9785 (clobber (match_scratch:SI 4 "=&r"))
9786 (clobber (match_scratch:SI 5 "=q"))]
9787 "TARGET_STRING && TARGET_POWER
9788 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9789 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9790 [(set_attr "type" "load")
9791 (set_attr "length" "8")])
9794 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
9795 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
9796 (use (match_operand:SI 2 "immediate_operand" "i"))
9797 (use (match_operand:SI 3 "immediate_operand" "i"))
9798 (clobber (match_scratch:SI 4 "=&r"))
9799 (clobber (match_scratch:SI 5 "X"))]
9800 "TARGET_STRING && !TARGET_POWER
9801 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9802 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9803 [(set_attr "type" "load")
9804 (set_attr "length" "8")])
9807 ;; Define insns that do load or store with update. Some of these we can
9808 ;; get by using pre-decrement or pre-increment, but the hardware can also
9809 ;; do cases where the increment is not the size of the object.
9811 ;; In all these cases, we use operands 0 and 1 for the register being
9812 ;; incremented because those are the operands that local-alloc will
9813 ;; tie and these are the pair most likely to be tieable (and the ones
9814 ;; that will benefit the most).
9816 (define_insn "*movdi_update1"
9817 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9818 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9819 (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
9820 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9821 (plus:DI (match_dup 1) (match_dup 2)))]
9822 "TARGET_POWERPC64 && TARGET_UPDATE"
9826 [(set_attr "type" "load")])
9828 (define_insn "*movdi_update2"
9829 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9831 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9832 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9833 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9834 (plus:DI (match_dup 1) (match_dup 2)))]
9837 [(set_attr "type" "load")])
9839 (define_insn "movdi_update"
9840 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9841 (match_operand:DI 2 "reg_or_short_operand" "r,I")))
9842 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9843 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9844 (plus:DI (match_dup 1) (match_dup 2)))]
9845 "TARGET_POWERPC64 && TARGET_UPDATE"
9849 [(set_attr "type" "store")])
9851 (define_insn "*movsi_update1"
9852 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9853 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9854 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9855 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9856 (plus:SI (match_dup 1) (match_dup 2)))]
9859 {lux|lwzux} %3,%0,%2
9860 {lu|lwzu} %3,%2(%0)"
9861 [(set_attr "type" "load")])
9863 (define_insn "movsi_update"
9864 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9865 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9866 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9867 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9868 (plus:SI (match_dup 1) (match_dup 2)))]
9871 {stux|stwux} %3,%0,%2
9872 {stu|stwu} %3,%2(%0)"
9873 [(set_attr "type" "store")])
9875 (define_insn "*movhi_update"
9876 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9877 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9878 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9879 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9880 (plus:SI (match_dup 1) (match_dup 2)))]
9885 [(set_attr "type" "load")])
9887 (define_insn "*movhi_update2"
9888 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9890 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9891 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9892 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9893 (plus:SI (match_dup 1) (match_dup 2)))]
9898 [(set_attr "type" "load")])
9900 (define_insn "*movhi_update3"
9901 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9903 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9904 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9905 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9906 (plus:SI (match_dup 1) (match_dup 2)))]
9911 [(set_attr "type" "load")])
9913 (define_insn "*movhi_update4"
9914 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9915 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9916 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9917 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9918 (plus:SI (match_dup 1) (match_dup 2)))]
9923 [(set_attr "type" "store")])
9925 (define_insn "*movqi_update1"
9926 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9927 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9928 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9929 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9930 (plus:SI (match_dup 1) (match_dup 2)))]
9935 [(set_attr "type" "load")])
9937 (define_insn "*movqi_update2"
9938 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9940 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9941 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9942 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9943 (plus:SI (match_dup 1) (match_dup 2)))]
9948 [(set_attr "type" "load")])
9950 (define_insn "*movqi_update3"
9951 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9952 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9953 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9954 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9955 (plus:SI (match_dup 1) (match_dup 2)))]
9960 [(set_attr "type" "store")])
9962 (define_insn "*movsf_update1"
9963 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9964 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9965 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9966 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9967 (plus:SI (match_dup 1) (match_dup 2)))]
9968 "TARGET_HARD_FLOAT && TARGET_UPDATE"
9972 [(set_attr "type" "fpload")])
9974 (define_insn "*movsf_update2"
9975 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9976 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9977 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9978 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9979 (plus:SI (match_dup 1) (match_dup 2)))]
9980 "TARGET_HARD_FLOAT && TARGET_UPDATE"
9984 [(set_attr "type" "fpstore")])
9986 (define_insn "*movsf_update3"
9987 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9988 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9989 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9990 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9991 (plus:SI (match_dup 1) (match_dup 2)))]
9992 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
9994 {lux|lwzux} %3,%0,%2
9995 {lu|lwzu} %3,%2(%0)"
9996 [(set_attr "type" "load")])
9998 (define_insn "*movsf_update4"
9999 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10000 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10001 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10002 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10003 (plus:SI (match_dup 1) (match_dup 2)))]
10004 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
10006 {stux|stwux} %3,%0,%2
10007 {stu|stwu} %3,%2(%0)"
10008 [(set_attr "type" "store")])
10010 (define_insn "*movdf_update1"
10011 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10012 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10013 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10014 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10015 (plus:SI (match_dup 1) (match_dup 2)))]
10016 "TARGET_HARD_FLOAT && TARGET_UPDATE"
10020 [(set_attr "type" "fpload")])
10022 (define_insn "*movdf_update2"
10023 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10024 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10025 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10026 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10027 (plus:SI (match_dup 1) (match_dup 2)))]
10028 "TARGET_HARD_FLOAT && TARGET_UPDATE"
10032 [(set_attr "type" "fpstore")])
10034 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10037 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
10038 (match_operand:DF 1 "memory_operand" ""))
10039 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
10040 (match_operand:DF 3 "memory_operand" ""))]
10042 && TARGET_HARD_FLOAT
10043 && registers_ok_for_quad_peep (operands[0], operands[2])
10044 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
10045 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
10049 [(set (match_operand:DF 0 "memory_operand" "")
10050 (match_operand:DF 1 "gpc_reg_operand" "f"))
10051 (set (match_operand:DF 2 "memory_operand" "")
10052 (match_operand:DF 3 "gpc_reg_operand" "f"))]
10054 && TARGET_HARD_FLOAT
10055 && registers_ok_for_quad_peep (operands[1], operands[3])
10056 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
10057 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
10058 "stfq%U0%X0 %1,%0")
10060 ;; Next come insns related to the calling sequence.
10062 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10063 ;; We move the back-chain and decrement the stack pointer.
10065 (define_expand "allocate_stack"
10066 [(set (match_operand 0 "register_operand" "=r")
10067 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10069 (minus (reg 1) (match_dup 1)))]
10072 { rtx chain = gen_reg_rtx (Pmode);
10073 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10076 emit_move_insn (chain, stack_bot);
10078 /* Under Windows NT, we need to add stack probes for large/variable
10079 allocations, so do it via a call to the external function alloca
10080 instead of doing it inline. */
10081 if (DEFAULT_ABI == ABI_NT
10082 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 4096))
10084 rtx tmp = gen_reg_rtx (Pmode);
10085 emit_library_call_value (gen_rtx_SYMBOL_REF (Pmode, \"__allocate_stack\"),
10086 tmp, 0, Pmode, 1, operands[1], Pmode);
10087 emit_insn (gen_set_sp (tmp));
10088 emit_move_insn (operands[0], tmp);
10092 if (GET_CODE (operands[1]) != CONST_INT
10093 || INTVAL (operands[1]) < -32767
10094 || INTVAL (operands[1]) > 32768)
10096 neg_op0 = gen_reg_rtx (Pmode);
10098 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10100 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10103 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10106 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
10107 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10111 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10112 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10113 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10116 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10120 ;; Marker to indicate that the stack pointer was changed under NT in
10121 ;; ways not known to the compiler
10123 (define_insn "set_sp"
10125 (unspec [(match_operand:SI 0 "register_operand" "r")] 7))]
10128 [(set_attr "length" "0")])
10130 ;; These patterns say how to save and restore the stack pointer. We need not
10131 ;; save the stack pointer at function level since we are careful to
10132 ;; preserve the backchain. At block level, we have to restore the backchain
10133 ;; when we restore the stack pointer.
10135 ;; For nonlocal gotos, we must save both the stack pointer and its
10136 ;; backchain and restore both. Note that in the nonlocal case, the
10137 ;; save area is a memory location.
10139 (define_expand "save_stack_function"
10140 [(match_operand 0 "any_operand" "")
10141 (match_operand 1 "any_operand" "")]
10145 (define_expand "restore_stack_function"
10146 [(match_operand 0 "any_operand" "")
10147 (match_operand 1 "any_operand" "")]
10151 (define_expand "restore_stack_block"
10152 [(use (match_operand 0 "register_operand" ""))
10153 (set (match_dup 2) (match_dup 3))
10154 (set (match_dup 0) (match_operand 1 "register_operand" ""))
10155 (set (match_dup 3) (match_dup 2))]
10159 operands[2] = gen_reg_rtx (Pmode);
10160 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
10163 (define_expand "save_stack_nonlocal"
10164 [(match_operand 0 "memory_operand" "")
10165 (match_operand 1 "register_operand" "")]
10169 rtx temp = gen_reg_rtx (Pmode);
10171 /* Copy the backchain to the first word, sp to the second. */
10172 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
10173 emit_move_insn (operand_subword (operands[0], 0, 0, (TARGET_32BIT ? DImode : TImode)),
10175 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
10180 (define_expand "restore_stack_nonlocal"
10181 [(match_operand 0 "register_operand" "")
10182 (match_operand 1 "memory_operand" "")]
10186 rtx temp = gen_reg_rtx (Pmode);
10188 /* Restore the backchain from the first word, sp from the second. */
10189 emit_move_insn (temp,
10190 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
10191 emit_move_insn (operands[0],
10192 operand_subword (operands[1], 1, 0, (TARGET_32BIT ? DImode : TImode)));
10193 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
10197 ;; If we have -mminimal-toc, we need to reload r30 after a nonlocal goto.
10199 (define_insn "nonlocal_goto_receiver"
10200 [(unspec_volatile [(const_int 0)] 1)]
10201 "TARGET_TOC && TARGET_MINIMAL_TOC"
10204 rs6000_output_load_toc_table (asm_out_file, 30);
10207 [(set_attr "type" "load")])
10209 ;; A function pointer under AIX is a pointer to a data area whose first word
10210 ;; contains the actual address of the function, whose second word contains a
10211 ;; pointer to its TOC, and whose third word contains a value to place in the
10212 ;; static chain register (r11). Note that if we load the static chain, our
10213 ;; "trampoline" need not have any executable code.
10215 ;; operands[0] is a register pointing to the 3 word descriptor (aka, the function address)
10216 ;; operands[1] is the stack size to clean up
10217 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for AIX)
10218 ;; operands[3] is location to store the TOC
10219 ;; operands[4] is the TOC register
10220 ;; operands[5] is the static chain register
10222 ;; We do not break this into separate insns, so that the scheduler will not try
10223 ;; to move the load of the new TOC before any loads from the TOC.
10225 (define_insn "call_indirect_aix32"
10226 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
10227 (match_operand 1 "const_int_operand" "n"))
10228 (use (match_operand 2 "const_int_operand" "n"))
10229 (use (match_operand 3 "offsettable_mem_operand" "o"))
10230 (use (match_operand 4 "register_operand" "r"))
10231 (clobber (match_operand 5 "register_operand" "=r"))
10232 (clobber (match_scratch:SI 6 "=&r"))
10233 (clobber (match_scratch:SI 7 "=l"))]
10234 "DEFAULT_ABI == ABI_AIX
10235 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
10236 "{st|stw} %4,%3\;{l|lwz} %6,0(%0)\;{l|lwz} %4,4(%0)\;mt%7 %6\;{l|lwz} %5,8(%0)\;{brl|blrl}\;{l|lwz} %4,%3"
10237 [(set_attr "type" "load")
10238 (set_attr "length" "28")])
10240 (define_insn "call_indirect_aix64"
10241 [(call (mem:SI (match_operand:DI 0 "register_operand" "b"))
10242 (match_operand 1 "const_int_operand" "n"))
10243 (use (match_operand 2 "const_int_operand" "n"))
10244 (use (match_operand 3 "offsettable_mem_operand" "o"))
10245 (use (match_operand 4 "register_operand" "r"))
10246 (clobber (match_operand 5 "register_operand" "=r"))
10247 (clobber (match_scratch:SI 6 "=&r"))
10248 (clobber (match_scratch:SI 7 "=l"))]
10249 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
10250 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
10251 "std %4,%3\;ld %6,0(%0)\;ld %4,8(%0)\;mt%7 %6\;ld %5,16(%0)\;blrl\;ld %4,%3"
10252 [(set_attr "type" "load")
10253 (set_attr "length" "28")])
10255 (define_insn "call_value_indirect_aix32"
10256 [(set (match_operand 0 "register_operand" "fg")
10257 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
10258 (match_operand 2 "const_int_operand" "n")))
10259 (use (match_operand 3 "const_int_operand" "n"))
10260 (use (match_operand 4 "offsettable_mem_operand" "o"))
10261 (use (match_operand 5 "register_operand" "r"))
10262 (clobber (match_operand 6 "register_operand" "=r"))
10263 (clobber (match_scratch:SI 7 "=&r"))
10264 (clobber (match_scratch:SI 8 "=l"))]
10265 "DEFAULT_ABI == ABI_AIX
10266 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
10267 "{st|stw} %5,%4\;{l|lwz} %7,0(%1)\;{l|lwz} %5,4(%1)\;mt%8 %7\;{l|lwz} %6,8(%1)\;{brl|blrl}\;{l|lwz} %5,%4"
10268 [(set_attr "type" "load")
10269 (set_attr "length" "28")])
10271 (define_insn "call_value_indirect_aix64"
10272 [(set (match_operand 0 "register_operand" "fg")
10273 (call (mem:SI (match_operand:DI 1 "register_operand" "b"))
10274 (match_operand 2 "const_int_operand" "n")))
10275 (use (match_operand 3 "const_int_operand" "n"))
10276 (use (match_operand 4 "offsettable_mem_operand" "o"))
10277 (use (match_operand 5 "register_operand" "r"))
10278 (clobber (match_operand 6 "register_operand" "=r"))
10279 (clobber (match_scratch:SI 7 "=&r"))
10280 (clobber (match_scratch:SI 8 "=l"))]
10281 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX
10282 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
10283 "std %5,%4\;ld %7,0(%1)\;ld %5,8(%1)\;mt%8 %7\;ld %6,16(%1)\;blrl\;ld %5,%4"
10284 [(set_attr "type" "load")
10285 (set_attr "length" "28")])
10287 ;; A function pointer undef NT is a pointer to a data area whose first word
10288 ;; contains the actual address of the function, whose second word contains a
10289 ;; pointer to its TOC. The static chain is not stored under NT, which means
10290 ;; that we need a trampoline.
10292 ;; operands[0] is an SImode pseudo in which we place the address of the function.
10293 ;; operands[1] is the stack size to clean up
10294 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for NT)
10295 ;; operands[3] is location to store the TOC
10296 ;; operands[4] is the TOC register
10298 ;; We do not break this into separate insns, so that the scheduler will not try
10299 ;; to move the load of the new TOC before any loads from the TOC.
10301 (define_insn "call_indirect_nt"
10302 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
10303 (match_operand 1 "const_int_operand" "n"))
10304 (use (match_operand 2 "const_int_operand" "n"))
10305 (use (match_operand 3 "offsettable_mem_operand" "o"))
10306 (use (match_operand 4 "register_operand" "r"))
10307 (clobber (match_scratch:SI 5 "=&r"))
10308 (clobber (match_scratch:SI 6 "=l"))]
10309 "DEFAULT_ABI == ABI_NT
10310 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
10311 "{st|stw} %4,%a3\;{l|lwz} %5,0(%0)\;{l|lwz} %4,4(%0)\;mt%6 %5\;{brl|blrl}\;{l|lwz} %4,%a3"
10312 [(set_attr "type" "load")
10313 (set_attr "length" "24")])
10315 (define_insn "call_value_indirect_nt"
10316 [(set (match_operand 0 "register_operand" "fg")
10317 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
10318 (match_operand 2 "const_int_operand" "n")))
10319 (use (match_operand 3 "const_int_operand" "n"))
10320 (use (match_operand 4 "offsettable_mem_operand" "o"))
10321 (use (match_operand 5 "register_operand" "r"))
10322 (clobber (match_scratch:SI 6 "=&r"))
10323 (clobber (match_scratch:SI 7 "=l"))]
10324 "DEFAULT_ABI == ABI_NT
10325 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
10326 "{st|stw} %5,%a4\;{l|lwz} %6,0(%1)\;{l|lwz} %5,4(%1)\;mt%7 %6\;{brl|blrl}\;{l|lwz} %5,%a4"
10327 [(set_attr "type" "load")
10328 (set_attr "length" "24")])
10330 ;; A function pointer under System V is just a normal pointer
10331 ;; operands[0] is the function pointer
10332 ;; operands[1] is the stack size to clean up
10333 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument which indicates how to set cr1
10335 (define_insn "call_indirect_sysv"
10336 [(call (mem:SI (match_operand:SI 0 "register_operand" "l,l"))
10337 (match_operand 1 "const_int_operand" "n,n"))
10338 (use (match_operand 2 "const_int_operand" "O,n"))
10339 (clobber (match_scratch:SI 3 "=l,l"))]
10340 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
10343 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10344 output_asm_insn (\"crxor 6,6,6\", operands);
10346 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10347 output_asm_insn (\"creqv 6,6,6\", operands);
10349 return \"{brl|blrl}\";
10351 [(set_attr "type" "jmpreg")
10352 (set_attr "length" "4,8")])
10354 (define_insn "call_value_indirect_sysv"
10355 [(set (match_operand 0 "register_operand" "=fg,fg")
10356 (call (mem:SI (match_operand:SI 1 "register_operand" "l,l"))
10357 (match_operand 2 "const_int_operand" "n,n")))
10358 (use (match_operand 3 "const_int_operand" "O,n"))
10359 (clobber (match_scratch:SI 4 "=l,l"))]
10360 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
10363 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10364 output_asm_insn (\"crxor 6,6,6\", operands);
10366 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10367 output_asm_insn (\"creqv 6,6,6\", operands);
10369 return \"{brl|blrl}\";
10371 [(set_attr "type" "jmpreg")
10372 (set_attr "length" "4,8")])
10374 ;; Now the definitions for the call and call_value insns
10375 (define_expand "call"
10376 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10377 (match_operand 1 "" ""))
10378 (use (match_operand 2 "" ""))
10379 (clobber (scratch:SI))])]
10383 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10386 operands[0] = XEXP (operands[0], 0);
10388 /* Convert NT DLL imports into an indirect call. */
10389 if (GET_CODE (operands[0]) == SYMBOL_REF
10390 && (INTVAL (operands[2]) & CALL_NT_DLLIMPORT) != 0)
10392 operands[0] = rs6000_dll_import_ref (operands[0]);
10393 operands[2] = GEN_INT ((int)CALL_NORMAL);
10396 if (GET_CODE (operands[0]) != SYMBOL_REF
10397 || (INTVAL (operands[2]) & CALL_LONG) != 0)
10399 if (INTVAL (operands[2]) & CALL_LONG)
10400 operands[0] = rs6000_longcall_ref (operands[0]);
10402 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
10403 emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
10404 operands[1], operands[2]));
10407 rtx toc_reg = gen_rtx_REG (Pmode, 2);
10408 rtx toc_addr = RS6000_SAVE_TOC;
10410 if (DEFAULT_ABI == ABI_AIX)
10412 /* AIX function pointers are really pointers to a three word area */
10413 rtx static_chain = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
10414 emit_call_insn (TARGET_32BIT
10415 ? gen_call_indirect_aix32 (force_reg (Pmode, operands[0]),
10416 operands[1], operands[2],
10417 toc_addr, toc_reg, static_chain)
10418 : gen_call_indirect_aix64 (force_reg (Pmode, operands[0]),
10419 operands[1], operands[2],
10420 toc_addr, toc_reg, static_chain));
10422 else if (DEFAULT_ABI == ABI_NT)
10424 /* NT function pointers are really pointers to a two word area */
10425 emit_call_insn (gen_call_indirect_nt (force_reg (Pmode, operands[0]),
10426 operands[1], operands[2],
10427 toc_addr, toc_reg));
10436 (define_expand "call_value"
10437 [(parallel [(set (match_operand 0 "" "")
10438 (call (mem:SI (match_operand 1 "address_operand" ""))
10439 (match_operand 2 "" "")))
10440 (use (match_operand 3 "" ""))
10441 (clobber (scratch:SI))])]
10445 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10448 operands[1] = XEXP (operands[1], 0);
10450 /* Convert NT DLL imports into an indirect call. */
10451 if (GET_CODE (operands[1]) == SYMBOL_REF
10452 && (INTVAL (operands[3]) & CALL_NT_DLLIMPORT) != 0)
10454 operands[1] = rs6000_dll_import_ref (operands[1]);
10455 operands[3] = GEN_INT ((int)CALL_NORMAL);
10458 if (GET_CODE (operands[1]) != SYMBOL_REF
10459 || (INTVAL (operands[3]) & CALL_LONG) != 0)
10461 if (INTVAL (operands[2]) & CALL_LONG)
10462 operands[1] = rs6000_longcall_ref (operands[1]);
10464 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
10465 emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
10466 operands[2], operands[3]));
10469 rtx toc_reg = gen_rtx_REG (Pmode, 2);
10470 rtx toc_addr = RS6000_SAVE_TOC;
10472 if (DEFAULT_ABI == ABI_AIX)
10474 /* AIX function pointers are really pointers to a three word area */
10475 rtx static_chain = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
10476 emit_call_insn (TARGET_32BIT
10477 ? gen_call_value_indirect_aix32 (operands[0],
10478 force_reg (Pmode, operands[1]),
10479 operands[2], operands[3],
10480 toc_addr, toc_reg, static_chain)
10481 : gen_call_value_indirect_aix64 (operands[0],
10482 force_reg (Pmode, operands[1]),
10483 operands[2], operands[3],
10484 toc_addr, toc_reg, static_chain));
10486 else if (DEFAULT_ABI == ABI_NT)
10488 /* NT function pointers are really pointers to a two word area */
10489 emit_call_insn (gen_call_value_indirect_nt (operands[0],
10490 force_reg (Pmode, operands[1]),
10491 operands[2], operands[3],
10492 toc_addr, toc_reg));
10501 ;; Call to function in current module. No TOC pointer reload needed.
10502 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
10503 ;; either the function was not prototyped, or it was prototyped as a
10504 ;; variable argument function. It is > 0 if FP registers were passed
10505 ;; and < 0 if they were not.
10507 (define_insn "*call_local32"
10508 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10509 (match_operand 1 "" "g,g"))
10510 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10511 (clobber (match_scratch:SI 3 "=l,l"))]
10512 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10515 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10516 output_asm_insn (\"crxor 6,6,6\", operands);
10518 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10519 output_asm_insn (\"creqv 6,6,6\", operands);
10521 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10523 [(set_attr "type" "branch")
10524 (set_attr "length" "4,8")])
10526 (define_insn "*call_local64"
10527 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10528 (match_operand 1 "" "g,g"))
10529 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10530 (clobber (match_scratch:SI 3 "=l,l"))]
10531 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10534 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10535 output_asm_insn (\"crxor 6,6,6\", operands);
10537 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10538 output_asm_insn (\"creqv 6,6,6\", operands);
10540 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10542 [(set_attr "type" "branch")
10543 (set_attr "length" "4,8")])
10545 (define_insn "*ret_call_local32"
10546 [(set (match_operand 0 "" "=fg,fg")
10547 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10548 (match_operand 2 "" "g,g")))
10549 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10550 (clobber (match_scratch:SI 4 "=l,l"))]
10551 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10554 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10555 output_asm_insn (\"crxor 6,6,6\", operands);
10557 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10558 output_asm_insn (\"creqv 6,6,6\", operands);
10560 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10562 [(set_attr "type" "branch")
10563 (set_attr "length" "4,8")])
10566 (define_insn "*ret_call_local64"
10567 [(set (match_operand 0 "" "=fg,fg")
10568 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10569 (match_operand 2 "" "g,g")))
10570 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10571 (clobber (match_scratch:SI 4 "=l,l"))]
10572 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10575 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10576 output_asm_insn (\"crxor 6,6,6\", operands);
10578 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10579 output_asm_insn (\"creqv 6,6,6\", operands);
10581 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10583 [(set_attr "type" "branch")
10584 (set_attr "length" "4,8")])
10586 ;; Call to function which may be in another module. Restore the TOC
10587 ;; pointer (r2) after the call unless this is System V.
10588 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
10589 ;; either the function was not prototyped, or it was prototyped as a
10590 ;; variable argument function. It is > 0 if FP registers were passed
10591 ;; and < 0 if they were not.
10593 (define_insn "*call_nonlocal_aix32"
10594 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
10595 (match_operand 1 "" "fg,fg"))
10596 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10597 (clobber (match_scratch:SI 3 "=l,l"))]
10598 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
10599 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10602 /* Indirect calls should go through call_indirect */
10603 if (GET_CODE (operands[0]) == REG)
10606 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10607 output_asm_insn (\"crxor 6,6,6\", operands);
10609 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10610 output_asm_insn (\"creqv 6,6,6\", operands);
10612 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
10614 [(set_attr "type" "branch")
10615 (set_attr "length" "8,12")])
10617 (define_insn "*call_nonlocal_aix64"
10618 [(call (mem:SI (match_operand:DI 0 "call_operand" "s,s"))
10619 (match_operand 1 "" "fg,fg"))
10620 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10621 (clobber (match_scratch:SI 3 "=l,l"))]
10622 "TARGET_64BIT && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
10623 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10626 /* Indirect calls should go through call_indirect */
10627 if (GET_CODE (operands[0]) == REG)
10630 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10631 output_asm_insn (\"crxor 6,6,6\", operands);
10633 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10634 output_asm_insn (\"creqv 6,6,6\", operands);
10636 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
10638 [(set_attr "type" "branch")
10639 (set_attr "length" "8,12")])
10641 (define_insn "*call_nonlocal_sysv"
10642 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
10643 (match_operand 1 "" "fg,fg"))
10644 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10645 (clobber (match_scratch:SI 3 "=l,l"))]
10646 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
10647 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10650 /* Indirect calls should go through call_indirect */
10651 if (GET_CODE (operands[0]) == REG)
10654 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10655 output_asm_insn (\"crxor 6,6,6\", operands);
10657 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10658 output_asm_insn (\"creqv 6,6,6\", operands);
10660 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@plt\" : \"bl %z0\";
10662 [(set_attr "type" "branch")
10663 (set_attr "length" "4,8")])
10665 (define_insn "*ret_call_nonlocal_aix32"
10666 [(set (match_operand 0 "" "=fg,fg")
10667 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
10668 (match_operand 2 "" "fg,fg")))
10669 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10670 (clobber (match_scratch:SI 4 "=l,l"))]
10671 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
10672 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10675 /* This should be handled by call_value_indirect */
10676 if (GET_CODE (operands[1]) == REG)
10679 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10680 output_asm_insn (\"crxor 6,6,6\", operands);
10682 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10683 output_asm_insn (\"creqv 6,6,6\", operands);
10685 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
10687 [(set_attr "type" "branch")
10688 (set_attr "length" "8,12")])
10690 (define_insn "*ret_call_nonlocal_aix64"
10691 [(set (match_operand 0 "" "=fg,fg")
10692 (call (mem:SI (match_operand:DI 1 "call_operand" "s,s"))
10693 (match_operand 2 "" "fg,fg")))
10694 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10695 (clobber (match_scratch:SI 4 "=l,l"))]
10696 "TARGET_64BIT && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
10697 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10700 /* This should be handled by call_value_indirect */
10701 if (GET_CODE (operands[1]) == REG)
10704 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10705 output_asm_insn (\"crxor 6,6,6\", operands);
10707 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10708 output_asm_insn (\"creqv 6,6,6\", operands);
10710 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
10712 [(set_attr "type" "branch")
10713 (set_attr "length" "8,12")])
10715 (define_insn "*ret_call_nonlocal_sysv"
10716 [(set (match_operand 0 "" "=fg,fg")
10717 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
10718 (match_operand 2 "" "fg,fg")))
10719 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10720 (clobber (match_scratch:SI 4 "=l,l"))]
10721 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
10722 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10725 /* This should be handled by call_value_indirect */
10726 if (GET_CODE (operands[1]) == REG)
10729 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10730 output_asm_insn (\"crxor 6,6,6\", operands);
10732 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10733 output_asm_insn (\"creqv 6,6,6\", operands);
10735 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@plt\" : \"bl %z1\";
10737 [(set_attr "type" "branch")
10738 (set_attr "length" "4,8")])
10740 ;; Call subroutine returning any type.
10741 (define_expand "untyped_call"
10742 [(parallel [(call (match_operand 0 "" "")
10744 (match_operand 1 "" "")
10745 (match_operand 2 "" "")])]
10751 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
10753 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10755 rtx set = XVECEXP (operands[2], 0, i);
10756 emit_move_insn (SET_DEST (set), SET_SRC (set));
10759 /* The optimizer does not know that the call sets the function value
10760 registers we stored in the result block. We avoid problems by
10761 claiming that all hard registers are used and clobbered at this
10763 emit_insn (gen_blockage ());
10768 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10769 ;; all of memory. This blocks insns from being moved across this point.
10771 (define_insn "blockage"
10772 [(unspec_volatile [(const_int 0)] 0)]
10776 ;; V.4 specific code to initialize the PIC register
10778 (define_insn "init_v4_pic"
10779 [(set (match_operand:SI 0 "register_operand" "=l")
10780 (unspec [(const_int 0)] 7))]
10781 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS"
10782 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10783 [(set_attr "type" "branch")
10784 (set_attr "length" "4")])
10787 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10788 ;; signed & unsigned, and one type of branch.
10790 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10791 ;; insns, and branches. We store the operands of compares until we see
10793 (define_expand "cmpsi"
10795 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10796 (match_operand:SI 1 "reg_or_short_operand" "")))]
10800 /* Take care of the possibility that operands[1] might be negative but
10801 this might be a logical operation. That insn doesn't exist. */
10802 if (GET_CODE (operands[1]) == CONST_INT
10803 && INTVAL (operands[1]) < 0)
10804 operands[1] = force_reg (SImode, operands[1]);
10806 rs6000_compare_op0 = operands[0];
10807 rs6000_compare_op1 = operands[1];
10808 rs6000_compare_fp_p = 0;
10812 (define_expand "cmpdi"
10814 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10815 (match_operand:DI 1 "reg_or_short_operand" "")))]
10819 /* Take care of the possibility that operands[1] might be negative but
10820 this might be a logical operation. That insn doesn't exist. */
10821 if (GET_CODE (operands[1]) == CONST_INT
10822 && INTVAL (operands[1]) < 0)
10823 operands[1] = force_reg (DImode, operands[1]);
10825 rs6000_compare_op0 = operands[0];
10826 rs6000_compare_op1 = operands[1];
10827 rs6000_compare_fp_p = 0;
10831 (define_expand "cmpsf"
10832 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10833 (match_operand:SF 1 "gpc_reg_operand" "")))]
10834 "TARGET_HARD_FLOAT"
10837 rs6000_compare_op0 = operands[0];
10838 rs6000_compare_op1 = operands[1];
10839 rs6000_compare_fp_p = 1;
10843 (define_expand "cmpdf"
10844 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10845 (match_operand:DF 1 "gpc_reg_operand" "")))]
10846 "TARGET_HARD_FLOAT"
10849 rs6000_compare_op0 = operands[0];
10850 rs6000_compare_op1 = operands[1];
10851 rs6000_compare_fp_p = 1;
10855 (define_expand "beq"
10856 [(set (match_dup 2) (match_dup 1))
10858 (if_then_else (eq (match_dup 2)
10860 (label_ref (match_operand 0 "" ""))
10864 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
10865 operands[1] = gen_rtx_COMPARE (mode,
10866 rs6000_compare_op0, rs6000_compare_op1);
10867 operands[2] = gen_reg_rtx (mode);
10870 (define_expand "bne"
10871 [(set (match_dup 2) (match_dup 1))
10873 (if_then_else (ne (match_dup 2)
10875 (label_ref (match_operand 0 "" ""))
10879 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
10880 operands[1] = gen_rtx_COMPARE (mode,
10881 rs6000_compare_op0, rs6000_compare_op1);
10882 operands[2] = gen_reg_rtx (mode);
10885 (define_expand "blt"
10886 [(set (match_dup 2) (match_dup 1))
10888 (if_then_else (lt (match_dup 2)
10890 (label_ref (match_operand 0 "" ""))
10894 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
10895 operands[1] = gen_rtx_COMPARE (mode,
10896 rs6000_compare_op0, rs6000_compare_op1);
10897 operands[2] = gen_reg_rtx (mode);
10900 (define_expand "bgt"
10901 [(set (match_dup 2) (match_dup 1))
10903 (if_then_else (gt (match_dup 2)
10905 (label_ref (match_operand 0 "" ""))
10909 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
10910 operands[1] = gen_rtx_COMPARE (mode,
10911 rs6000_compare_op0, rs6000_compare_op1);
10912 operands[2] = gen_reg_rtx (mode);
10915 (define_expand "ble"
10916 [(set (match_dup 2) (match_dup 1))
10918 (if_then_else (le (match_dup 2)
10920 (label_ref (match_operand 0 "" ""))
10924 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
10925 operands[1] = gen_rtx_COMPARE (mode,
10926 rs6000_compare_op0, rs6000_compare_op1);
10927 operands[2] = gen_reg_rtx (mode);
10930 (define_expand "bge"
10931 [(set (match_dup 2) (match_dup 1))
10933 (if_then_else (ge (match_dup 2)
10935 (label_ref (match_operand 0 "" ""))
10939 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
10940 operands[1] = gen_rtx_COMPARE (mode,
10941 rs6000_compare_op0, rs6000_compare_op1);
10942 operands[2] = gen_reg_rtx (mode);
10945 (define_expand "bgtu"
10946 [(set (match_dup 2) (match_dup 1))
10948 (if_then_else (gtu (match_dup 2)
10950 (label_ref (match_operand 0 "" ""))
10954 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
10955 rs6000_compare_op0, rs6000_compare_op1);
10956 operands[2] = gen_reg_rtx (CCUNSmode);
10959 (define_expand "bltu"
10960 [(set (match_dup 2) (match_dup 1))
10962 (if_then_else (ltu (match_dup 2)
10964 (label_ref (match_operand 0 "" ""))
10968 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
10969 rs6000_compare_op0, rs6000_compare_op1);
10970 operands[2] = gen_reg_rtx (CCUNSmode);
10973 (define_expand "bgeu"
10974 [(set (match_dup 2) (match_dup 1))
10976 (if_then_else (geu (match_dup 2)
10978 (label_ref (match_operand 0 "" ""))
10982 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
10983 rs6000_compare_op0, rs6000_compare_op1);
10984 operands[2] = gen_reg_rtx (CCUNSmode);
10987 (define_expand "bleu"
10988 [(set (match_dup 2) (match_dup 1))
10990 (if_then_else (leu (match_dup 2)
10992 (label_ref (match_operand 0 "" ""))
10996 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
10997 rs6000_compare_op0, rs6000_compare_op1);
10998 operands[2] = gen_reg_rtx (CCUNSmode);
11001 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11002 ;; For SEQ, likewise, except that comparisons with zero should be done
11003 ;; with an scc insns. However, due to the order that combine see the
11004 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11005 ;; the cases we don't want to handle.
11006 (define_expand "seq"
11007 [(set (match_dup 2) (match_dup 1))
11008 (set (match_operand:SI 0 "gpc_reg_operand" "")
11009 (eq:SI (match_dup 2) (const_int 0)))]
11012 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
11013 operands[1] = gen_rtx_COMPARE (mode,
11014 rs6000_compare_op0, rs6000_compare_op1);
11015 operands[2] = gen_reg_rtx (mode);
11018 (define_expand "sne"
11019 [(set (match_dup 2) (match_dup 1))
11020 (set (match_operand:SI 0 "gpc_reg_operand" "")
11021 (ne:SI (match_dup 2) (const_int 0)))]
11024 { if (! rs6000_compare_fp_p)
11027 operands[1] = gen_rtx_COMPARE (CCFPmode,
11028 rs6000_compare_op0, rs6000_compare_op1);
11029 operands[2] = gen_reg_rtx (CCFPmode);
11032 ;; A > 0 is best done using the portable sequence, so fail in that case.
11033 (define_expand "sgt"
11034 [(set (match_dup 2) (match_dup 1))
11035 (set (match_operand:SI 0 "gpc_reg_operand" "")
11036 (gt:SI (match_dup 2) (const_int 0)))]
11039 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
11041 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11044 operands[1] = gen_rtx_COMPARE (mode,
11045 rs6000_compare_op0, rs6000_compare_op1);
11046 operands[2] = gen_reg_rtx (mode);
11049 ;; A < 0 is best done in the portable way for A an integer.
11050 (define_expand "slt"
11051 [(set (match_dup 2) (match_dup 1))
11052 (set (match_operand:SI 0 "gpc_reg_operand" "")
11053 (lt:SI (match_dup 2) (const_int 0)))]
11056 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
11058 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11061 operands[1] = gen_rtx_COMPARE (mode,
11062 rs6000_compare_op0, rs6000_compare_op1);
11063 operands[2] = gen_reg_rtx (mode);
11066 (define_expand "sge"
11067 [(set (match_dup 2) (match_dup 1))
11068 (set (match_operand:SI 0 "gpc_reg_operand" "")
11069 (ge:SI (match_dup 2) (const_int 0)))]
11072 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
11073 operands[1] = gen_rtx_COMPARE (mode,
11074 rs6000_compare_op0, rs6000_compare_op1);
11075 operands[2] = gen_reg_rtx (mode);
11078 ;; A <= 0 is best done the portable way for A an integer.
11079 (define_expand "sle"
11080 [(set (match_dup 2) (match_dup 1))
11081 (set (match_operand:SI 0 "gpc_reg_operand" "")
11082 (le:SI (match_dup 2) (const_int 0)))]
11085 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
11087 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
11090 operands[1] = gen_rtx_COMPARE (mode,
11091 rs6000_compare_op0, rs6000_compare_op1);
11092 operands[2] = gen_reg_rtx (mode);
11095 (define_expand "sgtu"
11096 [(set (match_dup 2) (match_dup 1))
11097 (set (match_operand:SI 0 "gpc_reg_operand" "")
11098 (gtu:SI (match_dup 2) (const_int 0)))]
11101 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
11102 rs6000_compare_op0, rs6000_compare_op1);
11103 operands[2] = gen_reg_rtx (CCUNSmode);
11106 (define_expand "sltu"
11107 [(set (match_dup 2) (match_dup 1))
11108 (set (match_operand:SI 0 "gpc_reg_operand" "")
11109 (ltu:SI (match_dup 2) (const_int 0)))]
11112 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
11113 rs6000_compare_op0, rs6000_compare_op1);
11114 operands[2] = gen_reg_rtx (CCUNSmode);
11117 (define_expand "sgeu"
11118 [(set (match_dup 2) (match_dup 1))
11119 (set (match_operand:SI 0 "gpc_reg_operand" "")
11120 (geu:SI (match_dup 2) (const_int 0)))]
11123 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
11124 rs6000_compare_op0, rs6000_compare_op1);
11125 operands[2] = gen_reg_rtx (CCUNSmode);
11128 (define_expand "sleu"
11129 [(set (match_dup 2) (match_dup 1))
11130 (set (match_operand:SI 0 "gpc_reg_operand" "")
11131 (leu:SI (match_dup 2) (const_int 0)))]
11134 { operands[1] = gen_rtx_COMPARE (CCUNSmode,
11135 rs6000_compare_op0, rs6000_compare_op1);
11136 operands[2] = gen_reg_rtx (CCUNSmode);
11139 ;; Here are the actual compare insns.
11141 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11142 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11143 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11145 "{cmp%I2|cmpw%I2} %0,%1,%2"
11146 [(set_attr "type" "compare")])
11149 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11150 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11151 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11154 [(set_attr "type" "compare")])
11156 ;; If we are comparing a register for equality with a large constant,
11157 ;; we can do this with an XOR followed by a compare. But we need a scratch
11158 ;; register for the result of the XOR.
11161 [(set (match_operand:CC 0 "cc_reg_operand" "")
11162 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11163 (match_operand:SI 2 "non_short_cint_operand" "")))
11164 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11165 "find_single_use (operands[0], insn, 0)
11166 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11167 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11168 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11169 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11172 /* Get the constant we are comparing against, C, and see what it looks like
11173 sign-extended to 16 bits. Then see what constant could be XOR'ed
11174 with C to get the sign-extended value. */
11176 int c = INTVAL (operands[2]);
11177 int sextc = (c << 16) >> 16;
11178 int xorv = c ^ sextc;
11180 operands[4] = GEN_INT (xorv);
11181 operands[5] = GEN_INT (sextc);
11185 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11186 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11187 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
11189 "{cmpl%I2|cmplw%I2} %0,%1,%W2"
11190 [(set_attr "type" "compare")])
11193 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11194 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11195 (match_operand:DI 2 "reg_or_u_short_operand" "rI")))]
11197 "cmpld%I2 %0,%1,%W2"
11198 [(set_attr "type" "compare")])
11200 ;; The following two insns don't exist as single insns, but if we provide
11201 ;; them, we can swap an add and compare, which will enable us to overlap more
11202 ;; of the required delay between a compare and branch. We generate code for
11203 ;; them by splitting.
11206 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11207 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11208 (match_operand:SI 2 "short_cint_operand" "i")))
11209 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11210 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11213 [(set_attr "length" "8")])
11216 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11217 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11218 (match_operand:SI 2 "u_short_cint_operand" "i")))
11219 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11220 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11223 [(set_attr "length" "8")])
11226 [(set (match_operand:CC 3 "cc_reg_operand" "")
11227 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11228 (match_operand:SI 2 "short_cint_operand" "")))
11229 (set (match_operand:SI 0 "gpc_reg_operand" "")
11230 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11232 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11233 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11236 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11237 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11238 (match_operand:SI 2 "u_short_cint_operand" "")))
11239 (set (match_operand:SI 0 "gpc_reg_operand" "")
11240 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11242 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11243 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11246 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11247 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11248 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11249 "TARGET_HARD_FLOAT"
11251 [(set_attr "type" "fpcompare")])
11254 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11255 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11256 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11257 "TARGET_HARD_FLOAT"
11259 [(set_attr "type" "fpcompare")])
11261 ;; Now we have the scc insns. We can do some combinations because of the
11262 ;; way the machine works.
11264 ;; Note that this is probably faster if we can put an insn between the
11265 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11266 ;; cases the insns below which don't use an intermediate CR field will
11267 ;; be used instead.
11269 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11270 (match_operator:SI 1 "scc_comparison_operator"
11271 [(match_operand 2 "cc_reg_operand" "y")
11274 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11275 [(set_attr "length" "12")])
11278 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
11279 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11280 [(match_operand 2 "cc_reg_operand" "y")
11283 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11284 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11286 "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
11287 [(set_attr "type" "delayed_compare")
11288 (set_attr "length" "12")])
11291 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11292 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11293 [(match_operand 2 "cc_reg_operand" "y")
11295 (match_operand:SI 3 "const_int_operand" "n")))]
11299 int is_bit = ccr_bit (operands[1], 1);
11300 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11303 if (is_bit >= put_bit)
11304 count = is_bit - put_bit;
11306 count = 32 - (put_bit - is_bit);
11308 operands[4] = GEN_INT (count);
11309 operands[5] = GEN_INT (put_bit);
11311 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11313 [(set_attr "length" "12")])
11316 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
11318 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11319 [(match_operand 2 "cc_reg_operand" "y")
11321 (match_operand:SI 3 "const_int_operand" "n"))
11323 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
11324 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11329 int is_bit = ccr_bit (operands[1], 1);
11330 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11333 if (is_bit >= put_bit)
11334 count = is_bit - put_bit;
11336 count = 32 - (put_bit - is_bit);
11338 operands[5] = GEN_INT (count);
11339 operands[6] = GEN_INT (put_bit);
11341 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11343 [(set_attr "type" "delayed_compare")
11344 (set_attr "length" "12")])
11346 ;; If we are comparing the result of two comparisons, this can be done
11347 ;; using creqv or crxor.
11350 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
11351 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
11352 [(match_operand 2 "cc_reg_operand" "y")
11354 (match_operator 3 "scc_comparison_operator"
11355 [(match_operand 4 "cc_reg_operand" "y")
11357 "REGNO (operands[2]) != REGNO (operands[4])"
11360 enum rtx_code code1, code2;
11362 code1 = GET_CODE (operands[1]);
11363 code2 = GET_CODE (operands[3]);
11365 if ((code1 == EQ || code1 == LT || code1 == GT
11366 || code1 == LTU || code1 == GTU
11367 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
11369 (code2 == EQ || code2 == LT || code2 == GT
11370 || code2 == LTU || code2 == GTU
11371 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
11372 return \"%C1%C3crxor %E0,%j1,%j3\";
11374 return \"%C1%C3creqv %E0,%j1,%j3\";
11376 [(set_attr "length" "12")])
11378 ;; There is a 3 cycle delay between consecutive mfcr instructions
11379 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11382 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11383 (match_operator:SI 1 "scc_comparison_operator"
11384 [(match_operand 2 "cc_reg_operand" "y")
11386 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11387 (match_operator:SI 4 "scc_comparison_operator"
11388 [(match_operand 5 "cc_reg_operand" "y")
11390 "REGNO (operands[2]) != REGNO (operands[5])"
11391 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11392 [(set_attr "length" "20")])
11394 ;; There are some scc insns that can be done directly, without a compare.
11395 ;; These are faster because they don't involve the communications between
11396 ;; the FXU and branch units. In fact, we will be replacing all of the
11397 ;; integer scc insns here or in the portable methods in emit_store_flag.
11399 ;; Also support (neg (scc ..)) since that construct is used to replace
11400 ;; branches, (plus (scc ..) ..) since that construct is common and
11401 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11402 ;; cases where it is no more expensive than (neg (scc ..)).
11404 ;; Have reload force a constant into a register for the simple insns that
11405 ;; otherwise won't accept constants. We do this because it is faster than
11406 ;; the cmp/mfcr sequence we would otherwise generate.
11409 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11410 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11411 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11412 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11415 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11416 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11417 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11418 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11419 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11420 [(set_attr "length" "12,8,12,12,12")])
11423 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11424 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11425 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11426 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11429 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11430 subfic %3,%1,0\;adde %0,%3,%1
11431 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11432 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11433 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11434 [(set_attr "length" "12,8,12,12,12")])
11437 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11439 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11440 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11442 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11443 (eq:SI (match_dup 1) (match_dup 2)))
11444 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11447 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11448 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11449 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11450 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11451 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11452 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11453 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1\;cmpli %4,%0,0
11454 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0\;cmpli %4,%0,0
11455 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0\;cmpli %4,%0,0
11456 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0\;cmpli %4,%0,0"
11457 [(set_attr "type" "compare")
11458 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11461 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11463 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11464 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11466 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11467 (eq:DI (match_dup 1) (match_dup 2)))
11468 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11471 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11472 subfic %3,%1,0\;adde. %0,%3,%1
11473 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11474 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11475 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11476 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11477 subfic %3,%1,0\;adde %0,%3,%1\;cmpli %4,%0,0
11478 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0\;cmpli %4,%0,0
11479 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0\;cmpli %4,%0,0
11480 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0\;cmpli %4,%0,0"
11481 [(set_attr "type" "compare")
11482 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11484 ;; We have insns of the form shown by the first define_insn below. If
11485 ;; there is something inside the comparison operation, we must split it.
11487 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11488 (plus:SI (match_operator 1 "comparison_operator"
11489 [(match_operand:SI 2 "" "")
11490 (match_operand:SI 3
11491 "reg_or_cint_operand" "")])
11492 (match_operand:SI 4 "gpc_reg_operand" "")))
11493 (clobber (match_operand:SI 5 "register_operand" ""))]
11494 "! gpc_reg_operand (operands[2], SImode)"
11495 [(set (match_dup 5) (match_dup 2))
11496 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11500 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11501 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11502 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
11503 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
11504 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
11507 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
11508 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
11509 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
11510 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
11511 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
11512 [(set_attr "length" "12,8,12,12,12")])
11515 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11518 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11519 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11520 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11522 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11525 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11526 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11527 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11528 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11529 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11530 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3\;cmpli %0,%4,0
11531 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3\;cmpli %0,%4,0
11532 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %4,%3\;cmpli %0,%4,0
11533 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %4,%3\;cmpli %0,%4,0
11534 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %4,%3\;cmpli %0,%4,0"
11535 [(set_attr "type" "compare")
11536 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11539 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11542 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11543 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11544 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11546 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11547 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11548 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11551 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
11552 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11553 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
11554 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
11555 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
11556 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3\;cmpli %5,%0,0
11557 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3\;cmpli %5,%0,0
11558 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3\;cmpli %5,%0,0
11559 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3\;cmpli %5,%0,0
11560 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3\;cmpli %5,%0,0"
11561 [(set_attr "type" "compare")
11562 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11565 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11566 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11567 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
11570 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11571 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11572 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11573 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11574 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11575 [(set_attr "length" "12,8,12,12,12")])
11577 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11578 ;; since it nabs/sr is just as fast.
11579 (define_insn "*ne0"
11580 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11581 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11583 (clobber (match_scratch:SI 2 "=&r"))]
11585 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11586 [(set_attr "length" "8")])
11589 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11590 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11592 (clobber (match_scratch:DI 2 "=&r"))]
11594 "addic %2,%1,-1\;subfe %0,%2,%1"
11595 [(set_attr "length" "8")])
11597 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11599 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11600 (plus:SI (lshiftrt:SI
11601 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11603 (match_operand:SI 2 "gpc_reg_operand" "r")))
11604 (clobber (match_scratch:SI 3 "=&r"))]
11606 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11607 [(set_attr "length" "8")])
11610 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11611 (plus:DI (lshiftrt:DI
11612 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11614 (match_operand:DI 2 "gpc_reg_operand" "r")))
11615 (clobber (match_scratch:DI 3 "=&r"))]
11617 "addic %3,%1,-1\;addze %0,%2"
11618 [(set_attr "length" "8")])
11621 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11623 (plus:SI (lshiftrt:SI
11624 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11626 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11628 (clobber (match_scratch:SI 3 "=&r,&r"))]
11631 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11632 {ai|addic} %3,%1,-1\;{aze|addze} %3,%2\;cmpli %0,%3,0"
11633 [(set_attr "type" "compare")
11634 (set_attr "length" "8,12")])
11637 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11639 (plus:DI (lshiftrt:DI
11640 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11642 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11644 (clobber (match_scratch:DI 3 "=&r,&r"))]
11647 addic %3,%1,-1\;addze. %3,%2
11648 addic %3,%1,-1\;addze. %3,%2\;cmpdi %0,%3,0"
11649 [(set_attr "type" "compare")
11650 (set_attr "length" "8,12")])
11653 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11655 (plus:SI (lshiftrt:SI
11656 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11658 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11660 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11661 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11663 (clobber (match_scratch:SI 3 "=&r,&r"))]
11666 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11667 {ai|addic} %3,%1,-1\;{aze|addze} %0,%2\;cmpli %4,%0,0"
11668 [(set_attr "type" "compare")
11669 (set_attr "length" "8,12")])
11672 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11674 (plus:DI (lshiftrt:DI
11675 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11677 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11679 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11680 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11682 (clobber (match_scratch:DI 3 "=&r,&r"))]
11685 addic %3,%1,-1\;addze. %0,%2
11686 addic %3,%1,-1\;addze. %0,%2\;cmpdi %4,%0,0"
11687 [(set_attr "type" "compare")
11688 (set_attr "length" "8,12")])
11691 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11692 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11693 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11694 (clobber (match_scratch:SI 3 "=r,X"))]
11697 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11698 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11699 [(set_attr "length" "12")])
11702 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11704 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11705 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11707 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11708 (le:SI (match_dup 1) (match_dup 2)))
11709 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11712 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11713 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11714 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3\;cmpli %4,%0,0
11715 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31\;cmpli %4,%0,0"
11716 [(set_attr "type" "compare,delayed_compare,compare,compare")
11717 (set_attr "length" "12,12,16,16")])
11720 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11721 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11722 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11723 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
11724 (clobber (match_scratch:SI 4 "=&r,&r"))]
11727 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
11728 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
11729 [(set_attr "length" "12")])
11732 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11734 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11735 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11736 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11738 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11741 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11742 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11743 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %4,%3\;cmpli %0,%4,0
11744 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3\;cmpli %0,%4,0"
11745 [(set_attr "type" "compare")
11746 (set_attr "length" "12,12,16,16")])
11749 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
11751 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11752 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11753 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11755 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11756 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11757 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11760 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
11761 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3
11762 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3\;cmpli %5,%0,0
11763 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3\;cmpli %5,%0,0"
11764 [(set_attr "type" "compare")
11765 (set_attr "length" "12,12,16,16")])
11768 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11769 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11770 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11773 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11774 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11775 [(set_attr "length" "12")])
11778 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11779 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11780 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11782 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11783 [(set_attr "length" "12")])
11786 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11788 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11789 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11791 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11792 (leu:SI (match_dup 1) (match_dup 2)))]
11795 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11796 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0\;cmpli %3,%0,0"
11797 [(set_attr "type" "compare")
11798 (set_attr "length" "12,16")])
11801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11802 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11803 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11804 (match_operand:SI 3 "gpc_reg_operand" "r")))
11805 (clobber (match_scratch:SI 4 "=&r"))]
11807 "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
11808 [(set_attr "length" "8")])
11811 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11813 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11814 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11815 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11817 (clobber (match_scratch:SI 4 "=&r,&r"))]
11820 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11821 {sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %4,%3\;cmpli %0,%4,0"
11822 [(set_attr "type" "compare")
11823 (set_attr "length" "8,12")])
11826 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
11828 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11829 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11830 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11832 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11833 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11834 (clobber (match_scratch:SI 4 "=&r,&r"))]
11837 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3
11838 {sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3\;cmpli %5,%0,0"
11839 [(set_attr "type" "compare")
11840 (set_attr "length" "8,12")])
11843 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11844 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11845 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11847 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
11848 [(set_attr "length" "12")])
11851 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11853 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11854 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11855 (match_operand:SI 3 "gpc_reg_operand" "r")))
11856 (clobber (match_scratch:SI 4 "=&r"))]
11858 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
11859 [(set_attr "length" "12")])
11862 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11865 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11866 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11867 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11869 (clobber (match_scratch:SI 4 "=&r,&r"))]
11872 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
11873 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %4,%3,%4\;cmpli %0,%4,0"
11874 [(set_attr "type" "compare")
11875 (set_attr "length" "12,16")])
11878 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
11881 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11882 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11883 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11885 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11886 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
11887 (clobber (match_scratch:SI 4 "=&r,&r"))]
11890 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
11891 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4\;cmpli %5,%0,0"
11892 [(set_attr "type" "compare")
11893 (set_attr "length" "12,16")])
11896 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11897 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11898 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11900 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
11901 [(set_attr "length" "12")])
11904 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11906 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11907 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11909 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11910 (lt:SI (match_dup 1) (match_dup 2)))]
11913 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
11914 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31\;cmpli %3,%0,0"
11915 [(set_attr "type" "delayed_compare,compare")
11916 (set_attr "length" "12,16")])
11919 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11920 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11921 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11922 (match_operand:SI 3 "gpc_reg_operand" "r")))
11923 (clobber (match_scratch:SI 4 "=&r"))]
11925 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
11926 [(set_attr "length" "12")])
11929 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11931 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11932 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11933 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11935 (clobber (match_scratch:SI 4 "=&r,&r"))]
11938 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
11939 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %4,%3\;cmpli %0,%4,0"
11940 [(set_attr "type" "compare")
11941 (set_attr "length" "12,16")])
11944 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
11946 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11947 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11948 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11950 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11951 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11952 (clobber (match_scratch:SI 4 "=&r,&r"))]
11955 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3
11956 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3\;cmpli %5,%0,0"
11957 [(set_attr "type" "compare")
11958 (set_attr "length" "12,16")])
11961 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11962 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11963 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11965 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
11966 [(set_attr "length" "12")])
11969 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11970 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11971 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
11974 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
11975 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
11976 [(set_attr "length" "12")])
11979 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
11981 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11982 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
11984 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11985 (ltu:SI (match_dup 1) (match_dup 2)))]
11988 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
11989 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
11990 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0\;cmpli %3,%0,0
11991 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0\;cmpli %3,%0,0"
11992 [(set_attr "type" "compare")
11993 (set_attr "length" "12,12,16,16")])
11996 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11997 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11998 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
11999 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
12000 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
12003 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
12004 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
12005 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
12006 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
12007 [(set_attr "length" "12")])
12010 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12012 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12013 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12014 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12016 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12019 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12020 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12021 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf|subfc} %4,%4,%3\;cmpli %0,%4,0
12022 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf|subfc} %4,%4,%3\;cmpli %0,%4,0"
12023 [(set_attr "type" "compare")
12024 (set_attr "length" "12,12,16,16")])
12027 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12029 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12030 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12031 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12033 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12034 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12035 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12038 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
12039 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
12040 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf|subfc} %0,%4,%3\;cmpli %5,%0,0
12041 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf|subfc} %0,%4,%3\;cmpli %5,%0,0"
12042 [(set_attr "type" "compare")
12043 (set_attr "length" "12,12,16,16")])
12046 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12047 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12048 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12051 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12052 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12053 [(set_attr "length" "8")])
12056 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12057 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12058 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12059 (clobber (match_scratch:SI 3 "=r"))]
12061 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12062 [(set_attr "length" "12")])
12065 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12067 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12068 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12070 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12071 (ge:SI (match_dup 1) (match_dup 2)))
12072 (clobber (match_scratch:SI 3 "=r,r"))]
12075 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12076 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3\;cmpli %4,%0,0"
12077 [(set_attr "type" "compare")
12078 (set_attr "length" "12,16")])
12081 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12082 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12083 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12084 (match_operand:SI 3 "gpc_reg_operand" "r")))
12085 (clobber (match_scratch:SI 4 "=&r"))]
12087 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
12088 [(set_attr "length" "12")])
12091 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12093 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12094 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12095 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12097 (clobber (match_scratch:SI 4 "=&r,&r"))]
12100 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12101 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %4,%3\;cmpli %0,%4,0"
12102 [(set_attr "type" "compare")
12103 (set_attr "length" "12,16")])
12106 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
12108 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12109 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12110 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12112 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12113 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12114 (clobber (match_scratch:SI 4 "=&r,&r"))]
12117 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
12118 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3\;cmpli %5,%0,0"
12119 [(set_attr "type" "compare")
12120 (set_attr "length" "12,16")])
12123 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12124 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12125 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12127 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12128 [(set_attr "length" "12")])
12130 ;; This is (and (neg (ge X (const_int 0))) Y).
12132 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12135 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
12137 (match_operand:SI 2 "gpc_reg_operand" "r")))
12138 (clobber (match_scratch:SI 3 "=&r"))]
12140 "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
12141 [(set_attr "length" "8")])
12144 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12148 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
12150 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12152 (clobber (match_scratch:SI 3 "=&r,&r"))]
12155 {srai|srawi} %3,%1,31\;andc. %3,%2,%3
12156 {srai|srawi} %3,%1,31\;andc %3,%2,%3\;cmpli %0,%3,0"
12157 [(set_attr "type" "compare")
12158 (set_attr "length" "8,12")])
12161 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12165 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
12167 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12169 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12170 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
12173 (clobber (match_scratch:SI 3 "=&r,&r"))]
12176 {srai|srawi} %3,%1,31\;andc. %0,%2,%3
12177 {srai|srawi} %3,%1,31\;andc %0,%2,%3\;cmpli %4,%0,0"
12178 [(set_attr "type" "compare")
12179 (set_attr "length" "8,12")])
12182 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12183 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12184 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12187 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12188 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12189 [(set_attr "length" "12")])
12192 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12194 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12195 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12197 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12198 (geu:SI (match_dup 1) (match_dup 2)))]
12201 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12202 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12203 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0\;cmpli %3,%0,0
12204 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0\;cmpli %3,%0,0"
12205 [(set_attr "type" "compare")
12206 (set_attr "length" "12,12,16,16")])
12209 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12210 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12211 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12212 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
12213 (clobber (match_scratch:SI 4 "=&r,&r"))]
12216 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
12217 {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
12218 [(set_attr "length" "8")])
12221 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12223 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12224 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12225 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12227 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12230 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12231 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12232 {sf|subfc} %4,%2,%1\;{aze|addze} %4,%3\;cmpli %0,%4,0
12233 {ai|addic} %4,%1,%n2\;{aze|addze} %4,%3\;cmpli %0,%4,0"
12234 [(set_attr "type" "compare")
12235 (set_attr "length" "8,8,12,12")])
12238 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12240 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12241 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12242 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12244 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12245 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12246 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12249 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
12250 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12251 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3\;cmpli %5,%0,0
12252 {ai|addic} %4,%1,%n2\;{aze|addze} %4,%3\;cmpli %5,%0,0"
12253 [(set_attr "type" "compare")
12254 (set_attr "length" "8,8,12,12")])
12257 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12258 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12259 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12262 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12263 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12264 [(set_attr "length" "12")])
12267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12269 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12270 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12271 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
12272 (clobber (match_scratch:SI 4 "=&r,&r"))]
12275 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
12276 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
12277 [(set_attr "length" "12")])
12280 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12283 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12284 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12285 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12287 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12290 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12291 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12292 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %4,%3,%4\;cmpli %0,%4,0
12293 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4\;cmpli %0,%4,0"
12294 [(set_attr "type" "compare")
12295 (set_attr "length" "12,12,16,16")])
12298 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12301 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12302 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12303 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12305 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12306 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12307 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12310 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
12311 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
12312 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4\;cmpli %5,%0,0
12313 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4\;cmpli %5,%0,0"
12314 [(set_attr "type" "compare")
12315 (set_attr "length" "12,12,16,16")])
12318 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12319 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12322 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12323 [(set_attr "length" "12")])
12326 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12328 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12331 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12332 (gt:SI (match_dup 1) (const_int 0)))]
12335 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12336 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31\;cmpli %2,%0,0"
12337 [(set_attr "type" "delayed_compare,compare")
12338 (set_attr "length" "12,8")])
12341 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12342 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12343 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12345 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12346 [(set_attr "length" "12")])
12349 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12351 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12352 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12354 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12355 (gt:SI (match_dup 1) (match_dup 2)))]
12358 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12359 doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31\;cmpli %3,%0,0"
12360 [(set_attr "type" "delayed_compare,compare")
12361 (set_attr "length" "12,16")])
12364 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12365 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12367 (match_operand:SI 2 "gpc_reg_operand" "r")))
12368 (clobber (match_scratch:SI 3 "=&r"))]
12370 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
12371 [(set_attr "length" "12")])
12374 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12376 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12378 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12380 (clobber (match_scratch:SI 3 "=&r,&r"))]
12383 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12384 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %3,%2\;cmpli %0,%3"
12385 [(set_attr "type" "compare")
12386 (set_attr "length" "12,16")])
12389 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12391 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12393 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12395 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12396 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12397 (clobber (match_scratch:SI 3 "=&r,&r"))]
12400 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12401 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %3,%2\;cmpli %4,%3"
12402 [(set_attr "type" "compare")
12403 (set_attr "length" "12,16")])
12406 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12407 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12408 (match_operand:SI 2 "reg_or_short_operand" "r"))
12409 (match_operand:SI 3 "gpc_reg_operand" "r")))
12410 (clobber (match_scratch:SI 4 "=&r"))]
12412 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
12413 [(set_attr "length" "12")])
12416 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12418 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12419 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12420 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12422 (clobber (match_scratch:SI 4 "=&r,&r"))]
12425 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12426 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %4,%3\;cmpli %0,%4,0"
12427 [(set_attr "type" "compare")
12428 (set_attr "length" "12,16")])
12431 [(set (match_operand:CC 5 "cc_reg_operand" "=x,?y")
12433 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12434 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12435 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12437 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12438 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12439 (clobber (match_scratch:SI 4 "=&r,&r"))]
12442 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3
12443 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3\;cmpli %5,%0,0"
12444 [(set_attr "type" "compare")
12445 (set_attr "length" "12,16")])
12448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12449 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12452 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
12453 [(set_attr "length" "12")])
12456 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12457 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12458 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
12460 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12461 [(set_attr "length" "12")])
12464 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12465 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12466 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12468 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12469 [(set_attr "length" "12")])
12472 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12474 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12475 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12477 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12478 (gtu:SI (match_dup 1) (match_dup 2)))]
12481 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12482 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0\;cmpli %3,%0,0"
12483 [(set_attr "type" "compare")
12484 (set_attr "length" "12,16")])
12487 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
12488 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
12489 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
12490 (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
12491 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
12494 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
12495 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
12496 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
12497 [(set_attr "length" "8,12,12")])
12500 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12502 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12503 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
12504 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12506 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12509 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
12510 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12511 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3\;cmpli %0,%4,0
12512 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3\;cmpli %0,%4,0"
12513 [(set_attr "type" "compare")
12514 (set_attr "length" "8,12,12,16")])
12517 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,?y,?y")
12519 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12520 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
12521 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12523 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12524 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12525 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12528 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
12529 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
12530 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3\;cmpli %5,%0,0
12531 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf|subfc} %0,%4,%3\;cmpli %5,%0,0"
12532 [(set_attr "type" "compare")
12533 (set_attr "length" "8,12,12,16")])
12536 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12537 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12538 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12540 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
12541 [(set_attr "length" "8")])
12543 ;; Define both directions of branch and return. If we need a reload
12544 ;; register, we'd rather use CR0 since it is much easier to copy a
12545 ;; register CC value to there.
12549 (if_then_else (match_operator 1 "branch_comparison_operator"
12551 "cc_reg_operand" "x,?y")
12553 (label_ref (match_operand 0 "" ""))
12558 if (get_attr_length (insn) == 8)
12559 return \"%C1bc %t1,%j1,%l0\";
12561 return \"%C1bc %T1,%j1,%$+8\;b %l0\";
12564 [(set_attr "type" "branch")])
12568 (if_then_else (match_operator 0 "branch_comparison_operator"
12570 "cc_reg_operand" "x,?y")
12575 "{%C0bcr|%C0bclr} %t0,%j0"
12576 [(set_attr "type" "branch")
12577 (set_attr "length" "8")])
12581 (if_then_else (match_operator 1 "branch_comparison_operator"
12583 "cc_reg_operand" "x,?y")
12586 (label_ref (match_operand 0 "" ""))))]
12590 if (get_attr_length (insn) == 8)
12591 return \"%C1bc %T1,%j1,%l0\";
12593 return \"%C1bc %t1,%j1,%$+8\;b %l0\";
12595 [(set_attr "type" "branch")])
12599 (if_then_else (match_operator 0 "branch_comparison_operator"
12601 "cc_reg_operand" "x,?y")
12606 "{%C0bcr|%C0bclr} %T0,%j0"
12607 [(set_attr "type" "branch")
12608 (set_attr "length" "8")])
12610 ;; Unconditional branch and return.
12612 (define_insn "jump"
12614 (label_ref (match_operand 0 "" "")))]
12617 [(set_attr "type" "branch")])
12619 (define_insn "return"
12623 [(set_attr "type" "jmpreg")])
12625 (define_insn "indirect_jump"
12626 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
12631 [(set_attr "type" "jmpreg")])
12634 [(set (pc) (match_operand:DI 0 "register_operand" "c,l"))]
12639 [(set_attr "type" "jmpreg")])
12641 ;; Table jump for switch statements:
12642 (define_expand "tablejump"
12643 [(use (match_operand 0 "" ""))
12644 (use (label_ref (match_operand 1 "" "")))]
12649 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
12651 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
12655 (define_expand "tablejumpsi"
12656 [(set (match_dup 3)
12657 (plus:SI (match_operand:SI 0 "" "")
12659 (parallel [(set (pc) (match_dup 3))
12660 (use (label_ref (match_operand 1 "" "")))])]
12663 { operands[0] = force_reg (SImode, operands[0]);
12664 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (VOIDmode, operands[1]));
12665 operands[3] = gen_reg_rtx (SImode);
12668 (define_expand "tablejumpdi"
12669 [(set (match_dup 3)
12670 (plus:DI (match_operand:DI 0 "" "")
12672 (parallel [(set (pc) (match_dup 3))
12673 (use (label_ref (match_operand 1 "" "")))])]
12676 { operands[0] = force_reg (DImode, operands[0]);
12677 operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (VOIDmode, operands[1]));
12678 operands[3] = gen_reg_rtx (DImode);
12683 (match_operand:SI 0 "register_operand" "c,l"))
12684 (use (label_ref (match_operand 1 "" "")))]
12689 [(set_attr "type" "jmpreg")])
12693 (match_operand:DI 0 "register_operand" "c,l"))
12694 (use (label_ref (match_operand 1 "" "")))]
12699 [(set_attr "type" "jmpreg")])
12704 "{cror 0,0,0|nop}")
12706 ;; Define the subtract-one-and-jump insns, starting with the template
12707 ;; so loop.c knows what to generate.
12709 (define_expand "decrement_and_branch_on_count"
12710 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "")
12712 (label_ref (match_operand 1 "" ""))
12715 (plus:SI (match_dup 0)
12717 (clobber (match_scratch:CC 2 ""))
12718 (clobber (match_scratch:SI 3 ""))])]
12722 ;; We need to be able to do this for any operand, including MEM, or we
12723 ;; will cause reload to blow up since we don't allow output reloads on
12725 ;; In order that the length attribute is calculated correctly, the
12726 ;; label MUST be operand 0.
12730 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
12732 (label_ref (match_operand 0 "" ""))
12734 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
12735 (plus:SI (match_dup 1)
12737 (clobber (match_scratch:CC 3 "=X,&x,&x"))
12738 (clobber (match_scratch:SI 4 "=X,X,r"))]
12742 if (which_alternative != 0)
12744 else if (get_attr_length (insn) == 8)
12745 return \"{bdn|bdnz} %l0\";
12747 return \"bdz %$+8\;b %l0\";
12749 [(set_attr "type" "branch")
12750 (set_attr "length" "*,12,16")])
12754 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
12757 (label_ref (match_operand 0 "" ""))))
12758 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
12759 (plus:SI (match_dup 1)
12761 (clobber (match_scratch:CC 3 "=X,&x,&x"))
12762 (clobber (match_scratch:SI 4 "=X,X,r"))]
12766 if (which_alternative != 0)
12768 else if (get_attr_length (insn) == 8)
12769 return \"bdz %l0\";
12771 return \"{bdn|bdnz} %$+8\;b %l0\";
12773 [(set_attr "type" "branch")
12774 (set_attr "length" "*,12,16")])
12776 ;; Similar, but we can use GE since we have a REG_NONNEG.
12779 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
12781 (label_ref (match_operand 0 "" ""))
12783 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
12784 (plus:SI (match_dup 1)
12786 (clobber (match_scratch:CC 3 "=X,&x,&X"))
12787 (clobber (match_scratch:SI 4 "=X,X,r"))]
12788 "find_reg_note (insn, REG_NONNEG, 0)"
12791 if (which_alternative != 0)
12793 else if (get_attr_length (insn) == 8)
12794 return \"{bdn|bdnz} %l0\";
12796 return \"bdz %$+8\;b %l0\";
12798 [(set_attr "type" "branch")
12799 (set_attr "length" "*,12,16")])
12803 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
12806 (label_ref (match_operand 0 "" ""))))
12807 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
12808 (plus:SI (match_dup 1)
12810 (clobber (match_scratch:CC 3 "=X,&x,&X"))
12811 (clobber (match_scratch:SI 4 "=X,X,r"))]
12812 "find_reg_note (insn, REG_NONNEG, 0)"
12815 if (which_alternative != 0)
12817 else if (get_attr_length (insn) == 8)
12818 return \"bdz %l0\";
12820 return \"{bdn|bdnz} %$+8\;b %l0\";
12822 [(set_attr "type" "branch")
12823 (set_attr "length" "*,12,16")])
12827 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
12829 (label_ref (match_operand 0 "" ""))
12831 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
12832 (plus:SI (match_dup 1)
12834 (clobber (match_scratch:CC 3 "=X,&x,&x"))
12835 (clobber (match_scratch:SI 4 "=X,X,r"))]
12839 if (which_alternative != 0)
12841 else if (get_attr_length (insn) == 8)
12842 return \"bdz %l0\";
12844 return \"{bdn|bdnz} %$+8\;b %l0\";
12846 [(set_attr "type" "branch")
12847 (set_attr "length" "*,12,16")])
12851 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
12854 (label_ref (match_operand 0 "" ""))))
12855 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
12856 (plus:SI (match_dup 1)
12858 (clobber (match_scratch:CC 3 "=X,&x,&x"))
12859 (clobber (match_scratch:SI 4 "=X,X,r"))]
12863 if (which_alternative != 0)
12865 else if (get_attr_length (insn) == 8)
12866 return \"{bdn|bdnz} %l0\";
12868 return \"bdz %$+8\;b %l0\";
12870 [(set_attr "type" "branch")
12871 (set_attr "length" "*,12,16")])
12875 (if_then_else (match_operator 2 "comparison_operator"
12876 [(match_operand:SI 1 "gpc_reg_operand" "")
12878 (match_operand 5 "" "")
12879 (match_operand 6 "" "")))
12880 (set (match_operand:SI 0 "gpc_reg_operand" "")
12881 (plus:SI (match_dup 1)
12883 (clobber (match_scratch:CC 3 ""))
12884 (clobber (match_scratch:SI 4 ""))]
12886 [(parallel [(set (match_dup 3)
12887 (compare:CC (plus:SI (match_dup 1)
12891 (plus:SI (match_dup 1)
12893 (set (pc) (if_then_else (match_dup 7)
12897 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
12902 (if_then_else (match_operator 2 "comparison_operator"
12903 [(match_operand:SI 1 "gpc_reg_operand" "")
12905 (match_operand 5 "" "")
12906 (match_operand 6 "" "")))
12907 (set (match_operand:SI 0 "general_operand" "")
12908 (plus:SI (match_dup 1) (const_int -1)))
12909 (clobber (match_scratch:CC 3 ""))
12910 (clobber (match_scratch:SI 4 ""))]
12911 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
12912 [(parallel [(set (match_dup 3)
12913 (compare:CC (plus:SI (match_dup 1)
12917 (plus:SI (match_dup 1)
12921 (set (pc) (if_then_else (match_dup 7)
12925 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
12928 (define_insn "trap"
12929 [(trap_if (const_int 1) (const_int 0))]
12933 (define_expand "conditional_trap"
12934 [(trap_if (match_operator 0 "trap_comparison_operator"
12935 [(match_dup 2) (match_dup 3)])
12936 (match_operand 1 "const_int_operand" ""))]
12938 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
12939 operands[2] = rs6000_compare_op0;
12940 operands[3] = rs6000_compare_op1;")
12943 [(trap_if (match_operator 0 "trap_comparison_operator"
12944 [(match_operand:SI 1 "register_operand" "r")
12945 (match_operand:SI 2 "reg_or_short_operand" "rI")])