1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GNU CC.
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; `unspec' values used in rs6000.md:
27 ;; 0 frsp for POWER machines
29 ;; 5 used to tie the stack contents and the stack pointer
30 ;; 6 address of a word pointing to the TOC
31 ;; 7 address of the TOC (more-or-less)
35 ;; 15 load_macho_picbase
36 ;; 16 macho_correct_pic
39 ;; 21 cntlz{w,d}2 count lead zero word/double word
41 ;; Define an insn type attribute. This is used in function unit delay
43 (define_attr "type" "integer,load,store,fpload,fpstore,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,branch,compare,cr_logical,delayed_compare,fpcompare,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,vecsimple,veccomplex,veccmp,vecperm,vecfloat"
44 (const_string "integer"))
47 ; '(pc)' in the following doesn't include the instruction itself; it is
48 ; calculated as if the instruction had zero size.
49 (define_attr "length" ""
50 (if_then_else (eq_attr "type" "branch")
51 (if_then_else (and (ge (minus (match_dup 0) (pc))
53 (lt (minus (match_dup 0) (pc))
59 ;; Processor type -- this attribute must exactly match the processor_type
60 ;; enumeration in rs6000.h.
62 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4"
63 (const (symbol_ref "rs6000_cpu_attr")))
65 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
66 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
68 ; Load/Store Unit -- pure PowerPC only
69 ; (POWER and 601 use Integer Unit)
70 (define_function_unit "lsu" 1 0
71 (and (eq_attr "type" "load")
72 (eq_attr "cpu" "rs64a,mpccore,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400"))
75 (define_function_unit "lsu" 1 0
76 (and (eq_attr "type" "load,vecload")
77 (eq_attr "cpu" "ppc7450"))
80 (define_function_unit "lsu" 1 0
81 (and (eq_attr "type" "store,fpstore")
82 (eq_attr "cpu" "rs64a,mpccore,ppc603,ppc604,ppc604e,ppc620,ppc630"))
85 (define_function_unit "lsu" 1 0
86 (and (eq_attr "type" "store,fpstore")
87 (eq_attr "cpu" "ppc750,ppc7400"))
90 (define_function_unit "lsu" 1 0
91 (and (eq_attr "type" "store,vecstore")
92 (eq_attr "cpu" "ppc7450"))
95 (define_function_unit "lsu" 1 0
96 (and (eq_attr "type" "fpstore")
97 (eq_attr "cpu" "ppc7450"))
100 (define_function_unit "lsu" 1 0
101 (and (eq_attr "type" "fpload")
102 (eq_attr "cpu" "mpccore,ppc603,ppc750,ppc7400"))
105 (define_function_unit "lsu" 1 0
106 (and (eq_attr "type" "fpload")
107 (eq_attr "cpu" "ppc7450"))
110 (define_function_unit "lsu" 1 0
111 (and (eq_attr "type" "fpload")
112 (eq_attr "cpu" "rs64a,ppc604,ppc604e,ppc620,ppc630"))
115 (define_function_unit "iu" 1 0
116 (and (eq_attr "type" "load")
117 (eq_attr "cpu" "rios1,ppc403,ppc405,ppc601"))
120 (define_function_unit "iu" 1 0
121 (and (eq_attr "type" "store,fpstore")
122 (eq_attr "cpu" "rios1,ppc403,ppc405,ppc601"))
125 (define_function_unit "fpu" 1 0
126 (and (eq_attr "type" "fpstore")
127 (eq_attr "cpu" "rios1,ppc601"))
130 (define_function_unit "iu" 1 0
131 (and (eq_attr "type" "fpload")
132 (eq_attr "cpu" "rios1"))
135 (define_function_unit "iu" 1 0
136 (and (eq_attr "type" "fpload")
137 (eq_attr "cpu" "ppc601"))
140 (define_function_unit "iu2" 2 0
141 (and (eq_attr "type" "load,fpload")
142 (eq_attr "cpu" "rios2"))
145 (define_function_unit "iu2" 2 0
146 (and (eq_attr "type" "store,fpstore")
147 (eq_attr "cpu" "rios2"))
150 ; Integer Unit (RIOS1, PPC601, PPC603, RS64a)
151 (define_function_unit "iu" 1 0
152 (and (eq_attr "type" "integer")
153 (eq_attr "cpu" "rios1,rs64a,mpccore,ppc403,ppc405,ppc601,ppc603"))
156 (define_function_unit "iu" 1 0
157 (and (eq_attr "type" "cr_logical")
158 (eq_attr "cpu" "mpccore,ppc403,ppc405,ppc601"))
161 (define_function_unit "iu" 1 0
162 (and (eq_attr "type" "imul,imul2,imul3")
163 (eq_attr "cpu" "ppc403"))
166 (define_function_unit "iu" 1 0
167 (and (eq_attr "type" "imul")
168 (eq_attr "cpu" "ppc405"))
171 (define_function_unit "iu" 1 0
172 (and (eq_attr "type" "imul2,imul3")
173 (eq_attr "cpu" "ppc405"))
176 (define_function_unit "iu" 1 0
177 (and (eq_attr "type" "imul")
178 (eq_attr "cpu" "rios1"))
181 (define_function_unit "iu" 1 0
182 (and (eq_attr "type" "imul2")
183 (eq_attr "cpu" "rios1"))
186 (define_function_unit "iu" 1 0
187 (and (eq_attr "type" "imul3")
188 (eq_attr "cpu" "rios1"))
191 (define_function_unit "iu" 1 0
192 (and (eq_attr "type" "imul,imul2,imul3")
193 (eq_attr "cpu" "ppc601,ppc603"))
196 (define_function_unit "iu" 1 0
197 (and (eq_attr "type" "imul")
198 (eq_attr "cpu" "rs64a"))
201 (define_function_unit "iu" 1 0
202 (and (eq_attr "type" "imul2")
203 (eq_attr "cpu" "rs64a"))
206 (define_function_unit "iu" 1 0
207 (and (eq_attr "type" "imul3")
208 (eq_attr "cpu" "rs64a"))
211 (define_function_unit "iu" 1 0
212 (and (eq_attr "type" "lmul")
213 (eq_attr "cpu" "rs64a"))
216 (define_function_unit "iu" 1 0
217 (and (eq_attr "type" "idiv")
218 (eq_attr "cpu" "rios1"))
221 (define_function_unit "iu" 1 0
222 (and (eq_attr "type" "idiv")
223 (eq_attr "cpu" "rs64a"))
226 (define_function_unit "iu" 1 0
227 (and (eq_attr "type" "ldiv")
228 (eq_attr "cpu" "rs64a"))
231 (define_function_unit "iu" 1 0
232 (and (eq_attr "type" "idiv")
233 (eq_attr "cpu" "ppc403"))
236 (define_function_unit "iu" 1 0
237 (and (eq_attr "type" "idiv")
238 (eq_attr "cpu" "ppc405"))
241 (define_function_unit "iu" 1 0
242 (and (eq_attr "type" "idiv")
243 (eq_attr "cpu" "ppc601"))
246 (define_function_unit "iu" 1 0
247 (and (eq_attr "type" "idiv")
248 (eq_attr "cpu" "ppc603"))
251 ; RIOS2 has two integer units: a primary one which can perform all
252 ; operations and a secondary one which is fed in lock step with the first
253 ; and can perform "simple" integer operations.
254 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
255 ; for the complex insns.
256 (define_function_unit "iu2" 2 0
257 (and (eq_attr "type" "integer")
258 (eq_attr "cpu" "rios2"))
261 (define_function_unit "iu2" 2 0
262 (and (eq_attr "type" "imul,imul2,imul3")
263 (eq_attr "cpu" "rios2"))
266 (define_function_unit "iu2" 2 0
267 (and (eq_attr "type" "idiv")
268 (eq_attr "cpu" "rios2"))
271 (define_function_unit "imuldiv" 1 0
272 (and (eq_attr "type" "imul,imul2,imul3")
273 (eq_attr "cpu" "rios2"))
276 (define_function_unit "imuldiv" 1 0
277 (and (eq_attr "type" "idiv")
278 (eq_attr "cpu" "rios2"))
281 ; MPCCORE has separate IMUL/IDIV unit for multicycle instructions
282 ; Divide latency varies greatly from 2-11, use 6 as average
283 (define_function_unit "imuldiv" 1 0
284 (and (eq_attr "type" "imul,imul2,imul3")
285 (eq_attr "cpu" "mpccore"))
288 (define_function_unit "imuldiv" 1 0
289 (and (eq_attr "type" "idiv")
290 (eq_attr "cpu" "mpccore"))
293 ; PPC604{,e} has two units that perform integer operations
294 ; and one unit for divide/multiply operations (and move
296 (define_function_unit "iu2" 2 0
297 (and (eq_attr "type" "integer")
298 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
301 (define_function_unit "imuldiv" 1 0
302 (and (eq_attr "type" "imul,imul2,imul3")
303 (eq_attr "cpu" "ppc604"))
306 (define_function_unit "imuldiv" 1 0
307 (and (eq_attr "type" "imul,imul2,imul3")
308 (eq_attr "cpu" "ppc604e"))
311 (define_function_unit "imuldiv" 1 0
312 (and (eq_attr "type" "imul")
313 (eq_attr "cpu" "ppc620,ppc630"))
316 (define_function_unit "imuldiv" 1 0
317 (and (eq_attr "type" "imul2")
318 (eq_attr "cpu" "ppc620,ppc630"))
321 (define_function_unit "imuldiv" 1 0
322 (and (eq_attr "type" "imul3")
323 (eq_attr "cpu" "ppc620,ppc630"))
326 (define_function_unit "imuldiv" 1 0
327 (and (eq_attr "type" "lmul")
328 (eq_attr "cpu" "ppc620,ppc630"))
331 (define_function_unit "imuldiv" 1 0
332 (and (eq_attr "type" "idiv")
333 (eq_attr "cpu" "ppc604,ppc604e"))
336 (define_function_unit "imuldiv" 1 0
337 (and (eq_attr "type" "idiv")
338 (eq_attr "cpu" "ppc620"))
341 (define_function_unit "imuldiv" 1 0
342 (and (eq_attr "type" "idiv")
343 (eq_attr "cpu" "ppc630"))
346 (define_function_unit "imuldiv" 1 0
347 (and (eq_attr "type" "ldiv")
348 (eq_attr "cpu" "ppc620,ppc630"))
351 ; PPC7450 has 3 integer units (for most integer insns) and one mul/div
352 ; unit, which also does CR-logical insns and move to/from SPR.
353 ; It also has 4 vector units, one for each type of vector instruction.
354 ; However, we can only dispatch 2 instructions per cycle.
355 ; We model this as saying that dispatching two of the same type of instruction
356 ; in a row incurs a single cycle delay.
357 (define_function_unit "iu3" 3 0
358 (and (eq_attr "type" "integer")
359 (eq_attr "cpu" "ppc7450"))
362 (define_function_unit "imuldiv" 1 0
363 (and (eq_attr "type" "imul")
364 (eq_attr "cpu" "ppc7450"))
367 (define_function_unit "imuldiv" 1 0
368 (and (eq_attr "type" "imul2,imul3")
369 (eq_attr "cpu" "ppc7450"))
372 (define_function_unit "imuldiv" 1 0
373 (and (eq_attr "type" "idiv")
374 (eq_attr "cpu" "ppc7450"))
377 (define_function_unit "imuldiv" 1 0
378 (and (eq_attr "type" "cr_logical")
379 (eq_attr "cpu" "ppc7450"))
382 (define_function_unit "vec_alu2" 2 0
383 (and (eq_attr "type" "vecsimple")
384 (eq_attr "cpu" "ppc7450"))
385 1 2 [(eq_attr "type" "vecsimple")])
387 (define_function_unit "vec_alu2" 2 0
388 (and (eq_attr "type" "vecsimple")
389 (eq_attr "cpu" "ppc7450"))
390 1 1 [(eq_attr "type" "!vecsimple")])
392 (define_function_unit "vec_alu2" 2 0
393 (and (eq_attr "type" "veccomplex")
394 (eq_attr "cpu" "ppc7450"))
395 4 2 [(eq_attr "type" "veccomplex")])
397 (define_function_unit "vec_alu2" 2 0
398 (and (eq_attr "type" "veccomplex")
399 (eq_attr "cpu" "ppc7450"))
400 4 1 [(eq_attr "type" "!veccomplex")])
402 (define_function_unit "vec_alu2" 2 0
403 (and (eq_attr "type" "veccmp")
404 (eq_attr "cpu" "ppc7450"))
405 2 2 [(eq_attr "type" "veccmp")])
407 (define_function_unit "vec_alu2" 2 0
408 (and (eq_attr "type" "veccmp")
409 (eq_attr "cpu" "ppc7450"))
410 2 1 [(eq_attr "type" "!veccmp")])
412 (define_function_unit "vec_alu2" 2 0
413 (and (eq_attr "type" "vecfloat")
414 (eq_attr "cpu" "ppc7450"))
415 4 2 [(eq_attr "type" "vecfloat")])
417 (define_function_unit "vec_alu2" 2 0
418 (and (eq_attr "type" "vecfloat")
419 (eq_attr "cpu" "ppc7450"))
420 4 1 [(eq_attr "type" "!vecfloat")])
422 (define_function_unit "vec_alu2" 2 0
423 (and (eq_attr "type" "vecperm")
424 (eq_attr "cpu" "ppc7450"))
425 2 2 [(eq_attr "type" "vecperm")])
427 (define_function_unit "vec_alu2" 2 0
428 (and (eq_attr "type" "vecperm")
429 (eq_attr "cpu" "ppc7450"))
430 2 1 [(eq_attr "type" "!vecperm")])
432 ; PPC750 has two integer units: a primary one which can perform all
433 ; operations and a secondary one which is fed in lock step with the first
434 ; and can perform "simple" integer operations.
435 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
436 ; for the complex insns.
437 (define_function_unit "iu2" 2 0
438 (and (eq_attr "type" "integer")
439 (eq_attr "cpu" "ppc750,ppc7400"))
442 (define_function_unit "iu2" 2 0
443 (and (eq_attr "type" "imul")
444 (eq_attr "cpu" "ppc750,ppc7400"))
447 (define_function_unit "iu2" 2 0
448 (and (eq_attr "type" "imul2")
449 (eq_attr "cpu" "ppc750,ppc7400"))
452 (define_function_unit "iu2" 2 0
453 (and (eq_attr "type" "imul3")
454 (eq_attr "cpu" "ppc750,ppc7400"))
457 (define_function_unit "iu2" 2 0
458 (and (eq_attr "type" "idiv")
459 (eq_attr "cpu" "ppc750,ppc7400"))
462 (define_function_unit "imuldiv" 1 0
463 (and (eq_attr "type" "imul")
464 (eq_attr "cpu" "ppc750,ppc7400"))
467 (define_function_unit "imuldiv" 1 0
468 (and (eq_attr "type" "imul2")
469 (eq_attr "cpu" "ppc750,ppc7400"))
472 (define_function_unit "imuldiv" 1 0
473 (and (eq_attr "type" "imul3")
474 (eq_attr "cpu" "ppc750,ppc7400"))
477 (define_function_unit "imuldiv" 1 0
478 (and (eq_attr "type" "idiv")
479 (eq_attr "cpu" "ppc750,ppc7400"))
482 ; CR-logical operations are execute-serialized, that is they don't
483 ; start (and block the function unit) until all preceding operations
484 ; have finished. They don't block dispatch of other insns, though.
485 ; I've imitated this by giving them longer latency.
486 (define_function_unit "sru" 1 0
487 (and (eq_attr "type" "cr_logical")
488 (eq_attr "cpu" "ppc603,ppc750,ppc7400"))
491 ; compare is done on integer unit, but feeds insns which
492 ; execute on the branch unit.
493 (define_function_unit "iu" 1 0
494 (and (eq_attr "type" "compare")
495 (eq_attr "cpu" "rios1"))
498 (define_function_unit "iu" 1 0
499 (and (eq_attr "type" "delayed_compare")
500 (eq_attr "cpu" "rios1"))
503 (define_function_unit "iu" 1 0
504 (and (eq_attr "type" "compare,delayed_compare")
505 (eq_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc601,ppc603"))
508 ; some extra cycles added by TARGET_SCHED_ADJUST_COST between compare
509 ; and a following branch, to reduce mispredicts
510 (define_function_unit "iu3" 3 0
511 (and (eq_attr "type" "compare,delayed_compare")
512 (eq_attr "cpu" "ppc7450"))
515 (define_function_unit "iu2" 2 0
516 (and (eq_attr "type" "compare,delayed_compare")
517 (eq_attr "cpu" "rios2"))
520 (define_function_unit "iu2" 2 0
521 (and (eq_attr "type" "compare,delayed_compare")
522 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400"))
525 ; fp compare uses fp unit
526 (define_function_unit "fpu" 1 0
527 (and (eq_attr "type" "fpcompare")
528 (eq_attr "cpu" "rios1"))
531 ; rios1 and rios2 have different fpcompare delays
532 (define_function_unit "fpu2" 2 0
533 (and (eq_attr "type" "fpcompare")
534 (eq_attr "cpu" "rios2,ppc630"))
537 ; on ppc601 and ppc603, fpcompare takes also 2 cycles from
539 ; here we do not define delays, just occupy the unit. The dependencies
540 ; will be assigned by the fpcompare definition in the fpu.
541 (define_function_unit "iu" 1 0
542 (and (eq_attr "type" "fpcompare")
543 (eq_attr "cpu" "ppc601,ppc603"))
546 ; fp compare uses fp unit
547 (define_function_unit "fpu" 1 0
548 (and (eq_attr "type" "fpcompare")
549 (eq_attr "cpu" "rs64a,ppc601,ppc603,ppc604,ppc604e,ppc620"))
552 (define_function_unit "fpu" 1 0
553 (and (eq_attr "type" "fpcompare")
554 (eq_attr "cpu" "ppc750,ppc7400,ppc7450"))
557 (define_function_unit "fpu" 1 0
558 (and (eq_attr "type" "fpcompare")
559 (eq_attr "cpu" "mpccore"))
562 (define_function_unit "bpu" 1 0
563 (and (eq_attr "type" "mtjmpr")
564 (eq_attr "cpu" "rios1,rios2,rs64a"))
567 (define_function_unit "bpu" 1 0
568 (and (eq_attr "type" "mtjmpr")
569 (eq_attr "cpu" "mpccore,ppc403,ppc405,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630"))
572 (define_function_unit "sru" 1 0
573 (and (eq_attr "type" "mtjmpr")
574 (eq_attr "cpu" "ppc750,ppc7400"))
577 (define_function_unit "imuldiv" 1 0
578 (and (eq_attr "type" "mtjmpr")
579 (eq_attr "cpu" "ppc7450"))
582 (define_function_unit "bpu" 1 0
583 (and (eq_attr "type" "cr_logical")
584 (eq_attr "cpu" "rios1,rios2,ppc604"))
587 (define_function_unit "cru" 1 0
588 (and (eq_attr "type" "cr_logical")
589 (eq_attr "cpu" "ppc604e,ppc620,ppc630,rs64a"))
592 ; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
593 (define_function_unit "bpu" 1 0
594 (eq_attr "type" "jmpreg")
597 (define_function_unit "bpu" 1 0
598 (eq_attr "type" "branch")
601 ; Floating Point Unit
602 (define_function_unit "fpu" 1 0
603 (and (eq_attr "type" "fp,dmul")
604 (eq_attr "cpu" "rios1"))
607 (define_function_unit "fpu" 1 0
608 (and (eq_attr "type" "fp")
609 (eq_attr "cpu" "rs64a,mpccore"))
612 (define_function_unit "fpu" 1 0
613 (and (eq_attr "type" "fp")
614 (eq_attr "cpu" "ppc601"))
617 (define_function_unit "fpu" 1 0
618 (and (eq_attr "type" "fp")
619 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620,ppc750,ppc7400"))
622 (define_function_unit "fpu" 1 0
623 (and (eq_attr "type" "fp,dmul")
624 (eq_attr "cpu" "ppc7450"))
627 (define_function_unit "fpu" 1 0
628 (and (eq_attr "type" "dmul")
629 (eq_attr "cpu" "rs64a"))
632 (define_function_unit "fpu" 1 0
633 (and (eq_attr "type" "dmul")
634 (eq_attr "cpu" "mpccore"))
637 (define_function_unit "fpu" 1 0
638 (and (eq_attr "type" "dmul")
639 (eq_attr "cpu" "ppc601"))
643 (define_function_unit "fpu" 1 0
644 (and (eq_attr "type" "dmul")
645 (eq_attr "cpu" "ppc603,ppc750"))
648 (define_function_unit "fpu" 1 0
649 (and (eq_attr "type" "dmul")
650 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc7400"))
653 (define_function_unit "fpu" 1 0
654 (and (eq_attr "type" "sdiv,ddiv")
655 (eq_attr "cpu" "rios1"))
658 (define_function_unit "fpu" 1 0
659 (and (eq_attr "type" "sdiv")
660 (eq_attr "cpu" "rs64a"))
663 (define_function_unit "fpu" 1 0
664 (and (eq_attr "type" "sdiv")
665 (eq_attr "cpu" "ppc601,ppc750,ppc7400"))
668 (define_function_unit "fpu" 1 0
669 (and (eq_attr "type" "sdiv")
670 (eq_attr "cpu" "ppc7450"))
673 (define_function_unit "fpu" 1 0
674 (and (eq_attr "type" "sdiv")
675 (eq_attr "cpu" "mpccore"))
678 (define_function_unit "fpu" 1 0
679 (and (eq_attr "type" "sdiv")
680 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620"))
683 (define_function_unit "fpu" 1 0
684 (and (eq_attr "type" "ddiv")
685 (eq_attr "cpu" "mpccore"))
688 (define_function_unit "fpu" 1 0
689 (and (eq_attr "type" "ddiv")
690 (eq_attr "cpu" "rs64a,ppc601,ppc750,ppc604,ppc604e,ppc620,ppc7400"))
693 (define_function_unit "fpu" 1 0
694 (and (eq_attr "type" "ddiv")
695 (eq_attr "cpu" "ppc7450"))
698 (define_function_unit "fpu" 1 0
699 (and (eq_attr "type" "ddiv")
700 (eq_attr "cpu" "ppc603"))
703 (define_function_unit "fpu" 1 0
704 (and (eq_attr "type" "ssqrt")
705 (eq_attr "cpu" "ppc620"))
708 (define_function_unit "fpu" 1 0
709 (and (eq_attr "type" "dsqrt")
710 (eq_attr "cpu" "ppc620"))
713 ; RIOS2 has two symmetric FPUs.
714 (define_function_unit "fpu2" 2 0
715 (and (eq_attr "type" "fp,dmul")
716 (eq_attr "cpu" "rios2"))
719 (define_function_unit "fpu2" 2 0
720 (and (eq_attr "type" "fp,dmul")
721 (eq_attr "cpu" "ppc630"))
724 (define_function_unit "fpu2" 2 0
725 (and (eq_attr "type" "sdiv,ddiv")
726 (eq_attr "cpu" "rios2"))
729 (define_function_unit "fpu2" 2 0
730 (and (eq_attr "type" "sdiv")
731 (eq_attr "cpu" "ppc630"))
734 (define_function_unit "fpu2" 2 0
735 (and (eq_attr "type" "ddiv")
736 (eq_attr "cpu" "ppc630"))
739 (define_function_unit "fpu2" 2 0
740 (and (eq_attr "type" "ssqrt,dsqrt")
741 (eq_attr "cpu" "rios2"))
744 (define_function_unit "fpu2" 2 0
745 (and (eq_attr "type" "ssqrt")
746 (eq_attr "cpu" "ppc630"))
749 (define_function_unit "fpu2" 2 0
750 (and (eq_attr "type" "dsqrt")
751 (eq_attr "cpu" "ppc630"))
755 (define_function_unit "lsu2" 2 0
756 (and (eq_attr "type" "load")
757 (eq_attr "cpu" "power4"))
760 (define_function_unit "lsu2" 2 0
761 (and (eq_attr "type" "fpload")
762 (eq_attr "cpu" "power4"))
765 (define_function_unit "lsu2" 2 0
766 (and (eq_attr "type" "store,fpstore")
767 (eq_attr "cpu" "power4"))
770 (define_function_unit "iu2" 2 0
771 (and (eq_attr "type" "integer")
772 (eq_attr "cpu" "power4"))
775 (define_function_unit "iu2" 2 0
776 (and (eq_attr "type" "imul,lmul")
777 (eq_attr "cpu" "power4"))
780 (define_function_unit "iu2" 2 0
781 (and (eq_attr "type" "imul2")
782 (eq_attr "cpu" "power4"))
785 (define_function_unit "iu2" 2 0
786 (and (eq_attr "type" "imul3")
787 (eq_attr "cpu" "power4"))
790 (define_function_unit "iu2" 2 0
791 (and (eq_attr "type" "idiv")
792 (eq_attr "cpu" "power4"))
795 (define_function_unit "iu2" 2 0
796 (and (eq_attr "type" "ldiv")
797 (eq_attr "cpu" "power4"))
800 (define_function_unit "imuldiv" 1 0
801 (and (eq_attr "type" "idiv")
802 (eq_attr "cpu" "power4"))
805 (define_function_unit "imuldiv" 1 0
806 (and (eq_attr "type" "ldiv")
807 (eq_attr "cpu" "power4"))
810 (define_function_unit "iu2" 2 0
811 (and (eq_attr "type" "compare")
812 (eq_attr "cpu" "power4"))
815 (define_function_unit "iu2" 2 0
816 (and (eq_attr "type" "delayed_compare")
817 (eq_attr "cpu" "power4"))
820 (define_function_unit "bpu" 1 0
821 (and (eq_attr "type" "mtjmpr")
822 (eq_attr "cpu" "power4"))
825 (define_function_unit "bpu" 1 0
826 (and (eq_attr "type" "jmpreg,branch")
827 (eq_attr "cpu" "power4"))
830 (define_function_unit "cru" 1 0
831 (and (eq_attr "type" "cr_logical")
832 (eq_attr "cpu" "power4"))
835 (define_function_unit "fpu2" 2 0
836 (and (eq_attr "type" "fp,dmul")
837 (eq_attr "cpu" "power4"))
840 ; adjust_cost increases the cost of dependent branches,
841 ; so shave a few cycles off for fpcompare.
842 (define_function_unit "fpu2" 2 0
843 (and (eq_attr "type" "fpcompare")
844 (eq_attr "cpu" "power4"))
847 (define_function_unit "fpu2" 2 0
848 (and (eq_attr "type" "sdiv,ddiv")
849 (eq_attr "cpu" "power4"))
852 (define_function_unit "fpu2" 2 0
853 (and (eq_attr "type" "ssqrt,dsqrt")
854 (eq_attr "cpu" "power4"))
858 ;; Start with fixed-point load and store insns. Here we put only the more
859 ;; complex forms. Basic data transfer is done later.
861 (define_expand "zero_extendqidi2"
862 [(set (match_operand:DI 0 "gpc_reg_operand" "")
863 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
868 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
869 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
874 [(set_attr "type" "load,*")])
877 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
878 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
880 (clobber (match_scratch:DI 2 "=r,r"))]
885 [(set_attr "type" "compare")
886 (set_attr "length" "4,8")])
889 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
890 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
892 (clobber (match_scratch:DI 2 ""))]
893 "TARGET_POWERPC64 && reload_completed"
895 (zero_extend:DI (match_dup 1)))
897 (compare:CC (match_dup 2)
902 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
903 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
905 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
906 (zero_extend:DI (match_dup 1)))]
911 [(set_attr "type" "compare")
912 (set_attr "length" "4,8")])
915 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
916 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
918 (set (match_operand:DI 0 "gpc_reg_operand" "")
919 (zero_extend:DI (match_dup 1)))]
920 "TARGET_POWERPC64 && reload_completed"
922 (zero_extend:DI (match_dup 1)))
924 (compare:CC (match_dup 0)
928 (define_insn "extendqidi2"
929 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
930 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
935 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
936 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
938 (clobber (match_scratch:DI 2 "=r,r"))]
943 [(set_attr "type" "compare")
944 (set_attr "length" "4,8")])
947 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
948 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
950 (clobber (match_scratch:DI 2 ""))]
951 "TARGET_POWERPC64 && reload_completed"
953 (sign_extend:DI (match_dup 1)))
955 (compare:CC (match_dup 2)
960 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
961 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
963 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
964 (sign_extend:DI (match_dup 1)))]
969 [(set_attr "type" "compare")
970 (set_attr "length" "4,8")])
973 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
974 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
976 (set (match_operand:DI 0 "gpc_reg_operand" "")
977 (sign_extend:DI (match_dup 1)))]
978 "TARGET_POWERPC64 && reload_completed"
980 (sign_extend:DI (match_dup 1)))
982 (compare:CC (match_dup 0)
986 (define_expand "zero_extendhidi2"
987 [(set (match_operand:DI 0 "gpc_reg_operand" "")
988 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
993 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
994 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
999 [(set_attr "type" "load,*")])
1002 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1003 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1005 (clobber (match_scratch:DI 2 "=r,r"))]
1010 [(set_attr "type" "compare")
1011 (set_attr "length" "4,8")])
1014 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1015 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1017 (clobber (match_scratch:DI 2 ""))]
1018 "TARGET_POWERPC64 && reload_completed"
1020 (zero_extend:DI (match_dup 1)))
1022 (compare:CC (match_dup 2)
1027 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1028 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1030 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1031 (zero_extend:DI (match_dup 1)))]
1036 [(set_attr "type" "compare")
1037 (set_attr "length" "4,8")])
1040 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1041 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1043 (set (match_operand:DI 0 "gpc_reg_operand" "")
1044 (zero_extend:DI (match_dup 1)))]
1045 "TARGET_POWERPC64 && reload_completed"
1047 (zero_extend:DI (match_dup 1)))
1049 (compare:CC (match_dup 0)
1053 (define_expand "extendhidi2"
1054 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1055 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
1060 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1061 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1066 [(set_attr "type" "load,*")])
1069 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1070 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1072 (clobber (match_scratch:DI 2 "=r,r"))]
1077 [(set_attr "type" "compare")
1078 (set_attr "length" "4,8")])
1081 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1082 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1084 (clobber (match_scratch:DI 2 ""))]
1085 "TARGET_POWERPC64 && reload_completed"
1087 (sign_extend:DI (match_dup 1)))
1089 (compare:CC (match_dup 2)
1094 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1095 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1097 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1098 (sign_extend:DI (match_dup 1)))]
1103 [(set_attr "type" "compare")
1104 (set_attr "length" "4,8")])
1107 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1108 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1110 (set (match_operand:DI 0 "gpc_reg_operand" "")
1111 (sign_extend:DI (match_dup 1)))]
1112 "TARGET_POWERPC64 && reload_completed"
1114 (sign_extend:DI (match_dup 1)))
1116 (compare:CC (match_dup 0)
1120 (define_expand "zero_extendsidi2"
1121 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1122 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
1127 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1128 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
1133 [(set_attr "type" "load,*")])
1136 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1137 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1139 (clobber (match_scratch:DI 2 "=r,r"))]
1144 [(set_attr "type" "compare")
1145 (set_attr "length" "4,8")])
1148 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1149 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1151 (clobber (match_scratch:DI 2 ""))]
1152 "TARGET_POWERPC64 && reload_completed"
1154 (zero_extend:DI (match_dup 1)))
1156 (compare:CC (match_dup 2)
1161 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1162 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1164 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1165 (zero_extend:DI (match_dup 1)))]
1170 [(set_attr "type" "compare")
1171 (set_attr "length" "4,8")])
1174 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1175 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1177 (set (match_operand:DI 0 "gpc_reg_operand" "")
1178 (zero_extend:DI (match_dup 1)))]
1179 "TARGET_POWERPC64 && reload_completed"
1181 (zero_extend:DI (match_dup 1)))
1183 (compare:CC (match_dup 0)
1187 (define_expand "extendsidi2"
1188 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1189 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
1194 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1195 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
1200 [(set_attr "type" "load,*")])
1203 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1204 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1206 (clobber (match_scratch:DI 2 "=r,r"))]
1211 [(set_attr "type" "compare")
1212 (set_attr "length" "4,8")])
1215 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1216 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1218 (clobber (match_scratch:DI 2 ""))]
1219 "TARGET_POWERPC64 && reload_completed"
1221 (sign_extend:DI (match_dup 1)))
1223 (compare:CC (match_dup 2)
1228 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1229 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1231 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1232 (sign_extend:DI (match_dup 1)))]
1237 [(set_attr "type" "compare")
1238 (set_attr "length" "4,8")])
1241 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1242 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1244 (set (match_operand:DI 0 "gpc_reg_operand" "")
1245 (sign_extend:DI (match_dup 1)))]
1246 "TARGET_POWERPC64 && reload_completed"
1248 (sign_extend:DI (match_dup 1)))
1250 (compare:CC (match_dup 0)
1254 (define_expand "zero_extendqisi2"
1255 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1256 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
1261 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1262 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
1266 {rlinm|rlwinm} %0,%1,0,0xff"
1267 [(set_attr "type" "load,*")])
1270 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1271 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1273 (clobber (match_scratch:SI 2 "=r,r"))]
1276 {andil.|andi.} %2,%1,0xff
1278 [(set_attr "type" "compare")
1279 (set_attr "length" "4,8")])
1282 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1283 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1285 (clobber (match_scratch:SI 2 ""))]
1288 (zero_extend:SI (match_dup 1)))
1290 (compare:CC (match_dup 2)
1295 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1296 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1298 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1299 (zero_extend:SI (match_dup 1)))]
1302 {andil.|andi.} %0,%1,0xff
1304 [(set_attr "type" "compare")
1305 (set_attr "length" "4,8")])
1308 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1309 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1311 (set (match_operand:SI 0 "gpc_reg_operand" "")
1312 (zero_extend:SI (match_dup 1)))]
1315 (zero_extend:SI (match_dup 1)))
1317 (compare:CC (match_dup 0)
1321 (define_expand "extendqisi2"
1322 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1323 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
1328 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
1329 else if (TARGET_POWER)
1330 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
1332 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
1336 (define_insn "extendqisi2_ppc"
1337 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1338 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1343 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1344 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1346 (clobber (match_scratch:SI 2 "=r,r"))]
1351 [(set_attr "type" "compare")
1352 (set_attr "length" "4,8")])
1355 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1356 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1358 (clobber (match_scratch:SI 2 ""))]
1359 "TARGET_POWERPC && reload_completed"
1361 (sign_extend:SI (match_dup 1)))
1363 (compare:CC (match_dup 2)
1368 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1369 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1371 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1372 (sign_extend:SI (match_dup 1)))]
1377 [(set_attr "type" "compare")
1378 (set_attr "length" "4,8")])
1381 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1382 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1384 (set (match_operand:SI 0 "gpc_reg_operand" "")
1385 (sign_extend:SI (match_dup 1)))]
1386 "TARGET_POWERPC && reload_completed"
1388 (sign_extend:SI (match_dup 1)))
1390 (compare:CC (match_dup 0)
1394 (define_expand "extendqisi2_power"
1395 [(parallel [(set (match_dup 2)
1396 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1398 (clobber (scratch:SI))])
1399 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1400 (ashiftrt:SI (match_dup 2)
1402 (clobber (scratch:SI))])]
1405 { operands[1] = gen_lowpart (SImode, operands[1]);
1406 operands[2] = gen_reg_rtx (SImode); }")
1408 (define_expand "extendqisi2_no_power"
1410 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1412 (set (match_operand:SI 0 "gpc_reg_operand" "")
1413 (ashiftrt:SI (match_dup 2)
1415 "! TARGET_POWER && ! TARGET_POWERPC"
1417 { operands[1] = gen_lowpart (SImode, operands[1]);
1418 operands[2] = gen_reg_rtx (SImode); }")
1420 (define_expand "zero_extendqihi2"
1421 [(set (match_operand:HI 0 "gpc_reg_operand" "")
1422 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
1427 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1428 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
1432 {rlinm|rlwinm} %0,%1,0,0xff"
1433 [(set_attr "type" "load,*")])
1436 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1437 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1439 (clobber (match_scratch:HI 2 "=r,r"))]
1442 {andil.|andi.} %2,%1,0xff
1444 [(set_attr "type" "compare")
1445 (set_attr "length" "4,8")])
1448 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1449 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1451 (clobber (match_scratch:HI 2 ""))]
1454 (zero_extend:HI (match_dup 1)))
1456 (compare:CC (match_dup 2)
1461 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1462 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1464 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1465 (zero_extend:HI (match_dup 1)))]
1468 {andil.|andi.} %0,%1,0xff
1470 [(set_attr "type" "compare")
1471 (set_attr "length" "4,8")])
1474 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1475 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1477 (set (match_operand:HI 0 "gpc_reg_operand" "")
1478 (zero_extend:HI (match_dup 1)))]
1481 (zero_extend:HI (match_dup 1)))
1483 (compare:CC (match_dup 0)
1487 (define_expand "extendqihi2"
1488 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
1489 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
1494 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
1495 else if (TARGET_POWER)
1496 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
1498 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
1502 (define_insn "extendqihi2_ppc"
1503 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1504 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1509 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1510 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1512 (clobber (match_scratch:HI 2 "=r,r"))]
1517 [(set_attr "type" "compare")
1518 (set_attr "length" "4,8")])
1521 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1522 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1524 (clobber (match_scratch:HI 2 ""))]
1525 "TARGET_POWERPC && reload_completed"
1527 (sign_extend:HI (match_dup 1)))
1529 (compare:CC (match_dup 2)
1534 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1535 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1537 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1538 (sign_extend:HI (match_dup 1)))]
1543 [(set_attr "type" "compare")
1544 (set_attr "length" "4,8")])
1547 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1548 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1550 (set (match_operand:HI 0 "gpc_reg_operand" "")
1551 (sign_extend:HI (match_dup 1)))]
1552 "TARGET_POWERPC && reload_completed"
1554 (sign_extend:HI (match_dup 1)))
1556 (compare:CC (match_dup 0)
1560 (define_expand "extendqihi2_power"
1561 [(parallel [(set (match_dup 2)
1562 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1564 (clobber (scratch:SI))])
1565 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
1566 (ashiftrt:SI (match_dup 2)
1568 (clobber (scratch:SI))])]
1571 { operands[0] = gen_lowpart (SImode, operands[0]);
1572 operands[1] = gen_lowpart (SImode, operands[1]);
1573 operands[2] = gen_reg_rtx (SImode); }")
1575 (define_expand "extendqihi2_no_power"
1577 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1579 (set (match_operand:HI 0 "gpc_reg_operand" "")
1580 (ashiftrt:SI (match_dup 2)
1582 "! TARGET_POWER && ! TARGET_POWERPC"
1584 { operands[0] = gen_lowpart (SImode, operands[0]);
1585 operands[1] = gen_lowpart (SImode, operands[1]);
1586 operands[2] = gen_reg_rtx (SImode); }")
1588 (define_expand "zero_extendhisi2"
1589 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1590 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1596 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1600 {rlinm|rlwinm} %0,%1,0,0xffff"
1601 [(set_attr "type" "load,*")])
1604 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1605 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1607 (clobber (match_scratch:SI 2 "=r,r"))]
1610 {andil.|andi.} %2,%1,0xffff
1612 [(set_attr "type" "compare")
1613 (set_attr "length" "4,8")])
1616 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1617 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1619 (clobber (match_scratch:SI 2 ""))]
1622 (zero_extend:SI (match_dup 1)))
1624 (compare:CC (match_dup 2)
1629 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1630 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1632 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1633 (zero_extend:SI (match_dup 1)))]
1636 {andil.|andi.} %0,%1,0xffff
1638 [(set_attr "type" "compare")
1639 (set_attr "length" "4,8")])
1642 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1643 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1645 (set (match_operand:SI 0 "gpc_reg_operand" "")
1646 (zero_extend:SI (match_dup 1)))]
1649 (zero_extend:SI (match_dup 1)))
1651 (compare:CC (match_dup 0)
1655 (define_expand "extendhisi2"
1656 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1657 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1662 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1663 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1668 [(set_attr "type" "load,*")])
1671 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1672 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1674 (clobber (match_scratch:SI 2 "=r,r"))]
1677 {exts.|extsh.} %2,%1
1679 [(set_attr "type" "compare")
1680 (set_attr "length" "4,8")])
1683 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1684 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1686 (clobber (match_scratch:SI 2 ""))]
1689 (sign_extend:SI (match_dup 1)))
1691 (compare:CC (match_dup 2)
1696 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1697 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1699 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1700 (sign_extend:SI (match_dup 1)))]
1703 {exts.|extsh.} %0,%1
1705 [(set_attr "type" "compare")
1706 (set_attr "length" "4,8")])
1709 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1710 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1712 (set (match_operand:SI 0 "gpc_reg_operand" "")
1713 (sign_extend:SI (match_dup 1)))]
1716 (sign_extend:SI (match_dup 1)))
1718 (compare:CC (match_dup 0)
1722 ;; Fixed-point arithmetic insns.
1724 ;; Discourage ai/addic because of carry but provide it in an alternative
1725 ;; allowing register zero as source.
1726 (define_expand "addsi3"
1727 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1728 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1729 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1733 if (GET_CODE (operands[2]) == CONST_INT
1734 && ! add_operand (operands[2], SImode))
1736 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1737 ? operands[0] : gen_reg_rtx (SImode));
1739 HOST_WIDE_INT val = INTVAL (operands[2]);
1740 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1741 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1743 /* The ordering here is important for the prolog expander.
1744 When space is allocated from the stack, adding 'low' first may
1745 produce a temporary deallocation (which would be bad). */
1746 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
1747 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1752 (define_insn "*addsi3_internal1"
1753 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1754 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1755 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1759 {cal %0,%2(%1)|addi %0,%1,%2}
1761 {cau|addis} %0,%1,%v2"
1762 [(set_attr "length" "4,4,4,4")])
1764 (define_insn "addsi3_high"
1765 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1766 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1767 (high:SI (match_operand 2 "" ""))))]
1768 "TARGET_MACHO && !TARGET_64BIT"
1769 "{cau|addis} %0,%1,ha16(%2)"
1770 [(set_attr "length" "4")])
1772 (define_insn "*addsi3_internal2"
1773 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1774 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1775 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1777 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1778 "! TARGET_POWERPC64"
1780 {cax.|add.} %3,%1,%2
1781 {ai.|addic.} %3,%1,%2
1784 [(set_attr "type" "compare")
1785 (set_attr "length" "4,4,8,8")])
1788 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1789 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1790 (match_operand:SI 2 "reg_or_short_operand" ""))
1792 (clobber (match_scratch:SI 3 ""))]
1793 "! TARGET_POWERPC64 && reload_completed"
1795 (plus:SI (match_dup 1)
1798 (compare:CC (match_dup 3)
1802 (define_insn "*addsi3_internal3"
1803 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1804 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1805 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1807 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1808 (plus:SI (match_dup 1)
1810 "! TARGET_POWERPC64"
1812 {cax.|add.} %0,%1,%2
1813 {ai.|addic.} %0,%1,%2
1816 [(set_attr "type" "compare")
1817 (set_attr "length" "4,4,8,8")])
1820 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1821 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1822 (match_operand:SI 2 "reg_or_short_operand" ""))
1824 (set (match_operand:SI 0 "gpc_reg_operand" "")
1825 (plus:SI (match_dup 1) (match_dup 2)))]
1826 "! TARGET_POWERPC64 && reload_completed"
1828 (plus:SI (match_dup 1)
1831 (compare:CC (match_dup 0)
1835 ;; Split an add that we can't do in one insn into two insns, each of which
1836 ;; does one 16-bit part. This is used by combine. Note that the low-order
1837 ;; add should be last in case the result gets used in an address.
1840 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1841 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1842 (match_operand:SI 2 "non_add_cint_operand" "")))]
1844 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1845 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1848 HOST_WIDE_INT val = INTVAL (operands[2]);
1849 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1850 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1852 operands[3] = GEN_INT (rest);
1853 operands[4] = GEN_INT (low);
1856 (define_insn "one_cmplsi2"
1857 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1858 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1863 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1864 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1866 (clobber (match_scratch:SI 2 "=r,r"))]
1867 "! TARGET_POWERPC64"
1871 [(set_attr "type" "compare")
1872 (set_attr "length" "4,8")])
1875 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1876 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1878 (clobber (match_scratch:SI 2 ""))]
1879 "! TARGET_POWERPC64 && reload_completed"
1881 (not:SI (match_dup 1)))
1883 (compare:CC (match_dup 2)
1888 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1889 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1891 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1892 (not:SI (match_dup 1)))]
1893 "! TARGET_POWERPC64"
1897 [(set_attr "type" "compare")
1898 (set_attr "length" "4,8")])
1901 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1902 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1904 (set (match_operand:SI 0 "gpc_reg_operand" "")
1905 (not:SI (match_dup 1)))]
1906 "! TARGET_POWERPC64 && reload_completed"
1908 (not:SI (match_dup 1)))
1910 (compare:CC (match_dup 0)
1915 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1916 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1917 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1919 "{sf%I1|subf%I1c} %0,%2,%1")
1922 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1923 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1924 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1931 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1932 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1933 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1935 (clobber (match_scratch:SI 3 "=r,r"))]
1938 {sf.|subfc.} %3,%2,%1
1940 [(set_attr "type" "compare")
1941 (set_attr "length" "4,8")])
1944 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1945 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1946 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1948 (clobber (match_scratch:SI 3 "=r,r"))]
1949 "TARGET_POWERPC && ! TARGET_POWERPC64"
1953 [(set_attr "type" "compare")
1954 (set_attr "length" "4,8")])
1957 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1958 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1959 (match_operand:SI 2 "gpc_reg_operand" ""))
1961 (clobber (match_scratch:SI 3 ""))]
1962 "! TARGET_POWERPC64 && reload_completed"
1964 (minus:SI (match_dup 1)
1967 (compare:CC (match_dup 3)
1972 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1973 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1974 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1976 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1977 (minus:SI (match_dup 1) (match_dup 2)))]
1980 {sf.|subfc.} %0,%2,%1
1982 [(set_attr "type" "compare")
1983 (set_attr "length" "4,8")])
1986 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1987 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1988 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1990 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1991 (minus:SI (match_dup 1)
1993 "TARGET_POWERPC && ! TARGET_POWERPC64"
1997 [(set_attr "type" "compare")
1998 (set_attr "length" "4,8")])
2001 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2002 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
2003 (match_operand:SI 2 "gpc_reg_operand" ""))
2005 (set (match_operand:SI 0 "gpc_reg_operand" "")
2006 (minus:SI (match_dup 1)
2008 "! TARGET_POWERPC64 && reload_completed"
2010 (minus:SI (match_dup 1)
2013 (compare:CC (match_dup 0)
2017 (define_expand "subsi3"
2018 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2019 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
2020 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
2024 if (GET_CODE (operands[2]) == CONST_INT)
2026 emit_insn (gen_addsi3 (operands[0], operands[1],
2027 negate_rtx (SImode, operands[2])));
2032 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
2033 ;; instruction and some auxiliary computations. Then we just have a single
2034 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
2037 (define_expand "sminsi3"
2039 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2040 (match_operand:SI 2 "reg_or_short_operand" ""))
2042 (minus:SI (match_dup 2) (match_dup 1))))
2043 (set (match_operand:SI 0 "gpc_reg_operand" "")
2044 (minus:SI (match_dup 2) (match_dup 3)))]
2045 "TARGET_POWER || TARGET_ISEL"
2050 operands[2] = force_reg (SImode, operands[2]);
2051 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
2055 operands[3] = gen_reg_rtx (SImode);
2059 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2060 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
2061 (match_operand:SI 2 "reg_or_short_operand" "")))
2062 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
2065 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
2067 (minus:SI (match_dup 2) (match_dup 1))))
2068 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
2071 (define_expand "smaxsi3"
2073 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2074 (match_operand:SI 2 "reg_or_short_operand" ""))
2076 (minus:SI (match_dup 2) (match_dup 1))))
2077 (set (match_operand:SI 0 "gpc_reg_operand" "")
2078 (plus:SI (match_dup 3) (match_dup 1)))]
2079 "TARGET_POWER || TARGET_ISEL"
2084 operands[2] = force_reg (SImode, operands[2]);
2085 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
2088 operands[3] = gen_reg_rtx (SImode);
2092 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2093 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
2094 (match_operand:SI 2 "reg_or_short_operand" "")))
2095 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
2098 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
2100 (minus:SI (match_dup 2) (match_dup 1))))
2101 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
2104 (define_expand "uminsi3"
2105 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2107 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2109 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2111 (minus:SI (match_dup 4) (match_dup 3))))
2112 (set (match_operand:SI 0 "gpc_reg_operand" "")
2113 (minus:SI (match_dup 2) (match_dup 3)))]
2114 "TARGET_POWER || TARGET_ISEL"
2119 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
2122 operands[3] = gen_reg_rtx (SImode);
2123 operands[4] = gen_reg_rtx (SImode);
2124 operands[5] = GEN_INT (-2147483647 - 1);
2127 (define_expand "umaxsi3"
2128 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2130 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2132 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2134 (minus:SI (match_dup 4) (match_dup 3))))
2135 (set (match_operand:SI 0 "gpc_reg_operand" "")
2136 (plus:SI (match_dup 3) (match_dup 1)))]
2137 "TARGET_POWER || TARGET_ISEL"
2142 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
2145 operands[3] = gen_reg_rtx (SImode);
2146 operands[4] = gen_reg_rtx (SImode);
2147 operands[5] = GEN_INT (-2147483647 - 1);
2151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2152 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2153 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2155 (minus:SI (match_dup 2) (match_dup 1))))]
2160 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2162 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2163 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2165 (minus:SI (match_dup 2) (match_dup 1)))
2167 (clobber (match_scratch:SI 3 "=r,r"))]
2172 [(set_attr "type" "delayed_compare")
2173 (set_attr "length" "4,8")])
2176 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2178 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2179 (match_operand:SI 2 "reg_or_short_operand" ""))
2181 (minus:SI (match_dup 2) (match_dup 1)))
2183 (clobber (match_scratch:SI 3 ""))]
2184 "TARGET_POWER && reload_completed"
2186 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2188 (minus:SI (match_dup 2) (match_dup 1))))
2190 (compare:CC (match_dup 3)
2195 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2197 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2198 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2200 (minus:SI (match_dup 2) (match_dup 1)))
2202 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2203 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2205 (minus:SI (match_dup 2) (match_dup 1))))]
2210 [(set_attr "type" "delayed_compare")
2211 (set_attr "length" "4,8")])
2214 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2216 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2217 (match_operand:SI 2 "reg_or_short_operand" ""))
2219 (minus:SI (match_dup 2) (match_dup 1)))
2221 (set (match_operand:SI 0 "gpc_reg_operand" "")
2222 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2224 (minus:SI (match_dup 2) (match_dup 1))))]
2225 "TARGET_POWER && reload_completed"
2227 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2229 (minus:SI (match_dup 2) (match_dup 1))))
2231 (compare:CC (match_dup 0)
2235 ;; We don't need abs with condition code because such comparisons should
2237 (define_expand "abssi2"
2238 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2239 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2245 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2248 else if (! TARGET_POWER)
2250 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2255 (define_insn "*abssi2_power"
2256 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2257 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2261 (define_insn_and_split "abssi2_isel"
2262 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2263 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2264 (clobber (match_scratch:SI 2 "=b"))
2265 (clobber (match_scratch:CC 3 "=y"))]
2268 "&& reload_completed"
2269 [(set (match_dup 2) (neg:SI (match_dup 1)))
2271 (compare:CC (match_dup 1)
2274 (if_then_else:SI (ge (match_dup 3)
2280 (define_insn_and_split "abssi2_nopower"
2281 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2282 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2283 (clobber (match_scratch:SI 2 "=&r,&r"))]
2284 "! TARGET_POWER && ! TARGET_ISEL"
2286 "&& reload_completed"
2287 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2288 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2289 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2292 (define_insn "*nabs_power"
2293 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2294 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2298 (define_insn_and_split "*nabs_nopower"
2299 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2300 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2301 (clobber (match_scratch:SI 2 "=&r,&r"))]
2304 "&& reload_completed"
2305 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2306 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2307 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2310 (define_insn "negsi2"
2311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2312 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2317 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2318 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2320 (clobber (match_scratch:SI 2 "=r,r"))]
2321 "! TARGET_POWERPC64"
2325 [(set_attr "type" "compare")
2326 (set_attr "length" "4,8")])
2329 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2330 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2332 (clobber (match_scratch:SI 2 ""))]
2333 "! TARGET_POWERPC64 && reload_completed"
2335 (neg:SI (match_dup 1)))
2337 (compare:CC (match_dup 2)
2342 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2343 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2345 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2346 (neg:SI (match_dup 1)))]
2347 "! TARGET_POWERPC64"
2351 [(set_attr "type" "compare")
2352 (set_attr "length" "4,8")])
2355 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2356 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2358 (set (match_operand:SI 0 "gpc_reg_operand" "")
2359 (neg:SI (match_dup 1)))]
2360 "! TARGET_POWERPC64 && reload_completed"
2362 (neg:SI (match_dup 1)))
2364 (compare:CC (match_dup 0)
2368 (define_expand "ffssi2"
2370 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
2371 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
2373 (clobber (scratch:CC))])
2374 (set (match_dup 4) (unspec:SI [(match_dup 3)] 21))
2375 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2376 (minus:SI (const_int 32) (match_dup 4)))]
2379 operands[2] = gen_reg_rtx (SImode);
2380 operands[3] = gen_reg_rtx (SImode);
2381 operands[4] = gen_reg_rtx (SImode);
2384 (define_insn "cntlzw2"
2385 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2386 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "r")] 21))]
2388 "{cntlz|cntlzw} %0,%1")
2390 (define_expand "mulsi3"
2391 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2392 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2393 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2398 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2400 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2404 (define_insn "mulsi3_mq"
2405 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2406 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2407 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2408 (clobber (match_scratch:SI 3 "=q,q"))]
2411 {muls|mullw} %0,%1,%2
2412 {muli|mulli} %0,%1,%2"
2414 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2415 (const_string "imul3")
2416 (match_operand:SI 2 "short_cint_operand" "")
2417 (const_string "imul2")]
2418 (const_string "imul")))])
2420 (define_insn "mulsi3_no_mq"
2421 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2422 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2423 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2426 {muls|mullw} %0,%1,%2
2427 {muli|mulli} %0,%1,%2"
2429 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2430 (const_string "imul3")
2431 (match_operand:SI 2 "short_cint_operand" "")
2432 (const_string "imul2")]
2433 (const_string "imul")))])
2436 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2437 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2438 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2440 (clobber (match_scratch:SI 3 "=r,r"))
2441 (clobber (match_scratch:SI 4 "=q,q"))]
2444 {muls.|mullw.} %3,%1,%2
2446 [(set_attr "type" "delayed_compare")
2447 (set_attr "length" "4,8")])
2450 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2451 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2452 (match_operand:SI 2 "gpc_reg_operand" ""))
2454 (clobber (match_scratch:SI 3 ""))
2455 (clobber (match_scratch:SI 4 ""))]
2456 "TARGET_POWER && reload_completed"
2457 [(parallel [(set (match_dup 3)
2458 (mult:SI (match_dup 1) (match_dup 2)))
2459 (clobber (match_dup 4))])
2461 (compare:CC (match_dup 3)
2466 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2467 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2468 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2470 (clobber (match_scratch:SI 3 "=r,r"))]
2473 {muls.|mullw.} %3,%1,%2
2475 [(set_attr "type" "delayed_compare")
2476 (set_attr "length" "4,8")])
2479 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2480 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2481 (match_operand:SI 2 "gpc_reg_operand" ""))
2483 (clobber (match_scratch:SI 3 ""))]
2484 "! TARGET_POWER && reload_completed"
2486 (mult:SI (match_dup 1) (match_dup 2)))
2488 (compare:CC (match_dup 3)
2493 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2494 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2495 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2497 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2498 (mult:SI (match_dup 1) (match_dup 2)))
2499 (clobber (match_scratch:SI 4 "=q,q"))]
2502 {muls.|mullw.} %0,%1,%2
2504 [(set_attr "type" "delayed_compare")
2505 (set_attr "length" "4,8")])
2508 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2509 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2510 (match_operand:SI 2 "gpc_reg_operand" ""))
2512 (set (match_operand:SI 0 "gpc_reg_operand" "")
2513 (mult:SI (match_dup 1) (match_dup 2)))
2514 (clobber (match_scratch:SI 4 ""))]
2515 "TARGET_POWER && reload_completed"
2516 [(parallel [(set (match_dup 0)
2517 (mult:SI (match_dup 1) (match_dup 2)))
2518 (clobber (match_dup 4))])
2520 (compare:CC (match_dup 0)
2525 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2526 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2527 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2529 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2530 (mult:SI (match_dup 1) (match_dup 2)))]
2533 {muls.|mullw.} %0,%1,%2
2535 [(set_attr "type" "delayed_compare")
2536 (set_attr "length" "4,8")])
2539 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2540 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2541 (match_operand:SI 2 "gpc_reg_operand" ""))
2543 (set (match_operand:SI 0 "gpc_reg_operand" "")
2544 (mult:SI (match_dup 1) (match_dup 2)))]
2545 "! TARGET_POWER && reload_completed"
2547 (mult:SI (match_dup 1) (match_dup 2)))
2549 (compare:CC (match_dup 0)
2553 ;; Operand 1 is divided by operand 2; quotient goes to operand
2554 ;; 0 and remainder to operand 3.
2555 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2557 (define_expand "divmodsi4"
2558 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2559 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2560 (match_operand:SI 2 "gpc_reg_operand" "")))
2561 (set (match_operand:SI 3 "gpc_reg_operand" "")
2562 (mod:SI (match_dup 1) (match_dup 2)))])]
2563 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2566 if (! TARGET_POWER && ! TARGET_POWERPC)
2568 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2569 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2570 emit_insn (gen_divss_call ());
2571 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2572 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2579 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2580 (match_operand:SI 2 "gpc_reg_operand" "r")))
2581 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
2582 (mod:SI (match_dup 1) (match_dup 2)))]
2585 [(set_attr "type" "idiv")])
2587 (define_expand "udivsi3"
2588 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2589 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2590 (match_operand:SI 2 "gpc_reg_operand" "")))]
2591 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2594 if (! TARGET_POWER && ! TARGET_POWERPC)
2596 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2597 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2598 emit_insn (gen_quous_call ());
2599 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2602 else if (TARGET_POWER)
2604 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2609 (define_insn "udivsi3_mq"
2610 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2611 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2612 (match_operand:SI 2 "gpc_reg_operand" "r")))
2613 (clobber (match_scratch:SI 3 "=q"))]
2614 "TARGET_POWERPC && TARGET_POWER"
2616 [(set_attr "type" "idiv")])
2618 (define_insn "*udivsi3_no_mq"
2619 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2620 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2621 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2622 "TARGET_POWERPC && ! TARGET_POWER"
2624 [(set_attr "type" "idiv")])
2626 ;; For powers of two we can do srai/aze for divide and then adjust for
2627 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2628 ;; used; for PowerPC, force operands into register and do a normal divide;
2629 ;; for AIX common-mode, use quoss call on register operands.
2630 (define_expand "divsi3"
2631 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2632 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2633 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2637 if (GET_CODE (operands[2]) == CONST_INT
2638 && INTVAL (operands[2]) > 0
2639 && exact_log2 (INTVAL (operands[2])) >= 0)
2641 else if (TARGET_POWERPC)
2643 operands[2] = force_reg (SImode, operands[2]);
2646 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2650 else if (TARGET_POWER)
2654 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2655 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2656 emit_insn (gen_quoss_call ());
2657 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2662 (define_insn "divsi3_mq"
2663 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2664 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2665 (match_operand:SI 2 "gpc_reg_operand" "r")))
2666 (clobber (match_scratch:SI 3 "=q"))]
2667 "TARGET_POWERPC && TARGET_POWER"
2669 [(set_attr "type" "idiv")])
2671 (define_insn "*divsi3_no_mq"
2672 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2673 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2674 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2675 "TARGET_POWERPC && ! TARGET_POWER"
2677 [(set_attr "type" "idiv")])
2679 (define_expand "modsi3"
2680 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2681 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2682 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2690 if (GET_CODE (operands[2]) != CONST_INT
2691 || INTVAL (operands[2]) <= 0
2692 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2695 temp1 = gen_reg_rtx (SImode);
2696 temp2 = gen_reg_rtx (SImode);
2698 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
2699 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
2700 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
2705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2706 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2707 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
2709 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
2710 [(set_attr "length" "8")])
2713 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2714 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2715 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2717 (clobber (match_scratch:SI 3 "=r,r"))]
2720 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
2722 [(set_attr "type" "compare")
2723 (set_attr "length" "8,12")])
2726 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2727 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2728 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2730 (clobber (match_scratch:SI 3 ""))]
2733 (div:SI (match_dup 1) (match_dup 2)))
2735 (compare:CC (match_dup 3)
2740 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2741 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2742 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2744 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2745 (div:SI (match_dup 1) (match_dup 2)))]
2748 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2750 [(set_attr "type" "compare")
2751 (set_attr "length" "8,12")])
2754 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2755 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2756 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2758 (set (match_operand:SI 0 "gpc_reg_operand" "")
2759 (div:SI (match_dup 1) (match_dup 2)))]
2762 (div:SI (match_dup 1) (match_dup 2)))
2764 (compare:CC (match_dup 0)
2769 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2772 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2774 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2775 (match_operand:SI 3 "gpc_reg_operand" "r")))
2776 (set (match_operand:SI 2 "register_operand" "=*q")
2779 (zero_extend:DI (match_dup 1)) (const_int 32))
2780 (zero_extend:DI (match_dup 4)))
2784 [(set_attr "type" "idiv")])
2786 ;; To do unsigned divide we handle the cases of the divisor looking like a
2787 ;; negative number. If it is a constant that is less than 2**31, we don't
2788 ;; have to worry about the branches. So make a few subroutines here.
2790 ;; First comes the normal case.
2791 (define_expand "udivmodsi4_normal"
2792 [(set (match_dup 4) (const_int 0))
2793 (parallel [(set (match_operand:SI 0 "" "")
2794 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2796 (zero_extend:DI (match_operand:SI 1 "" "")))
2797 (match_operand:SI 2 "" "")))
2798 (set (match_operand:SI 3 "" "")
2799 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2801 (zero_extend:DI (match_dup 1)))
2805 { operands[4] = gen_reg_rtx (SImode); }")
2807 ;; This handles the branches.
2808 (define_expand "udivmodsi4_tests"
2809 [(set (match_operand:SI 0 "" "") (const_int 0))
2810 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2811 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2812 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2813 (label_ref (match_operand:SI 4 "" "")) (pc)))
2814 (set (match_dup 0) (const_int 1))
2815 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2816 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2817 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2818 (label_ref (match_dup 4)) (pc)))]
2821 { operands[5] = gen_reg_rtx (CCUNSmode);
2822 operands[6] = gen_reg_rtx (CCmode);
2825 (define_expand "udivmodsi4"
2826 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2827 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2828 (match_operand:SI 2 "reg_or_cint_operand" "")))
2829 (set (match_operand:SI 3 "gpc_reg_operand" "")
2830 (umod:SI (match_dup 1) (match_dup 2)))])]
2838 if (! TARGET_POWERPC)
2840 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2841 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2842 emit_insn (gen_divus_call ());
2843 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2844 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2851 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2853 operands[2] = force_reg (SImode, operands[2]);
2854 label = gen_label_rtx ();
2855 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2856 operands[3], label));
2859 operands[2] = force_reg (SImode, operands[2]);
2861 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2869 ;; AIX architecture-independent common-mode multiply (DImode),
2870 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2871 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2872 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2873 ;; assumed unused if generating common-mode, so ignore.
2874 (define_insn "mulh_call"
2877 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2878 (sign_extend:DI (reg:SI 4)))
2880 (clobber (match_scratch:SI 0 "=l"))]
2881 "! TARGET_POWER && ! TARGET_POWERPC"
2883 [(set_attr "type" "imul")])
2885 (define_insn "mull_call"
2887 (mult:DI (sign_extend:DI (reg:SI 3))
2888 (sign_extend:DI (reg:SI 4))))
2889 (clobber (match_scratch:SI 0 "=l"))
2890 (clobber (reg:SI 0))]
2891 "! TARGET_POWER && ! TARGET_POWERPC"
2893 [(set_attr "type" "imul")])
2895 (define_insn "divss_call"
2897 (div:SI (reg:SI 3) (reg:SI 4)))
2899 (mod:SI (reg:SI 3) (reg:SI 4)))
2900 (clobber (match_scratch:SI 0 "=l"))
2901 (clobber (reg:SI 0))]
2902 "! TARGET_POWER && ! TARGET_POWERPC"
2904 [(set_attr "type" "idiv")])
2906 (define_insn "divus_call"
2908 (udiv:SI (reg:SI 3) (reg:SI 4)))
2910 (umod:SI (reg:SI 3) (reg:SI 4)))
2911 (clobber (match_scratch:SI 0 "=l"))
2912 (clobber (reg:SI 0))
2913 (clobber (match_scratch:CC 1 "=x"))
2914 (clobber (reg:CC 69))]
2915 "! TARGET_POWER && ! TARGET_POWERPC"
2917 [(set_attr "type" "idiv")])
2919 (define_insn "quoss_call"
2921 (div:SI (reg:SI 3) (reg:SI 4)))
2922 (clobber (match_scratch:SI 0 "=l"))]
2923 "! TARGET_POWER && ! TARGET_POWERPC"
2925 [(set_attr "type" "idiv")])
2927 (define_insn "quous_call"
2929 (udiv:SI (reg:SI 3) (reg:SI 4)))
2930 (clobber (match_scratch:SI 0 "=l"))
2931 (clobber (reg:SI 0))
2932 (clobber (match_scratch:CC 1 "=x"))
2933 (clobber (reg:CC 69))]
2934 "! TARGET_POWER && ! TARGET_POWERPC"
2936 [(set_attr "type" "idiv")])
2938 ;; Logical instructions
2939 ;; The logical instructions are mostly combined by using match_operator,
2940 ;; but the plain AND insns are somewhat different because there is no
2941 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2942 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2944 (define_insn "andsi3"
2945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2946 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2947 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2948 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2952 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2953 {andil.|andi.} %0,%1,%b2
2954 {andiu.|andis.} %0,%1,%u2")
2956 ;; Note to set cr's other than cr0 we do the and immediate and then
2957 ;; the test again -- this avoids a mfcr which on the higher end
2958 ;; machines causes an execution serialization
2960 (define_insn "*andsi3_internal2"
2961 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2962 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2963 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2965 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2966 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2967 "! TARGET_POWERPC64"
2970 {andil.|andi.} %3,%1,%b2
2971 {andiu.|andis.} %3,%1,%u2
2972 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2977 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2978 (set_attr "length" "4,4,4,4,8,8,8,8")])
2980 (define_insn "*andsi3_internal3"
2981 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2982 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2983 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2985 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2986 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2990 {andil.|andi.} %3,%1,%b2
2991 {andiu.|andis.} %3,%1,%u2
2992 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2997 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2998 (set_attr "length" "8,4,4,4,8,8,8,8")])
3001 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3002 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3003 (match_operand:SI 2 "and_operand" ""))
3005 (clobber (match_scratch:SI 3 ""))
3006 (clobber (match_scratch:CC 4 ""))]
3008 [(parallel [(set (match_dup 3)
3009 (and:SI (match_dup 1)
3011 (clobber (match_dup 4))])
3013 (compare:CC (match_dup 3)
3017 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3018 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3021 [(set (match_operand:CC 0 "cc_reg_operand" "")
3022 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3023 (match_operand:SI 2 "gpc_reg_operand" ""))
3025 (clobber (match_scratch:SI 3 ""))
3026 (clobber (match_scratch:CC 4 ""))]
3027 "TARGET_POWERPC64 && reload_completed"
3028 [(parallel [(set (match_dup 3)
3029 (and:SI (match_dup 1)
3031 (clobber (match_dup 4))])
3033 (compare:CC (match_dup 3)
3037 (define_insn "*andsi3_internal4"
3038 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3039 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3040 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3042 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3043 (and:SI (match_dup 1)
3045 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3046 "! TARGET_POWERPC64"
3049 {andil.|andi.} %0,%1,%b2
3050 {andiu.|andis.} %0,%1,%u2
3051 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3056 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
3057 (set_attr "length" "4,4,4,4,8,8,8,8")])
3059 (define_insn "*andsi3_internal5"
3060 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3061 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3062 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3064 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3065 (and:SI (match_dup 1)
3067 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3071 {andil.|andi.} %0,%1,%b2
3072 {andiu.|andis.} %0,%1,%u2
3073 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3078 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
3079 (set_attr "length" "8,4,4,4,8,8,8,8")])
3082 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3083 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3084 (match_operand:SI 2 "and_operand" ""))
3086 (set (match_operand:SI 0 "gpc_reg_operand" "")
3087 (and:SI (match_dup 1)
3089 (clobber (match_scratch:CC 4 ""))]
3091 [(parallel [(set (match_dup 0)
3092 (and:SI (match_dup 1)
3094 (clobber (match_dup 4))])
3096 (compare:CC (match_dup 0)
3101 [(set (match_operand:CC 3 "cc_reg_operand" "")
3102 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3103 (match_operand:SI 2 "gpc_reg_operand" ""))
3105 (set (match_operand:SI 0 "gpc_reg_operand" "")
3106 (and:SI (match_dup 1)
3108 (clobber (match_scratch:CC 4 ""))]
3109 "TARGET_POWERPC64 && reload_completed"
3110 [(parallel [(set (match_dup 0)
3111 (and:SI (match_dup 1)
3113 (clobber (match_dup 4))])
3115 (compare:CC (match_dup 0)
3119 ;; Handle the PowerPC64 rlwinm corner case
3121 (define_insn_and_split "*andsi3_internal6"
3122 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3123 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3124 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3129 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3132 (rotate:SI (match_dup 0) (match_dup 5)))]
3135 int mb = extract_MB (operands[2]);
3136 int me = extract_ME (operands[2]);
3137 operands[3] = GEN_INT (me + 1);
3138 operands[5] = GEN_INT (32 - (me + 1));
3139 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3141 [(set_attr "length" "8")])
3143 (define_insn_and_split "*andsi3_internal7"
3144 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
3145 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
3146 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
3148 (clobber (match_scratch:SI 3 "=r,r"))]
3152 [(parallel [(set (match_dup 2)
3153 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
3156 (clobber (match_dup 3))])]
3159 int mb = extract_MB (operands[1]);
3160 int me = extract_ME (operands[1]);
3161 operands[4] = GEN_INT (me + 1);
3162 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3164 [(set_attr "type" "delayed_compare,compare")
3165 (set_attr "length" "4,8")])
3167 (define_insn_and_split "*andsi3_internal8"
3168 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
3169 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3170 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
3172 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3173 (and:SI (match_dup 1)
3178 [(parallel [(set (match_dup 3)
3179 (compare:CC (and:SI (rotate:SI (match_dup 1) (match_dup 4))
3183 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
3186 (rotate:SI (match_dup 0) (match_dup 6)))]
3189 int mb = extract_MB (operands[2]);
3190 int me = extract_ME (operands[2]);
3191 operands[4] = GEN_INT (me + 1);
3192 operands[6] = GEN_INT (32 - (me + 1));
3193 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3195 [(set_attr "type" "delayed_compare,compare")
3196 (set_attr "length" "8,12")])
3198 (define_expand "iorsi3"
3199 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3200 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3201 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3205 if (GET_CODE (operands[2]) == CONST_INT
3206 && ! logical_operand (operands[2], SImode))
3208 HOST_WIDE_INT value = INTVAL (operands[2]);
3209 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
3210 ? operands[0] : gen_reg_rtx (SImode));
3212 emit_insn (gen_iorsi3 (tmp, operands[1],
3213 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3214 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3219 (define_expand "xorsi3"
3220 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3221 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3222 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3226 if (GET_CODE (operands[2]) == CONST_INT
3227 && ! logical_operand (operands[2], SImode))
3229 HOST_WIDE_INT value = INTVAL (operands[2]);
3230 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
3231 ? operands[0] : gen_reg_rtx (SImode));
3233 emit_insn (gen_xorsi3 (tmp, operands[1],
3234 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3235 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3240 (define_insn "*boolsi3_internal1"
3241 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3242 (match_operator:SI 3 "boolean_or_operator"
3243 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3244 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3248 {%q3il|%q3i} %0,%1,%b2
3249 {%q3iu|%q3is} %0,%1,%u2")
3251 (define_insn "*boolsi3_internal2"
3252 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3253 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3254 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3255 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3257 (clobber (match_scratch:SI 3 "=r,r"))]
3258 "! TARGET_POWERPC64"
3262 [(set_attr "type" "compare")
3263 (set_attr "length" "4,8")])
3266 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3267 (compare:CC (match_operator:SI 4 "boolean_operator"
3268 [(match_operand:SI 1 "gpc_reg_operand" "")
3269 (match_operand:SI 2 "gpc_reg_operand" "")])
3271 (clobber (match_scratch:SI 3 ""))]
3272 "! TARGET_POWERPC64 && reload_completed"
3273 [(set (match_dup 3) (match_dup 4))
3275 (compare:CC (match_dup 3)
3279 (define_insn "*boolsi3_internal3"
3280 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3281 (compare:CC (match_operator:SI 4 "boolean_operator"
3282 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3283 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3285 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3287 "! TARGET_POWERPC64"
3291 [(set_attr "type" "compare")
3292 (set_attr "length" "4,8")])
3295 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3296 (compare:CC (match_operator:SI 4 "boolean_operator"
3297 [(match_operand:SI 1 "gpc_reg_operand" "")
3298 (match_operand:SI 2 "gpc_reg_operand" "")])
3300 (set (match_operand:SI 0 "gpc_reg_operand" "")
3302 "! TARGET_POWERPC64 && reload_completed"
3303 [(set (match_dup 0) (match_dup 4))
3305 (compare:CC (match_dup 0)
3309 ;; Split an logical operation that we can't do in one insn into two insns,
3310 ;; each of which does one 16-bit part. This is used by combine.
3313 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3314 (match_operator:SI 3 "boolean_or_operator"
3315 [(match_operand:SI 1 "gpc_reg_operand" "")
3316 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3318 [(set (match_dup 0) (match_dup 4))
3319 (set (match_dup 0) (match_dup 5))]
3323 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3324 operands[4] = gen_rtx (GET_CODE (operands[3]), SImode,
3326 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3327 operands[5] = gen_rtx (GET_CODE (operands[3]), SImode,
3331 (define_insn "*boolcsi3_internal1"
3332 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3333 (match_operator:SI 3 "boolean_operator"
3334 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3335 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3339 (define_insn "*boolcsi3_internal2"
3340 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3341 (compare:CC (match_operator:SI 4 "boolean_operator"
3342 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3343 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3345 (clobber (match_scratch:SI 3 "=r,r"))]
3346 "! TARGET_POWERPC64"
3350 [(set_attr "type" "compare")
3351 (set_attr "length" "4,8")])
3354 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3355 (compare:CC (match_operator:SI 4 "boolean_operator"
3356 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3357 (match_operand:SI 2 "gpc_reg_operand" "")])
3359 (clobber (match_scratch:SI 3 ""))]
3360 "! TARGET_POWERPC64 && reload_completed"
3361 [(set (match_dup 3) (match_dup 4))
3363 (compare:CC (match_dup 3)
3367 (define_insn "*boolcsi3_internal3"
3368 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3369 (compare:CC (match_operator:SI 4 "boolean_operator"
3370 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3371 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3373 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3375 "! TARGET_POWERPC64"
3379 [(set_attr "type" "compare")
3380 (set_attr "length" "4,8")])
3383 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3384 (compare:CC (match_operator:SI 4 "boolean_operator"
3385 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3386 (match_operand:SI 2 "gpc_reg_operand" "")])
3388 (set (match_operand:SI 0 "gpc_reg_operand" "")
3390 "! TARGET_POWERPC64 && reload_completed"
3391 [(set (match_dup 0) (match_dup 4))
3393 (compare:CC (match_dup 0)
3397 (define_insn "*boolccsi3_internal1"
3398 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3399 (match_operator:SI 3 "boolean_operator"
3400 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3401 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3405 (define_insn "*boolccsi3_internal2"
3406 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3407 (compare:CC (match_operator:SI 4 "boolean_operator"
3408 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3409 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3411 (clobber (match_scratch:SI 3 "=r,r"))]
3412 "! TARGET_POWERPC64"
3416 [(set_attr "type" "compare")
3417 (set_attr "length" "4,8")])
3420 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3421 (compare:CC (match_operator:SI 4 "boolean_operator"
3422 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3423 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3425 (clobber (match_scratch:SI 3 ""))]
3426 "! TARGET_POWERPC64 && reload_completed"
3427 [(set (match_dup 3) (match_dup 4))
3429 (compare:CC (match_dup 3)
3433 (define_insn "*boolccsi3_internal3"
3434 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3435 (compare:CC (match_operator:SI 4 "boolean_operator"
3436 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3437 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3439 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3441 "! TARGET_POWERPC64"
3445 [(set_attr "type" "compare")
3446 (set_attr "length" "4,8")])
3449 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3450 (compare:CC (match_operator:SI 4 "boolean_operator"
3451 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3452 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3454 (set (match_operand:SI 0 "gpc_reg_operand" "")
3456 "! TARGET_POWERPC64 && reload_completed"
3457 [(set (match_dup 0) (match_dup 4))
3459 (compare:CC (match_dup 0)
3463 ;; maskir insn. We need four forms because things might be in arbitrary
3464 ;; orders. Don't define forms that only set CR fields because these
3465 ;; would modify an input register.
3467 (define_insn "*maskir_internal1"
3468 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3469 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3470 (match_operand:SI 1 "gpc_reg_operand" "0"))
3471 (and:SI (match_dup 2)
3472 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3476 (define_insn "*maskir_internal2"
3477 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3478 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3479 (match_operand:SI 1 "gpc_reg_operand" "0"))
3480 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3485 (define_insn "*maskir_internal3"
3486 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3487 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3488 (match_operand:SI 3 "gpc_reg_operand" "r"))
3489 (and:SI (not:SI (match_dup 2))
3490 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3494 (define_insn "*maskir_internal4"
3495 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3496 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3497 (match_operand:SI 2 "gpc_reg_operand" "r"))
3498 (and:SI (not:SI (match_dup 2))
3499 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3503 (define_insn "*maskir_internal5"
3504 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3506 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3507 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3508 (and:SI (match_dup 2)
3509 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3511 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3512 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3513 (and:SI (match_dup 2) (match_dup 3))))]
3518 [(set_attr "type" "compare")
3519 (set_attr "length" "4,8")])
3522 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3524 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3525 (match_operand:SI 1 "gpc_reg_operand" ""))
3526 (and:SI (match_dup 2)
3527 (match_operand:SI 3 "gpc_reg_operand" "")))
3529 (set (match_operand:SI 0 "gpc_reg_operand" "")
3530 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3531 (and:SI (match_dup 2) (match_dup 3))))]
3532 "TARGET_POWER && reload_completed"
3534 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3535 (and:SI (match_dup 2) (match_dup 3))))
3537 (compare:CC (match_dup 0)
3541 (define_insn "*maskir_internal6"
3542 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3544 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3545 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3546 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3549 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3550 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3551 (and:SI (match_dup 3) (match_dup 2))))]
3556 [(set_attr "type" "compare")
3557 (set_attr "length" "4,8")])
3560 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3562 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3563 (match_operand:SI 1 "gpc_reg_operand" ""))
3564 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3567 (set (match_operand:SI 0 "gpc_reg_operand" "")
3568 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3569 (and:SI (match_dup 3) (match_dup 2))))]
3570 "TARGET_POWER && reload_completed"
3572 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3573 (and:SI (match_dup 3) (match_dup 2))))
3575 (compare:CC (match_dup 0)
3579 (define_insn "*maskir_internal7"
3580 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3582 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3583 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3584 (and:SI (not:SI (match_dup 2))
3585 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3587 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3588 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3589 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3594 [(set_attr "type" "compare")
3595 (set_attr "length" "4,8")])
3598 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3600 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3601 (match_operand:SI 3 "gpc_reg_operand" ""))
3602 (and:SI (not:SI (match_dup 2))
3603 (match_operand:SI 1 "gpc_reg_operand" "")))
3605 (set (match_operand:SI 0 "gpc_reg_operand" "")
3606 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3607 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3608 "TARGET_POWER && reload_completed"
3610 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3611 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3613 (compare:CC (match_dup 0)
3617 (define_insn "*maskir_internal8"
3618 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3620 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3621 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3622 (and:SI (not:SI (match_dup 2))
3623 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3625 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3626 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3627 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3632 [(set_attr "type" "compare")
3633 (set_attr "length" "4,8")])
3636 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3638 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3639 (match_operand:SI 2 "gpc_reg_operand" ""))
3640 (and:SI (not:SI (match_dup 2))
3641 (match_operand:SI 1 "gpc_reg_operand" "")))
3643 (set (match_operand:SI 0 "gpc_reg_operand" "")
3644 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3645 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3646 "TARGET_POWER && reload_completed"
3648 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3649 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3651 (compare:CC (match_dup 0)
3655 ;; Rotate and shift insns, in all their variants. These support shifts,
3656 ;; field inserts and extracts, and various combinations thereof.
3657 (define_expand "insv"
3658 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3659 (match_operand:SI 1 "const_int_operand" "")
3660 (match_operand:SI 2 "const_int_operand" ""))
3661 (match_operand 3 "gpc_reg_operand" ""))]
3665 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3666 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3667 compiler if the address of the structure is taken later. */
3668 if (GET_CODE (operands[0]) == SUBREG
3669 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3672 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3673 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3675 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3679 (define_insn "insvsi"
3680 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3681 (match_operand:SI 1 "const_int_operand" "i")
3682 (match_operand:SI 2 "const_int_operand" "i"))
3683 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3687 int start = INTVAL (operands[2]) & 31;
3688 int size = INTVAL (operands[1]) & 31;
3690 operands[4] = GEN_INT (32 - start - size);
3691 operands[1] = GEN_INT (start + size - 1);
3692 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3695 (define_insn "*insvsi_internal1"
3696 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3697 (match_operand:SI 1 "const_int_operand" "i")
3698 (match_operand:SI 2 "const_int_operand" "i"))
3699 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3700 (match_operand:SI 4 "const_int_operand" "i")))]
3701 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3704 int shift = INTVAL (operands[4]) & 31;
3705 int start = INTVAL (operands[2]) & 31;
3706 int size = INTVAL (operands[1]) & 31;
3708 operands[4] = GEN_INT (shift - start - size);
3709 operands[1] = GEN_INT (start + size - 1);
3710 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3713 (define_insn "*insvsi_internal2"
3714 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3715 (match_operand:SI 1 "const_int_operand" "i")
3716 (match_operand:SI 2 "const_int_operand" "i"))
3717 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3718 (match_operand:SI 4 "const_int_operand" "i")))]
3719 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3722 int shift = INTVAL (operands[4]) & 31;
3723 int start = INTVAL (operands[2]) & 31;
3724 int size = INTVAL (operands[1]) & 31;
3726 operands[4] = GEN_INT (32 - shift - start - size);
3727 operands[1] = GEN_INT (start + size - 1);
3728 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3731 (define_insn "*insvsi_internal3"
3732 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3733 (match_operand:SI 1 "const_int_operand" "i")
3734 (match_operand:SI 2 "const_int_operand" "i"))
3735 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3736 (match_operand:SI 4 "const_int_operand" "i")))]
3737 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3740 int shift = INTVAL (operands[4]) & 31;
3741 int start = INTVAL (operands[2]) & 31;
3742 int size = INTVAL (operands[1]) & 31;
3744 operands[4] = GEN_INT (32 - shift - start - size);
3745 operands[1] = GEN_INT (start + size - 1);
3746 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3749 (define_insn "*insvsi_internal4"
3750 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3751 (match_operand:SI 1 "const_int_operand" "i")
3752 (match_operand:SI 2 "const_int_operand" "i"))
3753 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3754 (match_operand:SI 4 "const_int_operand" "i")
3755 (match_operand:SI 5 "const_int_operand" "i")))]
3756 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3759 int extract_start = INTVAL (operands[5]) & 31;
3760 int extract_size = INTVAL (operands[4]) & 31;
3761 int insert_start = INTVAL (operands[2]) & 31;
3762 int insert_size = INTVAL (operands[1]) & 31;
3764 /* Align extract field with insert field */
3765 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3766 operands[1] = GEN_INT (insert_start + insert_size - 1);
3767 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3770 (define_insn "insvdi"
3771 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3772 (match_operand:SI 1 "const_int_operand" "i")
3773 (match_operand:SI 2 "const_int_operand" "i"))
3774 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3778 int start = INTVAL (operands[2]) & 63;
3779 int size = INTVAL (operands[1]) & 63;
3781 operands[1] = GEN_INT (64 - start - size);
3782 return \"rldimi %0,%3,%H1,%H2\";
3785 (define_expand "extzv"
3786 [(set (match_operand 0 "gpc_reg_operand" "")
3787 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3788 (match_operand:SI 2 "const_int_operand" "")
3789 (match_operand:SI 3 "const_int_operand" "")))]
3793 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3794 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3795 compiler if the address of the structure is taken later. */
3796 if (GET_CODE (operands[0]) == SUBREG
3797 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3800 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3801 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3803 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3807 (define_insn "extzvsi"
3808 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3809 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3810 (match_operand:SI 2 "const_int_operand" "i")
3811 (match_operand:SI 3 "const_int_operand" "i")))]
3815 int start = INTVAL (operands[3]) & 31;
3816 int size = INTVAL (operands[2]) & 31;
3818 if (start + size >= 32)
3819 operands[3] = const0_rtx;
3821 operands[3] = GEN_INT (start + size);
3822 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3825 (define_insn "*extzvsi_internal1"
3826 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3827 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3828 (match_operand:SI 2 "const_int_operand" "i,i")
3829 (match_operand:SI 3 "const_int_operand" "i,i"))
3831 (clobber (match_scratch:SI 4 "=r,r"))]
3835 int start = INTVAL (operands[3]) & 31;
3836 int size = INTVAL (operands[2]) & 31;
3838 /* Force split for non-cc0 compare. */
3839 if (which_alternative == 1)
3842 /* If the bit-field being tested fits in the upper or lower half of a
3843 word, it is possible to use andiu. or andil. to test it. This is
3844 useful because the condition register set-use delay is smaller for
3845 andi[ul]. than for rlinm. This doesn't work when the starting bit
3846 position is 0 because the LT and GT bits may be set wrong. */
3848 if ((start > 0 && start + size <= 16) || start >= 16)
3850 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3851 - (1 << (16 - (start & 15) - size))));
3853 return \"{andiu.|andis.} %4,%1,%3\";
3855 return \"{andil.|andi.} %4,%1,%3\";
3858 if (start + size >= 32)
3859 operands[3] = const0_rtx;
3861 operands[3] = GEN_INT (start + size);
3862 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3864 [(set_attr "type" "compare")
3865 (set_attr "length" "4,8")])
3868 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3869 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3870 (match_operand:SI 2 "const_int_operand" "")
3871 (match_operand:SI 3 "const_int_operand" ""))
3873 (clobber (match_scratch:SI 4 ""))]
3876 (zero_extract:SI (match_dup 1) (match_dup 2)
3879 (compare:CC (match_dup 4)
3883 (define_insn "*extzvsi_internal2"
3884 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3885 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3886 (match_operand:SI 2 "const_int_operand" "i,i")
3887 (match_operand:SI 3 "const_int_operand" "i,i"))
3889 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3890 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3894 int start = INTVAL (operands[3]) & 31;
3895 int size = INTVAL (operands[2]) & 31;
3897 /* Force split for non-cc0 compare. */
3898 if (which_alternative == 1)
3901 /* Since we are using the output value, we can't ignore any need for
3902 a shift. The bit-field must end at the LSB. */
3903 if (start >= 16 && start + size == 32)
3905 operands[3] = GEN_INT ((1 << size) - 1);
3906 return \"{andil.|andi.} %0,%1,%3\";
3909 if (start + size >= 32)
3910 operands[3] = const0_rtx;
3912 operands[3] = GEN_INT (start + size);
3913 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3915 [(set_attr "type" "compare")
3916 (set_attr "length" "4,8")])
3919 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3920 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3921 (match_operand:SI 2 "const_int_operand" "")
3922 (match_operand:SI 3 "const_int_operand" ""))
3924 (set (match_operand:SI 0 "gpc_reg_operand" "")
3925 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3928 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3930 (compare:CC (match_dup 0)
3934 (define_insn "extzvdi"
3935 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3936 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3937 (match_operand:SI 2 "const_int_operand" "i")
3938 (match_operand:SI 3 "const_int_operand" "i")))]
3942 int start = INTVAL (operands[3]) & 63;
3943 int size = INTVAL (operands[2]) & 63;
3945 if (start + size >= 64)
3946 operands[3] = const0_rtx;
3948 operands[3] = GEN_INT (start + size);
3949 operands[2] = GEN_INT (64 - size);
3950 return \"rldicl %0,%1,%3,%2\";
3953 (define_insn "*extzvdi_internal1"
3954 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3955 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3956 (match_operand:SI 2 "const_int_operand" "i")
3957 (match_operand:SI 3 "const_int_operand" "i"))
3959 (clobber (match_scratch:DI 4 "=r"))]
3963 int start = INTVAL (operands[3]) & 63;
3964 int size = INTVAL (operands[2]) & 63;
3966 if (start + size >= 64)
3967 operands[3] = const0_rtx;
3969 operands[3] = GEN_INT (start + size);
3970 operands[2] = GEN_INT (64 - size);
3971 return \"rldicl. %4,%1,%3,%2\";
3974 (define_insn "*extzvdi_internal2"
3975 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3976 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3977 (match_operand:SI 2 "const_int_operand" "i")
3978 (match_operand:SI 3 "const_int_operand" "i"))
3980 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3981 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3985 int start = INTVAL (operands[3]) & 63;
3986 int size = INTVAL (operands[2]) & 63;
3988 if (start + size >= 64)
3989 operands[3] = const0_rtx;
3991 operands[3] = GEN_INT (start + size);
3992 operands[2] = GEN_INT (64 - size);
3993 return \"rldicl. %0,%1,%3,%2\";
3996 (define_insn "rotlsi3"
3997 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3998 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3999 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4001 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
4003 (define_insn "*rotlsi3_internal2"
4004 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4005 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4006 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4008 (clobber (match_scratch:SI 3 "=r,r"))]
4011 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
4013 [(set_attr "type" "delayed_compare")
4014 (set_attr "length" "4,8")])
4017 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4018 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4019 (match_operand:SI 2 "reg_or_cint_operand" ""))
4021 (clobber (match_scratch:SI 3 ""))]
4024 (rotate:SI (match_dup 1) (match_dup 2)))
4026 (compare:CC (match_dup 3)
4030 (define_insn "*rotlsi3_internal3"
4031 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4032 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4033 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4035 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4036 (rotate:SI (match_dup 1) (match_dup 2)))]
4039 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
4041 [(set_attr "type" "delayed_compare")
4042 (set_attr "length" "4,8")])
4045 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4046 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4047 (match_operand:SI 2 "reg_or_cint_operand" ""))
4049 (set (match_operand:SI 0 "gpc_reg_operand" "")
4050 (rotate:SI (match_dup 1) (match_dup 2)))]
4053 (rotate:SI (match_dup 1) (match_dup 2)))
4055 (compare:CC (match_dup 0)
4059 (define_insn "*rotlsi3_internal4"
4060 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4061 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4062 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4063 (match_operand:SI 3 "mask_operand" "n")))]
4065 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
4067 (define_insn "*rotlsi3_internal5"
4068 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4070 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4071 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4072 (match_operand:SI 3 "mask_operand" "n,n"))
4074 (clobber (match_scratch:SI 4 "=r,r"))]
4077 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
4079 [(set_attr "type" "delayed_compare")
4080 (set_attr "length" "4,8")])
4083 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4085 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4086 (match_operand:SI 2 "reg_or_cint_operand" ""))
4087 (match_operand:SI 3 "mask_operand" ""))
4089 (clobber (match_scratch:SI 4 ""))]
4092 (and:SI (rotate:SI (match_dup 1)
4096 (compare:CC (match_dup 4)
4100 (define_insn "*rotlsi3_internal6"
4101 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4103 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4104 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4105 (match_operand:SI 3 "mask_operand" "n,n"))
4107 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4108 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4111 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
4113 [(set_attr "type" "delayed_compare")
4114 (set_attr "length" "4,8")])
4117 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4119 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4120 (match_operand:SI 2 "reg_or_cint_operand" ""))
4121 (match_operand:SI 3 "mask_operand" ""))
4123 (set (match_operand:SI 0 "gpc_reg_operand" "")
4124 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4127 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4129 (compare:CC (match_dup 0)
4133 (define_insn "*rotlsi3_internal7"
4134 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4137 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4138 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4140 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4142 (define_insn "*rotlsi3_internal8"
4143 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4144 (compare:CC (zero_extend:SI
4146 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4147 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4149 (clobber (match_scratch:SI 3 "=r,r"))]
4152 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
4154 [(set_attr "type" "delayed_compare")
4155 (set_attr "length" "4,8")])
4158 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4159 (compare:CC (zero_extend:SI
4161 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4162 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4164 (clobber (match_scratch:SI 3 ""))]
4167 (zero_extend:SI (subreg:QI
4168 (rotate:SI (match_dup 1)
4171 (compare:CC (match_dup 3)
4175 (define_insn "*rotlsi3_internal9"
4176 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4177 (compare:CC (zero_extend:SI
4179 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4180 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4182 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4183 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4186 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
4188 [(set_attr "type" "delayed_compare")
4189 (set_attr "length" "4,8")])
4192 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4193 (compare:CC (zero_extend:SI
4195 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4196 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4198 (set (match_operand:SI 0 "gpc_reg_operand" "")
4199 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4202 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4204 (compare:CC (match_dup 0)
4208 (define_insn "*rotlsi3_internal10"
4209 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4212 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4213 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4215 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
4217 (define_insn "*rotlsi3_internal11"
4218 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4219 (compare:CC (zero_extend:SI
4221 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4222 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4224 (clobber (match_scratch:SI 3 "=r,r"))]
4227 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
4229 [(set_attr "type" "delayed_compare")
4230 (set_attr "length" "4,8")])
4233 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4234 (compare:CC (zero_extend:SI
4236 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4237 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4239 (clobber (match_scratch:SI 3 ""))]
4242 (zero_extend:SI (subreg:HI
4243 (rotate:SI (match_dup 1)
4246 (compare:CC (match_dup 3)
4250 (define_insn "*rotlsi3_internal12"
4251 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4252 (compare:CC (zero_extend:SI
4254 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4255 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4257 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4258 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4261 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
4263 [(set_attr "type" "delayed_compare")
4264 (set_attr "length" "4,8")])
4267 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4268 (compare:CC (zero_extend:SI
4270 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4271 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4273 (set (match_operand:SI 0 "gpc_reg_operand" "")
4274 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4277 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4279 (compare:CC (match_dup 0)
4283 ;; Note that we use "sle." instead of "sl." so that we can set
4284 ;; SHIFT_COUNT_TRUNCATED.
4286 (define_expand "ashlsi3"
4287 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4288 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4289 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4294 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4296 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4300 (define_insn "ashlsi3_power"
4301 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4302 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4303 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4304 (clobber (match_scratch:SI 3 "=q,X"))]
4308 {sli|slwi} %0,%1,%h2")
4310 (define_insn "ashlsi3_no_power"
4311 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4312 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4313 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4315 "{sl|slw}%I2 %0,%1,%h2")
4318 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4319 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4320 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4322 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4323 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4327 {sli.|slwi.} %3,%1,%h2
4330 [(set_attr "type" "delayed_compare")
4331 (set_attr "length" "4,4,8,8")])
4334 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4335 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4336 (match_operand:SI 2 "reg_or_cint_operand" ""))
4338 (clobber (match_scratch:SI 3 ""))
4339 (clobber (match_scratch:SI 4 ""))]
4340 "TARGET_POWER && reload_completed"
4341 [(parallel [(set (match_dup 3)
4342 (ashift:SI (match_dup 1) (match_dup 2)))
4343 (clobber (match_dup 4))])
4345 (compare:CC (match_dup 3)
4350 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4351 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4352 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4354 (clobber (match_scratch:SI 3 "=r,r"))]
4355 "! TARGET_POWER && ! TARGET_POWERPC64"
4357 {sl|slw}%I2. %3,%1,%h2
4359 [(set_attr "type" "delayed_compare")
4360 (set_attr "length" "4,8")])
4363 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4364 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4365 (match_operand:SI 2 "reg_or_cint_operand" ""))
4367 (clobber (match_scratch:SI 3 ""))]
4368 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4370 (ashift:SI (match_dup 1) (match_dup 2)))
4372 (compare:CC (match_dup 3)
4377 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4378 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4379 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4381 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4382 (ashift:SI (match_dup 1) (match_dup 2)))
4383 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4387 {sli.|slwi.} %0,%1,%h2
4390 [(set_attr "type" "delayed_compare")
4391 (set_attr "length" "4,4,8,8")])
4394 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4395 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4396 (match_operand:SI 2 "reg_or_cint_operand" ""))
4398 (set (match_operand:SI 0 "gpc_reg_operand" "")
4399 (ashift:SI (match_dup 1) (match_dup 2)))
4400 (clobber (match_scratch:SI 4 ""))]
4401 "TARGET_POWER && reload_completed"
4402 [(parallel [(set (match_dup 0)
4403 (ashift:SI (match_dup 1) (match_dup 2)))
4404 (clobber (match_dup 4))])
4406 (compare:CC (match_dup 0)
4411 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4412 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4413 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4415 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4416 (ashift:SI (match_dup 1) (match_dup 2)))]
4417 "! TARGET_POWER && ! TARGET_POWERPC64"
4419 {sl|slw}%I2. %0,%1,%h2
4421 [(set_attr "type" "delayed_compare")
4422 (set_attr "length" "4,8")])
4425 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4426 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4427 (match_operand:SI 2 "reg_or_cint_operand" ""))
4429 (set (match_operand:SI 0 "gpc_reg_operand" "")
4430 (ashift:SI (match_dup 1) (match_dup 2)))]
4431 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4433 (ashift:SI (match_dup 1) (match_dup 2)))
4435 (compare:CC (match_dup 0)
4440 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4441 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4442 (match_operand:SI 2 "const_int_operand" "i"))
4443 (match_operand:SI 3 "mask_operand" "n")))]
4444 "includes_lshift_p (operands[2], operands[3])"
4445 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4448 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4450 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4451 (match_operand:SI 2 "const_int_operand" "i,i"))
4452 (match_operand:SI 3 "mask_operand" "n,n"))
4454 (clobber (match_scratch:SI 4 "=r,r"))]
4455 "includes_lshift_p (operands[2], operands[3])"
4457 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4459 [(set_attr "type" "delayed_compare")
4460 (set_attr "length" "4,8")])
4463 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4465 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4466 (match_operand:SI 2 "const_int_operand" ""))
4467 (match_operand:SI 3 "mask_operand" ""))
4469 (clobber (match_scratch:SI 4 ""))]
4470 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4472 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4475 (compare:CC (match_dup 4)
4480 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4482 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4483 (match_operand:SI 2 "const_int_operand" "i,i"))
4484 (match_operand:SI 3 "mask_operand" "n,n"))
4486 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4487 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4488 "includes_lshift_p (operands[2], operands[3])"
4490 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4492 [(set_attr "type" "delayed_compare")
4493 (set_attr "length" "4,8")])
4496 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4498 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4499 (match_operand:SI 2 "const_int_operand" ""))
4500 (match_operand:SI 3 "mask_operand" ""))
4502 (set (match_operand:SI 0 "gpc_reg_operand" "")
4503 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4504 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4506 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4508 (compare:CC (match_dup 0)
4512 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4514 (define_expand "lshrsi3"
4515 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4516 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4517 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4522 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4524 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4528 (define_insn "lshrsi3_power"
4529 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4530 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4531 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4532 (clobber (match_scratch:SI 3 "=q,X,X"))]
4537 {s%A2i|s%A2wi} %0,%1,%h2")
4539 (define_insn "lshrsi3_no_power"
4540 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4541 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4542 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
4546 {sr|srw}%I2 %0,%1,%h2")
4549 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4550 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4551 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4553 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4554 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4559 {s%A2i.|s%A2wi.} %3,%1,%h2
4563 [(set_attr "type" "delayed_compare")
4564 (set_attr "length" "4,4,4,8,8,8")])
4567 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4568 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4569 (match_operand:SI 2 "reg_or_cint_operand" ""))
4571 (clobber (match_scratch:SI 3 ""))
4572 (clobber (match_scratch:SI 4 ""))]
4573 "TARGET_POWER && reload_completed"
4574 [(parallel [(set (match_dup 3)
4575 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4576 (clobber (match_dup 4))])
4578 (compare:CC (match_dup 3)
4583 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4584 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4585 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4587 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
4588 "! TARGET_POWER && ! TARGET_POWERPC64"
4591 {sr|srw}%I2. %3,%1,%h2
4594 [(set_attr "type" "delayed_compare")
4595 (set_attr "length" "4,4,8,8")])
4598 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4599 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4600 (match_operand:SI 2 "reg_or_cint_operand" ""))
4602 (clobber (match_scratch:SI 3 ""))]
4603 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4605 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4607 (compare:CC (match_dup 3)
4612 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4613 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4614 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4616 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4617 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4618 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4623 {s%A2i.|s%A2wi.} %0,%1,%h2
4627 [(set_attr "type" "delayed_compare")
4628 (set_attr "length" "4,4,4,8,8,8")])
4631 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4632 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4633 (match_operand:SI 2 "reg_or_cint_operand" ""))
4635 (set (match_operand:SI 0 "gpc_reg_operand" "")
4636 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4637 (clobber (match_scratch:SI 4 ""))]
4638 "TARGET_POWER && reload_completed"
4639 [(parallel [(set (match_dup 0)
4640 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4641 (clobber (match_dup 4))])
4643 (compare:CC (match_dup 0)
4648 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4649 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4650 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4652 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4653 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4654 "! TARGET_POWER && ! TARGET_POWERPC64"
4657 {sr|srw}%I2. %0,%1,%h2
4660 [(set_attr "type" "delayed_compare")
4661 (set_attr "length" "4,4,8,8")])
4664 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4665 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4666 (match_operand:SI 2 "reg_or_cint_operand" ""))
4668 (set (match_operand:SI 0 "gpc_reg_operand" "")
4669 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4670 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4672 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4674 (compare:CC (match_dup 0)
4679 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4680 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4681 (match_operand:SI 2 "const_int_operand" "i"))
4682 (match_operand:SI 3 "mask_operand" "n")))]
4683 "includes_rshift_p (operands[2], operands[3])"
4684 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4687 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4689 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4690 (match_operand:SI 2 "const_int_operand" "i,i"))
4691 (match_operand:SI 3 "mask_operand" "n,n"))
4693 (clobber (match_scratch:SI 4 "=r,r"))]
4694 "includes_rshift_p (operands[2], operands[3])"
4696 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4698 [(set_attr "type" "delayed_compare")
4699 (set_attr "length" "4,8")])
4702 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4704 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4705 (match_operand:SI 2 "const_int_operand" ""))
4706 (match_operand:SI 3 "mask_operand" ""))
4708 (clobber (match_scratch:SI 4 ""))]
4709 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4711 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4714 (compare:CC (match_dup 4)
4719 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4721 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4722 (match_operand:SI 2 "const_int_operand" "i,i"))
4723 (match_operand:SI 3 "mask_operand" "n,n"))
4725 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4726 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4727 "includes_rshift_p (operands[2], operands[3])"
4729 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4731 [(set_attr "type" "delayed_compare")
4732 (set_attr "length" "4,8")])
4735 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4737 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4738 (match_operand:SI 2 "const_int_operand" ""))
4739 (match_operand:SI 3 "mask_operand" ""))
4741 (set (match_operand:SI 0 "gpc_reg_operand" "")
4742 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4743 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4745 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4747 (compare:CC (match_dup 0)
4752 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4755 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4756 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4757 "includes_rshift_p (operands[2], GEN_INT (255))"
4758 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4761 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4765 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4766 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4768 (clobber (match_scratch:SI 3 "=r,r"))]
4769 "includes_rshift_p (operands[2], GEN_INT (255))"
4771 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4773 [(set_attr "type" "delayed_compare")
4774 (set_attr "length" "4,8")])
4777 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4781 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4782 (match_operand:SI 2 "const_int_operand" "")) 0))
4784 (clobber (match_scratch:SI 3 ""))]
4785 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4787 (zero_extend:SI (subreg:QI
4788 (lshiftrt:SI (match_dup 1)
4791 (compare:CC (match_dup 3)
4796 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4800 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4801 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4803 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4804 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4805 "includes_rshift_p (operands[2], GEN_INT (255))"
4807 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4809 [(set_attr "type" "delayed_compare")
4810 (set_attr "length" "4,8")])
4813 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4817 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4818 (match_operand:SI 2 "const_int_operand" "")) 0))
4820 (set (match_operand:SI 0 "gpc_reg_operand" "")
4821 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4822 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4824 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4826 (compare:CC (match_dup 0)
4831 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4834 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4835 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4836 "includes_rshift_p (operands[2], GEN_INT (65535))"
4837 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4840 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4844 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4845 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4847 (clobber (match_scratch:SI 3 "=r,r"))]
4848 "includes_rshift_p (operands[2], GEN_INT (65535))"
4850 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4852 [(set_attr "type" "delayed_compare")
4853 (set_attr "length" "4,8")])
4856 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4860 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4861 (match_operand:SI 2 "const_int_operand" "")) 0))
4863 (clobber (match_scratch:SI 3 ""))]
4864 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4866 (zero_extend:SI (subreg:HI
4867 (lshiftrt:SI (match_dup 1)
4870 (compare:CC (match_dup 3)
4875 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4879 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4880 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4882 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4883 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4884 "includes_rshift_p (operands[2], GEN_INT (65535))"
4886 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4888 [(set_attr "type" "delayed_compare")
4889 (set_attr "length" "4,8")])
4892 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4896 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4897 (match_operand:SI 2 "const_int_operand" "")) 0))
4899 (set (match_operand:SI 0 "gpc_reg_operand" "")
4900 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4901 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4903 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4905 (compare:CC (match_dup 0)
4910 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4912 (match_operand:SI 1 "gpc_reg_operand" "r"))
4913 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4919 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4921 (match_operand:SI 1 "gpc_reg_operand" "r"))
4922 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4928 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4930 (match_operand:SI 1 "gpc_reg_operand" "r"))
4931 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4937 (define_expand "ashrsi3"
4938 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4939 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4940 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4945 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4947 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4951 (define_insn "ashrsi3_power"
4952 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4953 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4954 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4955 (clobber (match_scratch:SI 3 "=q,X"))]
4959 {srai|srawi} %0,%1,%h2")
4961 (define_insn "ashrsi3_no_power"
4962 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4963 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4964 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4966 "{sra|sraw}%I2 %0,%1,%h2")
4969 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4970 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4971 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4973 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4974 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4978 {srai.|srawi.} %3,%1,%h2
4981 [(set_attr "type" "delayed_compare")
4982 (set_attr "length" "4,4,8,8")])
4985 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4986 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4987 (match_operand:SI 2 "reg_or_cint_operand" ""))
4989 (clobber (match_scratch:SI 3 ""))
4990 (clobber (match_scratch:SI 4 ""))]
4991 "TARGET_POWER && reload_completed"
4992 [(parallel [(set (match_dup 3)
4993 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4994 (clobber (match_dup 4))])
4996 (compare:CC (match_dup 3)
5001 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5002 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5003 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
5005 (clobber (match_scratch:SI 3 "=r,r"))]
5008 {sra|sraw}%I2. %3,%1,%h2
5010 [(set_attr "type" "delayed_compare")
5011 (set_attr "length" "4,8")])
5014 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5015 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5016 (match_operand:SI 2 "reg_or_cint_operand" ""))
5018 (clobber (match_scratch:SI 3 ""))]
5019 "! TARGET_POWER && reload_completed"
5021 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5023 (compare:CC (match_dup 3)
5028 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5029 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5030 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5032 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5033 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5034 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5038 {srai.|srawi.} %0,%1,%h2
5041 [(set_attr "type" "delayed_compare")
5042 (set_attr "length" "4,4,8,8")])
5045 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5046 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5047 (match_operand:SI 2 "reg_or_cint_operand" ""))
5049 (set (match_operand:SI 0 "gpc_reg_operand" "")
5050 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5051 (clobber (match_scratch:SI 4 ""))]
5052 "TARGET_POWER && reload_completed"
5053 [(parallel [(set (match_dup 0)
5054 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5055 (clobber (match_dup 4))])
5057 (compare:CC (match_dup 0)
5062 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5063 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5064 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
5066 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5067 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5070 {sra|sraw}%I2. %0,%1,%h2
5072 [(set_attr "type" "delayed_compare")
5073 (set_attr "length" "4,8")])
5076 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5077 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5078 (match_operand:SI 2 "reg_or_cint_operand" ""))
5080 (set (match_operand:SI 0 "gpc_reg_operand" "")
5081 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5082 "! TARGET_POWER && reload_completed"
5084 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5086 (compare:CC (match_dup 0)
5090 ;; Floating-point insns, excluding normal data motion.
5092 ;; PowerPC has a full set of single-precision floating point instructions.
5094 ;; For the POWER architecture, we pretend that we have both SFmode and
5095 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5096 ;; The only conversions we will do will be when storing to memory. In that
5097 ;; case, we will use the "frsp" instruction before storing.
5099 ;; Note that when we store into a single-precision memory location, we need to
5100 ;; use the frsp insn first. If the register being stored isn't dead, we
5101 ;; need a scratch register for the frsp. But this is difficult when the store
5102 ;; is done by reload. It is not incorrect to do the frsp on the register in
5103 ;; this case, we just lose precision that we would have otherwise gotten but
5104 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5106 (define_insn "extendsfdf2"
5107 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5108 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5109 "TARGET_HARD_FLOAT && TARGET_FPRS"
5112 if (REGNO (operands[0]) == REGNO (operands[1]))
5115 return \"fmr %0,%1\";
5117 [(set_attr "type" "fp")])
5119 (define_insn "truncdfsf2"
5120 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5121 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5122 "TARGET_HARD_FLOAT && TARGET_FPRS"
5124 [(set_attr "type" "fp")])
5126 (define_insn "aux_truncdfsf2"
5127 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5128 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
5129 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5131 [(set_attr "type" "fp")])
5133 (define_expand "negsf2"
5134 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5135 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5139 (define_insn "*negsf2"
5140 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5141 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5142 "TARGET_HARD_FLOAT && TARGET_FPRS"
5144 [(set_attr "type" "fp")])
5146 (define_expand "abssf2"
5147 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5148 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5152 (define_insn "*abssf2"
5153 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5154 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5155 "TARGET_HARD_FLOAT && TARGET_FPRS"
5157 [(set_attr "type" "fp")])
5160 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5161 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5162 "TARGET_HARD_FLOAT && TARGET_FPRS"
5164 [(set_attr "type" "fp")])
5166 (define_expand "addsf3"
5167 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5168 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5169 (match_operand:SF 2 "gpc_reg_operand" "")))]
5174 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5175 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5176 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5177 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5179 [(set_attr "type" "fp")])
5182 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5183 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5184 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5185 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5186 "{fa|fadd} %0,%1,%2"
5187 [(set_attr "type" "fp")])
5189 (define_expand "subsf3"
5190 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5191 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5192 (match_operand:SF 2 "gpc_reg_operand" "")))]
5197 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5198 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5199 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5200 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5202 [(set_attr "type" "fp")])
5205 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5206 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5207 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5208 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5209 "{fs|fsub} %0,%1,%2"
5210 [(set_attr "type" "fp")])
5212 (define_expand "mulsf3"
5213 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5214 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5215 (match_operand:SF 2 "gpc_reg_operand" "")))]
5220 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5221 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5222 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5223 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5225 [(set_attr "type" "fp")])
5228 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5229 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5230 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5231 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5232 "{fm|fmul} %0,%1,%2"
5233 [(set_attr "type" "dmul")])
5235 (define_expand "divsf3"
5236 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5237 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5238 (match_operand:SF 2 "gpc_reg_operand" "")))]
5243 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5244 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5245 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5246 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5248 [(set_attr "type" "sdiv")])
5251 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5252 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5253 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5254 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5255 "{fd|fdiv} %0,%1,%2"
5256 [(set_attr "type" "ddiv")])
5259 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5260 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5261 (match_operand:SF 2 "gpc_reg_operand" "f"))
5262 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5263 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5264 "fmadds %0,%1,%2,%3"
5265 [(set_attr "type" "fp")])
5268 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5269 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5270 (match_operand:SF 2 "gpc_reg_operand" "f"))
5271 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5272 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5273 "{fma|fmadd} %0,%1,%2,%3"
5274 [(set_attr "type" "dmul")])
5277 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5278 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5279 (match_operand:SF 2 "gpc_reg_operand" "f"))
5280 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5281 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5282 "fmsubs %0,%1,%2,%3"
5283 [(set_attr "type" "fp")])
5286 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5287 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5288 (match_operand:SF 2 "gpc_reg_operand" "f"))
5289 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5290 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5291 "{fms|fmsub} %0,%1,%2,%3"
5292 [(set_attr "type" "dmul")])
5295 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5296 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5297 (match_operand:SF 2 "gpc_reg_operand" "f"))
5298 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5299 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5300 && HONOR_SIGNED_ZEROS (SFmode)"
5301 "fnmadds %0,%1,%2,%3"
5302 [(set_attr "type" "fp")])
5305 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5306 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5307 (match_operand:SF 2 "gpc_reg_operand" "f"))
5308 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5309 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5310 && ! HONOR_SIGNED_ZEROS (SFmode)"
5311 "fnmadds %0,%1,%2,%3"
5312 [(set_attr "type" "fp")])
5315 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5316 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5317 (match_operand:SF 2 "gpc_reg_operand" "f"))
5318 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5319 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5320 "{fnma|fnmadd} %0,%1,%2,%3"
5321 [(set_attr "type" "dmul")])
5324 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5325 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
5326 (match_operand:SF 2 "gpc_reg_operand" "f"))
5327 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5328 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5329 && ! HONOR_SIGNED_ZEROS (SFmode)"
5330 "{fnma|fnmadd} %0,%1,%2,%3"
5331 [(set_attr "type" "dmul")])
5334 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5335 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5336 (match_operand:SF 2 "gpc_reg_operand" "f"))
5337 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5338 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5339 && HONOR_SIGNED_ZEROS (SFmode)"
5340 "fnmsubs %0,%1,%2,%3"
5341 [(set_attr "type" "fp")])
5344 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5345 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5346 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5347 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5348 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5349 && ! HONOR_SIGNED_ZEROS (SFmode)"
5350 "fnmsubs %0,%1,%2,%3"
5351 [(set_attr "type" "fp")])
5354 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5355 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5356 (match_operand:SF 2 "gpc_reg_operand" "f"))
5357 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5358 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5359 "{fnms|fnmsub} %0,%1,%2,%3"
5360 [(set_attr "type" "dmul")])
5363 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5364 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
5365 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5366 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
5367 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5368 && ! HONOR_SIGNED_ZEROS (SFmode)"
5369 "{fnms|fnmsub} %0,%1,%2,%3"
5370 [(set_attr "type" "fp")])
5372 (define_expand "sqrtsf2"
5373 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5374 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5375 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5379 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5380 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5381 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5383 [(set_attr "type" "ssqrt")])
5386 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5387 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5388 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5390 [(set_attr "type" "dsqrt")])
5392 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5393 ;; fsel instruction and some auxiliary computations. Then we just have a
5394 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5396 (define_expand "maxsf3"
5397 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5398 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5399 (match_operand:SF 2 "gpc_reg_operand" ""))
5402 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5403 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5405 (define_expand "minsf3"
5406 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5407 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5408 (match_operand:SF 2 "gpc_reg_operand" ""))
5411 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5412 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5415 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5416 (match_operator:SF 3 "min_max_operator"
5417 [(match_operand:SF 1 "gpc_reg_operand" "")
5418 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5419 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5422 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5423 operands[1], operands[2]);
5427 (define_expand "movsicc"
5428 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5429 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5430 (match_operand:SI 2 "gpc_reg_operand" "")
5431 (match_operand:SI 3 "gpc_reg_operand" "")))]
5435 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5441 ;; We use the BASE_REGS for the isel input operands because, if rA is
5442 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5443 ;; because we may switch the operands and rB may end up being rA.
5445 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5446 ;; leave out the mode in operand 4 and use one pattern, but reload can
5447 ;; change the mode underneath our feet and then gets confused trying
5448 ;; to reload the value.
5449 (define_insn "isel_signed"
5450 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5452 (match_operator 1 "comparison_operator"
5453 [(match_operand:CC 4 "cc_reg_operand" "y")
5455 (match_operand:SI 2 "gpc_reg_operand" "b")
5456 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5459 { return output_isel (operands); }"
5460 [(set_attr "length" "4")])
5462 (define_insn "isel_unsigned"
5463 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5465 (match_operator 1 "comparison_operator"
5466 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5468 (match_operand:SI 2 "gpc_reg_operand" "b")
5469 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5472 { return output_isel (operands); }"
5473 [(set_attr "length" "4")])
5475 (define_expand "movsfcc"
5476 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5477 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5478 (match_operand:SF 2 "gpc_reg_operand" "")
5479 (match_operand:SF 3 "gpc_reg_operand" "")))]
5480 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5483 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5489 (define_insn "*fselsfsf4"
5490 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5491 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5492 (match_operand:SF 4 "zero_fp_constant" "F"))
5493 (match_operand:SF 2 "gpc_reg_operand" "f")
5494 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5495 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5497 [(set_attr "type" "fp")])
5499 (define_insn "*fseldfsf4"
5500 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5501 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5502 (match_operand:DF 4 "zero_fp_constant" "F"))
5503 (match_operand:SF 2 "gpc_reg_operand" "f")
5504 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5505 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5507 [(set_attr "type" "fp")])
5509 (define_insn "negdf2"
5510 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5511 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5512 "TARGET_HARD_FLOAT && TARGET_FPRS"
5514 [(set_attr "type" "fp")])
5516 (define_insn "absdf2"
5517 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5518 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5519 "TARGET_HARD_FLOAT && TARGET_FPRS"
5521 [(set_attr "type" "fp")])
5524 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5525 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5526 "TARGET_HARD_FLOAT && TARGET_FPRS"
5528 [(set_attr "type" "fp")])
5530 (define_insn "adddf3"
5531 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5532 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5533 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5534 "TARGET_HARD_FLOAT && TARGET_FPRS"
5535 "{fa|fadd} %0,%1,%2"
5536 [(set_attr "type" "fp")])
5538 (define_insn "subdf3"
5539 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5540 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5541 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5542 "TARGET_HARD_FLOAT && TARGET_FPRS"
5543 "{fs|fsub} %0,%1,%2"
5544 [(set_attr "type" "fp")])
5546 (define_insn "muldf3"
5547 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5548 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5549 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5550 "TARGET_HARD_FLOAT && TARGET_FPRS"
5551 "{fm|fmul} %0,%1,%2"
5552 [(set_attr "type" "dmul")])
5554 (define_insn "divdf3"
5555 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5556 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5557 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5558 "TARGET_HARD_FLOAT && TARGET_FPRS"
5559 "{fd|fdiv} %0,%1,%2"
5560 [(set_attr "type" "ddiv")])
5563 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5564 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5565 (match_operand:DF 2 "gpc_reg_operand" "f"))
5566 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5567 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5568 "{fma|fmadd} %0,%1,%2,%3"
5569 [(set_attr "type" "dmul")])
5572 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5573 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5574 (match_operand:DF 2 "gpc_reg_operand" "f"))
5575 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5576 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5577 "{fms|fmsub} %0,%1,%2,%3"
5578 [(set_attr "type" "dmul")])
5581 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5582 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5583 (match_operand:DF 2 "gpc_reg_operand" "f"))
5584 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5585 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5586 && HONOR_SIGNED_ZEROS (DFmode)"
5587 "{fnma|fnmadd} %0,%1,%2,%3"
5588 [(set_attr "type" "dmul")])
5591 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5592 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5593 (match_operand:DF 2 "gpc_reg_operand" "f"))
5594 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5595 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5596 && ! HONOR_SIGNED_ZEROS (DFmode)"
5597 "{fnma|fnmadd} %0,%1,%2,%3"
5598 [(set_attr "type" "dmul")])
5601 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5602 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5603 (match_operand:DF 2 "gpc_reg_operand" "f"))
5604 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5605 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5606 && HONOR_SIGNED_ZEROS (DFmode)"
5607 "{fnms|fnmsub} %0,%1,%2,%3"
5608 [(set_attr "type" "dmul")])
5611 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5612 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5613 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5614 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5615 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5616 && ! HONOR_SIGNED_ZEROS (DFmode)"
5617 "{fnms|fnmsub} %0,%1,%2,%3"
5618 [(set_attr "type" "dmul")])
5620 (define_insn "sqrtdf2"
5621 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5622 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5623 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5625 [(set_attr "type" "dsqrt")])
5627 ;; The conditional move instructions allow us to perform max and min
5628 ;; operations even when
5630 (define_expand "maxdf3"
5631 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5632 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5633 (match_operand:DF 2 "gpc_reg_operand" ""))
5636 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5637 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5639 (define_expand "mindf3"
5640 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5641 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5642 (match_operand:DF 2 "gpc_reg_operand" ""))
5645 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5646 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5649 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5650 (match_operator:DF 3 "min_max_operator"
5651 [(match_operand:DF 1 "gpc_reg_operand" "")
5652 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5653 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5656 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5657 operands[1], operands[2]);
5661 (define_expand "movdfcc"
5662 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5663 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5664 (match_operand:DF 2 "gpc_reg_operand" "")
5665 (match_operand:DF 3 "gpc_reg_operand" "")))]
5666 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5669 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5675 (define_insn "*fseldfdf4"
5676 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5677 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5678 (match_operand:DF 4 "zero_fp_constant" "F"))
5679 (match_operand:DF 2 "gpc_reg_operand" "f")
5680 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5681 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5683 [(set_attr "type" "fp")])
5685 (define_insn "*fselsfdf4"
5686 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5687 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5688 (match_operand:SF 4 "zero_fp_constant" "F"))
5689 (match_operand:DF 2 "gpc_reg_operand" "f")
5690 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5693 [(set_attr "type" "fp")])
5695 ;; Conversions to and from floating-point.
5697 (define_expand "fixunssfsi2"
5698 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5699 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "gpc_reg_operand" ""))))]
5700 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5703 (define_expand "fix_truncsfsi2"
5704 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5705 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5706 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5709 ; For each of these conversions, there is a define_expand, a define_insn
5710 ; with a '#' template, and a define_split (with C code). The idea is
5711 ; to allow constant folding with the template of the define_insn,
5712 ; then to have the insns split later (between sched1 and final).
5714 (define_expand "floatsidf2"
5715 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5716 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5719 (clobber (match_dup 4))
5720 (clobber (match_dup 5))
5721 (clobber (match_dup 6))])]
5722 "TARGET_HARD_FLOAT && TARGET_FPRS"
5725 if (TARGET_POWERPC64)
5727 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5728 rtx t1 = gen_reg_rtx (DImode);
5729 rtx t2 = gen_reg_rtx (DImode);
5730 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5734 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5735 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5736 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5737 operands[5] = gen_reg_rtx (DFmode);
5738 operands[6] = gen_reg_rtx (SImode);
5741 (define_insn "*floatsidf2_internal"
5742 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5743 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5744 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5745 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5746 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5747 (clobber (match_operand:DF 5 "gpc_reg_operand" "=f"))
5748 (clobber (match_operand:SI 6 "gpc_reg_operand" "=r"))]
5749 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5751 [(set_attr "length" "24")])
5754 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5755 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5756 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5757 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5758 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5759 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5760 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5761 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5762 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5763 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5764 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5765 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5766 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5767 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5768 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5771 rtx lowword, highword;
5772 if (GET_CODE (operands[4]) != MEM)
5774 highword = XEXP (operands[4], 0);
5775 lowword = plus_constant (highword, 4);
5776 if (! WORDS_BIG_ENDIAN)
5779 tmp = highword; highword = lowword; lowword = tmp;
5782 emit_insn (gen_xorsi3 (operands[6], operands[1],
5783 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5784 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5785 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5786 emit_move_insn (operands[5], operands[4]);
5787 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5791 (define_expand "floatunssisf2"
5792 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5793 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5794 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5797 (define_expand "floatunssidf2"
5798 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5799 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5802 (clobber (match_dup 4))
5803 (clobber (match_dup 5))])]
5804 "TARGET_HARD_FLOAT && TARGET_FPRS"
5807 if (TARGET_POWERPC64)
5809 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5810 rtx t1 = gen_reg_rtx (DImode);
5811 rtx t2 = gen_reg_rtx (DImode);
5812 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5817 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5818 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5819 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5820 operands[5] = gen_reg_rtx (DFmode);
5823 (define_insn "*floatunssidf2_internal"
5824 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5825 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5826 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5827 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5828 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5829 (clobber (match_operand:DF 5 "gpc_reg_operand" "=f"))]
5830 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5832 [(set_attr "length" "20")])
5835 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5836 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5837 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5838 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5839 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5840 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5841 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5842 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5843 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5844 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5845 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5846 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5847 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5850 rtx lowword, highword;
5851 if (GET_CODE (operands[4]) != MEM)
5853 highword = XEXP (operands[4], 0);
5854 lowword = plus_constant (highword, 4);
5855 if (! WORDS_BIG_ENDIAN)
5858 tmp = highword; highword = lowword; lowword = tmp;
5861 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5862 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5863 emit_move_insn (operands[5], operands[4]);
5864 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5868 (define_expand "fix_truncdfsi2"
5869 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5870 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5871 (clobber (match_dup 2))
5872 (clobber (match_dup 3))])]
5873 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5876 operands[2] = gen_reg_rtx (DImode);
5877 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5880 (define_insn "*fix_truncdfsi2_internal"
5881 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5882 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5883 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5884 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5885 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5887 [(set_attr "length" "16")])
5890 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5891 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5892 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5893 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5894 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5895 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5896 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5897 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5898 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5902 if (GET_CODE (operands[3]) != MEM)
5904 lowword = XEXP (operands[3], 0);
5905 if (WORDS_BIG_ENDIAN)
5906 lowword = plus_constant (lowword, 4);
5908 emit_insn (gen_fctiwz (operands[2], operands[1]));
5909 emit_move_insn (operands[3], operands[2]);
5910 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5914 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] 10))
5915 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5916 ; because the first makes it clear that operand 0 is not live
5917 ; before the instruction.
5918 (define_insn "fctiwz"
5919 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5920 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))] 10))]
5921 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5922 "{fcirz|fctiwz} %0,%1"
5923 [(set_attr "type" "fp")])
5925 (define_expand "floatsisf2"
5926 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5927 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5928 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5931 (define_insn "floatdidf2"
5932 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5933 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5934 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5936 [(set_attr "type" "fp")])
5938 (define_insn_and_split "floatsidf_ppc64"
5939 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5940 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5941 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5942 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5943 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5944 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5947 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5948 (set (match_dup 2) (match_dup 3))
5949 (set (match_dup 4) (match_dup 2))
5950 (set (match_dup 0) (float:DF (match_dup 4)))]
5953 (define_insn_and_split "floatunssidf_ppc64"
5954 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5955 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5956 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5957 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5958 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5959 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5962 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5963 (set (match_dup 2) (match_dup 3))
5964 (set (match_dup 4) (match_dup 2))
5965 (set (match_dup 0) (float:DF (match_dup 4)))]
5968 (define_insn "fix_truncdfdi2"
5969 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5970 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5971 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5973 [(set_attr "type" "fp")])
5975 (define_expand "floatdisf2"
5976 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5977 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5978 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5981 if (!flag_unsafe_math_optimizations)
5983 rtx label = gen_label_rtx ();
5984 emit_insn (gen_floatdisf2_internal2 (operands[1], label));
5987 emit_insn (gen_floatdisf2_internal1 (operands[0], operands[1]));
5991 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5992 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5993 ;; from double rounding.
5994 (define_insn_and_split "floatdisf2_internal1"
5995 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5996 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5997 (clobber (match_scratch:DF 2 "=f"))]
5998 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6000 "&& reload_completed"
6002 (float:DF (match_dup 1)))
6004 (float_truncate:SF (match_dup 2)))]
6007 ;; Twiddles bits to avoid double rounding.
6008 ;; Bits that might be trucated when converting to DFmode are replaced
6009 ;; by a bit that won't be lost at that stage, but is below the SFmode
6010 ;; rounding position.
6011 (define_expand "floatdisf2_internal2"
6012 [(parallel [(set (match_dup 4)
6013 (compare:CC (and:DI (match_operand:DI 0 "" "")
6016 (set (match_dup 2) (and:DI (match_dup 0) (const_int 2047)))
6017 (clobber (match_scratch:CC 7 ""))])
6018 (set (match_dup 3) (ashiftrt:DI (match_dup 0) (const_int 53)))
6019 (set (match_dup 3) (plus:DI (match_dup 3) (const_int 1)))
6020 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
6021 (label_ref (match_operand:DI 1 "" ""))
6023 (set (match_dup 5) (compare:CCUNS (match_dup 3) (const_int 2)))
6024 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
6025 (label_ref (match_dup 1))
6027 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 2)))
6028 (set (match_dup 0) (ior:DI (match_dup 0) (const_int 2048)))]
6029 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
6032 operands[2] = gen_reg_rtx (DImode);
6033 operands[3] = gen_reg_rtx (DImode);
6034 operands[4] = gen_reg_rtx (CCmode);
6035 operands[5] = gen_reg_rtx (CCUNSmode);
6038 ;; Define the DImode operations that can be done in a small number
6039 ;; of instructions. The & constraints are to prevent the register
6040 ;; allocator from allocating registers that overlap with the inputs
6041 ;; (for example, having an input in 7,8 and an output in 6,7). We
6042 ;; also allow for the output being the same as one of the inputs.
6044 (define_insn "*adddi3_noppc64"
6045 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
6046 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
6047 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
6048 "! TARGET_POWERPC64"
6051 if (WORDS_BIG_ENDIAN)
6052 return (GET_CODE (operands[2])) != CONST_INT
6053 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
6054 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
6056 return (GET_CODE (operands[2])) != CONST_INT
6057 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
6058 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
6060 [(set_attr "length" "8")])
6062 (define_insn "*subdi3_noppc64"
6063 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
6064 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
6065 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
6066 "! TARGET_POWERPC64"
6069 if (WORDS_BIG_ENDIAN)
6070 return (GET_CODE (operands[1]) != CONST_INT)
6071 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
6072 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
6074 return (GET_CODE (operands[1]) != CONST_INT)
6075 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
6076 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
6078 [(set_attr "length" "8")])
6080 (define_insn "*negdi2_noppc64"
6081 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6082 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
6083 "! TARGET_POWERPC64"
6086 return (WORDS_BIG_ENDIAN)
6087 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
6088 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
6090 [(set_attr "length" "8")])
6092 (define_expand "mulsidi3"
6093 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6094 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6095 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6096 "! TARGET_POWERPC64"
6099 if (! TARGET_POWER && ! TARGET_POWERPC)
6101 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6102 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6103 emit_insn (gen_mull_call ());
6104 if (WORDS_BIG_ENDIAN)
6105 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
6108 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
6109 gen_rtx_REG (SImode, 3));
6110 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
6111 gen_rtx_REG (SImode, 4));
6115 else if (TARGET_POWER)
6117 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
6122 (define_insn "mulsidi3_mq"
6123 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6124 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6125 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6126 (clobber (match_scratch:SI 3 "=q"))]
6128 "mul %0,%1,%2\;mfmq %L0"
6129 [(set_attr "type" "imul")
6130 (set_attr "length" "8")])
6132 (define_insn "*mulsidi3_no_mq"
6133 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6134 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6135 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6136 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6139 return (WORDS_BIG_ENDIAN)
6140 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6141 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6143 [(set_attr "type" "imul")
6144 (set_attr "length" "8")])
6147 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6148 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6149 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6150 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6153 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6154 (sign_extend:DI (match_dup 2)))
6157 (mult:SI (match_dup 1)
6161 int endian = (WORDS_BIG_ENDIAN == 0);
6162 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6163 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6166 (define_expand "umulsidi3"
6167 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6168 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6169 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6170 "TARGET_POWERPC && ! TARGET_POWERPC64"
6175 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6180 (define_insn "umulsidi3_mq"
6181 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6182 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6183 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6184 (clobber (match_scratch:SI 3 "=q"))]
6185 "TARGET_POWERPC && TARGET_POWER"
6188 return (WORDS_BIG_ENDIAN)
6189 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6190 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6192 [(set_attr "type" "imul")
6193 (set_attr "length" "8")])
6195 (define_insn "*umulsidi3_no_mq"
6196 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6197 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6198 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6199 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6202 return (WORDS_BIG_ENDIAN)
6203 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6204 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6206 [(set_attr "type" "imul")
6207 (set_attr "length" "8")])
6210 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6211 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6212 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6213 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6216 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6217 (zero_extend:DI (match_dup 2)))
6220 (mult:SI (match_dup 1)
6224 int endian = (WORDS_BIG_ENDIAN == 0);
6225 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6226 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6229 (define_expand "smulsi3_highpart"
6230 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6232 (lshiftrt:DI (mult:DI (sign_extend:DI
6233 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6235 (match_operand:SI 2 "gpc_reg_operand" "r")))
6240 if (! TARGET_POWER && ! TARGET_POWERPC)
6242 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6243 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6244 emit_insn (gen_mulh_call ());
6245 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6248 else if (TARGET_POWER)
6250 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6255 (define_insn "smulsi3_highpart_mq"
6256 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6258 (lshiftrt:DI (mult:DI (sign_extend:DI
6259 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6261 (match_operand:SI 2 "gpc_reg_operand" "r")))
6263 (clobber (match_scratch:SI 3 "=q"))]
6266 [(set_attr "type" "imul")])
6268 (define_insn "*smulsi3_highpart_no_mq"
6269 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6271 (lshiftrt:DI (mult:DI (sign_extend:DI
6272 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6274 (match_operand:SI 2 "gpc_reg_operand" "r")))
6276 "TARGET_POWERPC && ! TARGET_POWER"
6278 [(set_attr "type" "imul")])
6280 (define_expand "umulsi3_highpart"
6281 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6283 (lshiftrt:DI (mult:DI (zero_extend:DI
6284 (match_operand:SI 1 "gpc_reg_operand" ""))
6286 (match_operand:SI 2 "gpc_reg_operand" "")))
6293 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6298 (define_insn "umulsi3_highpart_mq"
6299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6301 (lshiftrt:DI (mult:DI (zero_extend:DI
6302 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6304 (match_operand:SI 2 "gpc_reg_operand" "r")))
6306 (clobber (match_scratch:SI 3 "=q"))]
6307 "TARGET_POWERPC && TARGET_POWER"
6309 [(set_attr "type" "imul")])
6311 (define_insn "*umulsi3_highpart_no_mq"
6312 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6314 (lshiftrt:DI (mult:DI (zero_extend:DI
6315 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6317 (match_operand:SI 2 "gpc_reg_operand" "r")))
6319 "TARGET_POWERPC && ! TARGET_POWER"
6321 [(set_attr "type" "imul")])
6323 ;; If operands 0 and 2 are in the same register, we have a problem. But
6324 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6325 ;; why we have the strange constraints below.
6326 (define_insn "ashldi3_power"
6327 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6328 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6329 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6330 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6333 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6334 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6335 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6336 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6337 [(set_attr "length" "8")])
6339 (define_insn "lshrdi3_power"
6340 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6341 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6342 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6343 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6346 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6347 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6348 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6349 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6350 [(set_attr "length" "8")])
6352 ;; Shift by a variable amount is too complex to be worth open-coding. We
6353 ;; just handle shifts by constants.
6354 (define_insn "ashrdi3_power"
6355 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6356 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6357 (match_operand:SI 2 "const_int_operand" "M,i")))
6358 (clobber (match_scratch:SI 3 "=X,q"))]
6361 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6362 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6363 [(set_attr "length" "8")])
6365 (define_insn "ashrdi3_no_power"
6366 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6367 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6368 (match_operand:SI 2 "const_int_operand" "M,i")))]
6369 "TARGET_32BIT && !TARGET_POWER"
6371 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6372 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6373 [(set_attr "length" "8,12")])
6375 ;; PowerPC64 DImode operations.
6377 (define_expand "adddi3"
6378 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6379 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6380 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
6384 if (! TARGET_POWERPC64)
6386 if (non_short_cint_operand (operands[2], DImode))
6390 if (GET_CODE (operands[2]) == CONST_INT
6391 && ! add_operand (operands[2], DImode))
6393 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
6394 ? operands[0] : gen_reg_rtx (DImode));
6396 HOST_WIDE_INT val = INTVAL (operands[2]);
6397 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
6398 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
6400 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
6403 /* The ordering here is important for the prolog expander.
6404 When space is allocated from the stack, adding 'low' first may
6405 produce a temporary deallocation (which would be bad). */
6406 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
6407 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
6412 ;; Discourage ai/addic because of carry but provide it in an alternative
6413 ;; allowing register zero as source.
6415 (define_insn "*adddi3_internal1"
6416 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
6417 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
6418 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
6426 (define_insn "*adddi3_internal2"
6427 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6428 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
6429 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
6431 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6438 [(set_attr "type" "compare")
6439 (set_attr "length" "4,4,8,8")])
6442 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6443 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6444 (match_operand:DI 2 "reg_or_short_operand" ""))
6446 (clobber (match_scratch:DI 3 ""))]
6447 "TARGET_POWERPC64 && reload_completed"
6449 (plus:DI (match_dup 1) (match_dup 2)))
6451 (compare:CC (match_dup 3)
6455 (define_insn "*adddi3_internal3"
6456 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6457 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
6458 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
6460 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6461 (plus:DI (match_dup 1) (match_dup 2)))]
6468 [(set_attr "type" "compare")
6469 (set_attr "length" "4,4,8,8")])
6472 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6473 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6474 (match_operand:DI 2 "reg_or_short_operand" ""))
6476 (set (match_operand:DI 0 "gpc_reg_operand" "")
6477 (plus:DI (match_dup 1) (match_dup 2)))]
6478 "TARGET_POWERPC64 && reload_completed"
6480 (plus:DI (match_dup 1) (match_dup 2)))
6482 (compare:CC (match_dup 0)
6486 ;; Split an add that we can't do in one insn into two insns, each of which
6487 ;; does one 16-bit part. This is used by combine. Note that the low-order
6488 ;; add should be last in case the result gets used in an address.
6491 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6492 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6493 (match_operand:DI 2 "non_add_cint_operand" "")))]
6495 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
6496 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
6499 HOST_WIDE_INT val = INTVAL (operands[2]);
6500 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
6501 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
6503 operands[4] = GEN_INT (low);
6504 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
6505 operands[3] = GEN_INT (rest);
6506 else if (! no_new_pseudos)
6508 operands[3] = gen_reg_rtx (DImode);
6509 emit_move_insn (operands[3], operands[2]);
6510 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
6517 (define_insn "one_cmpldi2"
6518 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6519 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6524 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6525 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6527 (clobber (match_scratch:DI 2 "=r,r"))]
6532 [(set_attr "type" "compare")
6533 (set_attr "length" "4,8")])
6536 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6537 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6539 (clobber (match_scratch:DI 2 ""))]
6540 "TARGET_POWERPC64 && reload_completed"
6542 (not:DI (match_dup 1)))
6544 (compare:CC (match_dup 2)
6549 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6550 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6552 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6553 (not:DI (match_dup 1)))]
6558 [(set_attr "type" "compare")
6559 (set_attr "length" "4,8")])
6562 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6563 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6565 (set (match_operand:DI 0 "gpc_reg_operand" "")
6566 (not:DI (match_dup 1)))]
6567 "TARGET_POWERPC64 && reload_completed"
6569 (not:DI (match_dup 1)))
6571 (compare:CC (match_dup 0)
6576 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6577 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
6578 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
6585 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6586 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6587 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6589 (clobber (match_scratch:DI 3 "=r,r"))]
6594 [(set_attr "type" "compare")
6595 (set_attr "length" "4,8")])
6598 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6599 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6600 (match_operand:DI 2 "gpc_reg_operand" ""))
6602 (clobber (match_scratch:DI 3 ""))]
6603 "TARGET_POWERPC64 && reload_completed"
6605 (minus:DI (match_dup 1) (match_dup 2)))
6607 (compare:CC (match_dup 3)
6612 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6613 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6614 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6616 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6617 (minus:DI (match_dup 1) (match_dup 2)))]
6622 [(set_attr "type" "compare")
6623 (set_attr "length" "4,8")])
6626 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6627 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6628 (match_operand:DI 2 "gpc_reg_operand" ""))
6630 (set (match_operand:DI 0 "gpc_reg_operand" "")
6631 (minus:DI (match_dup 1) (match_dup 2)))]
6632 "TARGET_POWERPC64 && reload_completed"
6634 (minus:DI (match_dup 1) (match_dup 2)))
6636 (compare:CC (match_dup 0)
6640 (define_expand "subdi3"
6641 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6642 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
6643 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
6647 if (GET_CODE (operands[2]) == CONST_INT)
6649 emit_insn (gen_adddi3 (operands[0], operands[1],
6650 negate_rtx (DImode, operands[2])));
6655 (define_insn_and_split "absdi2"
6656 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6657 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6658 (clobber (match_scratch:DI 2 "=&r,&r"))]
6661 "&& reload_completed"
6662 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6663 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6664 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6667 (define_insn_and_split "*nabsdi2"
6668 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6669 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6670 (clobber (match_scratch:DI 2 "=&r,&r"))]
6673 "&& reload_completed"
6674 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6675 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6676 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6679 (define_expand "negdi2"
6680 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6681 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6686 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6687 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6692 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6693 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6695 (clobber (match_scratch:DI 2 "=r,r"))]
6700 [(set_attr "type" "compare")
6701 (set_attr "length" "4,8")])
6704 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6705 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6707 (clobber (match_scratch:DI 2 ""))]
6708 "TARGET_POWERPC64 && reload_completed"
6710 (neg:DI (match_dup 1)))
6712 (compare:CC (match_dup 2)
6717 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6718 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6720 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6721 (neg:DI (match_dup 1)))]
6726 [(set_attr "type" "compare")
6727 (set_attr "length" "4,8")])
6730 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6731 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6733 (set (match_operand:DI 0 "gpc_reg_operand" "")
6734 (neg:DI (match_dup 1)))]
6735 "TARGET_POWERPC64 && reload_completed"
6737 (neg:DI (match_dup 1)))
6739 (compare:CC (match_dup 0)
6743 (define_expand "ffsdi2"
6745 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6746 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6748 (clobber (scratch:CC))])
6749 (set (match_dup 4) (unspec:DI [(match_dup 3)] 21))
6750 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6751 (minus:DI (const_int 64) (match_dup 4)))]
6754 operands[2] = gen_reg_rtx (DImode);
6755 operands[3] = gen_reg_rtx (DImode);
6756 operands[4] = gen_reg_rtx (DImode);
6759 (define_insn "cntlzd2"
6760 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6761 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "r")] 21))]
6765 (define_insn "muldi3"
6766 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6767 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6768 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6771 [(set_attr "type" "lmul")])
6773 (define_insn "smuldi3_highpart"
6774 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6776 (lshiftrt:TI (mult:TI (sign_extend:TI
6777 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6779 (match_operand:DI 2 "gpc_reg_operand" "r")))
6783 [(set_attr "type" "lmul")])
6785 (define_insn "umuldi3_highpart"
6786 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6788 (lshiftrt:TI (mult:TI (zero_extend:TI
6789 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6791 (match_operand:DI 2 "gpc_reg_operand" "r")))
6795 [(set_attr "type" "lmul")])
6797 (define_expand "divdi3"
6798 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6799 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6800 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6804 if (GET_CODE (operands[2]) == CONST_INT
6805 && INTVAL (operands[2]) > 0
6806 && exact_log2 (INTVAL (operands[2])) >= 0)
6809 operands[2] = force_reg (DImode, operands[2]);
6812 (define_expand "moddi3"
6813 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6814 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6815 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6823 if (GET_CODE (operands[2]) != CONST_INT
6824 || INTVAL (operands[2]) <= 0
6825 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6828 temp1 = gen_reg_rtx (DImode);
6829 temp2 = gen_reg_rtx (DImode);
6831 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6832 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6833 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6838 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6839 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6840 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6842 "sradi %0,%1,%p2\;addze %0,%0"
6843 [(set_attr "length" "8")])
6846 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6847 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6848 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6850 (clobber (match_scratch:DI 3 "=r,r"))]
6853 sradi %3,%1,%p2\;addze. %3,%3
6855 [(set_attr "type" "compare")
6856 (set_attr "length" "8,12")])
6859 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6860 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6861 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6863 (clobber (match_scratch:DI 3 ""))]
6864 "TARGET_POWERPC64 && reload_completed"
6866 (div:DI (match_dup 1) (match_dup 2)))
6868 (compare:CC (match_dup 3)
6873 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6874 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6875 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6877 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6878 (div:DI (match_dup 1) (match_dup 2)))]
6881 sradi %0,%1,%p2\;addze. %0,%0
6883 [(set_attr "type" "compare")
6884 (set_attr "length" "8,12")])
6887 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6888 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6889 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6891 (set (match_operand:DI 0 "gpc_reg_operand" "")
6892 (div:DI (match_dup 1) (match_dup 2)))]
6893 "TARGET_POWERPC64 && reload_completed"
6895 (div:DI (match_dup 1) (match_dup 2)))
6897 (compare:CC (match_dup 0)
6902 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6903 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6904 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6907 [(set_attr "type" "ldiv")])
6909 (define_insn "udivdi3"
6910 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6911 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6912 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6915 [(set_attr "type" "ldiv")])
6917 (define_insn "rotldi3"
6918 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6919 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6920 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6922 "rld%I2cl %0,%1,%H2,0")
6924 (define_insn "*rotldi3_internal2"
6925 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6926 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6927 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6929 (clobber (match_scratch:DI 3 "=r,r"))]
6932 rld%I2cl. %3,%1,%H2,0
6934 [(set_attr "type" "delayed_compare")
6935 (set_attr "length" "4,8")])
6938 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6939 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6940 (match_operand:DI 2 "reg_or_cint_operand" ""))
6942 (clobber (match_scratch:DI 3 ""))]
6943 "TARGET_POWERPC64 && reload_completed"
6945 (rotate:DI (match_dup 1) (match_dup 2)))
6947 (compare:CC (match_dup 3)
6951 (define_insn "*rotldi3_internal3"
6952 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6953 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6954 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6956 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6957 (rotate:DI (match_dup 1) (match_dup 2)))]
6960 rld%I2cl. %0,%1,%H2,0
6962 [(set_attr "type" "delayed_compare")
6963 (set_attr "length" "4,8")])
6966 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6967 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6968 (match_operand:DI 2 "reg_or_cint_operand" ""))
6970 (set (match_operand:DI 0 "gpc_reg_operand" "")
6971 (rotate:DI (match_dup 1) (match_dup 2)))]
6972 "TARGET_POWERPC64 && reload_completed"
6974 (rotate:DI (match_dup 1) (match_dup 2)))
6976 (compare:CC (match_dup 0)
6980 (define_insn "*rotldi3_internal4"
6981 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6982 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6983 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6984 (match_operand:DI 3 "mask64_operand" "n")))]
6986 "rld%I2c%B3 %0,%1,%H2,%S3")
6988 (define_insn "*rotldi3_internal5"
6989 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6991 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6992 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6993 (match_operand:DI 3 "mask64_operand" "n,n"))
6995 (clobber (match_scratch:DI 4 "=r,r"))]
6998 rld%I2c%B3. %4,%1,%H2,%S3
7000 [(set_attr "type" "delayed_compare")
7001 (set_attr "length" "4,8")])
7004 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7006 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7007 (match_operand:DI 2 "reg_or_cint_operand" ""))
7008 (match_operand:DI 3 "mask64_operand" ""))
7010 (clobber (match_scratch:DI 4 ""))]
7011 "TARGET_POWERPC64 && reload_completed"
7013 (and:DI (rotate:DI (match_dup 1)
7017 (compare:CC (match_dup 4)
7021 (define_insn "*rotldi3_internal6"
7022 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7024 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7025 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
7026 (match_operand:DI 3 "mask64_operand" "n,n"))
7028 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7029 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7032 rld%I2c%B3. %0,%1,%H2,%S3
7034 [(set_attr "type" "delayed_compare")
7035 (set_attr "length" "4,8")])
7038 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7040 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7041 (match_operand:DI 2 "reg_or_cint_operand" ""))
7042 (match_operand:DI 3 "mask64_operand" ""))
7044 (set (match_operand:DI 0 "gpc_reg_operand" "")
7045 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7046 "TARGET_POWERPC64 && reload_completed"
7048 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
7050 (compare:CC (match_dup 0)
7054 (define_insn "*rotldi3_internal7"
7055 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7058 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7059 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
7061 "rld%I2cl %0,%1,%H2,56")
7063 (define_insn "*rotldi3_internal8"
7064 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7065 (compare:CC (zero_extend:DI
7067 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7068 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7070 (clobber (match_scratch:DI 3 "=r,r"))]
7073 rld%I2cl. %3,%1,%H2,56
7075 [(set_attr "type" "delayed_compare")
7076 (set_attr "length" "4,8")])
7079 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7080 (compare:CC (zero_extend:DI
7082 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7083 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7085 (clobber (match_scratch:DI 3 ""))]
7086 "TARGET_POWERPC64 && reload_completed"
7088 (zero_extend:DI (subreg:QI
7089 (rotate:DI (match_dup 1)
7092 (compare:CC (match_dup 3)
7096 (define_insn "*rotldi3_internal9"
7097 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7098 (compare:CC (zero_extend:DI
7100 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7101 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7103 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7104 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7107 rld%I2cl. %0,%1,%H2,56
7109 [(set_attr "type" "delayed_compare")
7110 (set_attr "length" "4,8")])
7113 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7114 (compare:CC (zero_extend:DI
7116 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7117 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7119 (set (match_operand:DI 0 "gpc_reg_operand" "")
7120 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7121 "TARGET_POWERPC64 && reload_completed"
7123 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7125 (compare:CC (match_dup 0)
7129 (define_insn "*rotldi3_internal10"
7130 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7133 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7134 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
7136 "rld%I2cl %0,%1,%H2,48")
7138 (define_insn "*rotldi3_internal11"
7139 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7140 (compare:CC (zero_extend:DI
7142 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7143 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7145 (clobber (match_scratch:DI 3 "=r,r"))]
7148 rld%I2cl. %3,%1,%H2,48
7150 [(set_attr "type" "delayed_compare")
7151 (set_attr "length" "4,8")])
7154 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7155 (compare:CC (zero_extend:DI
7157 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7158 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7160 (clobber (match_scratch:DI 3 ""))]
7161 "TARGET_POWERPC64 && reload_completed"
7163 (zero_extend:DI (subreg:HI
7164 (rotate:DI (match_dup 1)
7167 (compare:CC (match_dup 3)
7171 (define_insn "*rotldi3_internal12"
7172 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7173 (compare:CC (zero_extend:DI
7175 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7176 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7178 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7179 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7182 rld%I2cl. %0,%1,%H2,48
7184 [(set_attr "type" "delayed_compare")
7185 (set_attr "length" "4,8")])
7188 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7189 (compare:CC (zero_extend:DI
7191 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7192 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7194 (set (match_operand:DI 0 "gpc_reg_operand" "")
7195 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7196 "TARGET_POWERPC64 && reload_completed"
7198 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7200 (compare:CC (match_dup 0)
7204 (define_insn "*rotldi3_internal13"
7205 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7208 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7209 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
7211 "rld%I2cl %0,%1,%H2,32")
7213 (define_insn "*rotldi3_internal14"
7214 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7215 (compare:CC (zero_extend:DI
7217 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7218 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7220 (clobber (match_scratch:DI 3 "=r,r"))]
7223 rld%I2cl. %3,%1,%H2,32
7225 [(set_attr "type" "delayed_compare")
7226 (set_attr "length" "4,8")])
7229 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7230 (compare:CC (zero_extend:DI
7232 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7233 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7235 (clobber (match_scratch:DI 3 ""))]
7236 "TARGET_POWERPC64 && reload_completed"
7238 (zero_extend:DI (subreg:SI
7239 (rotate:DI (match_dup 1)
7242 (compare:CC (match_dup 3)
7246 (define_insn "*rotldi3_internal15"
7247 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7248 (compare:CC (zero_extend:DI
7250 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7251 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7253 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7254 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7257 rld%I2cl. %0,%1,%H2,32
7259 [(set_attr "type" "delayed_compare")
7260 (set_attr "length" "4,8")])
7263 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7264 (compare:CC (zero_extend:DI
7266 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7267 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7269 (set (match_operand:DI 0 "gpc_reg_operand" "")
7270 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7271 "TARGET_POWERPC64 && reload_completed"
7273 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7275 (compare:CC (match_dup 0)
7279 (define_expand "ashldi3"
7280 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7281 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7282 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7283 "TARGET_POWERPC64 || TARGET_POWER"
7286 if (TARGET_POWERPC64)
7288 else if (TARGET_POWER)
7290 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7297 (define_insn "*ashldi3_internal1"
7298 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7299 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7300 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7303 [(set_attr "length" "8")])
7305 (define_insn "*ashldi3_internal2"
7306 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7307 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7308 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7310 (clobber (match_scratch:DI 3 "=r,r"))]
7315 [(set_attr "type" "delayed_compare")
7316 (set_attr "length" "4,8")])
7319 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7320 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7321 (match_operand:SI 2 "reg_or_cint_operand" ""))
7323 (clobber (match_scratch:DI 3 ""))]
7324 "TARGET_POWERPC64 && reload_completed"
7326 (ashift:DI (match_dup 1) (match_dup 2)))
7328 (compare:CC (match_dup 3)
7332 (define_insn "*ashldi3_internal3"
7333 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7334 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7335 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7337 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7338 (ashift:DI (match_dup 1) (match_dup 2)))]
7343 [(set_attr "type" "delayed_compare")
7344 (set_attr "length" "4,8")])
7347 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7348 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7349 (match_operand:SI 2 "reg_or_cint_operand" ""))
7351 (set (match_operand:DI 0 "gpc_reg_operand" "")
7352 (ashift:DI (match_dup 1) (match_dup 2)))]
7353 "TARGET_POWERPC64 && reload_completed"
7355 (ashift:DI (match_dup 1) (match_dup 2)))
7357 (compare:CC (match_dup 0)
7361 (define_insn "*ashldi3_internal4"
7362 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7363 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7364 (match_operand:SI 2 "const_int_operand" "i"))
7365 (match_operand:DI 3 "const_int_operand" "n")))]
7366 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7367 "rldic %0,%1,%H2,%W3")
7369 (define_insn "ashldi3_internal5"
7370 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7372 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7373 (match_operand:SI 2 "const_int_operand" "i,i"))
7374 (match_operand:DI 3 "const_int_operand" "n,n"))
7376 (clobber (match_scratch:DI 4 "=r,r"))]
7377 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7379 rldic. %4,%1,%H2,%W3
7381 [(set_attr "type" "delayed_compare")
7382 (set_attr "length" "4,8")])
7385 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7387 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7388 (match_operand:SI 2 "const_int_operand" ""))
7389 (match_operand:DI 3 "const_int_operand" ""))
7391 (clobber (match_scratch:DI 4 ""))]
7392 "TARGET_POWERPC64 && reload_completed
7393 && includes_rldic_lshift_p (operands[2], operands[3])"
7395 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7398 (compare:CC (match_dup 4)
7402 (define_insn "*ashldi3_internal6"
7403 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7405 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7406 (match_operand:SI 2 "const_int_operand" "i,i"))
7407 (match_operand:DI 3 "const_int_operand" "n,n"))
7409 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7410 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7411 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7413 rldic. %0,%1,%H2,%W3
7415 [(set_attr "type" "delayed_compare")
7416 (set_attr "length" "4,8")])
7419 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7421 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7422 (match_operand:SI 2 "const_int_operand" ""))
7423 (match_operand:DI 3 "const_int_operand" ""))
7425 (set (match_operand:DI 0 "gpc_reg_operand" "")
7426 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7427 "TARGET_POWERPC64 && reload_completed
7428 && includes_rldic_lshift_p (operands[2], operands[3])"
7430 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7433 (compare:CC (match_dup 0)
7437 (define_insn "*ashldi3_internal7"
7438 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7439 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7440 (match_operand:SI 2 "const_int_operand" "i"))
7441 (match_operand:DI 3 "mask64_operand" "n")))]
7442 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7443 "rldicr %0,%1,%H2,%S3")
7445 (define_insn "ashldi3_internal8"
7446 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7448 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7449 (match_operand:SI 2 "const_int_operand" "i,i"))
7450 (match_operand:DI 3 "mask64_operand" "n,n"))
7452 (clobber (match_scratch:DI 4 "=r,r"))]
7453 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7455 rldicr. %4,%1,%H2,%S3
7457 [(set_attr "type" "delayed_compare")
7458 (set_attr "length" "4,8")])
7461 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7463 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7464 (match_operand:SI 2 "const_int_operand" ""))
7465 (match_operand:DI 3 "mask64_operand" ""))
7467 (clobber (match_scratch:DI 4 ""))]
7468 "TARGET_POWERPC64 && reload_completed
7469 && includes_rldicr_lshift_p (operands[2], operands[3])"
7471 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7474 (compare:CC (match_dup 4)
7478 (define_insn "*ashldi3_internal9"
7479 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7481 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7482 (match_operand:SI 2 "const_int_operand" "i,i"))
7483 (match_operand:DI 3 "mask64_operand" "n,n"))
7485 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7486 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7487 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7489 rldicr. %0,%1,%H2,%S3
7491 [(set_attr "type" "delayed_compare")
7492 (set_attr "length" "4,8")])
7495 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7497 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7498 (match_operand:SI 2 "const_int_operand" ""))
7499 (match_operand:DI 3 "mask64_operand" ""))
7501 (set (match_operand:DI 0 "gpc_reg_operand" "")
7502 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7503 "TARGET_POWERPC64 && reload_completed
7504 && includes_rldicr_lshift_p (operands[2], operands[3])"
7506 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7509 (compare:CC (match_dup 0)
7513 (define_expand "lshrdi3"
7514 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7515 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7516 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7517 "TARGET_POWERPC64 || TARGET_POWER"
7520 if (TARGET_POWERPC64)
7522 else if (TARGET_POWER)
7524 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7531 (define_insn "*lshrdi3_internal1"
7532 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7533 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7534 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7538 (define_insn "*lshrdi3_internal2"
7539 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7540 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7541 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7543 (clobber (match_scratch:DI 3 "=r,r"))]
7548 [(set_attr "type" "delayed_compare")
7549 (set_attr "length" "4,8")])
7552 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7553 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7554 (match_operand:SI 2 "reg_or_cint_operand" ""))
7556 (clobber (match_scratch:DI 3 ""))]
7557 "TARGET_POWERPC64 && reload_completed"
7559 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7561 (compare:CC (match_dup 3)
7565 (define_insn "*lshrdi3_internal3"
7566 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7567 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7568 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7570 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7571 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7576 [(set_attr "type" "delayed_compare")
7577 (set_attr "length" "4,8")])
7580 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7581 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7582 (match_operand:SI 2 "reg_or_cint_operand" ""))
7584 (set (match_operand:DI 0 "gpc_reg_operand" "")
7585 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7586 "TARGET_POWERPC64 && reload_completed"
7588 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7590 (compare:CC (match_dup 0)
7594 (define_expand "ashrdi3"
7595 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7596 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7597 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7601 if (TARGET_POWERPC64)
7603 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7605 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7608 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT)
7610 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7617 (define_insn "*ashrdi3_internal1"
7618 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7619 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7620 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7622 "srad%I2 %0,%1,%H2")
7624 (define_insn "*ashrdi3_internal2"
7625 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7626 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7627 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7629 (clobber (match_scratch:DI 3 "=r,r"))]
7634 [(set_attr "type" "delayed_compare")
7635 (set_attr "length" "4,8")])
7638 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7639 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7640 (match_operand:SI 2 "reg_or_cint_operand" ""))
7642 (clobber (match_scratch:DI 3 ""))]
7643 "TARGET_POWERPC64 && reload_completed"
7645 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7647 (compare:CC (match_dup 3)
7651 (define_insn "*ashrdi3_internal3"
7652 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7653 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7654 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7656 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7657 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7662 [(set_attr "type" "delayed_compare")
7663 (set_attr "length" "4,8")])
7666 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7667 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7668 (match_operand:SI 2 "reg_or_cint_operand" ""))
7670 (set (match_operand:DI 0 "gpc_reg_operand" "")
7671 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7672 "TARGET_POWERPC64 && reload_completed"
7674 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7676 (compare:CC (match_dup 0)
7680 (define_insn "anddi3"
7681 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
7682 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
7683 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
7684 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
7688 rldic%B2 %0,%1,0,%S2
7692 [(set_attr "length" "4,4,4,4,8")])
7695 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7696 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7697 (match_operand:DI 2 "mask64_2_operand" "")))
7698 (clobber (match_scratch:CC 3 ""))]
7700 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7701 && !mask64_operand (operands[2], DImode)"
7703 (and:DI (rotate:DI (match_dup 1)
7707 (and:DI (rotate:DI (match_dup 0)
7712 build_mask64_2_operands (operands[2], &operands[4]);
7715 (define_insn "*anddi3_internal2"
7716 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7717 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7718 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7720 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7721 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7725 rldic%B2. %3,%1,0,%S2
7734 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7735 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7738 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7739 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7740 (match_operand:DI 2 "and64_operand" ""))
7742 (clobber (match_scratch:DI 3 ""))
7743 (clobber (match_scratch:CC 4 ""))]
7744 "TARGET_POWERPC64 && reload_completed"
7745 [(parallel [(set (match_dup 3)
7746 (and:DI (match_dup 1)
7748 (clobber (match_dup 4))])
7750 (compare:CC (match_dup 3)
7755 [(set (match_operand:CC 0 "cc_reg_operand" "")
7756 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7757 (match_operand:DI 2 "mask64_2_operand" ""))
7759 (clobber (match_scratch:DI 3 ""))
7760 (clobber (match_scratch:CC 4 ""))]
7761 "TARGET_POWERPC64 && reload_completed
7762 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7763 && !mask64_operand (operands[2], DImode)"
7765 (and:DI (rotate:DI (match_dup 1)
7768 (parallel [(set (match_dup 0)
7769 (compare:CC (and:DI (rotate:DI (match_dup 3)
7773 (clobber (match_dup 3))])]
7776 build_mask64_2_operands (operands[2], &operands[5]);
7779 (define_insn "*anddi3_internal3"
7780 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7781 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7782 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7784 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7785 (and:DI (match_dup 1) (match_dup 2)))
7786 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7790 rldic%B2. %0,%1,0,%S2
7799 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7800 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7803 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7804 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7805 (match_operand:DI 2 "and64_operand" ""))
7807 (set (match_operand:DI 0 "gpc_reg_operand" "")
7808 (and:DI (match_dup 1) (match_dup 2)))
7809 (clobber (match_scratch:CC 4 ""))]
7810 "TARGET_POWERPC64 && reload_completed"
7811 [(parallel [(set (match_dup 0)
7812 (and:DI (match_dup 1) (match_dup 2)))
7813 (clobber (match_dup 4))])
7815 (compare:CC (match_dup 0)
7820 [(set (match_operand:CC 3 "cc_reg_operand" "")
7821 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7822 (match_operand:DI 2 "mask64_2_operand" ""))
7824 (set (match_operand:DI 0 "gpc_reg_operand" "")
7825 (and:DI (match_dup 1) (match_dup 2)))
7826 (clobber (match_scratch:CC 4 ""))]
7827 "TARGET_POWERPC64 && reload_completed
7828 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7829 && !mask64_operand (operands[2], DImode)"
7831 (and:DI (rotate:DI (match_dup 1)
7834 (parallel [(set (match_dup 3)
7835 (compare:CC (and:DI (rotate:DI (match_dup 0)
7840 (and:DI (rotate:DI (match_dup 0)
7845 build_mask64_2_operands (operands[2], &operands[5]);
7848 (define_expand "iordi3"
7849 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7850 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7851 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7855 if (non_logical_cint_operand (operands[2], DImode))
7857 HOST_WIDE_INT value;
7858 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7859 ? operands[0] : gen_reg_rtx (DImode));
7861 if (GET_CODE (operands[2]) == CONST_INT)
7863 value = INTVAL (operands[2]);
7864 emit_insn (gen_iordi3 (tmp, operands[1],
7865 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7869 value = CONST_DOUBLE_LOW (operands[2]);
7870 emit_insn (gen_iordi3 (tmp, operands[1],
7871 immed_double_const (value
7872 & (~ (HOST_WIDE_INT) 0xffff),
7876 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7881 (define_expand "xordi3"
7882 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7883 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7884 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7888 if (non_logical_cint_operand (operands[2], DImode))
7890 HOST_WIDE_INT value;
7891 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7892 ? operands[0] : gen_reg_rtx (DImode));
7894 if (GET_CODE (operands[2]) == CONST_INT)
7896 value = INTVAL (operands[2]);
7897 emit_insn (gen_xordi3 (tmp, operands[1],
7898 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7902 value = CONST_DOUBLE_LOW (operands[2]);
7903 emit_insn (gen_xordi3 (tmp, operands[1],
7904 immed_double_const (value
7905 & (~ (HOST_WIDE_INT) 0xffff),
7909 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7914 (define_insn "*booldi3_internal1"
7915 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7916 (match_operator:DI 3 "boolean_or_operator"
7917 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7918 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7925 (define_insn "*booldi3_internal2"
7926 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7927 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7928 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7929 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7931 (clobber (match_scratch:DI 3 "=r,r"))]
7936 [(set_attr "type" "compare")
7937 (set_attr "length" "4,8")])
7940 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7941 (compare:CC (match_operator:DI 4 "boolean_operator"
7942 [(match_operand:DI 1 "gpc_reg_operand" "")
7943 (match_operand:DI 2 "gpc_reg_operand" "")])
7945 (clobber (match_scratch:DI 3 ""))]
7946 "TARGET_POWERPC64 && reload_completed"
7947 [(set (match_dup 3) (match_dup 4))
7949 (compare:CC (match_dup 3)
7953 (define_insn "*booldi3_internal3"
7954 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7955 (compare:CC (match_operator:DI 4 "boolean_operator"
7956 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7957 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7959 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7965 [(set_attr "type" "compare")
7966 (set_attr "length" "4,8")])
7969 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7970 (compare:CC (match_operator:DI 4 "boolean_operator"
7971 [(match_operand:DI 1 "gpc_reg_operand" "")
7972 (match_operand:DI 2 "gpc_reg_operand" "")])
7974 (set (match_operand:DI 0 "gpc_reg_operand" "")
7976 "TARGET_POWERPC64 && reload_completed"
7977 [(set (match_dup 0) (match_dup 4))
7979 (compare:CC (match_dup 0)
7983 ;; Split an logical operation that we can't do in one insn into two insns,
7984 ;; each of which does one 16-bit part. This is used by combine.
7987 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7988 (match_operator:DI 3 "boolean_or_operator"
7989 [(match_operand:DI 1 "gpc_reg_operand" "")
7990 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7992 [(set (match_dup 0) (match_dup 4))
7993 (set (match_dup 0) (match_dup 5))]
7998 if (GET_CODE (operands[2]) == CONST_DOUBLE)
8000 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
8001 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
8003 i4 = GEN_INT (value & 0xffff);
8007 i3 = GEN_INT (INTVAL (operands[2])
8008 & (~ (HOST_WIDE_INT) 0xffff));
8009 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
8011 operands[4] = gen_rtx (GET_CODE (operands[3]), DImode,
8013 operands[5] = gen_rtx (GET_CODE (operands[3]), DImode,
8017 (define_insn "*boolcdi3_internal1"
8018 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8019 (match_operator:DI 3 "boolean_operator"
8020 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8021 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
8025 (define_insn "*boolcdi3_internal2"
8026 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8027 (compare:CC (match_operator:DI 4 "boolean_operator"
8028 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8029 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8031 (clobber (match_scratch:DI 3 "=r,r"))]
8036 [(set_attr "type" "compare")
8037 (set_attr "length" "4,8")])
8040 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8041 (compare:CC (match_operator:DI 4 "boolean_operator"
8042 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8043 (match_operand:DI 2 "gpc_reg_operand" "")])
8045 (clobber (match_scratch:DI 3 ""))]
8046 "TARGET_POWERPC64 && reload_completed"
8047 [(set (match_dup 3) (match_dup 4))
8049 (compare:CC (match_dup 3)
8053 (define_insn "*boolcdi3_internal3"
8054 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8055 (compare:CC (match_operator:DI 4 "boolean_operator"
8056 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8057 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
8059 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8065 [(set_attr "type" "compare")
8066 (set_attr "length" "4,8")])
8069 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8070 (compare:CC (match_operator:DI 4 "boolean_operator"
8071 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8072 (match_operand:DI 2 "gpc_reg_operand" "")])
8074 (set (match_operand:DI 0 "gpc_reg_operand" "")
8076 "TARGET_POWERPC64 && reload_completed"
8077 [(set (match_dup 0) (match_dup 4))
8079 (compare:CC (match_dup 0)
8083 (define_insn "*boolccdi3_internal1"
8084 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8085 (match_operator:DI 3 "boolean_operator"
8086 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
8087 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
8091 (define_insn "*boolccdi3_internal2"
8092 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
8093 (compare:CC (match_operator:DI 4 "boolean_operator"
8094 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
8095 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8097 (clobber (match_scratch:DI 3 "=r,r"))]
8102 [(set_attr "type" "compare")
8103 (set_attr "length" "4,8")])
8106 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
8107 (compare:CC (match_operator:DI 4 "boolean_operator"
8108 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8109 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8111 (clobber (match_scratch:DI 3 ""))]
8112 "TARGET_POWERPC64 && reload_completed"
8113 [(set (match_dup 3) (match_dup 4))
8115 (compare:CC (match_dup 3)
8119 (define_insn "*boolccdi3_internal3"
8120 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
8121 (compare:CC (match_operator:DI 4 "boolean_operator"
8122 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
8123 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
8125 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
8131 [(set_attr "type" "compare")
8132 (set_attr "length" "4,8")])
8135 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
8136 (compare:CC (match_operator:DI 4 "boolean_operator"
8137 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
8138 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
8140 (set (match_operand:DI 0 "gpc_reg_operand" "")
8142 "TARGET_POWERPC64 && reload_completed"
8143 [(set (match_dup 0) (match_dup 4))
8145 (compare:CC (match_dup 0)
8149 ;; Now define ways of moving data around.
8151 ;; Elf specific ways of loading addresses for non-PIC code.
8152 ;; The output of this could be r0, but we make a very strong
8153 ;; preference for a base register because it will usually
8155 (define_insn "elf_high"
8156 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
8157 (high:SI (match_operand 1 "" "")))]
8158 "TARGET_ELF && ! TARGET_64BIT"
8159 "{liu|lis} %0,%1@ha")
8161 (define_insn "elf_low"
8162 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8163 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
8164 (match_operand 2 "" "")))]
8165 "TARGET_ELF && ! TARGET_64BIT"
8167 {cal|la} %0,%2@l(%1)
8168 {ai|addic} %0,%1,%K2")
8170 ;; Mach-O PIC trickery.
8171 (define_insn "macho_high"
8172 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
8173 (high:SI (match_operand 1 "" "")))]
8174 "TARGET_MACHO && ! TARGET_64BIT"
8175 "{liu|lis} %0,ha16(%1)")
8177 (define_insn "macho_low"
8178 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8179 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
8180 (match_operand 2 "" "")))]
8181 "TARGET_MACHO && ! TARGET_64BIT"
8183 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
8184 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
8186 ;; Set up a register with a value from the GOT table
8188 (define_expand "movsi_got"
8189 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8190 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8192 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8195 if (GET_CODE (operands[1]) == CONST)
8197 rtx offset = const0_rtx;
8198 HOST_WIDE_INT value;
8200 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8201 value = INTVAL (offset);
8204 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
8205 emit_insn (gen_movsi_got (tmp, operands[1]));
8206 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8211 operands[2] = rs6000_got_register (operands[1]);
8214 (define_insn "*movsi_got_internal"
8215 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8216 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8217 (match_operand:SI 2 "gpc_reg_operand" "b")] 8))]
8218 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8219 "{l|lwz} %0,%a1@got(%2)"
8220 [(set_attr "type" "load")])
8222 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8223 ;; didn't get allocated to a hard register.
8225 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8226 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8227 (match_operand:SI 2 "memory_operand" "")] 8))]
8228 "DEFAULT_ABI == ABI_V4
8230 && (reload_in_progress || reload_completed)"
8231 [(set (match_dup 0) (match_dup 2))
8232 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)] 8))]
8235 ;; For SI, we special-case integers that can't be loaded in one insn. We
8236 ;; do the load 16-bits at a time. We could do this by loading from memory,
8237 ;; and this is even supposed to be faster, but it is simpler not to get
8238 ;; integers in the TOC.
8239 (define_expand "movsi"
8240 [(set (match_operand:SI 0 "general_operand" "")
8241 (match_operand:SI 1 "any_operand" ""))]
8243 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
8245 (define_insn "movsi_low"
8246 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8247 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8248 (match_operand 2 "" ""))))]
8249 "TARGET_MACHO && ! TARGET_64BIT"
8250 "{l|lwz} %0,lo16(%2)(%1)"
8251 [(set_attr "type" "load")
8252 (set_attr "length" "4")])
8254 (define_insn "movsi_low_st"
8255 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8256 (match_operand 2 "" "")))
8257 (match_operand:SI 0 "gpc_reg_operand" "r"))]
8258 "TARGET_MACHO && ! TARGET_64BIT"
8259 "{st|stw} %0,lo16(%2)(%1)"
8260 [(set_attr "type" "store")
8261 (set_attr "length" "4")])
8263 (define_insn "movdf_low"
8264 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
8265 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
8266 (match_operand 2 "" ""))))]
8267 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8270 switch (which_alternative)
8273 return \"lfd %0,lo16(%2)(%1)\";
8277 operands2[0] = operands[0];
8278 operands2[1] = operands[1];
8279 operands2[2] = operands[2];
8280 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
8281 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
8282 /* We cannot rely on ha16(low half)==ha16(high half), alas,
8283 although in practice it almost always is. */
8284 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
8285 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
8291 [(set_attr "type" "load")
8292 (set_attr "length" "4,12")])
8294 (define_insn "movdf_low_st"
8295 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8296 (match_operand 2 "" "")))
8297 (match_operand:DF 0 "gpc_reg_operand" "f"))]
8298 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8299 "stfd %0,lo16(%2)(%1)"
8300 [(set_attr "type" "store")
8301 (set_attr "length" "4")])
8303 (define_insn "movsf_low"
8304 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
8305 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
8306 (match_operand 2 "" ""))))]
8307 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8310 {l|lwz} %0,lo16(%2)(%1)"
8311 [(set_attr "type" "load")
8312 (set_attr "length" "4")])
8314 (define_insn "movsf_low_st"
8315 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
8316 (match_operand 2 "" "")))
8317 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
8318 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8320 stfs %0,lo16(%2)(%1)
8321 {st|stw} %0,lo16(%2)(%1)"
8322 [(set_attr "type" "store")
8323 (set_attr "length" "4")])
8325 (define_insn "*movsi_internal1"
8326 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8327 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8328 "gpc_reg_operand (operands[0], SImode)
8329 || gpc_reg_operand (operands[1], SImode)"
8333 {l%U1%X1|lwz%U1%X1} %0,%1
8334 {st%U0%X0|stw%U0%X0} %1,%0
8344 [(set_attr "type" "*,*,load,store,*,*,*,*,*,*,mtjmpr,*,*")
8345 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8347 ;; Split a load of a large constant into the appropriate two-insn
8351 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8352 (match_operand:SI 1 "const_int_operand" ""))]
8353 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8354 && (INTVAL (operands[1]) & 0xffff) != 0"
8358 (ior:SI (match_dup 0)
8361 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
8363 if (tem == operands[0])
8369 (define_insn "*movsi_internal2"
8370 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
8371 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r,r")
8373 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
8374 "! TARGET_POWERPC64"
8378 [(set_attr "type" "compare")
8379 (set_attr "length" "4,8")])
8382 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8383 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8385 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
8386 "! TARGET_POWERPC64 && reload_completed"
8387 [(set (match_dup 0) (match_dup 1))
8389 (compare:CC (match_dup 0)
8393 (define_expand "movhi"
8394 [(set (match_operand:HI 0 "general_operand" "")
8395 (match_operand:HI 1 "any_operand" ""))]
8397 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
8399 (define_insn "*movhi_internal"
8400 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8401 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8402 "gpc_reg_operand (operands[0], HImode)
8403 || gpc_reg_operand (operands[1], HImode)"
8413 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
8415 (define_expand "movqi"
8416 [(set (match_operand:QI 0 "general_operand" "")
8417 (match_operand:QI 1 "any_operand" ""))]
8419 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
8421 (define_insn "*movqi_internal"
8422 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8423 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8424 "gpc_reg_operand (operands[0], QImode)
8425 || gpc_reg_operand (operands[1], QImode)"
8435 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
8437 ;; Here is how to move condition codes around. When we store CC data in
8438 ;; an integer register or memory, we store just the high-order 4 bits.
8439 ;; This lets us not shift in the most common case of CR0.
8440 (define_expand "movcc"
8441 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8442 (match_operand:CC 1 "nonimmediate_operand" ""))]
8446 (define_insn "*movcc_internal1"
8447 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,cl,q,r,r,m")
8448 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,r,r,h,m,r"))]
8449 "register_operand (operands[0], CCmode)
8450 || register_operand (operands[1], CCmode)"
8454 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8456 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8461 {l%U1%X1|lwz%U1%X1} %0,%1
8462 {st%U0%U1|stw%U0%U1} %1,%0"
8463 [(set_attr "type" "cr_logical,cr_logical,cr_logical,cr_logical,cr_logical,*,*,mtjmpr,*,load,store")
8464 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
8466 ;; For floating-point, we normally deal with the floating-point registers
8467 ;; unless -msoft-float is used. The sole exception is that parameter passing
8468 ;; can produce floating-point values in fixed-point registers. Unless the
8469 ;; value is a simple constant or already in memory, we deal with this by
8470 ;; allocating memory and copying the value explicitly via that memory location.
8471 (define_expand "movsf"
8472 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8473 (match_operand:SF 1 "any_operand" ""))]
8475 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8478 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8479 (match_operand:SF 1 "const_double_operand" ""))]
8481 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8482 || (GET_CODE (operands[0]) == SUBREG
8483 && GET_CODE (SUBREG_REG (operands[0])) == REG
8484 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8485 [(set (match_dup 2) (match_dup 3))]
8491 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8492 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8494 if (! TARGET_POWERPC64)
8495 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8497 operands[2] = gen_lowpart (SImode, operands[0]);
8499 operands[3] = gen_int_mode (l, SImode);
8502 (define_insn "*movsf_hardfloat"
8503 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!r,!r")
8504 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,G,Fn"))]
8505 "(gpc_reg_operand (operands[0], SFmode)
8506 || gpc_reg_operand (operands[1], SFmode))
8507 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8510 {l%U1%X1|lwz%U1%X1} %0,%1
8511 {st%U0%X0|stw%U0%X0} %1,%0
8520 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*")
8521 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
8523 (define_insn "*movsf_softfloat"
8524 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r")
8525 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn"))]
8526 "(gpc_reg_operand (operands[0], SFmode)
8527 || gpc_reg_operand (operands[1], SFmode))
8528 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8534 {l%U1%X1|lwz%U1%X1} %0,%1
8535 {st%U0%X0|stw%U0%X0} %1,%0
8541 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*")
8542 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
8545 (define_expand "movdf"
8546 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8547 (match_operand:DF 1 "any_operand" ""))]
8549 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8552 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8553 (match_operand:DF 1 "const_int_operand" ""))]
8554 "! TARGET_POWERPC64 && reload_completed
8555 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8556 || (GET_CODE (operands[0]) == SUBREG
8557 && GET_CODE (SUBREG_REG (operands[0])) == REG
8558 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8559 [(set (match_dup 2) (match_dup 4))
8560 (set (match_dup 3) (match_dup 1))]
8563 int endian = (WORDS_BIG_ENDIAN == 0);
8564 HOST_WIDE_INT value = INTVAL (operands[1]);
8566 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8567 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8568 #if HOST_BITS_PER_WIDE_INT == 32
8569 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8571 operands[4] = GEN_INT (value >> 32);
8572 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8577 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8578 (match_operand:DF 1 "const_double_operand" ""))]
8579 "! TARGET_POWERPC64 && reload_completed
8580 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8581 || (GET_CODE (operands[0]) == SUBREG
8582 && GET_CODE (SUBREG_REG (operands[0])) == REG
8583 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8584 [(set (match_dup 2) (match_dup 4))
8585 (set (match_dup 3) (match_dup 5))]
8588 int endian = (WORDS_BIG_ENDIAN == 0);
8592 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8593 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8595 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8596 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8597 operands[4] = gen_int_mode (l[endian], SImode);
8598 operands[5] = gen_int_mode (l[1 - endian], SImode);
8602 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8603 (match_operand:DF 1 "easy_fp_constant" ""))]
8604 "TARGET_POWERPC64 && reload_completed
8605 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8606 || (GET_CODE (operands[0]) == SUBREG
8607 && GET_CODE (SUBREG_REG (operands[0])) == REG
8608 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8609 [(set (match_dup 2) (match_dup 3))]
8612 int endian = (WORDS_BIG_ENDIAN == 0);
8615 #if HOST_BITS_PER_WIDE_INT >= 64
8619 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8620 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8622 operands[2] = gen_lowpart (DImode, operands[0]);
8623 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8624 #if HOST_BITS_PER_WIDE_INT >= 64
8625 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
8626 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8628 operands[3] = gen_int_mode (val, DImode);
8630 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8634 ;; Don't have reload use general registers to load a constant. First,
8635 ;; it might not work if the output operand is the equivalent of
8636 ;; a non-offsettable memref, but also it is less efficient than loading
8637 ;; the constant into an FP register, since it will probably be used there.
8638 ;; The "??" is a kludge until we can figure out a more reasonable way
8639 ;; of handling these non-offsettable values.
8640 (define_insn "*movdf_hardfloat32"
8641 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
8642 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
8643 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8644 && (gpc_reg_operand (operands[0], DFmode)
8645 || gpc_reg_operand (operands[1], DFmode))"
8648 switch (which_alternative)
8653 /* We normally copy the low-numbered register first. However, if
8654 the first register operand 0 is the same as the second register
8655 of operand 1, we must copy in the opposite order. */
8656 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8657 return \"mr %L0,%L1\;mr %0,%1\";
8659 return \"mr %0,%1\;mr %L0,%L1\";
8661 if (offsettable_memref_p (operands[1])
8662 || (GET_CODE (operands[1]) == MEM
8663 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8664 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8665 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8667 /* If the low-address word is used in the address, we must load
8668 it last. Otherwise, load it first. Note that we cannot have
8669 auto-increment in that case since the address register is
8670 known to be dead. */
8671 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8673 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8675 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8681 addreg = find_addr_reg (XEXP (operands[1], 0));
8682 if (refers_to_regno_p (REGNO (operands[0]),
8683 REGNO (operands[0]) + 1,
8686 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8687 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8688 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8689 return \"{lx|lwzx} %0,%1\";
8693 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8694 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8695 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8696 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8701 if (offsettable_memref_p (operands[0])
8702 || (GET_CODE (operands[0]) == MEM
8703 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8704 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8705 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8706 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8711 addreg = find_addr_reg (XEXP (operands[0], 0));
8712 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8713 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8714 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8715 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8719 return \"fmr %0,%1\";
8721 return \"lfd%U1%X1 %0,%1\";
8723 return \"stfd%U0%X0 %1,%0\";
8730 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*")
8731 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
8733 (define_insn "*movdf_softfloat32"
8734 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8735 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8736 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8737 && (gpc_reg_operand (operands[0], DFmode)
8738 || gpc_reg_operand (operands[1], DFmode))"
8741 switch (which_alternative)
8746 /* We normally copy the low-numbered register first. However, if
8747 the first register operand 0 is the same as the second register of
8748 operand 1, we must copy in the opposite order. */
8749 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8750 return \"mr %L0,%L1\;mr %0,%1\";
8752 return \"mr %0,%1\;mr %L0,%L1\";
8754 /* If the low-address word is used in the address, we must load
8755 it last. Otherwise, load it first. Note that we cannot have
8756 auto-increment in that case since the address register is
8757 known to be dead. */
8758 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8760 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8762 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8764 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8771 [(set_attr "type" "*,load,store,*,*,*")
8772 (set_attr "length" "8,8,8,8,12,16")])
8774 (define_insn "*movdf_hardfloat64"
8775 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!cl,!r,!r,!r,!r")
8776 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,r,h,G,H,F"))]
8777 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8778 && (gpc_reg_operand (operands[0], DFmode)
8779 || gpc_reg_operand (operands[1], DFmode))"
8792 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*")
8793 (set_attr "length" "4,4,4,4,4,4,4,4,8,12,16")])
8795 (define_insn "*movdf_softfloat64"
8796 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r")
8797 (match_operand:DF 1 "input_operand" "r,r,h,m,r,G,H,F"))]
8798 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8799 && (gpc_reg_operand (operands[0], DFmode)
8800 || gpc_reg_operand (operands[1], DFmode))"
8810 [(set_attr "type" "*,*,*,load,store,*,*,*")
8811 (set_attr "length" "4,4,4,4,4,8,12,16")])
8813 (define_expand "movtf"
8814 [(set (match_operand:TF 0 "general_operand" "")
8815 (match_operand:TF 1 "any_operand" ""))]
8816 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8817 && TARGET_LONG_DOUBLE_128"
8818 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8820 (define_insn "*movtf_internal"
8821 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,m,!r,!r,!r")
8822 (match_operand:TF 1 "input_operand" "f,m,f,G,H,F"))]
8823 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8824 && TARGET_LONG_DOUBLE_128
8825 && (gpc_reg_operand (operands[0], TFmode)
8826 || gpc_reg_operand (operands[1], TFmode))"
8829 switch (which_alternative)
8834 /* We normally copy the low-numbered register first. However, if
8835 the first register operand 0 is the same as the second register of
8836 operand 1, we must copy in the opposite order. */
8837 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8838 return \"fmr %L0,%L1\;fmr %0,%1\";
8840 return \"fmr %0,%1\;fmr %L0,%L1\";
8842 return \"lfd %0,%1\;lfd %L0,%Y1\";
8844 return \"stfd %1,%0\;stfd %L1,%Y0\";
8851 [(set_attr "type" "fp,fpload,fpstore,*,*,*")
8852 (set_attr "length" "8,8,8,12,16,20")])
8855 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8856 (match_operand:TF 1 "easy_fp_constant" ""))]
8857 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8858 && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_POWERPC64
8859 && TARGET_LONG_DOUBLE_128 && reload_completed
8860 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8861 || (GET_CODE (operands[0]) == SUBREG
8862 && GET_CODE (SUBREG_REG (operands[0])) == REG
8863 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8864 [(set (match_dup 2) (match_dup 6))
8865 (set (match_dup 3) (match_dup 7))
8866 (set (match_dup 4) (match_dup 8))
8867 (set (match_dup 5) (match_dup 9))]
8873 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8874 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8876 operands[2] = operand_subword (operands[0], 0, 0, TFmode);
8877 operands[3] = operand_subword (operands[0], 1, 0, TFmode);
8878 operands[4] = operand_subword (operands[0], 2, 0, TFmode);
8879 operands[5] = operand_subword (operands[0], 3, 0, TFmode);
8880 operands[6] = gen_int_mode (l[0], SImode);
8881 operands[7] = gen_int_mode (l[1], SImode);
8882 operands[8] = gen_int_mode (l[2], SImode);
8883 operands[9] = gen_int_mode (l[3], SImode);
8887 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8888 (match_operand:TF 1 "easy_fp_constant" ""))]
8889 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8890 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
8891 && TARGET_LONG_DOUBLE_128 && reload_completed
8892 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8893 || (GET_CODE (operands[0]) == SUBREG
8894 && GET_CODE (SUBREG_REG (operands[0])) == REG
8895 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8896 [(set (match_dup 2) (match_dup 4))
8897 (set (match_dup 3) (match_dup 5))]
8904 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8905 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8907 operands[2] = gen_lowpart (DImode, operands[0]);
8908 operands[3] = gen_highpart (DImode, operands[0]);
8909 #if HOST_BITS_PER_WIDE_INT >= 64
8910 val = ((HOST_WIDE_INT)(unsigned long)l[0] << 32
8911 | ((HOST_WIDE_INT)(unsigned long)l[1]));
8912 operands[4] = gen_int_mode (val, DImode);
8914 val = ((HOST_WIDE_INT)(unsigned long)l[2] << 32
8915 | ((HOST_WIDE_INT)(unsigned long)l[3]));
8916 operands[5] = gen_int_mode (val, DImode);
8918 operands[4] = immed_double_const (l[1], l[0], DImode);
8919 operands[5] = immed_double_const (l[3], l[2], DImode);
8923 (define_insn "extenddftf2"
8924 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8925 (float_extend:TF (match_operand:DF 1 "gpc_reg_operand" "f")))]
8926 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8927 && TARGET_LONG_DOUBLE_128"
8930 if (REGNO (operands[0]) == REGNO (operands[1]))
8931 return \"fsub %L0,%L0,%L0\";
8933 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8935 [(set_attr "type" "fp")])
8937 (define_insn "extendsftf2"
8938 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8939 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "f")))]
8940 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8941 && TARGET_LONG_DOUBLE_128"
8944 if (REGNO (operands[0]) == REGNO (operands[1]))
8945 return \"fsub %L0,%L0,%L0\";
8947 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8949 [(set_attr "type" "fp")])
8951 (define_insn "trunctfdf2"
8952 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8953 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8954 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8955 && TARGET_LONG_DOUBLE_128"
8957 [(set_attr "type" "fp")
8958 (set_attr "length" "8")])
8960 (define_insn_and_split "trunctfsf2"
8961 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8962 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8963 (clobber (match_scratch:DF 2 "=f"))]
8964 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
8965 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8967 "&& reload_completed"
8969 (float_truncate:DF (match_dup 1)))
8971 (float_truncate:SF (match_dup 2)))]
8974 (define_insn_and_split "floatditf2"
8975 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8976 (float:TF (match_operand:DI 1 "gpc_reg_operand" "*f")))
8977 (clobber (match_scratch:DF 2 "=f"))]
8978 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8979 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8981 "&& reload_completed"
8983 (float:DF (match_dup 1)))
8985 (float_extend:TF (match_dup 2)))]
8988 (define_insn_and_split "floatsitf2"
8989 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8990 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))
8991 (clobber (match_scratch:DF 2 "=f"))]
8992 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8993 && TARGET_LONG_DOUBLE_128"
8995 "&& reload_completed"
8997 (float:DF (match_dup 1)))
8999 (float_extend:TF (match_dup 2)))]
9002 (define_insn_and_split "fix_trunctfdi2"
9003 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
9004 (fix:DI (match_operand:TF 1 "gpc_reg_operand" "f")))
9005 (clobber (match_scratch:DF 2 "=f"))]
9006 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
9007 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
9009 "&& reload_completed"
9011 (float_truncate:DF (match_dup 1)))
9013 (fix:DI (match_dup 2)))]
9016 (define_insn_and_split "fix_trunctfsi2"
9017 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9018 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
9019 (clobber (match_scratch:DF 2 "=f"))]
9020 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
9021 && TARGET_LONG_DOUBLE_128"
9023 "&& reload_completed"
9025 (float_truncate:DF (match_dup 1)))
9027 (fix:SI (match_dup 2)))]
9030 (define_insn "negtf2"
9031 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9032 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
9033 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
9034 && TARGET_LONG_DOUBLE_128"
9037 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9038 return \"fneg %L0,%L1\;fneg %0,%1\";
9040 return \"fneg %0,%1\;fneg %L0,%L1\";
9042 [(set_attr "type" "fp")
9043 (set_attr "length" "8")])
9045 (define_insn "abstf2"
9046 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9047 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
9048 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
9049 && TARGET_LONG_DOUBLE_128"
9052 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9053 return \"fabs %L0,%L1\;fabs %0,%1\";
9055 return \"fabs %0,%1\;fabs %L0,%L1\";
9057 [(set_attr "type" "fp")
9058 (set_attr "length" "8")])
9061 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9062 (neg:TF (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f"))))]
9063 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
9064 && TARGET_LONG_DOUBLE_128"
9067 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9068 return \"fnabs %L0,%L1\;fnabs %0,%1\";
9070 return \"fnabs %0,%1\;fnabs %L0,%L1\";
9072 [(set_attr "type" "fp")
9073 (set_attr "length" "8")])
9075 ;; Next come the multi-word integer load and store and the load and store
9077 (define_expand "movdi"
9078 [(set (match_operand:DI 0 "general_operand" "")
9079 (match_operand:DI 1 "any_operand" ""))]
9081 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
9083 (define_insn "*movdi_internal32"
9084 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
9085 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
9087 && (gpc_reg_operand (operands[0], DImode)
9088 || gpc_reg_operand (operands[1], DImode))"
9091 switch (which_alternative)
9096 /* We normally copy the low-numbered register first. However, if
9097 the first register operand 0 is the same as the second register of
9098 operand 1, we must copy in the opposite order. */
9099 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9100 return \"mr %L0,%L1\;mr %0,%1\";
9102 return \"mr %0,%1\;mr %L0,%L1\";
9104 /* If the low-address word is used in the address, we must load it
9105 last. Otherwise, load it first. Note that we cannot have
9106 auto-increment in that case since the address register is known to be
9108 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9110 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
9112 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
9114 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
9116 return \"fmr %0,%1\";
9118 return \"lfd%U1%X1 %0,%1\";
9120 return \"stfd%U0%X0 %1,%0\";
9129 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
9130 (set_attr "length" "8,8,8,4,4,4,8,12,8,12,16")])
9133 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9134 (match_operand:DI 1 "const_int_operand" ""))]
9135 "! TARGET_POWERPC64 && reload_completed"
9136 [(set (match_dup 2) (match_dup 4))
9137 (set (match_dup 3) (match_dup 1))]
9140 HOST_WIDE_INT value = INTVAL (operands[1]);
9141 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9143 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9145 #if HOST_BITS_PER_WIDE_INT == 32
9146 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
9148 operands[4] = GEN_INT (value >> 32);
9149 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
9154 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9155 (match_operand:DI 1 "const_double_operand" ""))]
9156 "HOST_BITS_PER_WIDE_INT == 32 && ! TARGET_POWERPC64 && reload_completed"
9157 [(set (match_dup 2) (match_dup 4))
9158 (set (match_dup 3) (match_dup 5))]
9161 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
9163 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
9165 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
9166 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
9169 (define_insn "*movdi_internal64"
9170 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
9171 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
9173 && (gpc_reg_operand (operands[0], DImode)
9174 || gpc_reg_operand (operands[1], DImode))"
9189 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
9190 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
9192 ;; immediate value valid for a single instruction hiding in a const_double
9194 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9195 (match_operand:DI 1 "const_double_operand" "F"))]
9196 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
9197 && GET_CODE (operands[1]) == CONST_DOUBLE
9198 && num_insns_constant (operands[1], DImode) == 1"
9201 return ((unsigned HOST_WIDE_INT)
9202 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
9203 ? \"li %0,%1\" : \"lis %0,%v1\";
9206 ;; Generate all one-bits and clear left or right.
9207 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
9209 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9210 (match_operand:DI 1 "mask64_operand" ""))]
9211 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9212 [(set (match_dup 0) (const_int -1))
9214 (and:DI (rotate:DI (match_dup 0)
9219 ;; Split a load of a large constant into the appropriate five-instruction
9220 ;; sequence. Handle anything in a constant number of insns.
9221 ;; When non-easy constants can go in the TOC, this should use
9222 ;; easy_fp_constant predicate.
9224 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9225 (match_operand:DI 1 "const_int_operand" ""))]
9226 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9227 [(set (match_dup 0) (match_dup 2))
9228 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9230 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9232 if (tem == operands[0])
9239 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9240 (match_operand:DI 1 "const_double_operand" ""))]
9241 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9242 [(set (match_dup 0) (match_dup 2))
9243 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9245 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9247 if (tem == operands[0])
9253 ;; Split a load of a large constant into the appropriate five-instruction
9254 (define_insn "*movdi_internal2"
9255 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
9256 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r,r")
9258 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
9263 [(set_attr "type" "compare")
9264 (set_attr "length" "4,8")])
9267 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
9268 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
9270 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
9271 "TARGET_POWERPC64 && reload_completed"
9272 [(set (match_dup 0) (match_dup 1))
9274 (compare:CC (match_dup 0)
9278 ;; TImode is similar, except that we usually want to compute the address into
9279 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9280 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9281 (define_expand "movti"
9282 [(parallel [(set (match_operand:TI 0 "general_operand" "")
9283 (match_operand:TI 1 "general_operand" ""))
9284 (clobber (scratch:SI))])]
9285 "TARGET_STRING || TARGET_POWERPC64"
9286 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
9288 ;; We say that MQ is clobbered in the last alternative because the first
9289 ;; alternative would never get used otherwise since it would need a reload
9290 ;; while the 2nd alternative would not. We put memory cases first so they
9291 ;; are preferred. Otherwise, we'd try to reload the output instead of
9292 ;; giving the SCRATCH mq.
9293 (define_insn "*movti_power"
9294 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
9295 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
9296 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
9297 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9298 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9301 switch (which_alternative)
9307 return \"{stsi|stswi} %1,%P0,16\";
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 is not used in the output, we can use lsi. Otherwise,
9323 fall through to generating four loads. */
9324 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
9325 return \"{lsi|lswi} %0,%P1,16\";
9326 /* ... fall through ... */
9328 /* If the address register is the same as the register for the lowest-
9329 addressed word, load it last. Similarly for the next two words.
9330 Otherwise load lowest address to highest. */
9331 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9333 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
9334 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
9335 REGNO (operands[0]) + 2, operands[1], 0))
9336 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
9337 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
9338 REGNO (operands[0]) + 3, operands[1], 0))
9339 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
9341 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
9344 [(set_attr "type" "store,store,*,load,load")
9345 (set_attr "length" "4,16,16,4,16")])
9347 (define_insn "*movti_string"
9348 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
9349 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
9350 (clobber (match_scratch:SI 2 "X,X,X,X,X"))]
9351 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9352 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9355 switch (which_alternative)
9361 return \"{stsi|stswi} %1,%P0,16\";
9363 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
9365 /* Normally copy registers with lowest numbered register copied first.
9366 But copy in the other order if the first register of the output
9367 is the second, third, or fourth register in the input. */
9368 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
9369 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
9370 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
9372 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
9374 /* If the address is not used in the output, we can use lsi. Otherwise,
9375 fall through to generating four loads. */
9376 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
9377 return \"{lsi|lswi} %0,%P1,16\";
9378 /* ... fall through ... */
9380 /* If the address register is the same as the register for the lowest-
9381 addressed word, load it last. Similarly for the next two words.
9382 Otherwise load lowest address to highest. */
9383 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9385 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
9386 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
9387 REGNO (operands[0]) + 2, operands[1], 0))
9388 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
9389 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
9390 REGNO (operands[0]) + 3, operands[1], 0))
9391 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
9393 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
9396 [(set_attr "type" "store,store,*,load,load")
9397 (set_attr "length" "4,16,16,4,16")])
9399 (define_insn "*movti_ppc64"
9400 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
9401 (match_operand:TI 1 "input_operand" "r,m,r"))]
9402 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9403 || gpc_reg_operand (operands[1], TImode))"
9406 switch (which_alternative)
9411 /* We normally copy the low-numbered register first. However, if
9412 the first register operand 0 is the same as the second register of
9413 operand 1, we must copy in the opposite order. */
9414 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9415 return \"mr %L0,%L1\;mr %0,%1\";
9417 return \"mr %0,%1\;mr %L0,%L1\";
9419 /* If the low-address word is used in the address, we must load it
9420 last. Otherwise, load it first. Note that we cannot have
9421 auto-increment in that case since the address register is known to be
9423 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9425 return \"ld %L0,%L1\;ld %0,%1\";
9427 return \"ld%U1 %0,%1\;ld %L0,%L1\";
9429 return \"std%U0 %1,%0\;std %L1,%L0\";
9432 [(set_attr "type" "*,load,store")
9433 (set_attr "length" "8,8,8")])
9435 (define_expand "load_multiple"
9436 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9437 (match_operand:SI 1 "" ""))
9438 (use (match_operand:SI 2 "" ""))])]
9439 "TARGET_STRING && !TARGET_POWERPC64"
9447 /* Support only loading a constant number of fixed-point registers from
9448 memory and only bother with this if more than two; the machine
9449 doesn't support more than eight. */
9450 if (GET_CODE (operands[2]) != CONST_INT
9451 || INTVAL (operands[2]) <= 2
9452 || INTVAL (operands[2]) > 8
9453 || GET_CODE (operands[1]) != MEM
9454 || GET_CODE (operands[0]) != REG
9455 || REGNO (operands[0]) >= 32)
9458 count = INTVAL (operands[2]);
9459 regno = REGNO (operands[0]);
9461 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9462 op1 = replace_equiv_address (operands[1],
9463 force_reg (SImode, XEXP (operands[1], 0)));
9465 for (i = 0; i < count; i++)
9466 XVECEXP (operands[3], 0, i)
9467 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9468 adjust_address_nv (op1, SImode, i * 4));
9471 (define_insn "*ldmsi8"
9472 [(match_parallel 0 "load_multiple_operation"
9473 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9474 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9475 (set (match_operand:SI 3 "gpc_reg_operand" "")
9476 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9477 (set (match_operand:SI 4 "gpc_reg_operand" "")
9478 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9479 (set (match_operand:SI 5 "gpc_reg_operand" "")
9480 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9481 (set (match_operand:SI 6 "gpc_reg_operand" "")
9482 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9483 (set (match_operand:SI 7 "gpc_reg_operand" "")
9484 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9485 (set (match_operand:SI 8 "gpc_reg_operand" "")
9486 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
9487 (set (match_operand:SI 9 "gpc_reg_operand" "")
9488 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
9489 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
9491 { return rs6000_output_load_multiple (operands); }"
9492 [(set_attr "type" "load")
9493 (set_attr "length" "32")])
9495 (define_insn "*ldmsi7"
9496 [(match_parallel 0 "load_multiple_operation"
9497 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9498 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9499 (set (match_operand:SI 3 "gpc_reg_operand" "")
9500 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9501 (set (match_operand:SI 4 "gpc_reg_operand" "")
9502 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9503 (set (match_operand:SI 5 "gpc_reg_operand" "")
9504 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9505 (set (match_operand:SI 6 "gpc_reg_operand" "")
9506 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9507 (set (match_operand:SI 7 "gpc_reg_operand" "")
9508 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
9509 (set (match_operand:SI 8 "gpc_reg_operand" "")
9510 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
9511 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
9513 { return rs6000_output_load_multiple (operands); }"
9514 [(set_attr "type" "load")
9515 (set_attr "length" "32")])
9517 (define_insn "*ldmsi6"
9518 [(match_parallel 0 "load_multiple_operation"
9519 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9520 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9521 (set (match_operand:SI 3 "gpc_reg_operand" "")
9522 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9523 (set (match_operand:SI 4 "gpc_reg_operand" "")
9524 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9525 (set (match_operand:SI 5 "gpc_reg_operand" "")
9526 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9527 (set (match_operand:SI 6 "gpc_reg_operand" "")
9528 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
9529 (set (match_operand:SI 7 "gpc_reg_operand" "")
9530 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
9531 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
9533 { return rs6000_output_load_multiple (operands); }"
9534 [(set_attr "type" "load")
9535 (set_attr "length" "32")])
9537 (define_insn "*ldmsi5"
9538 [(match_parallel 0 "load_multiple_operation"
9539 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9540 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9541 (set (match_operand:SI 3 "gpc_reg_operand" "")
9542 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9543 (set (match_operand:SI 4 "gpc_reg_operand" "")
9544 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9545 (set (match_operand:SI 5 "gpc_reg_operand" "")
9546 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
9547 (set (match_operand:SI 6 "gpc_reg_operand" "")
9548 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
9549 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
9551 { return rs6000_output_load_multiple (operands); }"
9552 [(set_attr "type" "load")
9553 (set_attr "length" "32")])
9555 (define_insn "*ldmsi4"
9556 [(match_parallel 0 "load_multiple_operation"
9557 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9558 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9559 (set (match_operand:SI 3 "gpc_reg_operand" "")
9560 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9561 (set (match_operand:SI 4 "gpc_reg_operand" "")
9562 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
9563 (set (match_operand:SI 5 "gpc_reg_operand" "")
9564 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
9565 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
9567 { return rs6000_output_load_multiple (operands); }"
9568 [(set_attr "type" "load")
9569 (set_attr "length" "32")])
9571 (define_insn "*ldmsi3"
9572 [(match_parallel 0 "load_multiple_operation"
9573 [(set (match_operand:SI 2 "gpc_reg_operand" "")
9574 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
9575 (set (match_operand:SI 3 "gpc_reg_operand" "")
9576 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
9577 (set (match_operand:SI 4 "gpc_reg_operand" "")
9578 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
9579 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
9581 { return rs6000_output_load_multiple (operands); }"
9582 [(set_attr "type" "load")
9583 (set_attr "length" "32")])
9585 (define_expand "store_multiple"
9586 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9587 (match_operand:SI 1 "" ""))
9588 (clobber (scratch:SI))
9589 (use (match_operand:SI 2 "" ""))])]
9590 "TARGET_STRING && !TARGET_POWERPC64"
9599 /* Support only storing a constant number of fixed-point registers to
9600 memory and only bother with this if more than two; the machine
9601 doesn't support more than eight. */
9602 if (GET_CODE (operands[2]) != CONST_INT
9603 || INTVAL (operands[2]) <= 2
9604 || INTVAL (operands[2]) > 8
9605 || GET_CODE (operands[0]) != MEM
9606 || GET_CODE (operands[1]) != REG
9607 || REGNO (operands[1]) >= 32)
9610 count = INTVAL (operands[2]);
9611 regno = REGNO (operands[1]);
9613 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9614 to = force_reg (SImode, XEXP (operands[0], 0));
9615 op0 = replace_equiv_address (operands[0], to);
9617 XVECEXP (operands[3], 0, 0)
9618 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
9619 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9620 gen_rtx_SCRATCH (SImode));
9622 for (i = 1; i < count; i++)
9623 XVECEXP (operands[3], 0, i + 1)
9624 = gen_rtx_SET (VOIDmode,
9625 adjust_address_nv (op0, SImode, i * 4),
9626 gen_rtx_REG (SImode, regno + i));
9629 (define_insn "*store_multiple_power"
9630 [(match_parallel 0 "store_multiple_operation"
9631 [(set (match_operand:SI 1 "indirect_operand" "=Q")
9632 (match_operand:SI 2 "gpc_reg_operand" "r"))
9633 (clobber (match_scratch:SI 3 "=q"))])]
9634 "TARGET_STRING && TARGET_POWER"
9635 "{stsi|stswi} %2,%P1,%O0"
9636 [(set_attr "type" "store")])
9638 (define_insn "*store_multiple_string"
9639 [(match_parallel 0 "store_multiple_operation"
9640 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9641 (match_operand:SI 2 "gpc_reg_operand" "r"))
9642 (clobber (match_scratch:SI 3 "X"))])]
9643 "TARGET_STRING && ! TARGET_POWER"
9644 "{stsi|stswi} %2,%1,%O0"
9645 [(set_attr "type" "store")])
9648 ;; String/block move insn.
9649 ;; Argument 0 is the destination
9650 ;; Argument 1 is the source
9651 ;; Argument 2 is the length
9652 ;; Argument 3 is the alignment
9654 (define_expand "movstrsi"
9655 [(parallel [(set (match_operand:BLK 0 "" "")
9656 (match_operand:BLK 1 "" ""))
9657 (use (match_operand:SI 2 "" ""))
9658 (use (match_operand:SI 3 "" ""))])]
9662 if (expand_block_move (operands))
9668 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9669 ;; register allocator doesn't have a clue about allocating 8 word registers.
9670 ;; rD/rS = r5 is preferred, efficient form.
9671 (define_expand "movstrsi_8reg"
9672 [(parallel [(set (match_operand 0 "" "")
9673 (match_operand 1 "" ""))
9674 (use (match_operand 2 "" ""))
9675 (use (match_operand 3 "" ""))
9676 (clobber (reg:SI 5))
9677 (clobber (reg:SI 6))
9678 (clobber (reg:SI 7))
9679 (clobber (reg:SI 8))
9680 (clobber (reg:SI 9))
9681 (clobber (reg:SI 10))
9682 (clobber (reg:SI 11))
9683 (clobber (reg:SI 12))
9684 (clobber (match_scratch:SI 4 ""))])]
9689 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9690 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9691 (use (match_operand:SI 2 "immediate_operand" "i"))
9692 (use (match_operand:SI 3 "immediate_operand" "i"))
9693 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9694 (clobber (reg:SI 6))
9695 (clobber (reg:SI 7))
9696 (clobber (reg:SI 8))
9697 (clobber (reg:SI 9))
9698 (clobber (reg:SI 10))
9699 (clobber (reg:SI 11))
9700 (clobber (reg:SI 12))
9701 (clobber (match_scratch:SI 5 "=q"))]
9702 "TARGET_STRING && TARGET_POWER
9703 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9704 || INTVAL (operands[2]) == 0)
9705 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9706 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9707 && REGNO (operands[4]) == 5"
9708 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9709 [(set_attr "type" "load")
9710 (set_attr "length" "8")])
9713 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9714 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9715 (use (match_operand:SI 2 "immediate_operand" "i"))
9716 (use (match_operand:SI 3 "immediate_operand" "i"))
9717 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9718 (clobber (reg:SI 6))
9719 (clobber (reg:SI 7))
9720 (clobber (reg:SI 8))
9721 (clobber (reg:SI 9))
9722 (clobber (reg:SI 10))
9723 (clobber (reg:SI 11))
9724 (clobber (reg:SI 12))
9725 (clobber (match_scratch:SI 5 "X"))]
9726 "TARGET_STRING && ! TARGET_POWER
9727 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9728 || INTVAL (operands[2]) == 0)
9729 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9730 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9731 && REGNO (operands[4]) == 5"
9732 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9733 [(set_attr "type" "load")
9734 (set_attr "length" "8")])
9737 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9738 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9739 (use (match_operand:SI 2 "immediate_operand" "i"))
9740 (use (match_operand:SI 3 "immediate_operand" "i"))
9741 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9742 (clobber (reg:SI 6))
9743 (clobber (reg:SI 7))
9744 (clobber (reg:SI 8))
9745 (clobber (reg:SI 9))
9746 (clobber (reg:SI 10))
9747 (clobber (reg:SI 11))
9748 (clobber (reg:SI 12))
9749 (clobber (match_scratch:SI 5 "X"))]
9750 "TARGET_STRING && TARGET_POWERPC64
9751 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9752 || INTVAL (operands[2]) == 0)
9753 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9754 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9755 && REGNO (operands[4]) == 5"
9756 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9757 [(set_attr "type" "load")
9758 (set_attr "length" "8")])
9760 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9761 ;; register allocator doesn't have a clue about allocating 6 word registers.
9762 ;; rD/rS = r5 is preferred, efficient form.
9763 (define_expand "movstrsi_6reg"
9764 [(parallel [(set (match_operand 0 "" "")
9765 (match_operand 1 "" ""))
9766 (use (match_operand 2 "" ""))
9767 (use (match_operand 3 "" ""))
9768 (clobber (reg:SI 5))
9769 (clobber (reg:SI 6))
9770 (clobber (reg:SI 7))
9771 (clobber (reg:SI 8))
9772 (clobber (reg:SI 9))
9773 (clobber (reg:SI 10))
9774 (clobber (match_scratch:SI 4 ""))])]
9779 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9780 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9781 (use (match_operand:SI 2 "immediate_operand" "i"))
9782 (use (match_operand:SI 3 "immediate_operand" "i"))
9783 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9784 (clobber (reg:SI 6))
9785 (clobber (reg:SI 7))
9786 (clobber (reg:SI 8))
9787 (clobber (reg:SI 9))
9788 (clobber (reg:SI 10))
9789 (clobber (match_scratch:SI 5 "=q"))]
9790 "TARGET_STRING && TARGET_POWER
9791 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9792 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9793 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9794 && REGNO (operands[4]) == 5"
9795 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9796 [(set_attr "type" "load")
9797 (set_attr "length" "8")])
9800 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9801 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9802 (use (match_operand:SI 2 "immediate_operand" "i"))
9803 (use (match_operand:SI 3 "immediate_operand" "i"))
9804 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9805 (clobber (reg:SI 6))
9806 (clobber (reg:SI 7))
9807 (clobber (reg:SI 8))
9808 (clobber (reg:SI 9))
9809 (clobber (reg:SI 10))
9810 (clobber (match_scratch:SI 5 "X"))]
9811 "TARGET_STRING && ! TARGET_POWER
9812 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9813 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9814 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9815 && REGNO (operands[4]) == 5"
9816 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9817 [(set_attr "type" "load")
9818 (set_attr "length" "8")])
9821 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9822 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9823 (use (match_operand:SI 2 "immediate_operand" "i"))
9824 (use (match_operand:SI 3 "immediate_operand" "i"))
9825 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9826 (clobber (reg:SI 6))
9827 (clobber (reg:SI 7))
9828 (clobber (reg:SI 8))
9829 (clobber (reg:SI 9))
9830 (clobber (reg:SI 10))
9831 (clobber (match_scratch:SI 5 "X"))]
9832 "TARGET_STRING && TARGET_POWERPC64
9833 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9834 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9835 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9836 && REGNO (operands[4]) == 5"
9837 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9838 [(set_attr "type" "load")
9839 (set_attr "length" "8")])
9841 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9842 ;; problems with TImode.
9843 ;; rD/rS = r5 is preferred, efficient form.
9844 (define_expand "movstrsi_4reg"
9845 [(parallel [(set (match_operand 0 "" "")
9846 (match_operand 1 "" ""))
9847 (use (match_operand 2 "" ""))
9848 (use (match_operand 3 "" ""))
9849 (clobber (reg:SI 5))
9850 (clobber (reg:SI 6))
9851 (clobber (reg:SI 7))
9852 (clobber (reg:SI 8))
9853 (clobber (match_scratch:SI 4 ""))])]
9858 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9859 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9860 (use (match_operand:SI 2 "immediate_operand" "i"))
9861 (use (match_operand:SI 3 "immediate_operand" "i"))
9862 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9863 (clobber (reg:SI 6))
9864 (clobber (reg:SI 7))
9865 (clobber (reg:SI 8))
9866 (clobber (match_scratch:SI 5 "=q"))]
9867 "TARGET_STRING && TARGET_POWER
9868 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9869 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9870 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9871 && REGNO (operands[4]) == 5"
9872 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9873 [(set_attr "type" "load")
9874 (set_attr "length" "8")])
9877 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9878 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9879 (use (match_operand:SI 2 "immediate_operand" "i"))
9880 (use (match_operand:SI 3 "immediate_operand" "i"))
9881 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9882 (clobber (reg:SI 6))
9883 (clobber (reg:SI 7))
9884 (clobber (reg:SI 8))
9885 (clobber (match_scratch:SI 5 "X"))]
9886 "TARGET_STRING && ! TARGET_POWER
9887 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9888 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9889 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9890 && REGNO (operands[4]) == 5"
9891 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9892 [(set_attr "type" "load")
9893 (set_attr "length" "8")])
9896 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9897 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9898 (use (match_operand:SI 2 "immediate_operand" "i"))
9899 (use (match_operand:SI 3 "immediate_operand" "i"))
9900 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9901 (clobber (reg:SI 6))
9902 (clobber (reg:SI 7))
9903 (clobber (reg:SI 8))
9904 (clobber (match_scratch:SI 5 "X"))]
9905 "TARGET_STRING && TARGET_POWERPC64
9906 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9907 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9908 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9909 && REGNO (operands[4]) == 5"
9910 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9911 [(set_attr "type" "load")
9912 (set_attr "length" "8")])
9914 ;; Move up to 8 bytes at a time.
9915 (define_expand "movstrsi_2reg"
9916 [(parallel [(set (match_operand 0 "" "")
9917 (match_operand 1 "" ""))
9918 (use (match_operand 2 "" ""))
9919 (use (match_operand 3 "" ""))
9920 (clobber (match_scratch:DI 4 ""))
9921 (clobber (match_scratch:SI 5 ""))])]
9922 "TARGET_STRING && ! TARGET_POWERPC64"
9926 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9927 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9928 (use (match_operand:SI 2 "immediate_operand" "i"))
9929 (use (match_operand:SI 3 "immediate_operand" "i"))
9930 (clobber (match_scratch:DI 4 "=&r"))
9931 (clobber (match_scratch:SI 5 "=q"))]
9932 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9933 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9934 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9935 [(set_attr "type" "load")
9936 (set_attr "length" "8")])
9939 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9940 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9941 (use (match_operand:SI 2 "immediate_operand" "i"))
9942 (use (match_operand:SI 3 "immediate_operand" "i"))
9943 (clobber (match_scratch:DI 4 "=&r"))
9944 (clobber (match_scratch:SI 5 "X"))]
9945 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9946 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9947 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9948 [(set_attr "type" "load")
9949 (set_attr "length" "8")])
9951 ;; Move up to 4 bytes at a time.
9952 (define_expand "movstrsi_1reg"
9953 [(parallel [(set (match_operand 0 "" "")
9954 (match_operand 1 "" ""))
9955 (use (match_operand 2 "" ""))
9956 (use (match_operand 3 "" ""))
9957 (clobber (match_scratch:SI 4 ""))
9958 (clobber (match_scratch:SI 5 ""))])]
9963 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9964 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9965 (use (match_operand:SI 2 "immediate_operand" "i"))
9966 (use (match_operand:SI 3 "immediate_operand" "i"))
9967 (clobber (match_scratch:SI 4 "=&r"))
9968 (clobber (match_scratch:SI 5 "=q"))]
9969 "TARGET_STRING && TARGET_POWER
9970 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9971 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9972 [(set_attr "type" "load")
9973 (set_attr "length" "8")])
9976 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9977 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9978 (use (match_operand:SI 2 "immediate_operand" "i"))
9979 (use (match_operand:SI 3 "immediate_operand" "i"))
9980 (clobber (match_scratch:SI 4 "=&r"))
9981 (clobber (match_scratch:SI 5 "X"))]
9982 "TARGET_STRING && ! TARGET_POWER
9983 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9984 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9985 [(set_attr "type" "load")
9986 (set_attr "length" "8")])
9989 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9990 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9991 (use (match_operand:SI 2 "immediate_operand" "i"))
9992 (use (match_operand:SI 3 "immediate_operand" "i"))
9993 (clobber (match_scratch:SI 4 "=&r"))
9994 (clobber (match_scratch:SI 5 "X"))]
9995 "TARGET_STRING && TARGET_POWERPC64
9996 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9997 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9998 [(set_attr "type" "load")
9999 (set_attr "length" "8")])
10002 ;; Define insns that do load or store with update. Some of these we can
10003 ;; get by using pre-decrement or pre-increment, but the hardware can also
10004 ;; do cases where the increment is not the size of the object.
10006 ;; In all these cases, we use operands 0 and 1 for the register being
10007 ;; incremented because those are the operands that local-alloc will
10008 ;; tie and these are the pair most likely to be tieable (and the ones
10009 ;; that will benefit the most).
10011 (define_insn "*movdi_update1"
10012 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
10013 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10014 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
10015 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10016 (plus:DI (match_dup 1) (match_dup 2)))]
10017 "TARGET_POWERPC64 && TARGET_UPDATE"
10021 [(set_attr "type" "load")])
10023 (define_insn "*movdi_update2"
10024 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
10026 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
10027 (match_operand:DI 2 "gpc_reg_operand" "r")))))
10028 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
10029 (plus:DI (match_dup 1) (match_dup 2)))]
10032 [(set_attr "type" "load")])
10034 (define_insn "movdi_update"
10035 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
10036 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
10037 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
10038 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
10039 (plus:DI (match_dup 1) (match_dup 2)))]
10040 "TARGET_POWERPC64 && TARGET_UPDATE"
10044 [(set_attr "type" "store")])
10046 (define_insn "*movsi_update1"
10047 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10048 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10049 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10050 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10051 (plus:SI (match_dup 1) (match_dup 2)))]
10054 {lux|lwzux} %3,%0,%2
10055 {lu|lwzu} %3,%2(%0)"
10056 [(set_attr "type" "load")])
10058 (define_insn "movsi_update"
10059 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10060 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10061 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
10062 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10063 (plus:SI (match_dup 1) (match_dup 2)))]
10066 {stux|stwux} %3,%0,%2
10067 {stu|stwu} %3,%2(%0)"
10068 [(set_attr "type" "store")])
10070 (define_insn "*movhi_update"
10071 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
10072 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10073 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10074 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10075 (plus:SI (match_dup 1) (match_dup 2)))]
10080 [(set_attr "type" "load")])
10082 (define_insn "*movhi_update2"
10083 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10085 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10086 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10087 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10088 (plus:SI (match_dup 1) (match_dup 2)))]
10093 [(set_attr "type" "load")])
10095 (define_insn "*movhi_update3"
10096 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10098 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10099 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10100 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10101 (plus:SI (match_dup 1) (match_dup 2)))]
10106 [(set_attr "type" "load")])
10108 (define_insn "*movhi_update4"
10109 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10110 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10111 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
10112 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10113 (plus:SI (match_dup 1) (match_dup 2)))]
10118 [(set_attr "type" "store")])
10120 (define_insn "*movqi_update1"
10121 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
10122 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10123 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10124 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10125 (plus:SI (match_dup 1) (match_dup 2)))]
10130 [(set_attr "type" "load")])
10132 (define_insn "*movqi_update2"
10133 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
10135 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10136 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
10137 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10138 (plus:SI (match_dup 1) (match_dup 2)))]
10143 [(set_attr "type" "load")])
10145 (define_insn "*movqi_update3"
10146 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10147 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10148 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
10149 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10150 (plus:SI (match_dup 1) (match_dup 2)))]
10155 [(set_attr "type" "store")])
10157 (define_insn "*movsf_update1"
10158 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
10159 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10160 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10161 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10162 (plus:SI (match_dup 1) (match_dup 2)))]
10163 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10167 [(set_attr "type" "fpload")])
10169 (define_insn "*movsf_update2"
10170 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10171 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10172 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
10173 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10174 (plus:SI (match_dup 1) (match_dup 2)))]
10175 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10179 [(set_attr "type" "fpstore")])
10181 (define_insn "*movsf_update3"
10182 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
10183 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10184 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10185 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10186 (plus:SI (match_dup 1) (match_dup 2)))]
10187 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10189 {lux|lwzux} %3,%0,%2
10190 {lu|lwzu} %3,%2(%0)"
10191 [(set_attr "type" "load")])
10193 (define_insn "*movsf_update4"
10194 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10195 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10196 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
10197 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10198 (plus:SI (match_dup 1) (match_dup 2)))]
10199 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
10201 {stux|stwux} %3,%0,%2
10202 {stu|stwu} %3,%2(%0)"
10203 [(set_attr "type" "store")])
10205 (define_insn "*movdf_update1"
10206 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
10207 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10208 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
10209 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10210 (plus:SI (match_dup 1) (match_dup 2)))]
10211 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10215 [(set_attr "type" "fpload")])
10217 (define_insn "*movdf_update2"
10218 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
10219 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
10220 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
10221 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
10222 (plus:SI (match_dup 1) (match_dup 2)))]
10223 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
10227 [(set_attr "type" "fpstore")])
10229 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
10232 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
10233 (match_operand:DF 1 "memory_operand" ""))
10234 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
10235 (match_operand:DF 3 "memory_operand" ""))]
10237 && TARGET_HARD_FLOAT && TARGET_FPRS
10238 && registers_ok_for_quad_peep (operands[0], operands[2])
10239 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
10240 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
10244 [(set (match_operand:DF 0 "memory_operand" "")
10245 (match_operand:DF 1 "gpc_reg_operand" "f"))
10246 (set (match_operand:DF 2 "memory_operand" "")
10247 (match_operand:DF 3 "gpc_reg_operand" "f"))]
10249 && TARGET_HARD_FLOAT && TARGET_FPRS
10250 && registers_ok_for_quad_peep (operands[1], operands[3])
10251 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
10252 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
10253 "stfq%U0%X0 %1,%0")
10255 ;; Next come insns related to the calling sequence.
10257 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
10258 ;; We move the back-chain and decrement the stack pointer.
10260 (define_expand "allocate_stack"
10261 [(set (match_operand 0 "gpc_reg_operand" "=r")
10262 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
10264 (minus (reg 1) (match_dup 1)))]
10267 { rtx chain = gen_reg_rtx (Pmode);
10268 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
10271 emit_move_insn (chain, stack_bot);
10273 /* Check stack bounds if necessary. */
10274 if (current_function_limit_stack)
10277 available = expand_binop (Pmode, sub_optab,
10278 stack_pointer_rtx, stack_limit_rtx,
10279 NULL_RTX, 1, OPTAB_WIDEN);
10280 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10283 if (GET_CODE (operands[1]) != CONST_INT
10284 || INTVAL (operands[1]) < -32767
10285 || INTVAL (operands[1]) > 32768)
10287 neg_op0 = gen_reg_rtx (Pmode);
10289 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10291 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10294 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10297 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
10298 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10302 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10303 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10304 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10307 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10311 ;; These patterns say how to save and restore the stack pointer. We need not
10312 ;; save the stack pointer at function level since we are careful to
10313 ;; preserve the backchain. At block level, we have to restore the backchain
10314 ;; when we restore the stack pointer.
10316 ;; For nonlocal gotos, we must save both the stack pointer and its
10317 ;; backchain and restore both. Note that in the nonlocal case, the
10318 ;; save area is a memory location.
10320 (define_expand "save_stack_function"
10321 [(match_operand 0 "any_operand" "")
10322 (match_operand 1 "any_operand" "")]
10326 (define_expand "restore_stack_function"
10327 [(match_operand 0 "any_operand" "")
10328 (match_operand 1 "any_operand" "")]
10332 (define_expand "restore_stack_block"
10333 [(use (match_operand 0 "register_operand" ""))
10334 (set (match_dup 2) (match_dup 3))
10335 (set (match_dup 0) (match_operand 1 "register_operand" ""))
10336 (set (match_dup 3) (match_dup 2))]
10340 operands[2] = gen_reg_rtx (Pmode);
10341 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
10344 (define_expand "save_stack_nonlocal"
10345 [(match_operand 0 "memory_operand" "")
10346 (match_operand 1 "register_operand" "")]
10350 rtx temp = gen_reg_rtx (Pmode);
10352 /* Copy the backchain to the first word, sp to the second. */
10353 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
10354 emit_move_insn (operand_subword (operands[0], 0, 0,
10355 (TARGET_32BIT ? DImode : TImode)),
10357 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
10362 (define_expand "restore_stack_nonlocal"
10363 [(match_operand 0 "register_operand" "")
10364 (match_operand 1 "memory_operand" "")]
10368 rtx temp = gen_reg_rtx (Pmode);
10370 /* Restore the backchain from the first word, sp from the second. */
10371 emit_move_insn (temp,
10372 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
10373 emit_move_insn (operands[0],
10374 operand_subword (operands[1], 1, 0,
10375 (TARGET_32BIT ? DImode : TImode)));
10376 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
10380 ;; TOC register handling.
10382 ;; Code to initialize the TOC register...
10384 (define_insn "load_toc_aix_si"
10385 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10386 (unspec:SI [(const_int 0)] 7))
10387 (use (reg:SI 2))])]
10388 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10392 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10393 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10394 operands[2] = gen_rtx_REG (Pmode, 2);
10395 return \"{l|lwz} %0,%1(%2)\";
10397 [(set_attr "type" "load")])
10399 (define_insn "load_toc_aix_di"
10400 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10401 (unspec:DI [(const_int 0)] 7))
10402 (use (reg:DI 2))])]
10403 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10407 #ifdef TARGET_RELOCATABLE
10408 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10409 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10411 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10414 strcat (buf, \"@toc\");
10415 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10416 operands[2] = gen_rtx_REG (Pmode, 2);
10417 return \"ld %0,%1(%2)\";
10419 [(set_attr "type" "load")])
10421 (define_insn "load_toc_v4_pic_si"
10422 [(set (match_operand:SI 0 "register_operand" "=l")
10423 (unspec:SI [(const_int 0)] 7))]
10424 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10425 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10426 [(set_attr "type" "branch")
10427 (set_attr "length" "4")])
10429 (define_insn "load_toc_v4_PIC_1"
10430 [(set (match_operand:SI 0 "register_operand" "=l")
10431 (match_operand:SI 1 "immediate_operand" "s"))
10432 (unspec [(match_dup 1)] 7)]
10433 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10434 "bcl 20,31,%1\\n%1:"
10435 [(set_attr "type" "branch")
10436 (set_attr "length" "4")])
10438 (define_insn "load_toc_v4_PIC_1b"
10439 [(set (match_operand:SI 0 "register_operand" "=l")
10440 (match_operand:SI 1 "immediate_operand" "s"))
10441 (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
10442 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10443 "bcl 20,31,%1\\n\\t.long %2-%1+4\\n%1:"
10444 [(set_attr "type" "branch")
10445 (set_attr "length" "8")])
10447 (define_insn "load_toc_v4_PIC_2"
10448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10449 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
10450 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10451 (match_operand:SI 3 "immediate_operand" "s")))))]
10452 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
10453 "{l|lwz} %0,%2-%3(%1)"
10454 [(set_attr "type" "load")])
10456 (define_insn "load_macho_picbase"
10457 [(set (match_operand:SI 0 "register_operand" "=l")
10458 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")] 15))]
10459 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
10460 "bcl 20,31,%1\\n%1:"
10461 [(set_attr "type" "branch")
10462 (set_attr "length" "4")])
10464 (define_insn "macho_correct_pic"
10465 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10466 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "=r")
10467 (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
10468 (match_operand:SI 3 "immediate_operand" "s")]
10470 "DEFAULT_ABI == ABI_DARWIN"
10471 "addis %0,%1,ha16(%2-%3)\n\taddi %1,%1,lo16(%2-%3)"
10472 [(set_attr "length" "8")])
10474 ;; If the TOC is shared over a translation unit, as happens with all
10475 ;; the kinds of PIC that we support, we need to restore the TOC
10476 ;; pointer only when jumping over units of translation.
10477 ;; On Darwin, we need to reload the picbase.
10479 (define_expand "builtin_setjmp_receiver"
10480 [(use (label_ref (match_operand 0 "" "")))]
10481 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10482 || (TARGET_TOC && TARGET_MINIMAL_TOC)
10483 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
10487 if (DEFAULT_ABI == ABI_DARWIN)
10489 char *picbase = machopic_function_base_name ();
10490 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1));
10491 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
10495 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
10496 CODE_LABEL_NUMBER (operands[0]));
10497 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (tmplab, -1));
10499 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
10500 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
10504 rs6000_emit_load_toc_table (FALSE);
10508 ;; A function pointer under AIX is a pointer to a data area whose first word
10509 ;; contains the actual address of the function, whose second word contains a
10510 ;; pointer to its TOC, and whose third word contains a value to place in the
10511 ;; static chain register (r11). Note that if we load the static chain, our
10512 ;; "trampoline" need not have any executable code.
10514 (define_expand "call_indirect_aix32"
10515 [(set (match_dup 2)
10516 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10517 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10520 (mem:SI (plus:SI (match_dup 0)
10523 (mem:SI (plus:SI (match_dup 0)
10525 (parallel [(call (mem:SI (match_dup 2))
10526 (match_operand 1 "" ""))
10530 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10531 (clobber (scratch:SI))])]
10534 { operands[2] = gen_reg_rtx (SImode); }")
10536 (define_expand "call_indirect_aix64"
10537 [(set (match_dup 2)
10538 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10539 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10542 (mem:DI (plus:DI (match_dup 0)
10545 (mem:DI (plus:DI (match_dup 0)
10547 (parallel [(call (mem:SI (match_dup 2))
10548 (match_operand 1 "" ""))
10552 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10553 (clobber (scratch:SI))])]
10556 { operands[2] = gen_reg_rtx (DImode); }")
10558 (define_expand "call_value_indirect_aix32"
10559 [(set (match_dup 3)
10560 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10561 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10564 (mem:SI (plus:SI (match_dup 1)
10567 (mem:SI (plus:SI (match_dup 1)
10569 (parallel [(set (match_operand 0 "" "")
10570 (call (mem:SI (match_dup 3))
10571 (match_operand 2 "" "")))
10575 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10576 (clobber (scratch:SI))])]
10579 { operands[3] = gen_reg_rtx (SImode); }")
10581 (define_expand "call_value_indirect_aix64"
10582 [(set (match_dup 3)
10583 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10584 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10587 (mem:DI (plus:DI (match_dup 1)
10590 (mem:DI (plus:DI (match_dup 1)
10592 (parallel [(set (match_operand 0 "" "")
10593 (call (mem:SI (match_dup 3))
10594 (match_operand 2 "" "")))
10598 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10599 (clobber (scratch:SI))])]
10602 { operands[3] = gen_reg_rtx (DImode); }")
10604 ;; Now the definitions for the call and call_value insns
10605 (define_expand "call"
10606 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10607 (match_operand 1 "" ""))
10608 (use (match_operand 2 "" ""))
10609 (clobber (scratch:SI))])]
10615 operands[0] = machopic_indirect_call_target (operands[0]);
10618 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10621 operands[0] = XEXP (operands[0], 0);
10623 if (GET_CODE (operands[0]) != SYMBOL_REF
10624 || (INTVAL (operands[2]) & CALL_LONG) != 0)
10626 if (INTVAL (operands[2]) & CALL_LONG)
10627 operands[0] = rs6000_longcall_ref (operands[0]);
10629 if (DEFAULT_ABI == ABI_V4
10630 || DEFAULT_ABI == ABI_AIX_NODESC
10631 || DEFAULT_ABI == ABI_DARWIN)
10632 operands[0] = force_reg (Pmode, operands[0]);
10634 else if (DEFAULT_ABI == ABI_AIX)
10636 /* AIX function pointers are really pointers to a three word
10638 emit_call_insn (TARGET_32BIT
10639 ? gen_call_indirect_aix32 (force_reg (SImode,
10642 : gen_call_indirect_aix64 (force_reg (DImode,
10652 (define_expand "call_value"
10653 [(parallel [(set (match_operand 0 "" "")
10654 (call (mem:SI (match_operand 1 "address_operand" ""))
10655 (match_operand 2 "" "")))
10656 (use (match_operand 3 "" ""))
10657 (clobber (scratch:SI))])]
10663 operands[1] = machopic_indirect_call_target (operands[1]);
10666 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10669 operands[1] = XEXP (operands[1], 0);
10671 if (GET_CODE (operands[1]) != SYMBOL_REF
10672 || (INTVAL (operands[3]) & CALL_LONG) != 0)
10674 if (INTVAL (operands[3]) & CALL_LONG)
10675 operands[1] = rs6000_longcall_ref (operands[1]);
10677 if (DEFAULT_ABI == ABI_V4
10678 || DEFAULT_ABI == ABI_AIX_NODESC
10679 || DEFAULT_ABI == ABI_DARWIN)
10680 operands[0] = force_reg (Pmode, operands[0]);
10682 else if (DEFAULT_ABI == ABI_AIX)
10684 /* AIX function pointers are really pointers to a three word
10686 emit_call_insn (TARGET_32BIT
10687 ? gen_call_value_indirect_aix32 (operands[0],
10691 : gen_call_value_indirect_aix64 (operands[0],
10702 ;; Call to function in current module. No TOC pointer reload needed.
10703 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10704 ;; either the function was not prototyped, or it was prototyped as a
10705 ;; variable argument function. It is > 0 if FP registers were passed
10706 ;; and < 0 if they were not.
10708 (define_insn "*call_local32"
10709 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10710 (match_operand 1 "" "g,g"))
10711 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10712 (clobber (match_scratch:SI 3 "=l,l"))]
10713 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10716 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10717 output_asm_insn (\"crxor 6,6,6\", operands);
10719 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10720 output_asm_insn (\"creqv 6,6,6\", operands);
10722 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10724 [(set_attr "type" "branch")
10725 (set_attr "length" "4,8")])
10727 (define_insn "*call_local64"
10728 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10729 (match_operand 1 "" "g,g"))
10730 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10731 (clobber (match_scratch:SI 3 "=l,l"))]
10732 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10735 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10736 output_asm_insn (\"crxor 6,6,6\", operands);
10738 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10739 output_asm_insn (\"creqv 6,6,6\", operands);
10741 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10743 [(set_attr "type" "branch")
10744 (set_attr "length" "4,8")])
10746 (define_insn "*call_value_local32"
10747 [(set (match_operand 0 "" "")
10748 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10749 (match_operand 2 "" "g,g")))
10750 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10751 (clobber (match_scratch:SI 4 "=l,l"))]
10752 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10755 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10756 output_asm_insn (\"crxor 6,6,6\", operands);
10758 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10759 output_asm_insn (\"creqv 6,6,6\", operands);
10761 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10763 [(set_attr "type" "branch")
10764 (set_attr "length" "4,8")])
10767 (define_insn "*call_value_local64"
10768 [(set (match_operand 0 "" "")
10769 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10770 (match_operand 2 "" "g,g")))
10771 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10772 (clobber (match_scratch:SI 4 "=l,l"))]
10773 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10776 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10777 output_asm_insn (\"crxor 6,6,6\", operands);
10779 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10780 output_asm_insn (\"creqv 6,6,6\", operands);
10782 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10784 [(set_attr "type" "branch")
10785 (set_attr "length" "4,8")])
10787 ;; Call to function which may be in another module. Restore the TOC
10788 ;; pointer (r2) after the call unless this is System V.
10789 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10790 ;; either the function was not prototyped, or it was prototyped as a
10791 ;; variable argument function. It is > 0 if FP registers were passed
10792 ;; and < 0 if they were not.
10794 (define_insn "*call_indirect_nonlocal_aix32"
10795 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10796 (match_operand 1 "" "g"))
10800 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10801 (clobber (match_scratch:SI 2 "=l"))]
10802 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10803 "b%T0l\;{l|lwz} 2,20(1)"
10804 [(set_attr "type" "jmpreg")
10805 (set_attr "length" "8")])
10807 (define_insn "*call_nonlocal_aix32"
10808 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10809 (match_operand 1 "" "g"))
10810 (use (match_operand:SI 2 "immediate_operand" "O"))
10811 (clobber (match_scratch:SI 3 "=l"))]
10813 && DEFAULT_ABI == ABI_AIX
10814 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10816 [(set_attr "type" "branch")
10817 (set_attr "length" "8")])
10819 (define_insn "*call_indirect_nonlocal_aix64"
10820 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10821 (match_operand 1 "" "g"))
10825 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10826 (clobber (match_scratch:SI 2 "=l"))]
10827 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10828 "b%T0l\;ld 2,40(1)"
10829 [(set_attr "type" "jmpreg")
10830 (set_attr "length" "8")])
10832 (define_insn "*call_nonlocal_aix64"
10833 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10834 (match_operand 1 "" "g"))
10835 (use (match_operand:SI 2 "immediate_operand" "O"))
10836 (clobber (match_scratch:SI 3 "=l"))]
10838 && DEFAULT_ABI == ABI_AIX
10839 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10841 [(set_attr "type" "branch")
10842 (set_attr "length" "8")])
10844 (define_insn "*call_value_indirect_nonlocal_aix32"
10845 [(set (match_operand 0 "" "")
10846 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10847 (match_operand 2 "" "g")))
10851 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10852 (clobber (match_scratch:SI 3 "=l"))]
10853 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10854 "b%T1l\;{l|lwz} 2,20(1)"
10855 [(set_attr "type" "jmpreg")
10856 (set_attr "length" "8")])
10858 (define_insn "*call_value_nonlocal_aix32"
10859 [(set (match_operand 0 "" "")
10860 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10861 (match_operand 2 "" "g")))
10862 (use (match_operand:SI 3 "immediate_operand" "O"))
10863 (clobber (match_scratch:SI 4 "=l"))]
10865 && DEFAULT_ABI == ABI_AIX
10866 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10868 [(set_attr "type" "branch")
10869 (set_attr "length" "8")])
10871 (define_insn "*call_value_indirect_nonlocal_aix64"
10872 [(set (match_operand 0 "" "")
10873 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10874 (match_operand 2 "" "g")))
10878 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10879 (clobber (match_scratch:SI 3 "=l"))]
10880 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10881 "b%T1l\;ld 2,40(1)"
10882 [(set_attr "type" "jmpreg")
10883 (set_attr "length" "8")])
10885 (define_insn "*call_value_nonlocal_aix64"
10886 [(set (match_operand 0 "" "")
10887 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10888 (match_operand 2 "" "g")))
10889 (use (match_operand:SI 3 "immediate_operand" "O"))
10890 (clobber (match_scratch:SI 4 "=l"))]
10892 && DEFAULT_ABI == ABI_AIX
10893 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10895 [(set_attr "type" "branch")
10896 (set_attr "length" "8")])
10898 ;; A function pointer under System V is just a normal pointer
10899 ;; operands[0] is the function pointer
10900 ;; operands[1] is the stack size to clean up
10901 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10902 ;; which indicates how to set cr1
10904 (define_insn "*call_indirect_nonlocal_sysv"
10905 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10906 (match_operand 1 "" "g,g"))
10907 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10908 (clobber (match_scratch:SI 3 "=l,l"))]
10909 "DEFAULT_ABI == ABI_AIX_NODESC
10910 || DEFAULT_ABI == ABI_V4
10911 || DEFAULT_ABI == ABI_DARWIN"
10913 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10914 output_asm_insn ("crxor 6,6,6", operands);
10916 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10917 output_asm_insn ("creqv 6,6,6", operands);
10921 [(set_attr "type" "jmpreg,jmpreg")
10922 (set_attr "length" "4,8")])
10924 (define_insn "*call_nonlocal_sysv"
10925 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10926 (match_operand 1 "" "g,g"))
10927 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10928 (clobber (match_scratch:SI 3 "=l,l"))]
10929 "(DEFAULT_ABI == ABI_AIX_NODESC
10930 || DEFAULT_ABI == ABI_V4
10931 || DEFAULT_ABI == ABI_DARWIN)
10932 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10934 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10935 output_asm_insn ("crxor 6,6,6", operands);
10937 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10938 output_asm_insn ("creqv 6,6,6", operands);
10940 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10942 [(set_attr "type" "branch,branch")
10943 (set_attr "length" "4,8")])
10945 (define_insn "*call_value_indirect_nonlocal_sysv"
10946 [(set (match_operand 0 "" "")
10947 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10948 (match_operand 2 "" "g,g")))
10949 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10950 (clobber (match_scratch:SI 4 "=l,l"))]
10951 "DEFAULT_ABI == ABI_AIX_NODESC
10952 || DEFAULT_ABI == ABI_V4
10953 || DEFAULT_ABI == ABI_DARWIN"
10955 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10956 output_asm_insn ("crxor 6,6,6", operands);
10958 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10959 output_asm_insn ("creqv 6,6,6", operands);
10963 [(set_attr "type" "jmpreg,jmpreg")
10964 (set_attr "length" "4,8")])
10966 (define_insn "*call_value_nonlocal_sysv"
10967 [(set (match_operand 0 "" "")
10968 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10969 (match_operand 2 "" "g,g")))
10970 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10971 (clobber (match_scratch:SI 4 "=l,l"))]
10972 "(DEFAULT_ABI == ABI_AIX_NODESC
10973 || DEFAULT_ABI == ABI_V4
10974 || DEFAULT_ABI == ABI_DARWIN)
10975 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10977 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10978 output_asm_insn ("crxor 6,6,6", operands);
10980 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10981 output_asm_insn ("creqv 6,6,6", operands);
10983 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10985 [(set_attr "type" "branch,branch")
10986 (set_attr "length" "4,8")])
10988 ;; Call subroutine returning any type.
10989 (define_expand "untyped_call"
10990 [(parallel [(call (match_operand 0 "" "")
10992 (match_operand 1 "" "")
10993 (match_operand 2 "" "")])]
10999 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
11001 for (i = 0; i < XVECLEN (operands[2], 0); i++)
11003 rtx set = XVECEXP (operands[2], 0, i);
11004 emit_move_insn (SET_DEST (set), SET_SRC (set));
11007 /* The optimizer does not know that the call sets the function value
11008 registers we stored in the result block. We avoid problems by
11009 claiming that all hard registers are used and clobbered at this
11011 emit_insn (gen_blockage ());
11016 ;; sibling call patterns
11017 (define_expand "sibcall"
11018 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
11019 (match_operand 1 "" ""))
11020 (use (match_operand 2 "" ""))
11028 operands[0] = machopic_indirect_call_target (operands[0]);
11031 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
11034 operands[0] = XEXP (operands[0], 0);
11038 ;; this and similar patterns must be marked as using LR, otherwise
11039 ;; dataflow will try to delete the store into it. This is true
11040 ;; even when the actual reg to jump to is in CTR, when LR was
11041 ;; saved and restored around the PIC-setting BCL.
11042 (define_insn "*sibcall_local32"
11043 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
11044 (match_operand 1 "" "g,g"))
11045 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11046 (use (match_scratch:SI 3 "=l,l"))
11048 "(INTVAL (operands[2]) & CALL_LONG) == 0"
11051 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11052 output_asm_insn (\"crxor 6,6,6\", operands);
11054 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11055 output_asm_insn (\"creqv 6,6,6\", operands);
11057 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11059 [(set_attr "type" "branch")
11060 (set_attr "length" "4,8")])
11062 (define_insn "*sibcall_local64"
11063 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
11064 (match_operand 1 "" "g,g"))
11065 (use (match_operand:SI 2 "immediate_operand" "O,n"))
11066 (use (match_scratch:SI 3 "=l,l"))
11068 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
11071 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11072 output_asm_insn (\"crxor 6,6,6\", operands);
11074 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11075 output_asm_insn (\"creqv 6,6,6\", operands);
11077 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
11079 [(set_attr "type" "branch")
11080 (set_attr "length" "4,8")])
11082 (define_insn "*sibcall_value_local32"
11083 [(set (match_operand 0 "" "")
11084 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
11085 (match_operand 2 "" "g,g")))
11086 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11087 (use (match_scratch:SI 4 "=l,l"))
11089 "(INTVAL (operands[3]) & CALL_LONG) == 0"
11092 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11093 output_asm_insn (\"crxor 6,6,6\", operands);
11095 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11096 output_asm_insn (\"creqv 6,6,6\", operands);
11098 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11100 [(set_attr "type" "branch")
11101 (set_attr "length" "4,8")])
11104 (define_insn "*sibcall_value_local64"
11105 [(set (match_operand 0 "" "")
11106 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
11107 (match_operand 2 "" "g,g")))
11108 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11109 (use (match_scratch:SI 4 "=l,l"))
11111 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
11114 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
11115 output_asm_insn (\"crxor 6,6,6\", operands);
11117 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
11118 output_asm_insn (\"creqv 6,6,6\", operands);
11120 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
11122 [(set_attr "type" "branch")
11123 (set_attr "length" "4,8")])
11125 (define_insn "*sibcall_nonlocal_aix32"
11126 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
11127 (match_operand 1 "" "g"))
11128 (use (match_operand:SI 2 "immediate_operand" "O"))
11129 (use (match_scratch:SI 3 "=l"))
11132 && DEFAULT_ABI == ABI_AIX
11133 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11135 [(set_attr "type" "branch")
11136 (set_attr "length" "4")])
11138 (define_insn "*sibcall_nonlocal_aix64"
11139 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
11140 (match_operand 1 "" "g"))
11141 (use (match_operand:SI 2 "immediate_operand" "O"))
11142 (use (match_scratch:SI 3 "=l"))
11145 && DEFAULT_ABI == ABI_AIX
11146 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11148 [(set_attr "type" "branch")
11149 (set_attr "length" "4")])
11151 (define_insn "*sibcall_value_nonlocal_aix32"
11152 [(set (match_operand 0 "" "")
11153 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
11154 (match_operand 2 "" "g")))
11155 (use (match_operand:SI 3 "immediate_operand" "O"))
11156 (use (match_scratch:SI 4 "=l"))
11159 && DEFAULT_ABI == ABI_AIX
11160 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11162 [(set_attr "type" "branch")
11163 (set_attr "length" "4")])
11165 (define_insn "*sibcall_value_nonlocal_aix64"
11166 [(set (match_operand 0 "" "")
11167 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
11168 (match_operand 2 "" "g")))
11169 (use (match_operand:SI 3 "immediate_operand" "O"))
11170 (use (match_scratch:SI 4 "=l"))
11173 && DEFAULT_ABI == ABI_AIX
11174 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11176 [(set_attr "type" "branch")
11177 (set_attr "length" "4")])
11179 (define_insn "*sibcall_nonlocal_sysv"
11180 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
11181 (match_operand 1 "" ""))
11182 (use (match_operand 2 "immediate_operand" "O,n"))
11183 (use (match_scratch:SI 3 "=l,l"))
11185 "(DEFAULT_ABI == ABI_DARWIN
11186 || DEFAULT_ABI == ABI_V4
11187 || DEFAULT_ABI == ABI_AIX_NODESC)
11188 && (INTVAL (operands[2]) & CALL_LONG) == 0"
11191 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11192 output_asm_insn (\"crxor 6,6,6\", operands);
11194 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11195 output_asm_insn (\"creqv 6,6,6\", operands);
11197 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
11199 [(set_attr "type" "branch,branch")
11200 (set_attr "length" "4,8")])
11202 (define_expand "sibcall_value"
11203 [(parallel [(set (match_operand 0 "register_operand" "")
11204 (call (mem:SI (match_operand 1 "address_operand" ""))
11205 (match_operand 2 "" "")))
11206 (use (match_operand 3 "" ""))
11214 operands[1] = machopic_indirect_call_target (operands[1]);
11217 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
11220 operands[1] = XEXP (operands[1], 0);
11224 (define_insn "*sibcall_value_nonlocal_sysv"
11225 [(set (match_operand 0 "" "")
11226 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
11227 (match_operand 2 "" "")))
11228 (use (match_operand:SI 3 "immediate_operand" "O,n"))
11229 (use (match_scratch:SI 4 "=l,l"))
11231 "(DEFAULT_ABI == ABI_DARWIN
11232 || DEFAULT_ABI == ABI_V4
11233 || DEFAULT_ABI == ABI_AIX_NODESC)
11234 && (INTVAL (operands[3]) & CALL_LONG) == 0"
11237 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
11238 output_asm_insn (\"crxor 6,6,6\", operands);
11240 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
11241 output_asm_insn (\"creqv 6,6,6\", operands);
11243 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
11245 [(set_attr "type" "branch,branch")
11246 (set_attr "length" "4,8")])
11248 (define_expand "sibcall_epilogue"
11249 [(use (const_int 0))]
11250 "TARGET_SCHED_PROLOG"
11253 rs6000_emit_epilogue (TRUE);
11257 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
11258 ;; all of memory. This blocks insns from being moved across this point.
11260 (define_insn "blockage"
11261 [(unspec_volatile [(const_int 0)] 0)]
11265 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
11266 ;; signed & unsigned, and one type of branch.
11268 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
11269 ;; insns, and branches. We store the operands of compares until we see
11271 (define_expand "cmpsi"
11273 (compare (match_operand:SI 0 "gpc_reg_operand" "")
11274 (match_operand:SI 1 "reg_or_short_operand" "")))]
11278 /* Take care of the possibility that operands[1] might be negative but
11279 this might be a logical operation. That insn doesn't exist. */
11280 if (GET_CODE (operands[1]) == CONST_INT
11281 && INTVAL (operands[1]) < 0)
11282 operands[1] = force_reg (SImode, operands[1]);
11284 rs6000_compare_op0 = operands[0];
11285 rs6000_compare_op1 = operands[1];
11286 rs6000_compare_fp_p = 0;
11290 (define_expand "cmpdi"
11292 (compare (match_operand:DI 0 "gpc_reg_operand" "")
11293 (match_operand:DI 1 "reg_or_short_operand" "")))]
11297 /* Take care of the possibility that operands[1] might be negative but
11298 this might be a logical operation. That insn doesn't exist. */
11299 if (GET_CODE (operands[1]) == CONST_INT
11300 && INTVAL (operands[1]) < 0)
11301 operands[1] = force_reg (DImode, operands[1]);
11303 rs6000_compare_op0 = operands[0];
11304 rs6000_compare_op1 = operands[1];
11305 rs6000_compare_fp_p = 0;
11309 (define_expand "cmpsf"
11310 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
11311 (match_operand:SF 1 "gpc_reg_operand" "")))]
11312 "TARGET_HARD_FLOAT"
11315 rs6000_compare_op0 = operands[0];
11316 rs6000_compare_op1 = operands[1];
11317 rs6000_compare_fp_p = 1;
11321 (define_expand "cmpdf"
11322 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
11323 (match_operand:DF 1 "gpc_reg_operand" "")))]
11324 "TARGET_HARD_FLOAT && TARGET_FPRS"
11327 rs6000_compare_op0 = operands[0];
11328 rs6000_compare_op1 = operands[1];
11329 rs6000_compare_fp_p = 1;
11333 (define_expand "cmptf"
11334 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
11335 (match_operand:TF 1 "gpc_reg_operand" "")))]
11336 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
11337 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
11340 rs6000_compare_op0 = operands[0];
11341 rs6000_compare_op1 = operands[1];
11342 rs6000_compare_fp_p = 1;
11346 (define_expand "beq"
11347 [(use (match_operand 0 "" ""))]
11349 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
11351 (define_expand "bne"
11352 [(use (match_operand 0 "" ""))]
11354 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
11356 (define_expand "bge"
11357 [(use (match_operand 0 "" ""))]
11359 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
11361 (define_expand "bgt"
11362 [(use (match_operand 0 "" ""))]
11364 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
11366 (define_expand "ble"
11367 [(use (match_operand 0 "" ""))]
11369 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
11371 (define_expand "blt"
11372 [(use (match_operand 0 "" ""))]
11374 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
11376 (define_expand "bgeu"
11377 [(use (match_operand 0 "" ""))]
11379 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
11381 (define_expand "bgtu"
11382 [(use (match_operand 0 "" ""))]
11384 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
11386 (define_expand "bleu"
11387 [(use (match_operand 0 "" ""))]
11389 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
11391 (define_expand "bltu"
11392 [(use (match_operand 0 "" ""))]
11394 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
11396 (define_expand "bunordered"
11397 [(use (match_operand 0 "" ""))]
11399 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
11401 (define_expand "bordered"
11402 [(use (match_operand 0 "" ""))]
11404 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
11406 (define_expand "buneq"
11407 [(use (match_operand 0 "" ""))]
11409 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
11411 (define_expand "bunge"
11412 [(use (match_operand 0 "" ""))]
11414 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
11416 (define_expand "bungt"
11417 [(use (match_operand 0 "" ""))]
11419 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
11421 (define_expand "bunle"
11422 [(use (match_operand 0 "" ""))]
11424 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
11426 (define_expand "bunlt"
11427 [(use (match_operand 0 "" ""))]
11429 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
11431 (define_expand "bltgt"
11432 [(use (match_operand 0 "" ""))]
11434 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
11436 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
11437 ;; For SEQ, likewise, except that comparisons with zero should be done
11438 ;; with an scc insns. However, due to the order that combine see the
11439 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
11440 ;; the cases we don't want to handle.
11441 (define_expand "seq"
11442 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11444 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
11446 (define_expand "sne"
11447 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11451 if (! rs6000_compare_fp_p)
11454 rs6000_emit_sCOND (NE, operands[0]);
11458 ;; A > 0 is best done using the portable sequence, so fail in that case.
11459 (define_expand "sgt"
11460 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11464 if (! rs6000_compare_fp_p
11465 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11468 rs6000_emit_sCOND (GT, operands[0]);
11472 ;; A < 0 is best done in the portable way for A an integer.
11473 (define_expand "slt"
11474 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11478 if (! rs6000_compare_fp_p
11479 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11482 rs6000_emit_sCOND (LT, operands[0]);
11486 ;; A >= 0 is best done the portable way for A an integer.
11487 (define_expand "sge"
11488 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11492 if (! rs6000_compare_fp_p
11493 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11496 rs6000_emit_sCOND (GE, operands[0]);
11500 ;; A <= 0 is best done the portable way for A an integer.
11501 (define_expand "sle"
11502 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11506 if (! rs6000_compare_fp_p
11507 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
11510 rs6000_emit_sCOND (LE, operands[0]);
11514 (define_expand "sgtu"
11515 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11517 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
11519 (define_expand "sltu"
11520 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11522 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
11524 (define_expand "sgeu"
11525 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11527 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
11529 (define_expand "sleu"
11530 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
11532 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
11534 ;; Here are the actual compare insns.
11535 (define_insn "*cmpsi_internal1"
11536 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11537 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11538 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11540 "{cmp%I2|cmpw%I2} %0,%1,%2"
11541 [(set_attr "type" "compare")])
11543 (define_insn "*cmpdi_internal1"
11544 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11545 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11546 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11549 [(set_attr "type" "compare")])
11551 ;; If we are comparing a register for equality with a large constant,
11552 ;; we can do this with an XOR followed by a compare. But we need a scratch
11553 ;; register for the result of the XOR.
11556 [(set (match_operand:CC 0 "cc_reg_operand" "")
11557 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11558 (match_operand:SI 2 "non_short_cint_operand" "")))
11559 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11560 "find_single_use (operands[0], insn, 0)
11561 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11562 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11563 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11564 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11567 /* Get the constant we are comparing against, C, and see what it looks like
11568 sign-extended to 16 bits. Then see what constant could be XOR'ed
11569 with C to get the sign-extended value. */
11571 HOST_WIDE_INT c = INTVAL (operands[2]);
11572 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11573 HOST_WIDE_INT xorv = c ^ sextc;
11575 operands[4] = GEN_INT (xorv);
11576 operands[5] = GEN_INT (sextc);
11579 (define_insn "*cmpsi_internal2"
11580 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11581 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11582 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11584 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11585 [(set_attr "type" "compare")])
11587 (define_insn "*cmpdi_internal2"
11588 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11589 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11590 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11592 "cmpld%I2 %0,%1,%b2"
11593 [(set_attr "type" "compare")])
11595 ;; The following two insns don't exist as single insns, but if we provide
11596 ;; them, we can swap an add and compare, which will enable us to overlap more
11597 ;; of the required delay between a compare and branch. We generate code for
11598 ;; them by splitting.
11601 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11602 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11603 (match_operand:SI 2 "short_cint_operand" "i")))
11604 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11605 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11608 [(set_attr "length" "8")])
11611 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11612 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11613 (match_operand:SI 2 "u_short_cint_operand" "i")))
11614 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11615 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11618 [(set_attr "length" "8")])
11621 [(set (match_operand:CC 3 "cc_reg_operand" "")
11622 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11623 (match_operand:SI 2 "short_cint_operand" "")))
11624 (set (match_operand:SI 0 "gpc_reg_operand" "")
11625 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11627 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11628 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11631 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11632 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11633 (match_operand:SI 2 "u_short_cint_operand" "")))
11634 (set (match_operand:SI 0 "gpc_reg_operand" "")
11635 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11637 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11638 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11640 (define_insn "*cmpsf_internal1"
11641 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11642 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11643 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11644 "TARGET_HARD_FLOAT && TARGET_FPRS"
11646 [(set_attr "type" "fpcompare")])
11648 (define_insn "*cmpdf_internal1"
11649 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11650 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11651 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11652 "TARGET_HARD_FLOAT && TARGET_FPRS"
11654 [(set_attr "type" "fpcompare")])
11656 ;; Only need to compare second words if first words equal
11657 (define_insn "*cmptf_internal1"
11658 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11659 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11660 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11661 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
11662 && TARGET_LONG_DOUBLE_128"
11663 "fcmpu %0,%1,%2\;bne %0,$+4\;fcmpu %0,%L1,%L2"
11664 [(set_attr "type" "fpcompare")
11665 (set_attr "length" "12")])
11667 ;; Now we have the scc insns. We can do some combinations because of the
11668 ;; way the machine works.
11670 ;; Note that this is probably faster if we can put an insn between the
11671 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11672 ;; cases the insns below which don't use an intermediate CR field will
11673 ;; be used instead.
11675 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11676 (match_operator:SI 1 "scc_comparison_operator"
11677 [(match_operand 2 "cc_reg_operand" "y")
11680 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11681 [(set_attr "type" "cr_logical")
11682 (set_attr "length" "12")])
11684 ;; Same as above, but get the OV/ORDERED bit.
11685 (define_insn "move_from_CR_ov_bit"
11686 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11687 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] 724))]
11689 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11690 [(set_attr "length" "12")])
11693 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11694 (match_operator:DI 1 "scc_comparison_operator"
11695 [(match_operand 2 "cc_reg_operand" "y")
11698 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11699 [(set_attr "type" "cr_logical")
11700 (set_attr "length" "12")])
11703 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11704 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11705 [(match_operand 2 "cc_reg_operand" "y,y")
11708 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11709 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11710 "! TARGET_POWERPC64"
11712 %D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1
11714 [(set_attr "type" "delayed_compare")
11715 (set_attr "length" "12,16")])
11718 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11719 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11720 [(match_operand 2 "cc_reg_operand" "")
11723 (set (match_operand:SI 3 "gpc_reg_operand" "")
11724 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11725 "! TARGET_POWERPC64 && reload_completed"
11726 [(set (match_dup 3)
11727 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11729 (compare:CC (match_dup 3)
11734 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11735 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11736 [(match_operand 2 "cc_reg_operand" "y")
11738 (match_operand:SI 3 "const_int_operand" "n")))]
11742 int is_bit = ccr_bit (operands[1], 1);
11743 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11746 if (is_bit >= put_bit)
11747 count = is_bit - put_bit;
11749 count = 32 - (put_bit - is_bit);
11751 operands[4] = GEN_INT (count);
11752 operands[5] = GEN_INT (put_bit);
11754 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11756 [(set_attr "type" "cr_logical")
11757 (set_attr "length" "12")])
11760 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11762 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11763 [(match_operand 2 "cc_reg_operand" "y,y")
11765 (match_operand:SI 3 "const_int_operand" "n,n"))
11767 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11768 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11773 int is_bit = ccr_bit (operands[1], 1);
11774 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11777 /* Force split for non-cc0 compare. */
11778 if (which_alternative == 1)
11781 if (is_bit >= put_bit)
11782 count = is_bit - put_bit;
11784 count = 32 - (put_bit - is_bit);
11786 operands[5] = GEN_INT (count);
11787 operands[6] = GEN_INT (put_bit);
11789 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11791 [(set_attr "type" "delayed_compare")
11792 (set_attr "length" "12,16")])
11795 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11797 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11798 [(match_operand 2 "cc_reg_operand" "")
11800 (match_operand:SI 3 "const_int_operand" ""))
11802 (set (match_operand:SI 4 "gpc_reg_operand" "")
11803 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11806 [(set (match_dup 4)
11807 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11810 (compare:CC (match_dup 4)
11814 ;; There is a 3 cycle delay between consecutive mfcr instructions
11815 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11818 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11819 (match_operator:SI 1 "scc_comparison_operator"
11820 [(match_operand 2 "cc_reg_operand" "y")
11822 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11823 (match_operator:SI 4 "scc_comparison_operator"
11824 [(match_operand 5 "cc_reg_operand" "y")
11826 "REGNO (operands[2]) != REGNO (operands[5])"
11827 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11828 [(set_attr "type" "cr_logical")
11829 (set_attr "length" "20")])
11832 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11833 (match_operator:DI 1 "scc_comparison_operator"
11834 [(match_operand 2 "cc_reg_operand" "y")
11836 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11837 (match_operator:DI 4 "scc_comparison_operator"
11838 [(match_operand 5 "cc_reg_operand" "y")
11840 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11841 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11842 [(set_attr "type" "cr_logical")
11843 (set_attr "length" "20")])
11845 ;; There are some scc insns that can be done directly, without a compare.
11846 ;; These are faster because they don't involve the communications between
11847 ;; the FXU and branch units. In fact, we will be replacing all of the
11848 ;; integer scc insns here or in the portable methods in emit_store_flag.
11850 ;; Also support (neg (scc ..)) since that construct is used to replace
11851 ;; branches, (plus (scc ..) ..) since that construct is common and
11852 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11853 ;; cases where it is no more expensive than (neg (scc ..)).
11855 ;; Have reload force a constant into a register for the simple insns that
11856 ;; otherwise won't accept constants. We do this because it is faster than
11857 ;; the cmp/mfcr sequence we would otherwise generate.
11860 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11861 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11862 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11863 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11864 "! TARGET_POWERPC64"
11866 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11867 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11868 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11869 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11870 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11871 [(set_attr "length" "12,8,12,12,12")])
11874 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11875 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11876 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11877 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11880 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11881 subfic %3,%1,0\;adde %0,%3,%1
11882 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11883 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11884 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11885 [(set_attr "length" "12,8,12,12,12")])
11888 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11890 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11891 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11893 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11894 (eq:SI (match_dup 1) (match_dup 2)))
11895 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11896 "! TARGET_POWERPC64"
11898 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11899 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11900 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11901 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11902 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11908 [(set_attr "type" "compare")
11909 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11912 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11914 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11915 (match_operand:SI 2 "reg_or_cint_operand" ""))
11917 (set (match_operand:SI 0 "gpc_reg_operand" "")
11918 (eq:SI (match_dup 1) (match_dup 2)))
11919 (clobber (match_scratch:SI 3 ""))]
11920 "! TARGET_POWERPC64 && reload_completed"
11921 [(parallel [(set (match_dup 0)
11922 (eq:SI (match_dup 1) (match_dup 2)))
11923 (clobber (match_dup 3))])
11925 (compare:CC (match_dup 0)
11930 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11932 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11933 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11935 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11936 (eq:DI (match_dup 1) (match_dup 2)))
11937 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11940 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11941 subfic %3,%1,0\;adde. %0,%3,%1
11942 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11943 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11944 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11950 [(set_attr "type" "compare")
11951 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11954 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11956 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11957 (match_operand:DI 2 "reg_or_cint_operand" ""))
11959 (set (match_operand:DI 0 "gpc_reg_operand" "")
11960 (eq:DI (match_dup 1) (match_dup 2)))
11961 (clobber (match_scratch:DI 3 ""))]
11962 "TARGET_POWERPC64 && reload_completed"
11963 [(parallel [(set (match_dup 0)
11964 (eq:DI (match_dup 1) (match_dup 2)))
11965 (clobber (match_dup 3))])
11967 (compare:CC (match_dup 0)
11971 ;; We have insns of the form shown by the first define_insn below. If
11972 ;; there is something inside the comparison operation, we must split it.
11974 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11975 (plus:SI (match_operator 1 "comparison_operator"
11976 [(match_operand:SI 2 "" "")
11977 (match_operand:SI 3
11978 "reg_or_cint_operand" "")])
11979 (match_operand:SI 4 "gpc_reg_operand" "")))
11980 (clobber (match_operand:SI 5 "register_operand" ""))]
11981 "! gpc_reg_operand (operands[2], SImode)"
11982 [(set (match_dup 5) (match_dup 2))
11983 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11987 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11988 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11989 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11990 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11991 "! TARGET_POWERPC64"
11993 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11994 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11995 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11996 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11997 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11998 [(set_attr "length" "12,8,12,12,12")])
12001 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12004 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12005 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
12006 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12008 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
12009 "! TARGET_POWERPC64"
12011 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12012 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
12013 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12014 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12015 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12021 [(set_attr "type" "compare")
12022 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12025 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12028 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12029 (match_operand:SI 2 "reg_or_cint_operand" ""))
12030 (match_operand:SI 3 "gpc_reg_operand" ""))
12032 (clobber (match_scratch:SI 4 ""))]
12033 "! TARGET_POWERPC64 && reload_completed"
12034 [(set (match_dup 4)
12035 (plus:SI (eq:SI (match_dup 1)
12039 (compare:CC (match_dup 4)
12044 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
12047 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
12048 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
12049 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
12051 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
12052 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12053 "! TARGET_POWERPC64"
12055 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12056 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
12057 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12058 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12059 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12065 [(set_attr "type" "compare")
12066 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
12069 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12072 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
12073 (match_operand:SI 2 "reg_or_cint_operand" ""))
12074 (match_operand:SI 3 "gpc_reg_operand" ""))
12076 (set (match_operand:SI 0 "gpc_reg_operand" "")
12077 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12078 "! TARGET_POWERPC64 && reload_completed"
12079 [(set (match_dup 0)
12080 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12082 (compare:CC (match_dup 0)
12087 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
12088 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
12089 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
12090 "! TARGET_POWERPC64"
12092 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12093 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
12094 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12095 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12096 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12097 [(set_attr "length" "12,8,12,12,12")])
12099 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
12100 ;; since it nabs/sr is just as fast.
12101 (define_insn "*ne0"
12102 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12103 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12105 (clobber (match_scratch:SI 2 "=&r"))]
12106 "! TARGET_POWER && ! TARGET_POWERPC64 && !TARGET_ISEL"
12107 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
12108 [(set_attr "length" "8")])
12111 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12112 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12114 (clobber (match_scratch:DI 2 "=&r"))]
12116 "addic %2,%1,-1\;subfe %0,%2,%1"
12117 [(set_attr "length" "8")])
12119 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
12121 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12122 (plus:SI (lshiftrt:SI
12123 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
12125 (match_operand:SI 2 "gpc_reg_operand" "r")))
12126 (clobber (match_scratch:SI 3 "=&r"))]
12127 "! TARGET_POWERPC64"
12128 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
12129 [(set_attr "length" "8")])
12132 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12133 (plus:DI (lshiftrt:DI
12134 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
12136 (match_operand:DI 2 "gpc_reg_operand" "r")))
12137 (clobber (match_scratch:DI 3 "=&r"))]
12139 "addic %3,%1,-1\;addze %0,%2"
12140 [(set_attr "length" "8")])
12143 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12145 (plus:SI (lshiftrt:SI
12146 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12148 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12150 (clobber (match_scratch:SI 3 "=&r,&r"))
12151 (clobber (match_scratch:SI 4 "=X,&r"))]
12152 "! TARGET_POWERPC64"
12154 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
12156 [(set_attr "type" "compare")
12157 (set_attr "length" "8,12")])
12160 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12162 (plus:SI (lshiftrt:SI
12163 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12165 (match_operand:SI 2 "gpc_reg_operand" ""))
12167 (clobber (match_scratch:SI 3 ""))
12168 (clobber (match_scratch:SI 4 ""))]
12169 "! TARGET_POWERPC64 && reload_completed"
12170 [(parallel [(set (match_dup 3)
12171 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
12174 (clobber (match_dup 4))])
12176 (compare:CC (match_dup 3)
12181 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12183 (plus:DI (lshiftrt:DI
12184 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12186 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12188 (clobber (match_scratch:DI 3 "=&r,&r"))]
12191 addic %3,%1,-1\;addze. %3,%2
12193 [(set_attr "type" "compare")
12194 (set_attr "length" "8,12")])
12197 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12199 (plus:DI (lshiftrt:DI
12200 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12202 (match_operand:DI 2 "gpc_reg_operand" ""))
12204 (clobber (match_scratch:DI 3 ""))]
12205 "TARGET_POWERPC64 && reload_completed"
12206 [(set (match_dup 3)
12207 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
12211 (compare:CC (match_dup 3)
12216 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12218 (plus:SI (lshiftrt:SI
12219 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
12221 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12223 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12224 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12226 (clobber (match_scratch:SI 3 "=&r,&r"))]
12227 "! TARGET_POWERPC64"
12229 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
12231 [(set_attr "type" "compare")
12232 (set_attr "length" "8,12")])
12235 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12237 (plus:SI (lshiftrt:SI
12238 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
12240 (match_operand:SI 2 "gpc_reg_operand" ""))
12242 (set (match_operand:SI 0 "gpc_reg_operand" "")
12243 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12245 (clobber (match_scratch:SI 3 ""))]
12246 "! TARGET_POWERPC64 && reload_completed"
12247 [(parallel [(set (match_dup 0)
12248 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
12250 (clobber (match_dup 3))])
12252 (compare:CC (match_dup 0)
12257 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12259 (plus:DI (lshiftrt:DI
12260 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
12262 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12264 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12265 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12267 (clobber (match_scratch:DI 3 "=&r,&r"))]
12270 addic %3,%1,-1\;addze. %0,%2
12272 [(set_attr "type" "compare")
12273 (set_attr "length" "8,12")])
12276 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12278 (plus:DI (lshiftrt:DI
12279 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
12281 (match_operand:DI 2 "gpc_reg_operand" ""))
12283 (set (match_operand:DI 0 "gpc_reg_operand" "")
12284 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12286 (clobber (match_scratch:DI 3 ""))]
12287 "TARGET_POWERPC64 && reload_completed"
12288 [(parallel [(set (match_dup 0)
12289 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
12291 (clobber (match_dup 3))])
12293 (compare:CC (match_dup 0)
12298 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12299 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12300 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
12301 (clobber (match_scratch:SI 3 "=r,X"))]
12304 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
12305 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
12306 [(set_attr "length" "12")])
12309 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12311 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12312 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12314 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12315 (le:SI (match_dup 1) (match_dup 2)))
12316 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
12319 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12320 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
12323 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
12324 (set_attr "length" "12,12,16,16")])
12327 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12329 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12330 (match_operand:SI 2 "reg_or_short_operand" ""))
12332 (set (match_operand:SI 0 "gpc_reg_operand" "")
12333 (le:SI (match_dup 1) (match_dup 2)))
12334 (clobber (match_scratch:SI 3 ""))]
12335 "TARGET_POWER && reload_completed"
12336 [(parallel [(set (match_dup 0)
12337 (le:SI (match_dup 1) (match_dup 2)))
12338 (clobber (match_dup 3))])
12340 (compare:CC (match_dup 0)
12345 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12346 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12347 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
12348 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12351 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
12352 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
12353 [(set_attr "length" "12")])
12356 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12358 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12359 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12360 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12362 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12365 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12366 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
12369 [(set_attr "type" "compare")
12370 (set_attr "length" "12,12,16,16")])
12373 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12375 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12376 (match_operand:SI 2 "reg_or_short_operand" ""))
12377 (match_operand:SI 3 "gpc_reg_operand" ""))
12379 (clobber (match_scratch:SI 4 ""))]
12380 "TARGET_POWER && reload_completed"
12381 [(set (match_dup 4)
12382 (plus:SI (le:SI (match_dup 1) (match_dup 2))
12385 (compare:CC (match_dup 4)
12390 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12392 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12393 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
12394 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12396 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12397 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12400 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12401 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
12404 [(set_attr "type" "compare")
12405 (set_attr "length" "12,12,16,16")])
12408 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12410 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
12411 (match_operand:SI 2 "reg_or_short_operand" ""))
12412 (match_operand:SI 3 "gpc_reg_operand" ""))
12414 (set (match_operand:SI 0 "gpc_reg_operand" "")
12415 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12416 "TARGET_POWER && reload_completed"
12417 [(set (match_dup 0)
12418 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12420 (compare:CC (match_dup 0)
12425 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12426 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12427 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
12430 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
12431 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
12432 [(set_attr "length" "12")])
12435 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12436 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12437 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12438 "! TARGET_POWERPC64"
12439 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12440 [(set_attr "length" "12")])
12443 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12444 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12445 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
12447 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
12448 [(set_attr "length" "12")])
12451 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12453 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12454 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12456 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12457 (leu:DI (match_dup 1) (match_dup 2)))]
12460 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12462 [(set_attr "type" "compare")
12463 (set_attr "length" "12,16")])
12466 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12468 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12469 (match_operand:DI 2 "reg_or_short_operand" ""))
12471 (set (match_operand:DI 0 "gpc_reg_operand" "")
12472 (leu:DI (match_dup 1) (match_dup 2)))]
12473 "TARGET_POWERPC64 && reload_completed"
12474 [(set (match_dup 0)
12475 (leu:DI (match_dup 1) (match_dup 2)))
12477 (compare:CC (match_dup 0)
12482 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12484 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12485 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12487 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12488 (leu:SI (match_dup 1) (match_dup 2)))]
12489 "! TARGET_POWERPC64"
12491 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12493 [(set_attr "type" "compare")
12494 (set_attr "length" "12,16")])
12497 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12499 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12500 (match_operand:SI 2 "reg_or_short_operand" ""))
12502 (set (match_operand:SI 0 "gpc_reg_operand" "")
12503 (leu:SI (match_dup 1) (match_dup 2)))]
12504 "! TARGET_POWERPC64 && reload_completed"
12505 [(set (match_dup 0)
12506 (leu:SI (match_dup 1) (match_dup 2)))
12508 (compare:CC (match_dup 0)
12513 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12515 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12516 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
12518 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12519 (leu:DI (match_dup 1) (match_dup 2)))]
12522 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
12524 [(set_attr "type" "compare")
12525 (set_attr "length" "12,16")])
12528 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12529 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12530 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12531 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12532 "! TARGET_POWERPC64"
12533 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
12534 [(set_attr "length" "8")])
12537 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12539 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12540 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12541 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12543 (clobber (match_scratch:SI 4 "=&r,&r"))]
12544 "! TARGET_POWERPC64"
12546 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12548 [(set_attr "type" "compare")
12549 (set_attr "length" "8,12")])
12552 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12554 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12555 (match_operand:SI 2 "reg_or_short_operand" ""))
12556 (match_operand:SI 3 "gpc_reg_operand" ""))
12558 (clobber (match_scratch:SI 4 ""))]
12559 "! TARGET_POWERPC64 && reload_completed"
12560 [(set (match_dup 4)
12561 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12564 (compare:CC (match_dup 4)
12569 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12571 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12572 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12573 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12575 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12576 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12577 "! TARGET_POWERPC64"
12579 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12581 [(set_attr "type" "compare")
12582 (set_attr "length" "8,12")])
12585 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12587 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12588 (match_operand:SI 2 "reg_or_short_operand" ""))
12589 (match_operand:SI 3 "gpc_reg_operand" ""))
12591 (set (match_operand:SI 0 "gpc_reg_operand" "")
12592 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12593 "! TARGET_POWERPC64 && reload_completed"
12594 [(set (match_dup 0)
12595 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12597 (compare:CC (match_dup 0)
12602 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12603 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12604 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12605 "! TARGET_POWERPC64"
12606 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12607 [(set_attr "length" "12")])
12610 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12612 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12613 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12614 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12615 "! TARGET_POWERPC64"
12616 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12617 [(set_attr "length" "12")])
12620 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12623 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12624 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12625 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12627 (clobber (match_scratch:SI 4 "=&r,&r"))]
12628 "! TARGET_POWERPC64"
12630 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12632 [(set_attr "type" "compare")
12633 (set_attr "length" "12,16")])
12636 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12639 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12640 (match_operand:SI 2 "reg_or_short_operand" "")))
12641 (match_operand:SI 3 "gpc_reg_operand" ""))
12643 (clobber (match_scratch:SI 4 ""))]
12644 "! TARGET_POWERPC64 && reload_completed"
12645 [(set (match_dup 4)
12646 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12649 (compare:CC (match_dup 4)
12654 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12657 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12658 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12659 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12661 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12662 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12663 "! TARGET_POWERPC64"
12665 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12667 [(set_attr "type" "compare")
12668 (set_attr "length" "12,16")])
12671 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12674 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12675 (match_operand:SI 2 "reg_or_short_operand" "")))
12676 (match_operand:SI 3 "gpc_reg_operand" ""))
12678 (set (match_operand:SI 0 "gpc_reg_operand" "")
12679 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12680 "! TARGET_POWERPC64 && reload_completed"
12681 [(set (match_dup 0)
12682 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12685 (compare:CC (match_dup 0)
12690 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12691 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12692 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12694 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12695 [(set_attr "length" "12")])
12698 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12700 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12701 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12703 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12704 (lt:SI (match_dup 1) (match_dup 2)))]
12707 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12709 [(set_attr "type" "delayed_compare")
12710 (set_attr "length" "12,16")])
12713 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12715 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12716 (match_operand:SI 2 "reg_or_short_operand" ""))
12718 (set (match_operand:SI 0 "gpc_reg_operand" "")
12719 (lt:SI (match_dup 1) (match_dup 2)))]
12720 "TARGET_POWER && reload_completed"
12721 [(set (match_dup 0)
12722 (lt:SI (match_dup 1) (match_dup 2)))
12724 (compare:CC (match_dup 0)
12729 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12730 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12731 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12732 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12734 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12735 [(set_attr "length" "12")])
12738 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12740 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12741 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12742 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12744 (clobber (match_scratch:SI 4 "=&r,&r"))]
12747 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12749 [(set_attr "type" "compare")
12750 (set_attr "length" "12,16")])
12753 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12755 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12756 (match_operand:SI 2 "reg_or_short_operand" ""))
12757 (match_operand:SI 3 "gpc_reg_operand" ""))
12759 (clobber (match_scratch:SI 4 ""))]
12760 "TARGET_POWER && reload_completed"
12761 [(set (match_dup 4)
12762 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12765 (compare:CC (match_dup 4)
12770 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12772 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12773 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12774 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12776 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12777 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12780 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12782 [(set_attr "type" "compare")
12783 (set_attr "length" "12,16")])
12786 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12788 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12789 (match_operand:SI 2 "reg_or_short_operand" ""))
12790 (match_operand:SI 3 "gpc_reg_operand" ""))
12792 (set (match_operand:SI 0 "gpc_reg_operand" "")
12793 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12794 "TARGET_POWER && reload_completed"
12795 [(set (match_dup 0)
12796 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12798 (compare:CC (match_dup 0)
12803 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12804 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12805 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12807 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12808 [(set_attr "length" "12")])
12811 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12812 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12813 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12814 "! TARGET_POWERPC64"
12816 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12817 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12818 [(set_attr "length" "12")])
12821 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12823 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12824 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12826 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12827 (ltu:SI (match_dup 1) (match_dup 2)))]
12828 "! TARGET_POWERPC64"
12830 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12831 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12834 [(set_attr "type" "compare")
12835 (set_attr "length" "12,12,16,16")])
12838 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12840 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12841 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12843 (set (match_operand:SI 0 "gpc_reg_operand" "")
12844 (ltu:SI (match_dup 1) (match_dup 2)))]
12845 "! TARGET_POWERPC64 && reload_completed"
12846 [(set (match_dup 0)
12847 (ltu:SI (match_dup 1) (match_dup 2)))
12849 (compare:CC (match_dup 0)
12854 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12855 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12856 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12857 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12858 "! TARGET_POWERPC64"
12860 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12861 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12862 [(set_attr "length" "12")])
12865 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12867 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12868 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12869 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12871 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12872 "! TARGET_POWERPC64"
12874 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12875 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12878 [(set_attr "type" "compare")
12879 (set_attr "length" "12,12,16,16")])
12882 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12884 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12885 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12886 (match_operand:SI 3 "gpc_reg_operand" ""))
12888 (clobber (match_scratch:SI 4 ""))]
12889 "! TARGET_POWERPC64 && reload_completed"
12890 [(set (match_dup 4)
12891 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12894 (compare:CC (match_dup 4)
12899 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12901 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12902 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12903 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12905 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12906 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12907 "! TARGET_POWERPC64"
12909 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12910 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12913 [(set_attr "type" "compare")
12914 (set_attr "length" "12,12,16,16")])
12917 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12919 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12920 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12921 (match_operand:SI 3 "gpc_reg_operand" ""))
12923 (set (match_operand:SI 0 "gpc_reg_operand" "")
12924 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12925 "! TARGET_POWERPC64 && reload_completed"
12926 [(set (match_dup 0)
12927 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12929 (compare:CC (match_dup 0)
12934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12935 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12936 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12937 "! TARGET_POWERPC64"
12939 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12940 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12941 [(set_attr "length" "8")])
12944 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12945 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12946 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12947 (clobber (match_scratch:SI 3 "=r"))]
12949 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12950 [(set_attr "length" "12")])
12953 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12955 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12956 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12958 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12959 (ge:SI (match_dup 1) (match_dup 2)))
12960 (clobber (match_scratch:SI 3 "=r,r"))]
12963 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12965 [(set_attr "type" "compare")
12966 (set_attr "length" "12,16")])
12969 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12971 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12972 (match_operand:SI 2 "reg_or_short_operand" ""))
12974 (set (match_operand:SI 0 "gpc_reg_operand" "")
12975 (ge:SI (match_dup 1) (match_dup 2)))
12976 (clobber (match_scratch:SI 3 ""))]
12977 "TARGET_POWER && reload_completed"
12978 [(parallel [(set (match_dup 0)
12979 (ge:SI (match_dup 1) (match_dup 2)))
12980 (clobber (match_dup 3))])
12982 (compare:CC (match_dup 0)
12987 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12988 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12989 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12990 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12992 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12993 [(set_attr "length" "12")])
12996 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12998 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12999 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13000 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13002 (clobber (match_scratch:SI 4 "=&r,&r"))]
13005 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
13007 [(set_attr "type" "compare")
13008 (set_attr "length" "12,16")])
13011 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13013 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13014 (match_operand:SI 2 "reg_or_short_operand" ""))
13015 (match_operand:SI 3 "gpc_reg_operand" ""))
13017 (clobber (match_scratch:SI 4 ""))]
13018 "TARGET_POWER && reload_completed"
13019 [(set (match_dup 4)
13020 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
13023 (compare:CC (match_dup 4)
13028 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13030 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13031 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13032 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13034 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13035 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13038 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
13040 [(set_attr "type" "compare")
13041 (set_attr "length" "12,16")])
13044 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13046 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
13047 (match_operand:SI 2 "reg_or_short_operand" ""))
13048 (match_operand:SI 3 "gpc_reg_operand" ""))
13050 (set (match_operand:SI 0 "gpc_reg_operand" "")
13051 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13052 "TARGET_POWER && reload_completed"
13053 [(set (match_dup 0)
13054 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13056 (compare:CC (match_dup 0)
13061 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13062 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13063 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13065 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
13066 [(set_attr "length" "12")])
13069 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13070 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13071 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
13072 "! TARGET_POWERPC64"
13074 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
13075 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
13076 [(set_attr "length" "12")])
13079 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13080 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13081 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
13084 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
13085 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
13086 [(set_attr "length" "12")])
13089 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13091 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13092 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13094 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
13095 (geu:SI (match_dup 1) (match_dup 2)))]
13096 "! TARGET_POWERPC64"
13098 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13099 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
13102 [(set_attr "type" "compare")
13103 (set_attr "length" "12,12,16,16")])
13106 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13108 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13109 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13111 (set (match_operand:SI 0 "gpc_reg_operand" "")
13112 (geu:SI (match_dup 1) (match_dup 2)))]
13113 "! TARGET_POWERPC64 && reload_completed"
13114 [(set (match_dup 0)
13115 (geu:SI (match_dup 1) (match_dup 2)))
13117 (compare:CC (match_dup 0)
13122 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
13124 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13125 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13127 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
13128 (geu:DI (match_dup 1) (match_dup 2)))]
13131 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
13132 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
13135 [(set_attr "type" "compare")
13136 (set_attr "length" "12,12,16,16")])
13139 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13141 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13142 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
13144 (set (match_operand:DI 0 "gpc_reg_operand" "")
13145 (geu:DI (match_dup 1) (match_dup 2)))]
13146 "TARGET_POWERPC64 && reload_completed"
13147 [(set (match_dup 0)
13148 (geu:DI (match_dup 1) (match_dup 2)))
13150 (compare:CC (match_dup 0)
13155 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13156 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13157 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
13158 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13159 "! TARGET_POWERPC64"
13161 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
13162 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
13163 [(set_attr "length" "8")])
13166 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13168 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13169 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13170 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13172 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13173 "! TARGET_POWERPC64"
13175 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
13176 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
13179 [(set_attr "type" "compare")
13180 (set_attr "length" "8,8,12,12")])
13183 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13185 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13186 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13187 (match_operand:SI 3 "gpc_reg_operand" ""))
13189 (clobber (match_scratch:SI 4 ""))]
13190 "! TARGET_POWERPC64 && reload_completed"
13191 [(set (match_dup 4)
13192 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
13195 (compare:CC (match_dup 4)
13200 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13202 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13203 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
13204 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13206 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13207 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13208 "! TARGET_POWERPC64"
13210 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
13211 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
13214 [(set_attr "type" "compare")
13215 (set_attr "length" "8,8,12,12")])
13218 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13220 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13221 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
13222 (match_operand:SI 3 "gpc_reg_operand" ""))
13224 (set (match_operand:SI 0 "gpc_reg_operand" "")
13225 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13226 "! TARGET_POWERPC64 && reload_completed"
13227 [(set (match_dup 0)
13228 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13230 (compare:CC (match_dup 0)
13235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13236 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13237 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
13238 "! TARGET_POWERPC64"
13240 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
13241 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
13242 [(set_attr "length" "12")])
13245 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13247 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13248 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
13249 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
13250 "! TARGET_POWERPC64"
13252 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
13253 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
13254 [(set_attr "length" "12")])
13257 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13260 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13261 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13262 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13264 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13265 "! TARGET_POWERPC64"
13267 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13268 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
13271 [(set_attr "type" "compare")
13272 (set_attr "length" "12,12,16,16")])
13275 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13278 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13279 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13280 (match_operand:SI 3 "gpc_reg_operand" ""))
13282 (clobber (match_scratch:SI 4 ""))]
13283 "! TARGET_POWERPC64 && reload_completed"
13284 [(set (match_dup 4)
13285 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
13288 (compare:CC (match_dup 4)
13293 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13296 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13297 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
13298 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13300 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13301 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13302 "! TARGET_POWERPC64"
13304 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13305 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
13308 [(set_attr "type" "compare")
13309 (set_attr "length" "12,12,16,16")])
13312 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13315 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13316 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
13317 (match_operand:SI 3 "gpc_reg_operand" ""))
13319 (set (match_operand:SI 0 "gpc_reg_operand" "")
13320 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
13321 "! TARGET_POWERPC64 && reload_completed"
13322 [(set (match_dup 0)
13323 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
13325 (compare:CC (match_dup 0)
13330 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13331 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13333 "! TARGET_POWERPC64"
13334 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
13335 [(set_attr "length" "12")])
13338 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13339 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13342 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
13343 [(set_attr "length" "12")])
13346 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13348 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13351 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13352 (gt:SI (match_dup 1) (const_int 0)))]
13353 "! TARGET_POWERPC64"
13355 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
13357 [(set_attr "type" "delayed_compare")
13358 (set_attr "length" "12,16")])
13361 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13363 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13366 (set (match_operand:SI 0 "gpc_reg_operand" "")
13367 (gt:SI (match_dup 1) (const_int 0)))]
13368 "! TARGET_POWERPC64 && reload_completed"
13369 [(set (match_dup 0)
13370 (gt:SI (match_dup 1) (const_int 0)))
13372 (compare:CC (match_dup 0)
13377 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
13379 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13382 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13383 (gt:DI (match_dup 1) (const_int 0)))]
13386 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
13388 [(set_attr "type" "delayed_compare")
13389 (set_attr "length" "12,16")])
13392 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
13394 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13397 (set (match_operand:DI 0 "gpc_reg_operand" "")
13398 (gt:DI (match_dup 1) (const_int 0)))]
13399 "TARGET_POWERPC64 && reload_completed"
13400 [(set (match_dup 0)
13401 (gt:DI (match_dup 1) (const_int 0)))
13403 (compare:CC (match_dup 0)
13408 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13409 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13410 (match_operand:SI 2 "reg_or_short_operand" "r")))]
13412 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
13413 [(set_attr "length" "12")])
13416 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13418 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13419 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13421 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13422 (gt:SI (match_dup 1) (match_dup 2)))]
13425 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
13427 [(set_attr "type" "delayed_compare")
13428 (set_attr "length" "12,16")])
13431 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13433 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13434 (match_operand:SI 2 "reg_or_short_operand" ""))
13436 (set (match_operand:SI 0 "gpc_reg_operand" "")
13437 (gt:SI (match_dup 1) (match_dup 2)))]
13438 "TARGET_POWER && reload_completed"
13439 [(set (match_dup 0)
13440 (gt:SI (match_dup 1) (match_dup 2)))
13442 (compare:CC (match_dup 0)
13447 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13448 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13450 (match_operand:SI 2 "gpc_reg_operand" "r")))]
13451 "! TARGET_POWERPC64"
13452 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
13453 [(set_attr "length" "12")])
13456 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13457 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13459 (match_operand:DI 2 "gpc_reg_operand" "r")))]
13461 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
13462 [(set_attr "length" "12")])
13465 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13467 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13469 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13471 (clobber (match_scratch:SI 3 "=&r,&r"))]
13472 "! TARGET_POWERPC64"
13474 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
13476 [(set_attr "type" "compare")
13477 (set_attr "length" "12,16")])
13480 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13482 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13484 (match_operand:SI 2 "gpc_reg_operand" ""))
13486 (clobber (match_scratch:SI 3 ""))]
13487 "! TARGET_POWERPC64 && reload_completed"
13488 [(set (match_dup 3)
13489 (plus:SI (gt:SI (match_dup 1) (const_int 0))
13492 (compare:CC (match_dup 3)
13497 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13499 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13501 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13503 (clobber (match_scratch:DI 3 "=&r,&r"))]
13506 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
13508 [(set_attr "type" "compare")
13509 (set_attr "length" "12,16")])
13512 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13514 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13516 (match_operand:DI 2 "gpc_reg_operand" ""))
13518 (clobber (match_scratch:DI 3 ""))]
13519 "TARGET_POWERPC64 && reload_completed"
13520 [(set (match_dup 3)
13521 (plus:DI (gt:DI (match_dup 1) (const_int 0))
13524 (compare:CC (match_dup 3)
13529 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13531 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13533 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
13535 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13536 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13537 "! TARGET_POWERPC64"
13539 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
13541 [(set_attr "type" "compare")
13542 (set_attr "length" "12,16")])
13545 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13547 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13549 (match_operand:SI 2 "gpc_reg_operand" ""))
13551 (set (match_operand:SI 0 "gpc_reg_operand" "")
13552 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13553 "! TARGET_POWERPC64 && reload_completed"
13554 [(set (match_dup 0)
13555 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13557 (compare:CC (match_dup 0)
13562 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13564 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13566 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13568 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13569 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13572 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13574 [(set_attr "type" "compare")
13575 (set_attr "length" "12,16")])
13578 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13580 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13582 (match_operand:DI 2 "gpc_reg_operand" ""))
13584 (set (match_operand:DI 0 "gpc_reg_operand" "")
13585 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13586 "TARGET_POWERPC64 && reload_completed"
13587 [(set (match_dup 0)
13588 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13590 (compare:CC (match_dup 0)
13595 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13596 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13597 (match_operand:SI 2 "reg_or_short_operand" "r"))
13598 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13600 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13601 [(set_attr "length" "12")])
13604 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13606 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13607 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13608 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13610 (clobber (match_scratch:SI 4 "=&r,&r"))]
13613 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13615 [(set_attr "type" "compare")
13616 (set_attr "length" "12,16")])
13619 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13621 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13622 (match_operand:SI 2 "reg_or_short_operand" ""))
13623 (match_operand:SI 3 "gpc_reg_operand" ""))
13625 (clobber (match_scratch:SI 4 ""))]
13626 "TARGET_POWER && reload_completed"
13627 [(set (match_dup 4)
13628 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13630 (compare:CC (match_dup 4)
13635 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13637 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13638 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13639 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13641 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13642 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13645 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13647 [(set_attr "type" "compare")
13648 (set_attr "length" "12,16")])
13651 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13653 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13654 (match_operand:SI 2 "reg_or_short_operand" ""))
13655 (match_operand:SI 3 "gpc_reg_operand" ""))
13657 (set (match_operand:SI 0 "gpc_reg_operand" "")
13658 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13659 "TARGET_POWER && reload_completed"
13660 [(set (match_dup 0)
13661 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13663 (compare:CC (match_dup 0)
13668 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13669 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13671 "! TARGET_POWERPC64"
13672 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13673 [(set_attr "length" "12")])
13676 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13677 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13680 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13681 [(set_attr "length" "12")])
13684 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13685 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13686 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13688 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13689 [(set_attr "length" "12")])
13692 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13693 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13694 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13695 "! TARGET_POWERPC64"
13696 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13697 [(set_attr "length" "12")])
13700 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13701 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13702 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13704 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13705 [(set_attr "length" "12")])
13708 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13710 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13711 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13713 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13714 (gtu:SI (match_dup 1) (match_dup 2)))]
13715 "! TARGET_POWERPC64"
13717 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13719 [(set_attr "type" "compare")
13720 (set_attr "length" "12,16")])
13723 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13725 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13726 (match_operand:SI 2 "reg_or_short_operand" ""))
13728 (set (match_operand:SI 0 "gpc_reg_operand" "")
13729 (gtu:SI (match_dup 1) (match_dup 2)))]
13730 "! TARGET_POWERPC64 && reload_completed"
13731 [(set (match_dup 0)
13732 (gtu:SI (match_dup 1) (match_dup 2)))
13734 (compare:CC (match_dup 0)
13739 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13741 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13742 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13744 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13745 (gtu:DI (match_dup 1) (match_dup 2)))]
13748 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13750 [(set_attr "type" "compare")
13751 (set_attr "length" "12,16")])
13754 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13756 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13757 (match_operand:DI 2 "reg_or_short_operand" ""))
13759 (set (match_operand:DI 0 "gpc_reg_operand" "")
13760 (gtu:DI (match_dup 1) (match_dup 2)))]
13761 "TARGET_POWERPC64 && reload_completed"
13762 [(set (match_dup 0)
13763 (gtu:DI (match_dup 1) (match_dup 2)))
13765 (compare:CC (match_dup 0)
13770 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13771 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13772 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13773 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13774 "! TARGET_POWERPC64"
13776 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13777 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13778 [(set_attr "length" "8,12")])
13781 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13782 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13783 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13784 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13787 addic %0,%1,%k2\;addze %0,%3
13788 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13789 [(set_attr "length" "8,12")])
13792 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13794 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13795 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13796 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13798 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13799 "! TARGET_POWERPC64"
13801 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13802 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13805 [(set_attr "type" "compare")
13806 (set_attr "length" "8,12,12,16")])
13809 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13811 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13812 (match_operand:SI 2 "reg_or_short_operand" ""))
13813 (match_operand:SI 3 "gpc_reg_operand" ""))
13815 (clobber (match_scratch:SI 4 ""))]
13816 "! TARGET_POWERPC64 && reload_completed"
13817 [(set (match_dup 4)
13818 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13821 (compare:CC (match_dup 4)
13826 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13828 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13829 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13830 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13832 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13835 addic %4,%1,%k2\;addze. %4,%3
13836 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13839 [(set_attr "type" "compare")
13840 (set_attr "length" "8,12,12,16")])
13843 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13845 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13846 (match_operand:DI 2 "reg_or_short_operand" ""))
13847 (match_operand:DI 3 "gpc_reg_operand" ""))
13849 (clobber (match_scratch:DI 4 ""))]
13850 "TARGET_POWERPC64 && reload_completed"
13851 [(set (match_dup 4)
13852 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13855 (compare:CC (match_dup 4)
13860 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13862 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13863 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13864 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13866 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13867 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13868 "! TARGET_POWERPC64"
13870 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13871 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13874 [(set_attr "type" "compare")
13875 (set_attr "length" "8,12,12,16")])
13878 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13880 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13881 (match_operand:SI 2 "reg_or_short_operand" ""))
13882 (match_operand:SI 3 "gpc_reg_operand" ""))
13884 (set (match_operand:SI 0 "gpc_reg_operand" "")
13885 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13886 "! TARGET_POWERPC64 && reload_completed"
13887 [(set (match_dup 0)
13888 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13890 (compare:CC (match_dup 0)
13895 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13897 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13898 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13899 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13901 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13902 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13905 addic %0,%1,%k2\;addze. %0,%3
13906 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13909 [(set_attr "type" "compare")
13910 (set_attr "length" "8,12,12,16")])
13913 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13915 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13916 (match_operand:DI 2 "reg_or_short_operand" ""))
13917 (match_operand:DI 3 "gpc_reg_operand" ""))
13919 (set (match_operand:DI 0 "gpc_reg_operand" "")
13920 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13921 "TARGET_POWERPC64 && reload_completed"
13922 [(set (match_dup 0)
13923 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13925 (compare:CC (match_dup 0)
13930 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13931 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13932 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13933 "! TARGET_POWERPC64"
13934 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13935 [(set_attr "length" "8")])
13938 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13939 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13940 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13942 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13943 [(set_attr "length" "8")])
13945 ;; Define both directions of branch and return. If we need a reload
13946 ;; register, we'd rather use CR0 since it is much easier to copy a
13947 ;; register CC value to there.
13951 (if_then_else (match_operator 1 "branch_comparison_operator"
13953 "cc_reg_operand" "x,?y")
13955 (label_ref (match_operand 0 "" ""))
13960 return output_cbranch (operands[1], \"%l0\", 0, insn);
13962 [(set_attr "type" "branch")])
13966 (if_then_else (match_operator 0 "branch_comparison_operator"
13968 "cc_reg_operand" "x,?y")
13975 return output_cbranch (operands[0], NULL, 0, insn);
13977 [(set_attr "type" "branch")
13978 (set_attr "length" "4")])
13982 (if_then_else (match_operator 1 "branch_comparison_operator"
13984 "cc_reg_operand" "x,?y")
13987 (label_ref (match_operand 0 "" ""))))]
13991 return output_cbranch (operands[1], \"%l0\", 1, insn);
13993 [(set_attr "type" "branch")])
13997 (if_then_else (match_operator 0 "branch_comparison_operator"
13999 "cc_reg_operand" "x,?y")
14006 return output_cbranch (operands[0], NULL, 1, insn);
14008 [(set_attr "type" "branch")
14009 (set_attr "length" "4")])
14011 ;; Logic on condition register values.
14013 ; This pattern matches things like
14014 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
14015 ; (eq:SI (reg:CCFP 68) (const_int 0)))
14017 ; which are generated by the branch logic.
14020 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14021 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
14022 [(match_operator:SI 2
14023 "branch_positive_comparison_operator"
14025 "cc_reg_operand" "y")
14027 (match_operator:SI 4
14028 "branch_positive_comparison_operator"
14030 "cc_reg_operand" "y")
14034 "cr%q1 %E0,%j2,%j4"
14035 [(set_attr "type" "cr_logical")])
14037 ; Why is the constant -1 here, but 1 in the previous pattern?
14038 ; Because ~1 has all but the low bit set.
14040 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14041 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
14042 [(not:SI (match_operator:SI 2
14043 "branch_positive_comparison_operator"
14045 "cc_reg_operand" "y")
14047 (match_operator:SI 4
14048 "branch_positive_comparison_operator"
14050 "cc_reg_operand" "y")
14054 "cr%q1 %E0,%j2,%j4"
14055 [(set_attr "type" "cr_logical")])
14058 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14059 (compare:CCEQ (match_operator:SI 1
14060 "branch_positive_comparison_operator"
14062 "cc_reg_operand" "y")
14066 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
14067 [(set_attr "type" "cr_logical")])
14069 ;; If we are comparing the result of two comparisons, this can be done
14070 ;; using creqv or crxor.
14072 (define_insn_and_split ""
14073 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
14074 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
14075 [(match_operand 2 "cc_reg_operand" "y")
14077 (match_operator 3 "branch_comparison_operator"
14078 [(match_operand 4 "cc_reg_operand" "y")
14083 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
14087 int positive_1, positive_2;
14089 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
14090 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
14093 operands[1] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[2]),
14094 GET_CODE (operands[1])),
14096 operands[2], const0_rtx);
14097 else if (GET_MODE (operands[1]) != SImode)
14098 operands[1] = gen_rtx (GET_CODE (operands[1]),
14100 operands[2], const0_rtx);
14103 operands[3] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[4]),
14104 GET_CODE (operands[3])),
14106 operands[4], const0_rtx);
14107 else if (GET_MODE (operands[3]) != SImode)
14108 operands[3] = gen_rtx (GET_CODE (operands[3]),
14110 operands[4], const0_rtx);
14112 if (positive_1 == positive_2)
14114 operands[1] = gen_rtx_NOT (SImode, operands[1]);
14115 operands[5] = constm1_rtx;
14119 operands[5] = const1_rtx;
14123 ;; Unconditional branch and return.
14125 (define_insn "jump"
14127 (label_ref (match_operand 0 "" "")))]
14130 [(set_attr "type" "branch")])
14132 (define_insn "return"
14136 [(set_attr "type" "jmpreg")])
14138 (define_expand "indirect_jump"
14139 [(set (pc) (match_operand 0 "register_operand" ""))]
14144 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
14146 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
14150 (define_insn "indirect_jumpsi"
14151 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
14156 [(set_attr "type" "jmpreg")])
14158 (define_insn "indirect_jumpdi"
14159 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
14164 [(set_attr "type" "jmpreg")])
14166 ;; Table jump for switch statements:
14167 (define_expand "tablejump"
14168 [(use (match_operand 0 "" ""))
14169 (use (label_ref (match_operand 1 "" "")))]
14174 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
14176 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
14180 (define_expand "tablejumpsi"
14181 [(set (match_dup 3)
14182 (plus:SI (match_operand:SI 0 "" "")
14184 (parallel [(set (pc) (match_dup 3))
14185 (use (label_ref (match_operand 1 "" "")))])]
14188 { operands[0] = force_reg (SImode, operands[0]);
14189 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
14190 operands[3] = gen_reg_rtx (SImode);
14193 (define_expand "tablejumpdi"
14194 [(set (match_dup 4)
14195 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
14197 (plus:DI (match_dup 4)
14199 (parallel [(set (pc) (match_dup 3))
14200 (use (label_ref (match_operand 1 "" "")))])]
14203 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
14204 operands[3] = gen_reg_rtx (DImode);
14205 operands[4] = gen_reg_rtx (DImode);
14210 (match_operand:SI 0 "register_operand" "c,*l"))
14211 (use (label_ref (match_operand 1 "" "")))]
14216 [(set_attr "type" "jmpreg")])
14220 (match_operand:DI 0 "register_operand" "c,*l"))
14221 (use (label_ref (match_operand 1 "" "")))]
14226 [(set_attr "type" "jmpreg")])
14231 "{cror 0,0,0|nop}")
14233 ;; Define the subtract-one-and-jump insns, starting with the template
14234 ;; so loop.c knows what to generate.
14236 (define_expand "doloop_end"
14237 [(use (match_operand 0 "" "")) ; loop pseudo
14238 (use (match_operand 1 "" "")) ; iterations; zero if unknown
14239 (use (match_operand 2 "" "")) ; max iterations
14240 (use (match_operand 3 "" "")) ; loop level
14241 (use (match_operand 4 "" ""))] ; label
14245 /* Only use this on innermost loops. */
14246 if (INTVAL (operands[3]) > 1)
14248 if (TARGET_POWERPC64)
14250 if (GET_MODE (operands[0]) != DImode)
14252 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
14256 if (GET_MODE (operands[0]) != SImode)
14258 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
14263 (define_expand "ctrsi"
14264 [(parallel [(set (pc)
14265 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
14267 (label_ref (match_operand 1 "" ""))
14270 (plus:SI (match_dup 0)
14272 (clobber (match_scratch:CC 2 ""))
14273 (clobber (match_scratch:SI 3 ""))])]
14274 "! TARGET_POWERPC64"
14277 (define_expand "ctrdi"
14278 [(parallel [(set (pc)
14279 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
14281 (label_ref (match_operand 1 "" ""))
14284 (plus:DI (match_dup 0)
14286 (clobber (match_scratch:CC 2 ""))
14287 (clobber (match_scratch:DI 3 ""))])]
14291 ;; We need to be able to do this for any operand, including MEM, or we
14292 ;; will cause reload to blow up since we don't allow output reloads on
14294 ;; For the length attribute to be calculated correctly, the
14295 ;; label MUST be operand 0.
14297 (define_insn "*ctrsi_internal1"
14299 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
14301 (label_ref (match_operand 0 "" ""))
14303 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
14304 (plus:SI (match_dup 1)
14306 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14307 (clobber (match_scratch:SI 4 "=X,X,r"))]
14308 "! TARGET_POWERPC64"
14311 if (which_alternative != 0)
14313 else if (get_attr_length (insn) == 4)
14314 return \"{bdn|bdnz} %l0\";
14316 return \"bdz $+8\;b %l0\";
14318 [(set_attr "type" "branch")
14319 (set_attr "length" "4,12,16")])
14321 (define_insn "*ctrsi_internal2"
14323 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
14326 (label_ref (match_operand 0 "" ""))))
14327 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
14328 (plus:SI (match_dup 1)
14330 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14331 (clobber (match_scratch:SI 4 "=X,X,r"))]
14332 "! TARGET_POWERPC64"
14335 if (which_alternative != 0)
14337 else if (get_attr_length (insn) == 4)
14338 return \"bdz %l0\";
14340 return \"{bdn|bdnz} $+8\;b %l0\";
14342 [(set_attr "type" "branch")
14343 (set_attr "length" "4,12,16")])
14345 (define_insn "*ctrdi_internal1"
14347 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
14349 (label_ref (match_operand 0 "" ""))
14351 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14352 (plus:DI (match_dup 1)
14354 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14355 (clobber (match_scratch:DI 4 "=X,X,r"))]
14359 if (which_alternative != 0)
14361 else if (get_attr_length (insn) == 4)
14362 return \"{bdn|bdnz} %l0\";
14364 return \"bdz $+8\;b %l0\";
14366 [(set_attr "type" "branch")
14367 (set_attr "length" "4,12,16")])
14369 (define_insn "*ctrdi_internal2"
14371 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
14374 (label_ref (match_operand 0 "" ""))))
14375 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14376 (plus:DI (match_dup 1)
14378 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14379 (clobber (match_scratch:DI 4 "=X,X,r"))]
14383 if (which_alternative != 0)
14385 else if (get_attr_length (insn) == 4)
14386 return \"bdz %l0\";
14388 return \"{bdn|bdnz} $+8\;b %l0\";
14390 [(set_attr "type" "branch")
14391 (set_attr "length" "4,12,16")])
14393 ;; Similar, but we can use GE since we have a REG_NONNEG.
14395 (define_insn "*ctrsi_internal3"
14397 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
14399 (label_ref (match_operand 0 "" ""))
14401 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
14402 (plus:SI (match_dup 1)
14404 (clobber (match_scratch:CC 3 "=X,&x,&X"))
14405 (clobber (match_scratch:SI 4 "=X,X,r"))]
14406 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14409 if (which_alternative != 0)
14411 else if (get_attr_length (insn) == 4)
14412 return \"{bdn|bdnz} %l0\";
14414 return \"bdz $+8\;b %l0\";
14416 [(set_attr "type" "branch")
14417 (set_attr "length" "4,12,16")])
14419 (define_insn "*ctrsi_internal4"
14421 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
14424 (label_ref (match_operand 0 "" ""))))
14425 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
14426 (plus:SI (match_dup 1)
14428 (clobber (match_scratch:CC 3 "=X,&x,&X"))
14429 (clobber (match_scratch:SI 4 "=X,X,r"))]
14430 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14433 if (which_alternative != 0)
14435 else if (get_attr_length (insn) == 4)
14436 return \"bdz %l0\";
14438 return \"{bdn|bdnz} $+8\;b %l0\";
14440 [(set_attr "type" "branch")
14441 (set_attr "length" "4,12,16")])
14443 (define_insn "*ctrdi_internal3"
14445 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
14447 (label_ref (match_operand 0 "" ""))
14449 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14450 (plus:DI (match_dup 1)
14452 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14453 (clobber (match_scratch:DI 4 "=X,X,r"))]
14454 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14457 if (which_alternative != 0)
14459 else if (get_attr_length (insn) == 4)
14460 return \"{bdn|bdnz} %l0\";
14462 return \"bdz $+8\;b %l0\";
14464 [(set_attr "type" "branch")
14465 (set_attr "length" "4,12,16")])
14467 (define_insn "*ctrdi_internal4"
14469 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
14472 (label_ref (match_operand 0 "" ""))))
14473 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14474 (plus:DI (match_dup 1)
14476 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14477 (clobber (match_scratch:DI 4 "=X,X,r"))]
14478 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
14481 if (which_alternative != 0)
14483 else if (get_attr_length (insn) == 4)
14484 return \"bdz %l0\";
14486 return \"{bdn|bdnz} $+8\;b %l0\";
14488 [(set_attr "type" "branch")
14489 (set_attr "length" "4,12,16")])
14491 ;; Similar but use EQ
14493 (define_insn "*ctrsi_internal5"
14495 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
14497 (label_ref (match_operand 0 "" ""))
14499 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
14500 (plus:SI (match_dup 1)
14502 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14503 (clobber (match_scratch:SI 4 "=X,X,r"))]
14504 "! TARGET_POWERPC64"
14507 if (which_alternative != 0)
14509 else if (get_attr_length (insn) == 4)
14510 return \"bdz %l0\";
14512 return \"{bdn|bdnz} $+8\;b %l0\";
14514 [(set_attr "type" "branch")
14515 (set_attr "length" "4,12,16")])
14517 (define_insn "*ctrsi_internal6"
14519 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
14522 (label_ref (match_operand 0 "" ""))))
14523 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
14524 (plus:SI (match_dup 1)
14526 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14527 (clobber (match_scratch:SI 4 "=X,X,r"))]
14528 "! TARGET_POWERPC64"
14531 if (which_alternative != 0)
14533 else if (get_attr_length (insn) == 4)
14534 return \"{bdn|bdnz} %l0\";
14536 return \"bdz $+8\;b %l0\";
14538 [(set_attr "type" "branch")
14539 (set_attr "length" "4,12,16")])
14541 (define_insn "*ctrdi_internal5"
14543 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
14545 (label_ref (match_operand 0 "" ""))
14547 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14548 (plus:DI (match_dup 1)
14550 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14551 (clobber (match_scratch:DI 4 "=X,X,r"))]
14555 if (which_alternative != 0)
14557 else if (get_attr_length (insn) == 4)
14558 return \"bdz %l0\";
14560 return \"{bdn|bdnz} $+8\;b %l0\";
14562 [(set_attr "type" "branch")
14563 (set_attr "length" "4,12,16")])
14565 (define_insn "*ctrdi_internal6"
14567 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
14570 (label_ref (match_operand 0 "" ""))))
14571 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14572 (plus:DI (match_dup 1)
14574 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14575 (clobber (match_scratch:DI 4 "=X,X,r"))]
14579 if (which_alternative != 0)
14581 else if (get_attr_length (insn) == 4)
14582 return \"{bdn|bdnz} %l0\";
14584 return \"bdz $+8\;b %l0\";
14586 [(set_attr "type" "branch")
14587 (set_attr "length" "4,12,16")])
14589 ;; Now the splitters if we could not allocate the CTR register
14593 (if_then_else (match_operator 2 "comparison_operator"
14594 [(match_operand:SI 1 "gpc_reg_operand" "")
14596 (match_operand 5 "" "")
14597 (match_operand 6 "" "")))
14598 (set (match_operand:SI 0 "gpc_reg_operand" "")
14599 (plus:SI (match_dup 1)
14601 (clobber (match_scratch:CC 3 ""))
14602 (clobber (match_scratch:SI 4 ""))]
14603 "! TARGET_POWERPC64 && reload_completed"
14604 [(parallel [(set (match_dup 3)
14605 (compare:CC (plus:SI (match_dup 1)
14609 (plus:SI (match_dup 1)
14611 (set (pc) (if_then_else (match_dup 7)
14615 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14620 (if_then_else (match_operator 2 "comparison_operator"
14621 [(match_operand:SI 1 "gpc_reg_operand" "")
14623 (match_operand 5 "" "")
14624 (match_operand 6 "" "")))
14625 (set (match_operand:SI 0 "nonimmediate_operand" "")
14626 (plus:SI (match_dup 1) (const_int -1)))
14627 (clobber (match_scratch:CC 3 ""))
14628 (clobber (match_scratch:SI 4 ""))]
14629 "! TARGET_POWERPC64 && reload_completed
14630 && ! gpc_reg_operand (operands[0], SImode)"
14631 [(parallel [(set (match_dup 3)
14632 (compare:CC (plus:SI (match_dup 1)
14636 (plus:SI (match_dup 1)
14640 (set (pc) (if_then_else (match_dup 7)
14644 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14648 (if_then_else (match_operator 2 "comparison_operator"
14649 [(match_operand:DI 1 "gpc_reg_operand" "")
14651 (match_operand 5 "" "")
14652 (match_operand 6 "" "")))
14653 (set (match_operand:DI 0 "gpc_reg_operand" "")
14654 (plus:DI (match_dup 1)
14656 (clobber (match_scratch:CC 3 ""))
14657 (clobber (match_scratch:DI 4 ""))]
14658 "TARGET_POWERPC64 && reload_completed"
14659 [(parallel [(set (match_dup 3)
14660 (compare:CC (plus:DI (match_dup 1)
14664 (plus:DI (match_dup 1)
14666 (set (pc) (if_then_else (match_dup 7)
14670 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14675 (if_then_else (match_operator 2 "comparison_operator"
14676 [(match_operand:DI 1 "gpc_reg_operand" "")
14678 (match_operand 5 "" "")
14679 (match_operand 6 "" "")))
14680 (set (match_operand:DI 0 "nonimmediate_operand" "")
14681 (plus:DI (match_dup 1) (const_int -1)))
14682 (clobber (match_scratch:CC 3 ""))
14683 (clobber (match_scratch:DI 4 ""))]
14684 "TARGET_POWERPC64 && reload_completed
14685 && ! gpc_reg_operand (operands[0], DImode)"
14686 [(parallel [(set (match_dup 3)
14687 (compare:CC (plus:DI (match_dup 1)
14691 (plus:DI (match_dup 1)
14695 (set (pc) (if_then_else (match_dup 7)
14699 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14703 (define_insn "trap"
14704 [(trap_if (const_int 1) (const_int 0))]
14708 (define_expand "conditional_trap"
14709 [(trap_if (match_operator 0 "trap_comparison_operator"
14710 [(match_dup 2) (match_dup 3)])
14711 (match_operand 1 "const_int_operand" ""))]
14713 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14714 operands[2] = rs6000_compare_op0;
14715 operands[3] = rs6000_compare_op1;")
14718 [(trap_if (match_operator 0 "trap_comparison_operator"
14719 [(match_operand:SI 1 "register_operand" "r")
14720 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14723 "{t|tw}%V0%I2 %1,%2")
14726 [(trap_if (match_operator 0 "trap_comparison_operator"
14727 [(match_operand:DI 1 "register_operand" "r")
14728 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14733 ;; Insns related to generating the function prologue and epilogue.
14735 (define_expand "prologue"
14736 [(use (const_int 0))]
14737 "TARGET_SCHED_PROLOG"
14740 rs6000_emit_prologue ();
14744 (define_insn "movesi_from_cr"
14745 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14746 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14747 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)] 19))]
14750 [(set_attr "type" "cr_logical")])
14752 (define_insn "*stmw"
14753 [(match_parallel 0 "stmw_operation"
14754 [(set (match_operand:SI 1 "memory_operand" "=m")
14755 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14757 "{stm|stmw} %2,%1")
14759 (define_insn "*save_fpregs_si"
14760 [(match_parallel 0 "any_operand"
14761 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14762 (use (match_operand:SI 2 "call_operand" "s"))
14763 (set (match_operand:DF 3 "memory_operand" "=m")
14764 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14768 (define_insn "*save_fpregs_di"
14769 [(match_parallel 0 "any_operand"
14770 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14771 (use (match_operand:DI 2 "call_operand" "s"))
14772 (set (match_operand:DF 3 "memory_operand" "=m")
14773 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14777 ; These are to explain that changes to the stack pointer should
14778 ; not be moved over stores to stack memory.
14779 (define_insn "stack_tie"
14780 [(set (match_operand:BLK 0 "memory_operand" "+m")
14781 (unspec:BLK [(match_dup 0)] 5))]
14784 [(set_attr "length" "0")])
14787 (define_expand "epilogue"
14788 [(use (const_int 0))]
14789 "TARGET_SCHED_PROLOG"
14792 rs6000_emit_epilogue (FALSE);
14796 ; On some processors, doing the mtcrf one CC register at a time is
14797 ; faster (like on the 604e). On others, doing them all at once is
14798 ; faster; for instance, on the 601 and 750.
14800 (define_expand "movsi_to_cr_one"
14801 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14802 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14803 (match_dup 2)] 20))]
14805 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14807 (define_insn "*movsi_to_cr"
14808 [(match_parallel 0 "mtcrf_operation"
14809 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14810 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14811 (match_operand 3 "immediate_operand" "n")]
14818 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14819 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14820 operands[4] = GEN_INT (mask);
14821 return \"mtcrf %4,%2\";
14823 [(set_attr "type" "cr_logical")])
14826 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14827 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14828 (match_operand 2 "immediate_operand" "n")] 20))]
14829 "GET_CODE (operands[0]) == REG
14830 && CR_REGNO_P (REGNO (operands[0]))
14831 && GET_CODE (operands[2]) == CONST_INT
14832 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14834 [(set_attr "type" "cr_logical")])
14836 ; The load-multiple instructions have similar properties.
14837 ; Note that "load_multiple" is a name known to the machine-independent
14838 ; code that actually corresponds to the powerpc load-string.
14840 (define_insn "*lmw"
14841 [(match_parallel 0 "lmw_operation"
14842 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14843 (match_operand:SI 2 "memory_operand" "m"))])]
14847 (define_insn "*return_internal_si"
14849 (use (match_operand:SI 0 "register_operand" "lc"))]
14852 [(set_attr "type" "jmpreg")])
14854 (define_insn "*return_internal_di"
14856 (use (match_operand:DI 0 "register_operand" "lc"))]
14859 [(set_attr "type" "jmpreg")])
14861 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14862 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14864 (define_insn "*return_and_restore_fpregs_si"
14865 [(match_parallel 0 "any_operand"
14867 (use (match_operand:SI 1 "register_operand" "l"))
14868 (use (match_operand:SI 2 "call_operand" "s"))
14869 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14870 (match_operand:DF 4 "memory_operand" "m"))])]
14874 (define_insn "*return_and_restore_fpregs_di"
14875 [(match_parallel 0 "any_operand"
14877 (use (match_operand:DI 1 "register_operand" "l"))
14878 (use (match_operand:DI 2 "call_operand" "s"))
14879 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14880 (match_operand:DF 4 "memory_operand" "m"))])]
14884 ; This is used in compiling the unwind routines.
14885 (define_expand "eh_return"
14886 [(use (match_operand 0 "general_operand" ""))
14887 (use (match_operand 1 "general_operand" ""))]
14892 rs6000_emit_eh_toc_restore (operands[0]);
14895 emit_insn (gen_eh_set_lr_si (operands[1]));
14897 emit_insn (gen_eh_set_lr_di (operands[1]));
14898 emit_move_insn (EH_RETURN_STACKADJ_RTX, operands[0]);
14902 ; We can't expand this before we know where the link register is stored.
14903 (define_insn "eh_set_lr_si"
14904 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] 9)
14905 (clobber (match_scratch:SI 1 "=&b"))]
14909 (define_insn "eh_set_lr_di"
14910 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 9)
14911 (clobber (match_scratch:DI 1 "=&b"))]
14916 [(unspec_volatile [(match_operand 0 "register_operand" "")] 9)
14917 (clobber (match_scratch 1 ""))]
14922 rs6000_stack_t *info = rs6000_stack_info ();
14924 if (info->lr_save_p)
14926 rtx frame_rtx = stack_pointer_rtx;
14930 if (frame_pointer_needed
14931 || current_function_calls_alloca
14932 || info->total_size > 32767)
14934 emit_move_insn (operands[1], gen_rtx_MEM (Pmode, frame_rtx));
14935 frame_rtx = operands[1];
14937 else if (info->push_p)
14938 sp_offset = info->total_size;
14940 tmp = plus_constant (frame_rtx, info->lr_save_offset + sp_offset);
14941 tmp = gen_rtx_MEM (Pmode, tmp);
14942 emit_move_insn (tmp, operands[0]);
14945 emit_move_insn (gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM), operands[0]);
14949 (define_insn "prefetch"
14950 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14951 (match_operand:SI 1 "const_int_operand" "n")
14952 (match_operand:SI 2 "const_int_operand" "n"))]
14956 if (GET_CODE (operands[0]) == REG)
14957 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14958 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14960 [(set_attr "type" "load")])
14962 (include "altivec.md")