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 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)
38 ;; Define an insn type attribute. This is used in function unit delay
40 (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,altivec"
41 (const_string "integer"))
44 ; '(pc)' in the following doesn't include the instruction itself; it is
45 ; calculated as if the instruction had zero size.
46 (define_attr "length" ""
47 (if_then_else (eq_attr "type" "branch")
48 (if_then_else (and (ge (minus (match_dup 0) (pc))
50 (lt (minus (match_dup 0) (pc))
56 ;; Processor type -- this attribute must exactly match the processor_type
57 ;; enumeration in rs6000.h.
59 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,power4"
60 (const (symbol_ref "rs6000_cpu_attr")))
62 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
63 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
65 ; Load/Store Unit -- pure PowerPC only
66 ; (POWER and 601 use Integer Unit)
67 (define_function_unit "lsu" 1 0
68 (and (eq_attr "type" "load")
69 (eq_attr "cpu" "rs64a,mpccore,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400"))
72 (define_function_unit "lsu" 1 0
73 (and (eq_attr "type" "load,vecload")
74 (eq_attr "cpu" "ppc7450"))
77 (define_function_unit "lsu" 1 0
78 (and (eq_attr "type" "store,fpstore")
79 (eq_attr "cpu" "rs64a,mpccore,ppc603,ppc604,ppc604e,ppc620,ppc630"))
82 (define_function_unit "lsu" 1 0
83 (and (eq_attr "type" "store,fpstore")
84 (eq_attr "cpu" "ppc750,ppc7400"))
87 (define_function_unit "lsu" 1 0
88 (and (eq_attr "type" "store,vecstore")
89 (eq_attr "cpu" "ppc7450"))
92 (define_function_unit "lsu" 1 0
93 (and (eq_attr "type" "fpstore")
94 (eq_attr "cpu" "ppc7450"))
97 (define_function_unit "lsu" 1 0
98 (and (eq_attr "type" "fpload")
99 (eq_attr "cpu" "mpccore,ppc603,ppc750,ppc7400"))
102 (define_function_unit "lsu" 1 0
103 (and (eq_attr "type" "fpload")
104 (eq_attr "cpu" "ppc7450"))
107 (define_function_unit "lsu" 1 0
108 (and (eq_attr "type" "fpload")
109 (eq_attr "cpu" "rs64a,ppc604,ppc604e,ppc620,ppc630"))
112 (define_function_unit "iu" 1 0
113 (and (eq_attr "type" "load")
114 (eq_attr "cpu" "rios1,ppc403,ppc405,ppc601"))
117 (define_function_unit "iu" 1 0
118 (and (eq_attr "type" "store,fpstore")
119 (eq_attr "cpu" "rios1,ppc403,ppc405,ppc601"))
122 (define_function_unit "fpu" 1 0
123 (and (eq_attr "type" "fpstore")
124 (eq_attr "cpu" "rios1,ppc601"))
127 (define_function_unit "iu" 1 0
128 (and (eq_attr "type" "fpload")
129 (eq_attr "cpu" "rios1"))
132 (define_function_unit "iu" 1 0
133 (and (eq_attr "type" "fpload")
134 (eq_attr "cpu" "ppc601"))
137 (define_function_unit "iu2" 2 0
138 (and (eq_attr "type" "load,fpload")
139 (eq_attr "cpu" "rios2"))
142 (define_function_unit "iu2" 2 0
143 (and (eq_attr "type" "store,fpstore")
144 (eq_attr "cpu" "rios2"))
147 ; Integer Unit (RIOS1, PPC601, PPC603, RS64a)
148 (define_function_unit "iu" 1 0
149 (and (eq_attr "type" "integer")
150 (eq_attr "cpu" "rios1,rs64a,mpccore,ppc403,ppc405,ppc601,ppc603"))
153 (define_function_unit "iu" 1 0
154 (and (eq_attr "type" "cr_logical")
155 (eq_attr "cpu" "mpccore,ppc403,ppc405,ppc601"))
158 (define_function_unit "iu" 1 0
159 (and (eq_attr "type" "imul,imul2,imul3")
160 (eq_attr "cpu" "ppc403"))
163 (define_function_unit "iu" 1 0
164 (and (eq_attr "type" "imul")
165 (eq_attr "cpu" "ppc405"))
168 (define_function_unit "iu" 1 0
169 (and (eq_attr "type" "imul2,imul3")
170 (eq_attr "cpu" "ppc405"))
173 (define_function_unit "iu" 1 0
174 (and (eq_attr "type" "imul")
175 (eq_attr "cpu" "rios1"))
178 (define_function_unit "iu" 1 0
179 (and (eq_attr "type" "imul2")
180 (eq_attr "cpu" "rios1"))
183 (define_function_unit "iu" 1 0
184 (and (eq_attr "type" "imul3")
185 (eq_attr "cpu" "rios1"))
188 (define_function_unit "iu" 1 0
189 (and (eq_attr "type" "imul,imul2,imul3")
190 (eq_attr "cpu" "ppc601,ppc603"))
193 (define_function_unit "iu" 1 0
194 (and (eq_attr "type" "imul")
195 (eq_attr "cpu" "rs64a"))
198 (define_function_unit "iu" 1 0
199 (and (eq_attr "type" "imul2")
200 (eq_attr "cpu" "rs64a"))
203 (define_function_unit "iu" 1 0
204 (and (eq_attr "type" "imul3")
205 (eq_attr "cpu" "rs64a"))
208 (define_function_unit "iu" 1 0
209 (and (eq_attr "type" "lmul")
210 (eq_attr "cpu" "rs64a"))
213 (define_function_unit "iu" 1 0
214 (and (eq_attr "type" "idiv")
215 (eq_attr "cpu" "rios1"))
218 (define_function_unit "iu" 1 0
219 (and (eq_attr "type" "idiv")
220 (eq_attr "cpu" "rs64a"))
223 (define_function_unit "iu" 1 0
224 (and (eq_attr "type" "ldiv")
225 (eq_attr "cpu" "rs64a"))
228 (define_function_unit "iu" 1 0
229 (and (eq_attr "type" "idiv")
230 (eq_attr "cpu" "ppc403"))
233 (define_function_unit "iu" 1 0
234 (and (eq_attr "type" "idiv")
235 (eq_attr "cpu" "ppc405"))
238 (define_function_unit "iu" 1 0
239 (and (eq_attr "type" "idiv")
240 (eq_attr "cpu" "ppc601"))
243 (define_function_unit "iu" 1 0
244 (and (eq_attr "type" "idiv")
245 (eq_attr "cpu" "ppc603"))
248 ; RIOS2 has two integer units: a primary one which can perform all
249 ; operations and a secondary one which is fed in lock step with the first
250 ; and can perform "simple" integer operations.
251 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
252 ; for the complex insns.
253 (define_function_unit "iu2" 2 0
254 (and (eq_attr "type" "integer")
255 (eq_attr "cpu" "rios2"))
258 (define_function_unit "iu2" 2 0
259 (and (eq_attr "type" "imul,imul2,imul3")
260 (eq_attr "cpu" "rios2"))
263 (define_function_unit "iu2" 2 0
264 (and (eq_attr "type" "idiv")
265 (eq_attr "cpu" "rios2"))
268 (define_function_unit "imuldiv" 1 0
269 (and (eq_attr "type" "imul,imul2,imul3")
270 (eq_attr "cpu" "rios2"))
273 (define_function_unit "imuldiv" 1 0
274 (and (eq_attr "type" "idiv")
275 (eq_attr "cpu" "rios2"))
278 ; MPCCORE has separate IMUL/IDIV unit for multicycle instructions
279 ; Divide latency varies greatly from 2-11, use 6 as average
280 (define_function_unit "imuldiv" 1 0
281 (and (eq_attr "type" "imul,imul2,imul3")
282 (eq_attr "cpu" "mpccore"))
285 (define_function_unit "imuldiv" 1 0
286 (and (eq_attr "type" "idiv")
287 (eq_attr "cpu" "mpccore"))
290 ; PPC604{,e} has two units that perform integer operations
291 ; and one unit for divide/multiply operations (and move
293 (define_function_unit "iu2" 2 0
294 (and (eq_attr "type" "integer")
295 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
298 (define_function_unit "imuldiv" 1 0
299 (and (eq_attr "type" "imul,imul2,imul3")
300 (eq_attr "cpu" "ppc604"))
303 (define_function_unit "imuldiv" 1 0
304 (and (eq_attr "type" "imul,imul2,imul3")
305 (eq_attr "cpu" "ppc604e"))
308 (define_function_unit "imuldiv" 1 0
309 (and (eq_attr "type" "imul")
310 (eq_attr "cpu" "ppc620,ppc630"))
313 (define_function_unit "imuldiv" 1 0
314 (and (eq_attr "type" "imul2")
315 (eq_attr "cpu" "ppc620,ppc630"))
318 (define_function_unit "imuldiv" 1 0
319 (and (eq_attr "type" "imul3")
320 (eq_attr "cpu" "ppc620,ppc630"))
323 (define_function_unit "imuldiv" 1 0
324 (and (eq_attr "type" "lmul")
325 (eq_attr "cpu" "ppc620,ppc630"))
328 (define_function_unit "imuldiv" 1 0
329 (and (eq_attr "type" "idiv")
330 (eq_attr "cpu" "ppc604,ppc604e"))
333 (define_function_unit "imuldiv" 1 0
334 (and (eq_attr "type" "idiv")
335 (eq_attr "cpu" "ppc620"))
338 (define_function_unit "imuldiv" 1 0
339 (and (eq_attr "type" "idiv")
340 (eq_attr "cpu" "ppc630"))
343 (define_function_unit "imuldiv" 1 0
344 (and (eq_attr "type" "ldiv")
345 (eq_attr "cpu" "ppc620,ppc630"))
348 ; PPC7450 has 3 integer units (for most integer insns) and one mul/div
349 ; unit, which also does CR-logical insns and move to/from SPR.
350 ; It also has 4 vector units, one for each type of vector instruction.
351 ; However, we can only dispatch 2 instructions per cycle.
352 ; We model this as saying that dispatching two of the same type of instruction
353 ; in a row incurs a single cycle delay.
354 (define_function_unit "iu3" 3 0
355 (and (eq_attr "type" "integer")
356 (eq_attr "cpu" "ppc7450"))
359 (define_function_unit "imuldiv" 1 0
360 (and (eq_attr "type" "imul")
361 (eq_attr "cpu" "ppc7450"))
364 (define_function_unit "imuldiv" 1 0
365 (and (eq_attr "type" "imul2,imul3")
366 (eq_attr "cpu" "ppc7450"))
369 (define_function_unit "imuldiv" 1 0
370 (and (eq_attr "type" "idiv")
371 (eq_attr "cpu" "ppc7450"))
374 (define_function_unit "imuldiv" 1 0
375 (and (eq_attr "type" "cr_logical")
376 (eq_attr "cpu" "ppc7450"))
379 (define_function_unit "vec_alu2" 2 0
380 (and (eq_attr "type" "vecsimple")
381 (eq_attr "cpu" "ppc7450"))
382 1 2 [(eq_attr "type" "vecsimple")])
384 (define_function_unit "vec_alu2" 2 0
385 (and (eq_attr "type" "vecsimple")
386 (eq_attr "cpu" "ppc7450"))
387 1 1 [(eq_attr "type" "!vecsimple")])
389 (define_function_unit "vec_alu2" 2 0
390 (and (eq_attr "type" "veccomplex")
391 (eq_attr "cpu" "ppc7450"))
392 4 2 [(eq_attr "type" "veccomplex")])
394 (define_function_unit "vec_alu2" 2 0
395 (and (eq_attr "type" "veccomplex")
396 (eq_attr "cpu" "ppc7450"))
397 4 1 [(eq_attr "type" "!veccomplex")])
399 (define_function_unit "vec_alu2" 2 0
400 (and (eq_attr "type" "veccmp")
401 (eq_attr "cpu" "ppc7450"))
402 2 2 [(eq_attr "type" "veccmp")])
404 (define_function_unit "vec_alu2" 2 0
405 (and (eq_attr "type" "veccmp")
406 (eq_attr "cpu" "ppc7450"))
407 2 1 [(eq_attr "type" "!veccmp")])
409 (define_function_unit "vec_alu2" 2 0
410 (and (eq_attr "type" "vecfloat")
411 (eq_attr "cpu" "ppc7450"))
412 4 2 [(eq_attr "type" "vecfloat")])
414 (define_function_unit "vec_alu2" 2 0
415 (and (eq_attr "type" "vecfloat")
416 (eq_attr "cpu" "ppc7450"))
417 4 1 [(eq_attr "type" "!vecfloat")])
419 (define_function_unit "vec_alu2" 2 0
420 (and (eq_attr "type" "vecperm")
421 (eq_attr "cpu" "ppc7450"))
422 2 2 [(eq_attr "type" "vecperm")])
424 (define_function_unit "vec_alu2" 2 0
425 (and (eq_attr "type" "vecperm")
426 (eq_attr "cpu" "ppc7450"))
427 2 1 [(eq_attr "type" "!vecperm")])
429 ; PPC750 has two integer units: a primary one which can perform all
430 ; operations and a secondary one which is fed in lock step with the first
431 ; and can perform "simple" integer operations.
432 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
433 ; for the complex insns.
434 (define_function_unit "iu2" 2 0
435 (and (eq_attr "type" "integer")
436 (eq_attr "cpu" "ppc750,ppc7400"))
439 (define_function_unit "iu2" 2 0
440 (and (eq_attr "type" "imul")
441 (eq_attr "cpu" "ppc750,ppc7400"))
444 (define_function_unit "iu2" 2 0
445 (and (eq_attr "type" "imul2")
446 (eq_attr "cpu" "ppc750,ppc7400"))
449 (define_function_unit "iu2" 2 0
450 (and (eq_attr "type" "imul3")
451 (eq_attr "cpu" "ppc750,ppc7400"))
454 (define_function_unit "iu2" 2 0
455 (and (eq_attr "type" "idiv")
456 (eq_attr "cpu" "ppc750,ppc7400"))
459 (define_function_unit "imuldiv" 1 0
460 (and (eq_attr "type" "imul")
461 (eq_attr "cpu" "ppc750,ppc7400"))
464 (define_function_unit "imuldiv" 1 0
465 (and (eq_attr "type" "imul2")
466 (eq_attr "cpu" "ppc750,ppc7400"))
469 (define_function_unit "imuldiv" 1 0
470 (and (eq_attr "type" "imul3")
471 (eq_attr "cpu" "ppc750,ppc7400"))
474 (define_function_unit "imuldiv" 1 0
475 (and (eq_attr "type" "idiv")
476 (eq_attr "cpu" "ppc750,ppc7400"))
479 ; CR-logical operations are execute-serialized, that is they don't
480 ; start (and block the function unit) until all preceding operations
481 ; have finished. They don't block dispatch of other insns, though.
482 ; I've imitated this by giving them longer latency.
483 (define_function_unit "sru" 1 0
484 (and (eq_attr "type" "cr_logical")
485 (eq_attr "cpu" "ppc603,ppc750,ppc7400"))
488 ; compare is done on integer unit, but feeds insns which
489 ; execute on the branch unit.
490 (define_function_unit "iu" 1 0
491 (and (eq_attr "type" "compare")
492 (eq_attr "cpu" "rios1"))
495 (define_function_unit "iu" 1 0
496 (and (eq_attr "type" "delayed_compare")
497 (eq_attr "cpu" "rios1"))
500 (define_function_unit "iu" 1 0
501 (and (eq_attr "type" "compare,delayed_compare")
502 (eq_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc601,ppc603"))
505 ; some extra cycles added by TARGET_SCHED_ADJUST_COST between compare
506 ; and a following branch, to reduce mispredicts
507 (define_function_unit "iu3" 3 0
508 (and (eq_attr "type" "compare,delayed_compare")
509 (eq_attr "cpu" "ppc7450"))
512 (define_function_unit "iu2" 2 0
513 (and (eq_attr "type" "compare,delayed_compare")
514 (eq_attr "cpu" "rios2"))
517 (define_function_unit "iu2" 2 0
518 (and (eq_attr "type" "compare,delayed_compare")
519 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400"))
522 ; fp compare uses fp unit
523 (define_function_unit "fpu" 1 0
524 (and (eq_attr "type" "fpcompare")
525 (eq_attr "cpu" "rios1"))
528 ; rios1 and rios2 have different fpcompare delays
529 (define_function_unit "fpu2" 2 0
530 (and (eq_attr "type" "fpcompare")
531 (eq_attr "cpu" "rios2,ppc630"))
534 ; on ppc601 and ppc603, fpcompare takes also 2 cycles from
536 ; here we do not define delays, just occupy the unit. The dependencies
537 ; will be assigned by the fpcompare definition in the fpu.
538 (define_function_unit "iu" 1 0
539 (and (eq_attr "type" "fpcompare")
540 (eq_attr "cpu" "ppc601,ppc603"))
543 ; fp compare uses fp unit
544 (define_function_unit "fpu" 1 0
545 (and (eq_attr "type" "fpcompare")
546 (eq_attr "cpu" "rs64a,ppc601,ppc603,ppc604,ppc604e,ppc620"))
549 (define_function_unit "fpu" 1 0
550 (and (eq_attr "type" "fpcompare")
551 (eq_attr "cpu" "ppc750,ppc7400,ppc7450"))
554 (define_function_unit "fpu" 1 0
555 (and (eq_attr "type" "fpcompare")
556 (eq_attr "cpu" "mpccore"))
559 (define_function_unit "bpu" 1 0
560 (and (eq_attr "type" "mtjmpr")
561 (eq_attr "cpu" "rios1,rios2,rs64a"))
564 (define_function_unit "bpu" 1 0
565 (and (eq_attr "type" "mtjmpr")
566 (eq_attr "cpu" "mpccore,ppc403,ppc405,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630"))
569 (define_function_unit "sru" 1 0
570 (and (eq_attr "type" "mtjmpr")
571 (eq_attr "cpu" "ppc750,ppc7400"))
574 (define_function_unit "imuldiv" 1 0
575 (and (eq_attr "type" "mtjmpr")
576 (eq_attr "cpu" "ppc7450"))
579 (define_function_unit "bpu" 1 0
580 (and (eq_attr "type" "cr_logical")
581 (eq_attr "cpu" "rios1,rios2,ppc604"))
584 (define_function_unit "cru" 1 0
585 (and (eq_attr "type" "cr_logical")
586 (eq_attr "cpu" "ppc604e,ppc620,ppc630,rs64a"))
589 ; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
590 (define_function_unit "bpu" 1 0
591 (eq_attr "type" "jmpreg")
594 (define_function_unit "bpu" 1 0
595 (eq_attr "type" "branch")
598 ; Floating Point Unit
599 (define_function_unit "fpu" 1 0
600 (and (eq_attr "type" "fp,dmul")
601 (eq_attr "cpu" "rios1"))
604 (define_function_unit "fpu" 1 0
605 (and (eq_attr "type" "fp")
606 (eq_attr "cpu" "rs64a,mpccore"))
609 (define_function_unit "fpu" 1 0
610 (and (eq_attr "type" "fp")
611 (eq_attr "cpu" "ppc601"))
614 (define_function_unit "fpu" 1 0
615 (and (eq_attr "type" "fp")
616 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620,ppc750,ppc7400"))
619 (define_function_unit "fpu" 1 0
620 (and (eq_attr "type" "fp,dmul")
621 (eq_attr "cpu" "ppc7450"))
624 (define_function_unit "fpu" 1 0
625 (and (eq_attr "type" "dmul")
626 (eq_attr "cpu" "rs64a"))
629 (define_function_unit "fpu" 1 0
630 (and (eq_attr "type" "dmul")
631 (eq_attr "cpu" "mpccore"))
634 (define_function_unit "fpu" 1 0
635 (and (eq_attr "type" "dmul")
636 (eq_attr "cpu" "ppc601"))
640 (define_function_unit "fpu" 1 0
641 (and (eq_attr "type" "dmul")
642 (eq_attr "cpu" "ppc603,ppc750"))
645 (define_function_unit "fpu" 1 0
646 (and (eq_attr "type" "dmul")
647 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc7400"))
650 (define_function_unit "fpu" 1 0
651 (and (eq_attr "type" "sdiv,ddiv")
652 (eq_attr "cpu" "rios1"))
655 (define_function_unit "fpu" 1 0
656 (and (eq_attr "type" "sdiv")
657 (eq_attr "cpu" "rs64a"))
660 (define_function_unit "fpu" 1 0
661 (and (eq_attr "type" "sdiv")
662 (eq_attr "cpu" "ppc601,ppc750,ppc7400"))
665 (define_function_unit "fpu" 1 0
666 (and (eq_attr "type" "sdiv")
667 (eq_attr "cpu" "ppc7450"))
670 (define_function_unit "fpu" 1 0
671 (and (eq_attr "type" "sdiv")
672 (eq_attr "cpu" "mpccore"))
675 (define_function_unit "fpu" 1 0
676 (and (eq_attr "type" "sdiv")
677 (eq_attr "cpu" "ppc603,ppc604,ppc604e,ppc620"))
680 (define_function_unit "fpu" 1 0
681 (and (eq_attr "type" "ddiv")
682 (eq_attr "cpu" "mpccore"))
685 (define_function_unit "fpu" 1 0
686 (and (eq_attr "type" "ddiv")
687 (eq_attr "cpu" "rs64a,ppc601,ppc750,ppc604,ppc604e,ppc620,ppc7400"))
690 (define_function_unit "fpu" 1 0
691 (and (eq_attr "type" "ddiv")
692 (eq_attr "cpu" "ppc7450"))
695 (define_function_unit "fpu" 1 0
696 (and (eq_attr "type" "ddiv")
697 (eq_attr "cpu" "ppc603"))
700 (define_function_unit "fpu" 1 0
701 (and (eq_attr "type" "ssqrt")
702 (eq_attr "cpu" "ppc620"))
705 (define_function_unit "fpu" 1 0
706 (and (eq_attr "type" "dsqrt")
707 (eq_attr "cpu" "ppc620"))
710 ; RIOS2 has two symmetric FPUs.
711 (define_function_unit "fpu2" 2 0
712 (and (eq_attr "type" "fp,dmul")
713 (eq_attr "cpu" "rios2"))
716 (define_function_unit "fpu2" 2 0
717 (and (eq_attr "type" "fp,dmul")
718 (eq_attr "cpu" "ppc630"))
721 (define_function_unit "fpu2" 2 0
722 (and (eq_attr "type" "sdiv,ddiv")
723 (eq_attr "cpu" "rios2"))
726 (define_function_unit "fpu2" 2 0
727 (and (eq_attr "type" "sdiv")
728 (eq_attr "cpu" "ppc630"))
731 (define_function_unit "fpu2" 2 0
732 (and (eq_attr "type" "ddiv")
733 (eq_attr "cpu" "ppc630"))
736 (define_function_unit "fpu2" 2 0
737 (and (eq_attr "type" "ssqrt,dsqrt")
738 (eq_attr "cpu" "rios2"))
741 (define_function_unit "fpu2" 2 0
742 (and (eq_attr "type" "ssqrt")
743 (eq_attr "cpu" "ppc630"))
746 (define_function_unit "fpu2" 2 0
747 (and (eq_attr "type" "dsqrt")
748 (eq_attr "cpu" "ppc630"))
752 (define_function_unit "lsu2" 2 0
753 (and (eq_attr "type" "load")
754 (eq_attr "cpu" "power4"))
757 (define_function_unit "lsu2" 2 0
758 (and (eq_attr "type" "fpload")
759 (eq_attr "cpu" "power4"))
762 (define_function_unit "lsu2" 2 0
763 (and (eq_attr "type" "store,fpstore")
764 (eq_attr "cpu" "power4"))
767 (define_function_unit "iu2" 2 0
768 (and (eq_attr "type" "integer")
769 (eq_attr "cpu" "power4"))
772 (define_function_unit "iu2" 2 0
773 (and (eq_attr "type" "imul,lmul")
774 (eq_attr "cpu" "power4"))
777 (define_function_unit "iu2" 2 0
778 (and (eq_attr "type" "imul2")
779 (eq_attr "cpu" "power4"))
782 (define_function_unit "iu2" 2 0
783 (and (eq_attr "type" "imul3")
784 (eq_attr "cpu" "power4"))
787 (define_function_unit "iu2" 2 0
788 (and (eq_attr "type" "idiv")
789 (eq_attr "cpu" "power4"))
792 (define_function_unit "iu2" 2 0
793 (and (eq_attr "type" "ldiv")
794 (eq_attr "cpu" "power4"))
797 (define_function_unit "imuldiv" 1 0
798 (and (eq_attr "type" "idiv")
799 (eq_attr "cpu" "power4"))
802 (define_function_unit "imuldiv" 1 0
803 (and (eq_attr "type" "ldiv")
804 (eq_attr "cpu" "power4"))
807 (define_function_unit "iu2" 2 0
808 (and (eq_attr "type" "compare")
809 (eq_attr "cpu" "power4"))
812 (define_function_unit "iu2" 2 0
813 (and (eq_attr "type" "delayed_compare")
814 (eq_attr "cpu" "power4"))
817 (define_function_unit "bpu" 1 0
818 (and (eq_attr "type" "mtjmpr")
819 (eq_attr "cpu" "power4"))
822 (define_function_unit "bpu" 1 0
823 (and (eq_attr "type" "jmpreg,branch")
824 (eq_attr "cpu" "power4"))
827 (define_function_unit "cru" 1 0
828 (and (eq_attr "type" "cr_logical")
829 (eq_attr "cpu" "power4"))
832 (define_function_unit "fpu2" 2 0
833 (and (eq_attr "type" "fp,dmul")
834 (eq_attr "cpu" "power4"))
837 ; adjust_cost increases the cost of dependent branches,
838 ; so shave a few cycles off for fpcompare.
839 (define_function_unit "fpu2" 2 0
840 (and (eq_attr "type" "fpcompare")
841 (eq_attr "cpu" "power4"))
844 (define_function_unit "fpu2" 2 0
845 (and (eq_attr "type" "sdiv,ddiv")
846 (eq_attr "cpu" "power4"))
849 (define_function_unit "fpu2" 2 0
850 (and (eq_attr "type" "ssqrt,dsqrt")
851 (eq_attr "cpu" "power4"))
855 ;; Start with fixed-point load and store insns. Here we put only the more
856 ;; complex forms. Basic data transfer is done later.
858 (define_expand "zero_extendqidi2"
859 [(set (match_operand:DI 0 "gpc_reg_operand" "")
860 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
865 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
866 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
871 [(set_attr "type" "load,*")])
874 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
875 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
877 (clobber (match_scratch:DI 2 "=r,r"))]
882 [(set_attr "type" "compare")
883 (set_attr "length" "4,8")])
886 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
887 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
889 (clobber (match_scratch:DI 2 ""))]
890 "TARGET_POWERPC64 && reload_completed"
892 (zero_extend:DI (match_dup 1)))
894 (compare:CC (match_dup 2)
899 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
900 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
902 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
903 (zero_extend:DI (match_dup 1)))]
908 [(set_attr "type" "compare")
909 (set_attr "length" "4,8")])
912 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
913 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
915 (set (match_operand:DI 0 "gpc_reg_operand" "")
916 (zero_extend:DI (match_dup 1)))]
917 "TARGET_POWERPC64 && reload_completed"
919 (zero_extend:DI (match_dup 1)))
921 (compare:CC (match_dup 0)
925 (define_insn "extendqidi2"
926 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
927 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
932 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
933 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
935 (clobber (match_scratch:DI 2 "=r,r"))]
940 [(set_attr "type" "compare")
941 (set_attr "length" "4,8")])
944 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
945 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
947 (clobber (match_scratch:DI 2 ""))]
948 "TARGET_POWERPC64 && reload_completed"
950 (sign_extend:DI (match_dup 1)))
952 (compare:CC (match_dup 2)
957 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
958 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
960 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
961 (sign_extend:DI (match_dup 1)))]
966 [(set_attr "type" "compare")
967 (set_attr "length" "4,8")])
970 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
971 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
973 (set (match_operand:DI 0 "gpc_reg_operand" "")
974 (sign_extend:DI (match_dup 1)))]
975 "TARGET_POWERPC64 && reload_completed"
977 (sign_extend:DI (match_dup 1)))
979 (compare:CC (match_dup 0)
983 (define_expand "zero_extendhidi2"
984 [(set (match_operand:DI 0 "gpc_reg_operand" "")
985 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
990 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
991 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
996 [(set_attr "type" "load,*")])
999 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1000 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1002 (clobber (match_scratch:DI 2 "=r,r"))]
1007 [(set_attr "type" "compare")
1008 (set_attr "length" "4,8")])
1011 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1012 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1014 (clobber (match_scratch:DI 2 ""))]
1015 "TARGET_POWERPC64 && reload_completed"
1017 (zero_extend:DI (match_dup 1)))
1019 (compare:CC (match_dup 2)
1024 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1025 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1027 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1028 (zero_extend:DI (match_dup 1)))]
1033 [(set_attr "type" "compare")
1034 (set_attr "length" "4,8")])
1037 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1038 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1040 (set (match_operand:DI 0 "gpc_reg_operand" "")
1041 (zero_extend:DI (match_dup 1)))]
1042 "TARGET_POWERPC64 && reload_completed"
1044 (zero_extend:DI (match_dup 1)))
1046 (compare:CC (match_dup 0)
1050 (define_expand "extendhidi2"
1051 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1052 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
1057 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1058 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1063 [(set_attr "type" "load,*")])
1066 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1067 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1069 (clobber (match_scratch:DI 2 "=r,r"))]
1074 [(set_attr "type" "compare")
1075 (set_attr "length" "4,8")])
1078 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1079 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1081 (clobber (match_scratch:DI 2 ""))]
1082 "TARGET_POWERPC64 && reload_completed"
1084 (sign_extend:DI (match_dup 1)))
1086 (compare:CC (match_dup 2)
1091 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1092 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1094 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1095 (sign_extend:DI (match_dup 1)))]
1100 [(set_attr "type" "compare")
1101 (set_attr "length" "4,8")])
1104 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1105 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
1107 (set (match_operand:DI 0 "gpc_reg_operand" "")
1108 (sign_extend:DI (match_dup 1)))]
1109 "TARGET_POWERPC64 && reload_completed"
1111 (sign_extend:DI (match_dup 1)))
1113 (compare:CC (match_dup 0)
1117 (define_expand "zero_extendsidi2"
1118 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1119 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
1124 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1125 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
1130 [(set_attr "type" "load,*")])
1133 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1134 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1136 (clobber (match_scratch:DI 2 "=r,r"))]
1141 [(set_attr "type" "compare")
1142 (set_attr "length" "4,8")])
1145 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1146 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1148 (clobber (match_scratch:DI 2 ""))]
1149 "TARGET_POWERPC64 && reload_completed"
1151 (zero_extend:DI (match_dup 1)))
1153 (compare:CC (match_dup 2)
1158 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1159 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1161 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1162 (zero_extend:DI (match_dup 1)))]
1167 [(set_attr "type" "compare")
1168 (set_attr "length" "4,8")])
1171 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1172 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1174 (set (match_operand:DI 0 "gpc_reg_operand" "")
1175 (zero_extend:DI (match_dup 1)))]
1176 "TARGET_POWERPC64 && reload_completed"
1178 (zero_extend:DI (match_dup 1)))
1180 (compare:CC (match_dup 0)
1184 (define_expand "extendsidi2"
1185 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1186 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
1191 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1192 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
1197 [(set_attr "type" "load,*")])
1200 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1201 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1203 (clobber (match_scratch:DI 2 "=r,r"))]
1208 [(set_attr "type" "compare")
1209 (set_attr "length" "4,8")])
1212 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1213 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1215 (clobber (match_scratch:DI 2 ""))]
1216 "TARGET_POWERPC64 && reload_completed"
1218 (sign_extend:DI (match_dup 1)))
1220 (compare:CC (match_dup 2)
1225 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1226 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1228 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1229 (sign_extend:DI (match_dup 1)))]
1234 [(set_attr "type" "compare")
1235 (set_attr "length" "4,8")])
1238 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1239 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1241 (set (match_operand:DI 0 "gpc_reg_operand" "")
1242 (sign_extend:DI (match_dup 1)))]
1243 "TARGET_POWERPC64 && reload_completed"
1245 (sign_extend:DI (match_dup 1)))
1247 (compare:CC (match_dup 0)
1251 (define_expand "zero_extendqisi2"
1252 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1253 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
1258 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1259 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
1263 {rlinm|rlwinm} %0,%1,0,0xff"
1264 [(set_attr "type" "load,*")])
1267 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1268 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1270 (clobber (match_scratch:SI 2 "=r,r"))]
1273 {andil.|andi.} %2,%1,0xff
1275 [(set_attr "type" "compare")
1276 (set_attr "length" "4,8")])
1279 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1280 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1282 (clobber (match_scratch:SI 2 ""))]
1285 (zero_extend:SI (match_dup 1)))
1287 (compare:CC (match_dup 2)
1292 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1293 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1295 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1296 (zero_extend:SI (match_dup 1)))]
1299 {andil.|andi.} %0,%1,0xff
1301 [(set_attr "type" "compare")
1302 (set_attr "length" "4,8")])
1305 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1306 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1308 (set (match_operand:SI 0 "gpc_reg_operand" "")
1309 (zero_extend:SI (match_dup 1)))]
1312 (zero_extend:SI (match_dup 1)))
1314 (compare:CC (match_dup 0)
1318 (define_expand "extendqisi2"
1319 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1320 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
1325 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
1326 else if (TARGET_POWER)
1327 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
1329 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
1333 (define_insn "extendqisi2_ppc"
1334 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1335 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1340 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1341 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1343 (clobber (match_scratch:SI 2 "=r,r"))]
1348 [(set_attr "type" "compare")
1349 (set_attr "length" "4,8")])
1352 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1353 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1355 (clobber (match_scratch:SI 2 ""))]
1356 "TARGET_POWERPC && reload_completed"
1358 (sign_extend:SI (match_dup 1)))
1360 (compare:CC (match_dup 2)
1365 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1366 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1368 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1369 (sign_extend:SI (match_dup 1)))]
1374 [(set_attr "type" "compare")
1375 (set_attr "length" "4,8")])
1378 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1379 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
1381 (set (match_operand:SI 0 "gpc_reg_operand" "")
1382 (sign_extend:SI (match_dup 1)))]
1383 "TARGET_POWERPC && reload_completed"
1385 (sign_extend:SI (match_dup 1)))
1387 (compare:CC (match_dup 0)
1391 (define_expand "extendqisi2_power"
1392 [(parallel [(set (match_dup 2)
1393 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1395 (clobber (scratch:SI))])
1396 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1397 (ashiftrt:SI (match_dup 2)
1399 (clobber (scratch:SI))])]
1402 { operands[1] = gen_lowpart (SImode, operands[1]);
1403 operands[2] = gen_reg_rtx (SImode); }")
1405 (define_expand "extendqisi2_no_power"
1407 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1409 (set (match_operand:SI 0 "gpc_reg_operand" "")
1410 (ashiftrt:SI (match_dup 2)
1412 "! TARGET_POWER && ! TARGET_POWERPC"
1414 { operands[1] = gen_lowpart (SImode, operands[1]);
1415 operands[2] = gen_reg_rtx (SImode); }")
1417 (define_expand "zero_extendqihi2"
1418 [(set (match_operand:HI 0 "gpc_reg_operand" "")
1419 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
1424 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1425 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
1429 {rlinm|rlwinm} %0,%1,0,0xff"
1430 [(set_attr "type" "load,*")])
1433 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1434 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1436 (clobber (match_scratch:HI 2 "=r,r"))]
1439 {andil.|andi.} %2,%1,0xff
1441 [(set_attr "type" "compare")
1442 (set_attr "length" "4,8")])
1445 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1446 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1448 (clobber (match_scratch:HI 2 ""))]
1451 (zero_extend:HI (match_dup 1)))
1453 (compare:CC (match_dup 2)
1458 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1459 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1461 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1462 (zero_extend:HI (match_dup 1)))]
1465 {andil.|andi.} %0,%1,0xff
1467 [(set_attr "type" "compare")
1468 (set_attr "length" "4,8")])
1471 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1472 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1474 (set (match_operand:HI 0 "gpc_reg_operand" "")
1475 (zero_extend:HI (match_dup 1)))]
1478 (zero_extend:HI (match_dup 1)))
1480 (compare:CC (match_dup 0)
1484 (define_expand "extendqihi2"
1485 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
1486 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
1491 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
1492 else if (TARGET_POWER)
1493 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
1495 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
1499 (define_insn "extendqihi2_ppc"
1500 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
1501 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
1506 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1507 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1509 (clobber (match_scratch:HI 2 "=r,r"))]
1514 [(set_attr "type" "compare")
1515 (set_attr "length" "4,8")])
1518 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1519 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1521 (clobber (match_scratch:HI 2 ""))]
1522 "TARGET_POWERPC && reload_completed"
1524 (sign_extend:HI (match_dup 1)))
1526 (compare:CC (match_dup 2)
1531 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1532 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
1534 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
1535 (sign_extend:HI (match_dup 1)))]
1540 [(set_attr "type" "compare")
1541 (set_attr "length" "4,8")])
1544 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1545 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
1547 (set (match_operand:HI 0 "gpc_reg_operand" "")
1548 (sign_extend:HI (match_dup 1)))]
1549 "TARGET_POWERPC && reload_completed"
1551 (sign_extend:HI (match_dup 1)))
1553 (compare:CC (match_dup 0)
1557 (define_expand "extendqihi2_power"
1558 [(parallel [(set (match_dup 2)
1559 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1561 (clobber (scratch:SI))])
1562 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
1563 (ashiftrt:SI (match_dup 2)
1565 (clobber (scratch:SI))])]
1568 { operands[0] = gen_lowpart (SImode, operands[0]);
1569 operands[1] = gen_lowpart (SImode, operands[1]);
1570 operands[2] = gen_reg_rtx (SImode); }")
1572 (define_expand "extendqihi2_no_power"
1574 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1576 (set (match_operand:HI 0 "gpc_reg_operand" "")
1577 (ashiftrt:SI (match_dup 2)
1579 "! TARGET_POWER && ! TARGET_POWERPC"
1581 { operands[0] = gen_lowpart (SImode, operands[0]);
1582 operands[1] = gen_lowpart (SImode, operands[1]);
1583 operands[2] = gen_reg_rtx (SImode); }")
1585 (define_expand "zero_extendhisi2"
1586 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1587 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1592 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1593 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1597 {rlinm|rlwinm} %0,%1,0,0xffff"
1598 [(set_attr "type" "load,*")])
1601 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1602 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1604 (clobber (match_scratch:SI 2 "=r,r"))]
1607 {andil.|andi.} %2,%1,0xffff
1609 [(set_attr "type" "compare")
1610 (set_attr "length" "4,8")])
1613 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1614 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1616 (clobber (match_scratch:SI 2 ""))]
1619 (zero_extend:SI (match_dup 1)))
1621 (compare:CC (match_dup 2)
1626 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1627 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1629 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1630 (zero_extend:SI (match_dup 1)))]
1633 {andil.|andi.} %0,%1,0xffff
1635 [(set_attr "type" "compare")
1636 (set_attr "length" "4,8")])
1639 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1640 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1642 (set (match_operand:SI 0 "gpc_reg_operand" "")
1643 (zero_extend:SI (match_dup 1)))]
1646 (zero_extend:SI (match_dup 1)))
1648 (compare:CC (match_dup 0)
1652 (define_expand "extendhisi2"
1653 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1654 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
1659 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1660 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
1665 [(set_attr "type" "load,*")])
1668 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1669 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1671 (clobber (match_scratch:SI 2 "=r,r"))]
1674 {exts.|extsh.} %2,%1
1676 [(set_attr "type" "compare")
1677 (set_attr "length" "4,8")])
1680 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1681 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1683 (clobber (match_scratch:SI 2 ""))]
1686 (sign_extend:SI (match_dup 1)))
1688 (compare:CC (match_dup 2)
1693 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1694 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
1696 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1697 (sign_extend:SI (match_dup 1)))]
1700 {exts.|extsh.} %0,%1
1702 [(set_attr "type" "compare")
1703 (set_attr "length" "4,8")])
1706 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1707 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1709 (set (match_operand:SI 0 "gpc_reg_operand" "")
1710 (sign_extend:SI (match_dup 1)))]
1713 (sign_extend:SI (match_dup 1)))
1715 (compare:CC (match_dup 0)
1719 ;; Fixed-point arithmetic insns.
1721 ;; Discourage ai/addic because of carry but provide it in an alternative
1722 ;; allowing register zero as source.
1723 (define_expand "addsi3"
1724 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1725 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1726 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1730 if (GET_CODE (operands[2]) == CONST_INT
1731 && ! add_operand (operands[2], SImode))
1733 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1734 ? operands[0] : gen_reg_rtx (SImode));
1736 HOST_WIDE_INT val = INTVAL (operands[2]);
1737 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1738 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1740 /* The ordering here is important for the prolog expander.
1741 When space is allocated from the stack, adding 'low' first may
1742 produce a temporary deallocation (which would be bad). */
1743 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
1744 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
1749 (define_insn "*addsi3_internal1"
1750 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
1751 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
1752 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
1756 {cal %0,%2(%1)|addi %0,%1,%2}
1758 {cau|addis} %0,%1,%v2"
1759 [(set_attr "length" "4,4,4,4")])
1761 (define_insn "addsi3_high"
1762 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1763 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1764 (high:SI (match_operand 2 "" ""))))]
1765 "TARGET_MACHO && !TARGET_64BIT"
1766 "{cau|addis} %0,%1,ha16(%2)"
1767 [(set_attr "length" "4")])
1769 (define_insn "*addsi3_internal2"
1770 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1771 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1772 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1774 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1775 "! TARGET_POWERPC64"
1777 {cax.|add.} %3,%1,%2
1778 {ai.|addic.} %3,%1,%2
1781 [(set_attr "type" "compare")
1782 (set_attr "length" "4,4,8,8")])
1785 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1786 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1787 (match_operand:SI 2 "reg_or_short_operand" ""))
1789 (clobber (match_scratch:SI 3 ""))]
1790 "! TARGET_POWERPC64 && reload_completed"
1792 (plus:SI (match_dup 1)
1795 (compare:CC (match_dup 3)
1799 (define_insn "*addsi3_internal3"
1800 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1801 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1802 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1804 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1805 (plus:SI (match_dup 1)
1807 "! TARGET_POWERPC64"
1809 {cax.|add.} %0,%1,%2
1810 {ai.|addic.} %0,%1,%2
1813 [(set_attr "type" "compare")
1814 (set_attr "length" "4,4,8,8")])
1817 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1818 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1819 (match_operand:SI 2 "reg_or_short_operand" ""))
1821 (set (match_operand:SI 0 "gpc_reg_operand" "")
1822 (plus:SI (match_dup 1) (match_dup 2)))]
1823 "! TARGET_POWERPC64 && reload_completed"
1825 (plus:SI (match_dup 1)
1828 (compare:CC (match_dup 0)
1832 ;; Split an add that we can't do in one insn into two insns, each of which
1833 ;; does one 16-bit part. This is used by combine. Note that the low-order
1834 ;; add should be last in case the result gets used in an address.
1837 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1838 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1839 (match_operand:SI 2 "non_add_cint_operand" "")))]
1841 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1842 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1845 HOST_WIDE_INT val = INTVAL (operands[2]);
1846 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1847 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1849 operands[3] = GEN_INT (rest);
1850 operands[4] = GEN_INT (low);
1853 (define_insn "one_cmplsi2"
1854 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1855 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1860 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1861 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1863 (clobber (match_scratch:SI 2 "=r,r"))]
1864 "! TARGET_POWERPC64"
1868 [(set_attr "type" "compare")
1869 (set_attr "length" "4,8")])
1872 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1873 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1875 (clobber (match_scratch:SI 2 ""))]
1876 "! TARGET_POWERPC64 && reload_completed"
1878 (not:SI (match_dup 1)))
1880 (compare:CC (match_dup 2)
1885 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1886 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1888 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1889 (not:SI (match_dup 1)))]
1890 "! TARGET_POWERPC64"
1894 [(set_attr "type" "compare")
1895 (set_attr "length" "4,8")])
1898 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1899 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1901 (set (match_operand:SI 0 "gpc_reg_operand" "")
1902 (not:SI (match_dup 1)))]
1903 "! TARGET_POWERPC64 && reload_completed"
1905 (not:SI (match_dup 1)))
1907 (compare:CC (match_dup 0)
1912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1913 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1914 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1916 "{sf%I1|subf%I1c} %0,%2,%1")
1919 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1920 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1921 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1928 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1929 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1930 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1932 (clobber (match_scratch:SI 3 "=r,r"))]
1935 {sf.|subfc.} %3,%2,%1
1937 [(set_attr "type" "compare")
1938 (set_attr "length" "4,8")])
1941 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1942 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1943 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1945 (clobber (match_scratch:SI 3 "=r,r"))]
1946 "TARGET_POWERPC && ! TARGET_POWERPC64"
1950 [(set_attr "type" "compare")
1951 (set_attr "length" "4,8")])
1954 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1955 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1956 (match_operand:SI 2 "gpc_reg_operand" ""))
1958 (clobber (match_scratch:SI 3 ""))]
1959 "! TARGET_POWERPC64 && reload_completed"
1961 (minus:SI (match_dup 1)
1964 (compare:CC (match_dup 3)
1969 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1970 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1971 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1973 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1974 (minus:SI (match_dup 1) (match_dup 2)))]
1977 {sf.|subfc.} %0,%2,%1
1979 [(set_attr "type" "compare")
1980 (set_attr "length" "4,8")])
1983 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1984 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1985 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1987 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1988 (minus:SI (match_dup 1)
1990 "TARGET_POWERPC && ! TARGET_POWERPC64"
1994 [(set_attr "type" "compare")
1995 (set_attr "length" "4,8")])
1998 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1999 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
2000 (match_operand:SI 2 "gpc_reg_operand" ""))
2002 (set (match_operand:SI 0 "gpc_reg_operand" "")
2003 (minus:SI (match_dup 1)
2005 "! TARGET_POWERPC64 && reload_completed"
2007 (minus:SI (match_dup 1)
2010 (compare:CC (match_dup 0)
2014 (define_expand "subsi3"
2015 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2016 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
2017 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
2021 if (GET_CODE (operands[2]) == CONST_INT)
2023 emit_insn (gen_addsi3 (operands[0], operands[1],
2024 negate_rtx (SImode, operands[2])));
2029 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
2030 ;; instruction and some auxiliary computations. Then we just have a single
2031 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
2034 (define_expand "sminsi3"
2036 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2037 (match_operand:SI 2 "reg_or_short_operand" ""))
2039 (minus:SI (match_dup 2) (match_dup 1))))
2040 (set (match_operand:SI 0 "gpc_reg_operand" "")
2041 (minus:SI (match_dup 2) (match_dup 3)))]
2042 "TARGET_POWER || TARGET_ISEL"
2047 operands[2] = force_reg (SImode, operands[2]);
2048 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
2052 operands[3] = gen_reg_rtx (SImode);
2056 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2057 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
2058 (match_operand:SI 2 "reg_or_short_operand" "")))
2059 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
2062 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
2064 (minus:SI (match_dup 2) (match_dup 1))))
2065 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
2068 (define_expand "smaxsi3"
2070 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2071 (match_operand:SI 2 "reg_or_short_operand" ""))
2073 (minus:SI (match_dup 2) (match_dup 1))))
2074 (set (match_operand:SI 0 "gpc_reg_operand" "")
2075 (plus:SI (match_dup 3) (match_dup 1)))]
2076 "TARGET_POWER || TARGET_ISEL"
2081 operands[2] = force_reg (SImode, operands[2]);
2082 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
2085 operands[3] = gen_reg_rtx (SImode);
2089 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2090 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
2091 (match_operand:SI 2 "reg_or_short_operand" "")))
2092 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
2095 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
2097 (minus:SI (match_dup 2) (match_dup 1))))
2098 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
2101 (define_expand "uminsi3"
2102 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2104 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2106 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2108 (minus:SI (match_dup 4) (match_dup 3))))
2109 (set (match_operand:SI 0 "gpc_reg_operand" "")
2110 (minus:SI (match_dup 2) (match_dup 3)))]
2111 "TARGET_POWER || TARGET_ISEL"
2116 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
2119 operands[3] = gen_reg_rtx (SImode);
2120 operands[4] = gen_reg_rtx (SImode);
2121 operands[5] = GEN_INT (-2147483647 - 1);
2124 (define_expand "umaxsi3"
2125 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2127 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
2129 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
2131 (minus:SI (match_dup 4) (match_dup 3))))
2132 (set (match_operand:SI 0 "gpc_reg_operand" "")
2133 (plus:SI (match_dup 3) (match_dup 1)))]
2134 "TARGET_POWER || TARGET_ISEL"
2139 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
2142 operands[3] = gen_reg_rtx (SImode);
2143 operands[4] = gen_reg_rtx (SImode);
2144 operands[5] = GEN_INT (-2147483647 - 1);
2148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2149 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
2150 (match_operand:SI 2 "reg_or_short_operand" "rI"))
2152 (minus:SI (match_dup 2) (match_dup 1))))]
2157 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2159 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2160 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2162 (minus:SI (match_dup 2) (match_dup 1)))
2164 (clobber (match_scratch:SI 3 "=r,r"))]
2169 [(set_attr "type" "delayed_compare")
2170 (set_attr "length" "4,8")])
2173 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2175 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2176 (match_operand:SI 2 "reg_or_short_operand" ""))
2178 (minus:SI (match_dup 2) (match_dup 1)))
2180 (clobber (match_scratch:SI 3 ""))]
2181 "TARGET_POWER && reload_completed"
2183 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2185 (minus:SI (match_dup 2) (match_dup 1))))
2187 (compare:CC (match_dup 3)
2192 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2194 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
2195 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
2197 (minus:SI (match_dup 2) (match_dup 1)))
2199 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2200 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2202 (minus:SI (match_dup 2) (match_dup 1))))]
2207 [(set_attr "type" "delayed_compare")
2208 (set_attr "length" "4,8")])
2211 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2213 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
2214 (match_operand:SI 2 "reg_or_short_operand" ""))
2216 (minus:SI (match_dup 2) (match_dup 1)))
2218 (set (match_operand:SI 0 "gpc_reg_operand" "")
2219 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2221 (minus:SI (match_dup 2) (match_dup 1))))]
2222 "TARGET_POWER && reload_completed"
2224 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
2226 (minus:SI (match_dup 2) (match_dup 1))))
2228 (compare:CC (match_dup 0)
2232 ;; We don't need abs with condition code because such comparisons should
2234 (define_expand "abssi2"
2235 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2236 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
2242 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
2245 else if (! TARGET_POWER)
2247 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
2252 (define_insn "*abssi2_power"
2253 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2254 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2258 (define_insn_and_split "abssi2_isel"
2259 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2260 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
2261 (clobber (match_scratch:SI 2 "=b"))
2262 (clobber (match_scratch:CC 3 "=y"))]
2265 "&& reload_completed"
2266 [(set (match_dup 2) (neg:SI (match_dup 1)))
2268 (compare:CC (match_dup 1)
2271 (if_then_else:SI (ge (match_dup 3)
2277 (define_insn_and_split "abssi2_nopower"
2278 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2279 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
2280 (clobber (match_scratch:SI 2 "=&r,&r"))]
2281 "! TARGET_POWER && ! TARGET_ISEL"
2283 "&& reload_completed"
2284 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2285 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2286 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
2289 (define_insn "*nabs_power"
2290 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2291 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
2295 (define_insn_and_split "*nabs_nopower"
2296 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
2297 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
2298 (clobber (match_scratch:SI 2 "=&r,&r"))]
2301 "&& reload_completed"
2302 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
2303 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
2304 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
2307 (define_insn "negsi2"
2308 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2309 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2314 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2315 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2317 (clobber (match_scratch:SI 2 "=r,r"))]
2318 "! TARGET_POWERPC64"
2322 [(set_attr "type" "compare")
2323 (set_attr "length" "4,8")])
2326 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2327 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2329 (clobber (match_scratch:SI 2 ""))]
2330 "! TARGET_POWERPC64 && reload_completed"
2332 (neg:SI (match_dup 1)))
2334 (compare:CC (match_dup 2)
2339 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2340 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2342 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2343 (neg:SI (match_dup 1)))]
2344 "! TARGET_POWERPC64"
2348 [(set_attr "type" "compare")
2349 (set_attr "length" "4,8")])
2352 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
2353 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2355 (set (match_operand:SI 0 "gpc_reg_operand" "")
2356 (neg:SI (match_dup 1)))]
2357 "! TARGET_POWERPC64 && reload_completed"
2359 (neg:SI (match_dup 1)))
2361 (compare:CC (match_dup 0)
2365 (define_insn "ffssi2"
2366 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
2367 (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
2369 "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
2370 [(set_attr "length" "16")])
2372 (define_expand "mulsi3"
2373 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2374 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2375 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
2380 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
2382 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
2386 (define_insn "mulsi3_mq"
2387 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2388 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2389 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2390 (clobber (match_scratch:SI 3 "=q,q"))]
2393 {muls|mullw} %0,%1,%2
2394 {muli|mulli} %0,%1,%2"
2396 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2397 (const_string "imul3")
2398 (match_operand:SI 2 "short_cint_operand" "")
2399 (const_string "imul2")]
2400 (const_string "imul")))])
2402 (define_insn "mulsi3_no_mq"
2403 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2404 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2405 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
2408 {muls|mullw} %0,%1,%2
2409 {muli|mulli} %0,%1,%2"
2411 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
2412 (const_string "imul3")
2413 (match_operand:SI 2 "short_cint_operand" "")
2414 (const_string "imul2")]
2415 (const_string "imul")))])
2418 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2419 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2420 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2422 (clobber (match_scratch:SI 3 "=r,r"))
2423 (clobber (match_scratch:SI 4 "=q,q"))]
2426 {muls.|mullw.} %3,%1,%2
2428 [(set_attr "type" "delayed_compare")
2429 (set_attr "length" "4,8")])
2432 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2433 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2434 (match_operand:SI 2 "gpc_reg_operand" ""))
2436 (clobber (match_scratch:SI 3 ""))
2437 (clobber (match_scratch:SI 4 ""))]
2438 "TARGET_POWER && reload_completed"
2439 [(parallel [(set (match_dup 3)
2440 (mult:SI (match_dup 1) (match_dup 2)))
2441 (clobber (match_dup 4))])
2443 (compare:CC (match_dup 3)
2448 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2449 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2450 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2452 (clobber (match_scratch:SI 3 "=r,r"))]
2455 {muls.|mullw.} %3,%1,%2
2457 [(set_attr "type" "delayed_compare")
2458 (set_attr "length" "4,8")])
2461 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2462 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2463 (match_operand:SI 2 "gpc_reg_operand" ""))
2465 (clobber (match_scratch:SI 3 ""))]
2466 "! TARGET_POWER && reload_completed"
2468 (mult:SI (match_dup 1) (match_dup 2)))
2470 (compare:CC (match_dup 3)
2475 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2476 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2477 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2479 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2480 (mult:SI (match_dup 1) (match_dup 2)))
2481 (clobber (match_scratch:SI 4 "=q,q"))]
2484 {muls.|mullw.} %0,%1,%2
2486 [(set_attr "type" "delayed_compare")
2487 (set_attr "length" "4,8")])
2490 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2491 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2492 (match_operand:SI 2 "gpc_reg_operand" ""))
2494 (set (match_operand:SI 0 "gpc_reg_operand" "")
2495 (mult:SI (match_dup 1) (match_dup 2)))
2496 (clobber (match_scratch:SI 4 ""))]
2497 "TARGET_POWER && reload_completed"
2498 [(parallel [(set (match_dup 0)
2499 (mult:SI (match_dup 1) (match_dup 2)))
2500 (clobber (match_dup 4))])
2502 (compare:CC (match_dup 0)
2507 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2508 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
2509 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2511 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2512 (mult:SI (match_dup 1) (match_dup 2)))]
2515 {muls.|mullw.} %0,%1,%2
2517 [(set_attr "type" "delayed_compare")
2518 (set_attr "length" "4,8")])
2521 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2522 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
2523 (match_operand:SI 2 "gpc_reg_operand" ""))
2525 (set (match_operand:SI 0 "gpc_reg_operand" "")
2526 (mult:SI (match_dup 1) (match_dup 2)))]
2527 "! TARGET_POWER && reload_completed"
2529 (mult:SI (match_dup 1) (match_dup 2)))
2531 (compare:CC (match_dup 0)
2535 ;; Operand 1 is divided by operand 2; quotient goes to operand
2536 ;; 0 and remainder to operand 3.
2537 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
2539 (define_expand "divmodsi4"
2540 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2541 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2542 (match_operand:SI 2 "gpc_reg_operand" "")))
2543 (set (match_operand:SI 3 "gpc_reg_operand" "")
2544 (mod:SI (match_dup 1) (match_dup 2)))])]
2545 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
2548 if (! TARGET_POWER && ! TARGET_POWERPC)
2550 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2551 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2552 emit_insn (gen_divss_call ());
2553 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2554 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2560 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2561 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2562 (match_operand:SI 2 "gpc_reg_operand" "r")))
2563 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
2564 (mod:SI (match_dup 1) (match_dup 2)))]
2567 [(set_attr "type" "idiv")])
2569 (define_expand "udivsi3"
2570 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2571 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2572 (match_operand:SI 2 "gpc_reg_operand" "")))]
2573 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
2576 if (! TARGET_POWER && ! TARGET_POWERPC)
2578 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2579 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2580 emit_insn (gen_quous_call ());
2581 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2584 else if (TARGET_POWER)
2586 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
2591 (define_insn "udivsi3_mq"
2592 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2593 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2594 (match_operand:SI 2 "gpc_reg_operand" "r")))
2595 (clobber (match_scratch:SI 3 "=q"))]
2596 "TARGET_POWERPC && TARGET_POWER"
2598 [(set_attr "type" "idiv")])
2600 (define_insn "*udivsi3_no_mq"
2601 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2602 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2603 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2604 "TARGET_POWERPC && ! TARGET_POWER"
2606 [(set_attr "type" "idiv")])
2608 ;; For powers of two we can do srai/aze for divide and then adjust for
2609 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
2610 ;; used; for PowerPC, force operands into register and do a normal divide;
2611 ;; for AIX common-mode, use quoss call on register operands.
2612 (define_expand "divsi3"
2613 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2614 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2615 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2619 if (GET_CODE (operands[2]) == CONST_INT
2620 && INTVAL (operands[2]) > 0
2621 && exact_log2 (INTVAL (operands[2])) >= 0)
2623 else if (TARGET_POWERPC)
2625 operands[2] = force_reg (SImode, operands[2]);
2628 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2632 else if (TARGET_POWER)
2636 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2637 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2638 emit_insn (gen_quoss_call ());
2639 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2644 (define_insn "divsi3_mq"
2645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2646 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2647 (match_operand:SI 2 "gpc_reg_operand" "r")))
2648 (clobber (match_scratch:SI 3 "=q"))]
2649 "TARGET_POWERPC && TARGET_POWER"
2651 [(set_attr "type" "idiv")])
2653 (define_insn "*divsi3_no_mq"
2654 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2655 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2656 (match_operand:SI 2 "gpc_reg_operand" "r")))]
2657 "TARGET_POWERPC && ! TARGET_POWER"
2659 [(set_attr "type" "idiv")])
2661 (define_expand "modsi3"
2662 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2663 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2664 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2672 if (GET_CODE (operands[2]) != CONST_INT
2673 || INTVAL (operands[2]) <= 0
2674 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2677 temp1 = gen_reg_rtx (SImode);
2678 temp2 = gen_reg_rtx (SImode);
2680 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
2681 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
2682 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
2687 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2688 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2689 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
2691 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
2692 [(set_attr "length" "8")])
2695 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2696 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2697 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2699 (clobber (match_scratch:SI 3 "=r,r"))]
2702 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
2704 [(set_attr "type" "compare")
2705 (set_attr "length" "8,12")])
2708 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2709 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2710 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2712 (clobber (match_scratch:SI 3 ""))]
2715 (div:SI (match_dup 1) (match_dup 2)))
2717 (compare:CC (match_dup 3)
2722 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2723 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2724 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
2726 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2727 (div:SI (match_dup 1) (match_dup 2)))]
2730 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
2732 [(set_attr "type" "compare")
2733 (set_attr "length" "8,12")])
2736 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2737 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
2738 (match_operand:SI 2 "exact_log2_cint_operand" ""))
2740 (set (match_operand:SI 0 "gpc_reg_operand" "")
2741 (div:SI (match_dup 1) (match_dup 2)))]
2744 (div:SI (match_dup 1) (match_dup 2)))
2746 (compare:CC (match_dup 0)
2751 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2754 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2756 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2757 (match_operand:SI 3 "gpc_reg_operand" "r")))
2758 (set (match_operand:SI 2 "register_operand" "=*q")
2761 (zero_extend:DI (match_dup 1)) (const_int 32))
2762 (zero_extend:DI (match_dup 4)))
2766 [(set_attr "type" "idiv")])
2768 ;; To do unsigned divide we handle the cases of the divisor looking like a
2769 ;; negative number. If it is a constant that is less than 2**31, we don't
2770 ;; have to worry about the branches. So make a few subroutines here.
2772 ;; First comes the normal case.
2773 (define_expand "udivmodsi4_normal"
2774 [(set (match_dup 4) (const_int 0))
2775 (parallel [(set (match_operand:SI 0 "" "")
2776 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2778 (zero_extend:DI (match_operand:SI 1 "" "")))
2779 (match_operand:SI 2 "" "")))
2780 (set (match_operand:SI 3 "" "")
2781 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2783 (zero_extend:DI (match_dup 1)))
2787 { operands[4] = gen_reg_rtx (SImode); }")
2789 ;; This handles the branches.
2790 (define_expand "udivmodsi4_tests"
2791 [(set (match_operand:SI 0 "" "") (const_int 0))
2792 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2793 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2794 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2795 (label_ref (match_operand:SI 4 "" "")) (pc)))
2796 (set (match_dup 0) (const_int 1))
2797 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2798 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2799 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2800 (label_ref (match_dup 4)) (pc)))]
2803 { operands[5] = gen_reg_rtx (CCUNSmode);
2804 operands[6] = gen_reg_rtx (CCmode);
2807 (define_expand "udivmodsi4"
2808 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2809 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2810 (match_operand:SI 2 "reg_or_cint_operand" "")))
2811 (set (match_operand:SI 3 "gpc_reg_operand" "")
2812 (umod:SI (match_dup 1) (match_dup 2)))])]
2820 if (! TARGET_POWERPC)
2822 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2823 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2824 emit_insn (gen_divus_call ());
2825 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2826 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2833 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2835 operands[2] = force_reg (SImode, operands[2]);
2836 label = gen_label_rtx ();
2837 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2838 operands[3], label));
2841 operands[2] = force_reg (SImode, operands[2]);
2843 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2851 ;; AIX architecture-independent common-mode multiply (DImode),
2852 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2853 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2854 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2855 ;; assumed unused if generating common-mode, so ignore.
2856 (define_insn "mulh_call"
2859 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2860 (sign_extend:DI (reg:SI 4)))
2862 (clobber (match_scratch:SI 0 "=l"))]
2863 "! TARGET_POWER && ! TARGET_POWERPC"
2865 [(set_attr "type" "imul")])
2867 (define_insn "mull_call"
2869 (mult:DI (sign_extend:DI (reg:SI 3))
2870 (sign_extend:DI (reg:SI 4))))
2871 (clobber (match_scratch:SI 0 "=l"))
2872 (clobber (reg:SI 0))]
2873 "! TARGET_POWER && ! TARGET_POWERPC"
2875 [(set_attr "type" "imul")])
2877 (define_insn "divss_call"
2879 (div:SI (reg:SI 3) (reg:SI 4)))
2881 (mod:SI (reg:SI 3) (reg:SI 4)))
2882 (clobber (match_scratch:SI 0 "=l"))
2883 (clobber (reg:SI 0))]
2884 "! TARGET_POWER && ! TARGET_POWERPC"
2886 [(set_attr "type" "idiv")])
2888 (define_insn "divus_call"
2890 (udiv:SI (reg:SI 3) (reg:SI 4)))
2892 (umod:SI (reg:SI 3) (reg:SI 4)))
2893 (clobber (match_scratch:SI 0 "=l"))
2894 (clobber (reg:SI 0))
2895 (clobber (match_scratch:CC 1 "=x"))
2896 (clobber (reg:CC 69))]
2897 "! TARGET_POWER && ! TARGET_POWERPC"
2899 [(set_attr "type" "idiv")])
2901 (define_insn "quoss_call"
2903 (div:SI (reg:SI 3) (reg:SI 4)))
2904 (clobber (match_scratch:SI 0 "=l"))]
2905 "! TARGET_POWER && ! TARGET_POWERPC"
2907 [(set_attr "type" "idiv")])
2909 (define_insn "quous_call"
2911 (udiv:SI (reg:SI 3) (reg:SI 4)))
2912 (clobber (match_scratch:SI 0 "=l"))
2913 (clobber (reg:SI 0))
2914 (clobber (match_scratch:CC 1 "=x"))
2915 (clobber (reg:CC 69))]
2916 "! TARGET_POWER && ! TARGET_POWERPC"
2918 [(set_attr "type" "idiv")])
2920 ;; Logical instructions
2921 ;; The logical instructions are mostly combined by using match_operator,
2922 ;; but the plain AND insns are somewhat different because there is no
2923 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2924 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2926 (define_insn "andsi3"
2927 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2928 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2929 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2930 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2934 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2935 {andil.|andi.} %0,%1,%b2
2936 {andiu.|andis.} %0,%1,%u2")
2938 ;; Note to set cr's other than cr0 we do the and immediate and then
2939 ;; the test again -- this avoids a mfcr which on the higher end
2940 ;; machines causes an execution serialization
2942 (define_insn "*andsi3_internal2"
2943 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2944 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2945 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2947 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2948 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2949 "! TARGET_POWERPC64"
2952 {andil.|andi.} %3,%1,%b2
2953 {andiu.|andis.} %3,%1,%u2
2954 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2959 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2960 (set_attr "length" "4,4,4,4,8,8,8,8")])
2962 (define_insn "*andsi3_internal3"
2963 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2964 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2965 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2967 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2968 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2972 {andil.|andi.} %3,%1,%b2
2973 {andiu.|andis.} %3,%1,%u2
2974 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2979 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2980 (set_attr "length" "8,4,4,4,8,8,8,8")])
2983 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2984 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2985 (match_operand:SI 2 "and_operand" ""))
2987 (clobber (match_scratch:SI 3 ""))
2988 (clobber (match_scratch:CC 4 ""))]
2990 [(parallel [(set (match_dup 3)
2991 (and:SI (match_dup 1)
2993 (clobber (match_dup 4))])
2995 (compare:CC (match_dup 3)
2999 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
3000 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
3003 [(set (match_operand:CC 0 "cc_reg_operand" "")
3004 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3005 (match_operand:SI 2 "gpc_reg_operand" ""))
3007 (clobber (match_scratch:SI 3 ""))
3008 (clobber (match_scratch:CC 4 ""))]
3009 "TARGET_POWERPC64 && reload_completed"
3010 [(parallel [(set (match_dup 3)
3011 (and:SI (match_dup 1)
3013 (clobber (match_dup 4))])
3015 (compare:CC (match_dup 3)
3019 (define_insn "*andsi3_internal4"
3020 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3021 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3022 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3024 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3025 (and:SI (match_dup 1)
3027 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3028 "! TARGET_POWERPC64"
3031 {andil.|andi.} %0,%1,%b2
3032 {andiu.|andis.} %0,%1,%u2
3033 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3038 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
3039 (set_attr "length" "4,4,4,4,8,8,8,8")])
3041 (define_insn "*andsi3_internal5"
3042 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
3043 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
3044 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
3046 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
3047 (and:SI (match_dup 1)
3049 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
3053 {andil.|andi.} %0,%1,%b2
3054 {andiu.|andis.} %0,%1,%u2
3055 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
3060 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
3061 (set_attr "length" "8,4,4,4,8,8,8,8")])
3064 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3065 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3066 (match_operand:SI 2 "and_operand" ""))
3068 (set (match_operand:SI 0 "gpc_reg_operand" "")
3069 (and:SI (match_dup 1)
3071 (clobber (match_scratch:CC 4 ""))]
3073 [(parallel [(set (match_dup 0)
3074 (and:SI (match_dup 1)
3076 (clobber (match_dup 4))])
3078 (compare:CC (match_dup 0)
3083 [(set (match_operand:CC 3 "cc_reg_operand" "")
3084 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
3085 (match_operand:SI 2 "gpc_reg_operand" ""))
3087 (set (match_operand:SI 0 "gpc_reg_operand" "")
3088 (and:SI (match_dup 1)
3090 (clobber (match_scratch:CC 4 ""))]
3091 "TARGET_POWERPC64 && reload_completed"
3092 [(parallel [(set (match_dup 0)
3093 (and:SI (match_dup 1)
3095 (clobber (match_dup 4))])
3097 (compare:CC (match_dup 0)
3101 ;; Handle the PowerPC64 rlwinm corner case
3103 (define_insn_and_split "*andsi3_internal6"
3104 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3105 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3106 (match_operand:SI 2 "mask_operand_wrap" "i")))]
3111 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
3114 (rotate:SI (match_dup 0) (match_dup 5)))]
3117 int mb = extract_MB (operands[2]);
3118 int me = extract_ME (operands[2]);
3119 operands[3] = GEN_INT (me + 1);
3120 operands[5] = GEN_INT (32 - (me + 1));
3121 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3123 [(set_attr "length" "8")])
3125 (define_insn_and_split "*andsi3_internal7"
3126 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
3127 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
3128 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
3130 (clobber (match_scratch:SI 3 "=r,r"))]
3134 [(parallel [(set (match_dup 2)
3135 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
3138 (clobber (match_dup 3))])]
3141 int mb = extract_MB (operands[1]);
3142 int me = extract_ME (operands[1]);
3143 operands[4] = GEN_INT (me + 1);
3144 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3146 [(set_attr "type" "delayed_compare,compare")
3147 (set_attr "length" "4,8")])
3149 (define_insn_and_split "*andsi3_internal8"
3150 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
3151 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3152 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
3154 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3155 (and:SI (match_dup 1)
3160 [(parallel [(set (match_dup 3)
3161 (compare:CC (and:SI (rotate:SI (match_dup 1) (match_dup 4))
3165 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
3168 (rotate:SI (match_dup 0) (match_dup 6)))]
3171 int mb = extract_MB (operands[2]);
3172 int me = extract_ME (operands[2]);
3173 operands[4] = GEN_INT (me + 1);
3174 operands[6] = GEN_INT (32 - (me + 1));
3175 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
3177 [(set_attr "type" "delayed_compare,compare")
3178 (set_attr "length" "8,12")])
3180 (define_expand "iorsi3"
3181 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3182 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
3183 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3187 if (GET_CODE (operands[2]) == CONST_INT
3188 && ! logical_operand (operands[2], SImode))
3190 HOST_WIDE_INT value = INTVAL (operands[2]);
3191 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
3192 ? operands[0] : gen_reg_rtx (SImode));
3194 emit_insn (gen_iorsi3 (tmp, operands[1],
3195 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3196 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3201 (define_expand "xorsi3"
3202 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3203 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3204 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
3208 if (GET_CODE (operands[2]) == CONST_INT
3209 && ! logical_operand (operands[2], SImode))
3211 HOST_WIDE_INT value = INTVAL (operands[2]);
3212 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
3213 ? operands[0] : gen_reg_rtx (SImode));
3215 emit_insn (gen_xorsi3 (tmp, operands[1],
3216 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
3217 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
3222 (define_insn "*boolsi3_internal1"
3223 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3224 (match_operator:SI 3 "boolean_or_operator"
3225 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
3226 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
3230 {%q3il|%q3i} %0,%1,%b2
3231 {%q3iu|%q3is} %0,%1,%u2")
3233 (define_insn "*boolsi3_internal2"
3234 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3235 (compare:CC (match_operator:SI 4 "boolean_or_operator"
3236 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3237 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3239 (clobber (match_scratch:SI 3 "=r,r"))]
3240 "! TARGET_POWERPC64"
3244 [(set_attr "type" "compare")
3245 (set_attr "length" "4,8")])
3248 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3249 (compare:CC (match_operator:SI 4 "boolean_operator"
3250 [(match_operand:SI 1 "gpc_reg_operand" "")
3251 (match_operand:SI 2 "gpc_reg_operand" "")])
3253 (clobber (match_scratch:SI 3 ""))]
3254 "! TARGET_POWERPC64 && reload_completed"
3255 [(set (match_dup 3) (match_dup 4))
3257 (compare:CC (match_dup 3)
3261 (define_insn "*boolsi3_internal3"
3262 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3263 (compare:CC (match_operator:SI 4 "boolean_operator"
3264 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
3265 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3267 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3269 "! TARGET_POWERPC64"
3273 [(set_attr "type" "compare")
3274 (set_attr "length" "4,8")])
3277 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3278 (compare:CC (match_operator:SI 4 "boolean_operator"
3279 [(match_operand:SI 1 "gpc_reg_operand" "")
3280 (match_operand:SI 2 "gpc_reg_operand" "")])
3282 (set (match_operand:SI 0 "gpc_reg_operand" "")
3284 "! TARGET_POWERPC64 && reload_completed"
3285 [(set (match_dup 0) (match_dup 4))
3287 (compare:CC (match_dup 0)
3291 ;; Split an logical operation that we can't do in one insn into two insns,
3292 ;; each of which does one 16-bit part. This is used by combine.
3295 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3296 (match_operator:SI 3 "boolean_or_operator"
3297 [(match_operand:SI 1 "gpc_reg_operand" "")
3298 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
3300 [(set (match_dup 0) (match_dup 4))
3301 (set (match_dup 0) (match_dup 5))]
3305 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
3306 operands[4] = gen_rtx (GET_CODE (operands[3]), SImode,
3308 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
3309 operands[5] = gen_rtx (GET_CODE (operands[3]), SImode,
3313 (define_insn "*boolcsi3_internal1"
3314 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3315 (match_operator:SI 3 "boolean_operator"
3316 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3317 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
3321 (define_insn "*boolcsi3_internal2"
3322 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3323 (compare:CC (match_operator:SI 4 "boolean_operator"
3324 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3325 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3327 (clobber (match_scratch:SI 3 "=r,r"))]
3328 "! TARGET_POWERPC64"
3332 [(set_attr "type" "compare")
3333 (set_attr "length" "4,8")])
3336 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3337 (compare:CC (match_operator:SI 4 "boolean_operator"
3338 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3339 (match_operand:SI 2 "gpc_reg_operand" "")])
3341 (clobber (match_scratch:SI 3 ""))]
3342 "! TARGET_POWERPC64 && reload_completed"
3343 [(set (match_dup 3) (match_dup 4))
3345 (compare:CC (match_dup 3)
3349 (define_insn "*boolcsi3_internal3"
3350 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3351 (compare:CC (match_operator:SI 4 "boolean_operator"
3352 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3353 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
3355 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3357 "! TARGET_POWERPC64"
3361 [(set_attr "type" "compare")
3362 (set_attr "length" "4,8")])
3365 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3366 (compare:CC (match_operator:SI 4 "boolean_operator"
3367 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3368 (match_operand:SI 2 "gpc_reg_operand" "")])
3370 (set (match_operand:SI 0 "gpc_reg_operand" "")
3372 "! TARGET_POWERPC64 && reload_completed"
3373 [(set (match_dup 0) (match_dup 4))
3375 (compare:CC (match_dup 0)
3379 (define_insn "*boolccsi3_internal1"
3380 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3381 (match_operator:SI 3 "boolean_operator"
3382 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
3383 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
3387 (define_insn "*boolccsi3_internal2"
3388 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3389 (compare:CC (match_operator:SI 4 "boolean_operator"
3390 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
3391 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3393 (clobber (match_scratch:SI 3 "=r,r"))]
3394 "! TARGET_POWERPC64"
3398 [(set_attr "type" "compare")
3399 (set_attr "length" "4,8")])
3402 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3403 (compare:CC (match_operator:SI 4 "boolean_operator"
3404 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3405 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3407 (clobber (match_scratch:SI 3 ""))]
3408 "! TARGET_POWERPC64 && reload_completed"
3409 [(set (match_dup 3) (match_dup 4))
3411 (compare:CC (match_dup 3)
3415 (define_insn "*boolccsi3_internal3"
3416 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3417 (compare:CC (match_operator:SI 4 "boolean_operator"
3418 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
3419 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
3421 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3423 "! TARGET_POWERPC64"
3427 [(set_attr "type" "compare")
3428 (set_attr "length" "4,8")])
3431 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3432 (compare:CC (match_operator:SI 4 "boolean_operator"
3433 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
3434 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
3436 (set (match_operand:SI 0 "gpc_reg_operand" "")
3438 "! TARGET_POWERPC64 && reload_completed"
3439 [(set (match_dup 0) (match_dup 4))
3441 (compare:CC (match_dup 0)
3445 ;; maskir insn. We need four forms because things might be in arbitrary
3446 ;; orders. Don't define forms that only set CR fields because these
3447 ;; would modify an input register.
3449 (define_insn "*maskir_internal1"
3450 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3451 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3452 (match_operand:SI 1 "gpc_reg_operand" "0"))
3453 (and:SI (match_dup 2)
3454 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
3458 (define_insn "*maskir_internal2"
3459 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3460 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
3461 (match_operand:SI 1 "gpc_reg_operand" "0"))
3462 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3467 (define_insn "*maskir_internal3"
3468 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3469 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
3470 (match_operand:SI 3 "gpc_reg_operand" "r"))
3471 (and:SI (not:SI (match_dup 2))
3472 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3476 (define_insn "*maskir_internal4"
3477 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3478 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3479 (match_operand:SI 2 "gpc_reg_operand" "r"))
3480 (and:SI (not:SI (match_dup 2))
3481 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
3485 (define_insn "*maskir_internal5"
3486 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3488 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3489 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3490 (and:SI (match_dup 2)
3491 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3493 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3494 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3495 (and:SI (match_dup 2) (match_dup 3))))]
3500 [(set_attr "type" "compare")
3501 (set_attr "length" "4,8")])
3504 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3506 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3507 (match_operand:SI 1 "gpc_reg_operand" ""))
3508 (and:SI (match_dup 2)
3509 (match_operand:SI 3 "gpc_reg_operand" "")))
3511 (set (match_operand:SI 0 "gpc_reg_operand" "")
3512 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3513 (and:SI (match_dup 2) (match_dup 3))))]
3514 "TARGET_POWER && reload_completed"
3516 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3517 (and:SI (match_dup 2) (match_dup 3))))
3519 (compare:CC (match_dup 0)
3523 (define_insn "*maskir_internal6"
3524 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3526 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3527 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
3528 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3531 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3532 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3533 (and:SI (match_dup 3) (match_dup 2))))]
3538 [(set_attr "type" "compare")
3539 (set_attr "length" "4,8")])
3542 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3544 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
3545 (match_operand:SI 1 "gpc_reg_operand" ""))
3546 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3549 (set (match_operand:SI 0 "gpc_reg_operand" "")
3550 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3551 (and:SI (match_dup 3) (match_dup 2))))]
3552 "TARGET_POWER && reload_completed"
3554 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
3555 (and:SI (match_dup 3) (match_dup 2))))
3557 (compare:CC (match_dup 0)
3561 (define_insn "*maskir_internal7"
3562 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3564 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
3565 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3566 (and:SI (not:SI (match_dup 2))
3567 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3569 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3570 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3571 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3576 [(set_attr "type" "compare")
3577 (set_attr "length" "4,8")])
3580 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3582 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
3583 (match_operand:SI 3 "gpc_reg_operand" ""))
3584 (and:SI (not:SI (match_dup 2))
3585 (match_operand:SI 1 "gpc_reg_operand" "")))
3587 (set (match_operand:SI 0 "gpc_reg_operand" "")
3588 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3589 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3590 "TARGET_POWER && reload_completed"
3592 (ior:SI (and:SI (match_dup 2) (match_dup 3))
3593 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3595 (compare:CC (match_dup 0)
3599 (define_insn "*maskir_internal8"
3600 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3602 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
3603 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
3604 (and:SI (not:SI (match_dup 2))
3605 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
3607 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3608 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3609 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3614 [(set_attr "type" "compare")
3615 (set_attr "length" "4,8")])
3618 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3620 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
3621 (match_operand:SI 2 "gpc_reg_operand" ""))
3622 (and:SI (not:SI (match_dup 2))
3623 (match_operand:SI 1 "gpc_reg_operand" "")))
3625 (set (match_operand:SI 0 "gpc_reg_operand" "")
3626 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3627 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
3628 "TARGET_POWER && reload_completed"
3630 (ior:SI (and:SI (match_dup 3) (match_dup 2))
3631 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
3633 (compare:CC (match_dup 0)
3637 ;; Rotate and shift insns, in all their variants. These support shifts,
3638 ;; field inserts and extracts, and various combinations thereof.
3639 (define_expand "insv"
3640 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
3641 (match_operand:SI 1 "const_int_operand" "")
3642 (match_operand:SI 2 "const_int_operand" ""))
3643 (match_operand 3 "gpc_reg_operand" ""))]
3647 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3648 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3649 compiler if the address of the structure is taken later. */
3650 if (GET_CODE (operands[0]) == SUBREG
3651 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3654 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
3655 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
3657 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
3661 (define_insn "insvsi"
3662 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3663 (match_operand:SI 1 "const_int_operand" "i")
3664 (match_operand:SI 2 "const_int_operand" "i"))
3665 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3669 int start = INTVAL (operands[2]) & 31;
3670 int size = INTVAL (operands[1]) & 31;
3672 operands[4] = GEN_INT (32 - start - size);
3673 operands[1] = GEN_INT (start + size - 1);
3674 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3677 (define_insn "*insvsi_internal1"
3678 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3679 (match_operand:SI 1 "const_int_operand" "i")
3680 (match_operand:SI 2 "const_int_operand" "i"))
3681 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3682 (match_operand:SI 4 "const_int_operand" "i")))]
3683 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3686 int shift = INTVAL (operands[4]) & 31;
3687 int start = INTVAL (operands[2]) & 31;
3688 int size = INTVAL (operands[1]) & 31;
3690 operands[4] = GEN_INT (shift - start - size);
3691 operands[1] = GEN_INT (start + size - 1);
3692 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3695 (define_insn "*insvsi_internal2"
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 (ashiftrt: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 (32 - shift - start - size);
3709 operands[1] = GEN_INT (start + size - 1);
3710 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3713 (define_insn "*insvsi_internal3"
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 (lshiftrt: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_internal4"
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 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3736 (match_operand:SI 4 "const_int_operand" "i")
3737 (match_operand:SI 5 "const_int_operand" "i")))]
3738 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3741 int extract_start = INTVAL (operands[5]) & 31;
3742 int extract_size = INTVAL (operands[4]) & 31;
3743 int insert_start = INTVAL (operands[2]) & 31;
3744 int insert_size = INTVAL (operands[1]) & 31;
3746 /* Align extract field with insert field */
3747 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3748 operands[1] = GEN_INT (insert_start + insert_size - 1);
3749 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3752 (define_insn "insvdi"
3753 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3754 (match_operand:SI 1 "const_int_operand" "i")
3755 (match_operand:SI 2 "const_int_operand" "i"))
3756 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3760 int start = INTVAL (operands[2]) & 63;
3761 int size = INTVAL (operands[1]) & 63;
3763 operands[1] = GEN_INT (64 - start - size);
3764 return \"rldimi %0,%3,%H1,%H2\";
3767 (define_expand "extzv"
3768 [(set (match_operand 0 "gpc_reg_operand" "")
3769 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3770 (match_operand:SI 2 "const_int_operand" "")
3771 (match_operand:SI 3 "const_int_operand" "")))]
3775 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3776 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3777 compiler if the address of the structure is taken later. */
3778 if (GET_CODE (operands[0]) == SUBREG
3779 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3782 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3783 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3785 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3789 (define_insn "extzvsi"
3790 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3791 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3792 (match_operand:SI 2 "const_int_operand" "i")
3793 (match_operand:SI 3 "const_int_operand" "i")))]
3797 int start = INTVAL (operands[3]) & 31;
3798 int size = INTVAL (operands[2]) & 31;
3800 if (start + size >= 32)
3801 operands[3] = const0_rtx;
3803 operands[3] = GEN_INT (start + size);
3804 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3807 (define_insn "*extzvsi_internal1"
3808 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3809 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3810 (match_operand:SI 2 "const_int_operand" "i,i")
3811 (match_operand:SI 3 "const_int_operand" "i,i"))
3813 (clobber (match_scratch:SI 4 "=r,r"))]
3817 int start = INTVAL (operands[3]) & 31;
3818 int size = INTVAL (operands[2]) & 31;
3820 /* Force split for non-cc0 compare. */
3821 if (which_alternative == 1)
3824 /* If the bitfield being tested fits in the upper or lower half of a
3825 word, it is possible to use andiu. or andil. to test it. This is
3826 useful because the condition register set-use delay is smaller for
3827 andi[ul]. than for rlinm. This doesn't work when the starting bit
3828 position is 0 because the LT and GT bits may be set wrong. */
3830 if ((start > 0 && start + size <= 16) || start >= 16)
3832 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3833 - (1 << (16 - (start & 15) - size))));
3835 return \"{andiu.|andis.} %4,%1,%3\";
3837 return \"{andil.|andi.} %4,%1,%3\";
3840 if (start + size >= 32)
3841 operands[3] = const0_rtx;
3843 operands[3] = GEN_INT (start + size);
3844 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3846 [(set_attr "type" "compare")
3847 (set_attr "length" "4,8")])
3850 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3851 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3852 (match_operand:SI 2 "const_int_operand" "")
3853 (match_operand:SI 3 "const_int_operand" ""))
3855 (clobber (match_scratch:SI 4 ""))]
3858 (zero_extract:SI (match_dup 1) (match_dup 2)
3861 (compare:CC (match_dup 4)
3865 (define_insn "*extzvsi_internal2"
3866 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3867 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3868 (match_operand:SI 2 "const_int_operand" "i,i")
3869 (match_operand:SI 3 "const_int_operand" "i,i"))
3871 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3872 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3876 int start = INTVAL (operands[3]) & 31;
3877 int size = INTVAL (operands[2]) & 31;
3879 /* Force split for non-cc0 compare. */
3880 if (which_alternative == 1)
3883 if ((start > 0 && start + size <= 16) || start >= 16)
3885 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3886 - (1 << (16 - (start & 15) - size))));
3888 return \"{andiu.|andis.} %0,%1,%3\";
3890 return \"{andil.|andi.} %0,%1,%3\";
3893 if (start + size >= 32)
3894 operands[3] = const0_rtx;
3896 operands[3] = GEN_INT (start + size);
3897 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3899 [(set_attr "type" "compare")
3900 (set_attr "length" "4,8")])
3903 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3904 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3905 (match_operand:SI 2 "const_int_operand" "")
3906 (match_operand:SI 3 "const_int_operand" ""))
3908 (set (match_operand:SI 0 "gpc_reg_operand" "")
3909 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3912 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3914 (compare:CC (match_dup 0)
3918 (define_insn "extzvdi"
3919 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3920 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3921 (match_operand:SI 2 "const_int_operand" "i")
3922 (match_operand:SI 3 "const_int_operand" "i")))]
3926 int start = INTVAL (operands[3]) & 63;
3927 int size = INTVAL (operands[2]) & 63;
3929 if (start + size >= 64)
3930 operands[3] = const0_rtx;
3932 operands[3] = GEN_INT (start + size);
3933 operands[2] = GEN_INT (64 - size);
3934 return \"rldicl %0,%1,%3,%2\";
3937 (define_insn "*extzvdi_internal1"
3938 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3939 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3940 (match_operand:SI 2 "const_int_operand" "i")
3941 (match_operand:SI 3 "const_int_operand" "i"))
3943 (clobber (match_scratch:DI 4 "=r"))]
3947 int start = INTVAL (operands[3]) & 63;
3948 int size = INTVAL (operands[2]) & 63;
3950 if (start + size >= 64)
3951 operands[3] = const0_rtx;
3953 operands[3] = GEN_INT (start + size);
3954 operands[2] = GEN_INT (64 - size);
3955 return \"rldicl. %4,%1,%3,%2\";
3958 (define_insn "*extzvdi_internal2"
3959 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3960 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3961 (match_operand:SI 2 "const_int_operand" "i")
3962 (match_operand:SI 3 "const_int_operand" "i"))
3964 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3965 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3969 int start = INTVAL (operands[3]) & 63;
3970 int size = INTVAL (operands[2]) & 63;
3972 if (start + size >= 64)
3973 operands[3] = const0_rtx;
3975 operands[3] = GEN_INT (start + size);
3976 operands[2] = GEN_INT (64 - size);
3977 return \"rldicl. %0,%1,%3,%2\";
3980 (define_insn "rotlsi3"
3981 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3982 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3983 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3985 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3987 (define_insn "*rotlsi3_internal2"
3988 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3989 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3990 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3992 (clobber (match_scratch:SI 3 "=r,r"))]
3995 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3997 [(set_attr "type" "delayed_compare")
3998 (set_attr "length" "4,8")])
4001 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4002 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4003 (match_operand:SI 2 "reg_or_cint_operand" ""))
4005 (clobber (match_scratch:SI 3 ""))]
4008 (rotate:SI (match_dup 1) (match_dup 2)))
4010 (compare:CC (match_dup 3)
4014 (define_insn "*rotlsi3_internal3"
4015 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4016 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4017 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4019 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4020 (rotate:SI (match_dup 1) (match_dup 2)))]
4023 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
4025 [(set_attr "type" "delayed_compare")
4026 (set_attr "length" "4,8")])
4029 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4030 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4031 (match_operand:SI 2 "reg_or_cint_operand" ""))
4033 (set (match_operand:SI 0 "gpc_reg_operand" "")
4034 (rotate:SI (match_dup 1) (match_dup 2)))]
4037 (rotate:SI (match_dup 1) (match_dup 2)))
4039 (compare:CC (match_dup 0)
4043 (define_insn "*rotlsi3_internal4"
4044 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4045 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4046 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4047 (match_operand:SI 3 "mask_operand" "n")))]
4049 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
4051 (define_insn "*rotlsi3_internal5"
4052 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4054 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4055 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4056 (match_operand:SI 3 "mask_operand" "n,n"))
4058 (clobber (match_scratch:SI 4 "=r,r"))]
4061 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
4063 [(set_attr "type" "delayed_compare")
4064 (set_attr "length" "4,8")])
4067 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4069 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4070 (match_operand:SI 2 "reg_or_cint_operand" ""))
4071 (match_operand:SI 3 "mask_operand" ""))
4073 (clobber (match_scratch:SI 4 ""))]
4076 (and:SI (rotate:SI (match_dup 1)
4080 (compare:CC (match_dup 4)
4084 (define_insn "*rotlsi3_internal6"
4085 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4087 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4088 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4089 (match_operand:SI 3 "mask_operand" "n,n"))
4091 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4092 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4095 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
4097 [(set_attr "type" "delayed_compare")
4098 (set_attr "length" "4,8")])
4101 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4103 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4104 (match_operand:SI 2 "reg_or_cint_operand" ""))
4105 (match_operand:SI 3 "mask_operand" ""))
4107 (set (match_operand:SI 0 "gpc_reg_operand" "")
4108 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4111 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4113 (compare:CC (match_dup 0)
4117 (define_insn "*rotlsi3_internal7"
4118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4121 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4122 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4124 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
4126 (define_insn "*rotlsi3_internal8"
4127 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4128 (compare:CC (zero_extend:SI
4130 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4131 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4133 (clobber (match_scratch:SI 3 "=r,r"))]
4136 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
4138 [(set_attr "type" "delayed_compare")
4139 (set_attr "length" "4,8")])
4142 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4143 (compare:CC (zero_extend:SI
4145 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4146 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4148 (clobber (match_scratch:SI 3 ""))]
4151 (zero_extend:SI (subreg:QI
4152 (rotate:SI (match_dup 1)
4155 (compare:CC (match_dup 3)
4159 (define_insn "*rotlsi3_internal9"
4160 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4161 (compare:CC (zero_extend:SI
4163 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4164 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4166 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4167 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4170 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
4172 [(set_attr "type" "delayed_compare")
4173 (set_attr "length" "4,8")])
4176 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4177 (compare:CC (zero_extend:SI
4179 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4180 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4182 (set (match_operand:SI 0 "gpc_reg_operand" "")
4183 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4186 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4188 (compare:CC (match_dup 0)
4192 (define_insn "*rotlsi3_internal10"
4193 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4196 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4197 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
4199 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
4201 (define_insn "*rotlsi3_internal11"
4202 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4203 (compare:CC (zero_extend:SI
4205 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4206 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4208 (clobber (match_scratch:SI 3 "=r,r"))]
4211 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
4213 [(set_attr "type" "delayed_compare")
4214 (set_attr "length" "4,8")])
4217 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4218 (compare:CC (zero_extend:SI
4220 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4221 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4223 (clobber (match_scratch:SI 3 ""))]
4226 (zero_extend:SI (subreg:HI
4227 (rotate:SI (match_dup 1)
4230 (compare:CC (match_dup 3)
4234 (define_insn "*rotlsi3_internal12"
4235 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4236 (compare:CC (zero_extend:SI
4238 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4239 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
4241 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4242 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4245 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
4247 [(set_attr "type" "delayed_compare")
4248 (set_attr "length" "4,8")])
4251 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4252 (compare:CC (zero_extend:SI
4254 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
4255 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
4257 (set (match_operand:SI 0 "gpc_reg_operand" "")
4258 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
4261 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
4263 (compare:CC (match_dup 0)
4267 ;; Note that we use "sle." instead of "sl." so that we can set
4268 ;; SHIFT_COUNT_TRUNCATED.
4270 (define_expand "ashlsi3"
4271 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4272 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4273 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4278 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
4280 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
4284 (define_insn "ashlsi3_power"
4285 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4286 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4287 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4288 (clobber (match_scratch:SI 3 "=q,X"))]
4292 {sli|slwi} %0,%1,%h2")
4294 (define_insn "ashlsi3_no_power"
4295 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4296 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4297 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4299 "{sl|slw}%I2 %0,%1,%h2")
4302 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4303 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4304 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4306 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4307 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4311 {sli.|slwi.} %3,%1,%h2
4314 [(set_attr "type" "delayed_compare")
4315 (set_attr "length" "4,4,8,8")])
4318 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4319 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4320 (match_operand:SI 2 "reg_or_cint_operand" ""))
4322 (clobber (match_scratch:SI 3 ""))
4323 (clobber (match_scratch:SI 4 ""))]
4324 "TARGET_POWER && reload_completed"
4325 [(parallel [(set (match_dup 3)
4326 (ashift:SI (match_dup 1) (match_dup 2)))
4327 (clobber (match_dup 4))])
4329 (compare:CC (match_dup 3)
4334 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4335 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4336 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4338 (clobber (match_scratch:SI 3 "=r,r"))]
4339 "! TARGET_POWER && ! TARGET_POWERPC64"
4341 {sl|slw}%I2. %3,%1,%h2
4343 [(set_attr "type" "delayed_compare")
4344 (set_attr "length" "4,8")])
4347 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4348 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4349 (match_operand:SI 2 "reg_or_cint_operand" ""))
4351 (clobber (match_scratch:SI 3 ""))]
4352 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4354 (ashift:SI (match_dup 1) (match_dup 2)))
4356 (compare:CC (match_dup 3)
4361 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4362 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4363 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4365 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4366 (ashift:SI (match_dup 1) (match_dup 2)))
4367 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4371 {sli.|slwi.} %0,%1,%h2
4374 [(set_attr "type" "delayed_compare")
4375 (set_attr "length" "4,4,8,8")])
4378 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4379 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4380 (match_operand:SI 2 "reg_or_cint_operand" ""))
4382 (set (match_operand:SI 0 "gpc_reg_operand" "")
4383 (ashift:SI (match_dup 1) (match_dup 2)))
4384 (clobber (match_scratch:SI 4 ""))]
4385 "TARGET_POWER && reload_completed"
4386 [(parallel [(set (match_dup 0)
4387 (ashift:SI (match_dup 1) (match_dup 2)))
4388 (clobber (match_dup 4))])
4390 (compare:CC (match_dup 0)
4395 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4396 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4397 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4399 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4400 (ashift:SI (match_dup 1) (match_dup 2)))]
4401 "! TARGET_POWER && ! TARGET_POWERPC64"
4403 {sl|slw}%I2. %0,%1,%h2
4405 [(set_attr "type" "delayed_compare")
4406 (set_attr "length" "4,8")])
4409 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4410 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4411 (match_operand:SI 2 "reg_or_cint_operand" ""))
4413 (set (match_operand:SI 0 "gpc_reg_operand" "")
4414 (ashift:SI (match_dup 1) (match_dup 2)))]
4415 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4417 (ashift:SI (match_dup 1) (match_dup 2)))
4419 (compare:CC (match_dup 0)
4424 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4425 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4426 (match_operand:SI 2 "const_int_operand" "i"))
4427 (match_operand:SI 3 "mask_operand" "n")))]
4428 "includes_lshift_p (operands[2], operands[3])"
4429 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
4432 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4434 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4435 (match_operand:SI 2 "const_int_operand" "i,i"))
4436 (match_operand:SI 3 "mask_operand" "n,n"))
4438 (clobber (match_scratch:SI 4 "=r,r"))]
4439 "includes_lshift_p (operands[2], operands[3])"
4441 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
4443 [(set_attr "type" "delayed_compare")
4444 (set_attr "length" "4,8")])
4447 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4449 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4450 (match_operand:SI 2 "const_int_operand" ""))
4451 (match_operand:SI 3 "mask_operand" ""))
4453 (clobber (match_scratch:SI 4 ""))]
4454 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4456 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
4459 (compare:CC (match_dup 4)
4464 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4466 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4467 (match_operand:SI 2 "const_int_operand" "i,i"))
4468 (match_operand:SI 3 "mask_operand" "n,n"))
4470 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4471 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4472 "includes_lshift_p (operands[2], operands[3])"
4474 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
4476 [(set_attr "type" "delayed_compare")
4477 (set_attr "length" "4,8")])
4480 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4482 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
4483 (match_operand:SI 2 "const_int_operand" ""))
4484 (match_operand:SI 3 "mask_operand" ""))
4486 (set (match_operand:SI 0 "gpc_reg_operand" "")
4487 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4488 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
4490 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4492 (compare:CC (match_dup 0)
4496 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
4498 (define_expand "lshrsi3"
4499 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
4500 (use (match_operand:SI 1 "gpc_reg_operand" ""))
4501 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
4506 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
4508 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
4512 (define_insn "lshrsi3_power"
4513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4514 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4515 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
4516 (clobber (match_scratch:SI 3 "=q,X,X"))]
4521 {s%A2i|s%A2wi} %0,%1,%h2")
4523 (define_insn "lshrsi3_no_power"
4524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4525 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4526 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
4530 {sr|srw}%I2 %0,%1,%h2")
4533 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4534 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4535 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4537 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
4538 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4543 {s%A2i.|s%A2wi.} %3,%1,%h2
4547 [(set_attr "type" "delayed_compare")
4548 (set_attr "length" "4,4,4,8,8,8")])
4551 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4552 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4553 (match_operand:SI 2 "reg_or_cint_operand" ""))
4555 (clobber (match_scratch:SI 3 ""))
4556 (clobber (match_scratch:SI 4 ""))]
4557 "TARGET_POWER && reload_completed"
4558 [(parallel [(set (match_dup 3)
4559 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4560 (clobber (match_dup 4))])
4562 (compare:CC (match_dup 3)
4567 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4568 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4569 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4571 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
4572 "! TARGET_POWER && ! TARGET_POWERPC64"
4575 {sr|srw}%I2. %3,%1,%h2
4578 [(set_attr "type" "delayed_compare")
4579 (set_attr "length" "4,4,8,8")])
4582 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4583 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4584 (match_operand:SI 2 "reg_or_cint_operand" ""))
4586 (clobber (match_scratch:SI 3 ""))]
4587 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4589 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4591 (compare:CC (match_dup 3)
4596 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4597 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4598 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4600 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4601 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4602 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4607 {s%A2i.|s%A2wi.} %0,%1,%h2
4611 [(set_attr "type" "delayed_compare")
4612 (set_attr "length" "4,4,4,8,8,8")])
4615 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4616 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4617 (match_operand:SI 2 "reg_or_cint_operand" ""))
4619 (set (match_operand:SI 0 "gpc_reg_operand" "")
4620 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4621 (clobber (match_scratch:SI 4 ""))]
4622 "TARGET_POWER && reload_completed"
4623 [(parallel [(set (match_dup 0)
4624 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4625 (clobber (match_dup 4))])
4627 (compare:CC (match_dup 0)
4632 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4633 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4634 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4636 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4637 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4638 "! TARGET_POWER && ! TARGET_POWERPC64"
4641 {sr|srw}%I2. %0,%1,%h2
4644 [(set_attr "type" "delayed_compare")
4645 (set_attr "length" "4,4,8,8")])
4648 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4649 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4650 (match_operand:SI 2 "reg_or_cint_operand" ""))
4652 (set (match_operand:SI 0 "gpc_reg_operand" "")
4653 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4654 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
4656 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4658 (compare:CC (match_dup 0)
4663 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4664 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4665 (match_operand:SI 2 "const_int_operand" "i"))
4666 (match_operand:SI 3 "mask_operand" "n")))]
4667 "includes_rshift_p (operands[2], operands[3])"
4668 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4671 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4673 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4674 (match_operand:SI 2 "const_int_operand" "i,i"))
4675 (match_operand:SI 3 "mask_operand" "n,n"))
4677 (clobber (match_scratch:SI 4 "=r,r"))]
4678 "includes_rshift_p (operands[2], operands[3])"
4680 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4682 [(set_attr "type" "delayed_compare")
4683 (set_attr "length" "4,8")])
4686 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4688 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4689 (match_operand:SI 2 "const_int_operand" ""))
4690 (match_operand:SI 3 "mask_operand" ""))
4692 (clobber (match_scratch:SI 4 ""))]
4693 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4695 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4698 (compare:CC (match_dup 4)
4703 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4705 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4706 (match_operand:SI 2 "const_int_operand" "i,i"))
4707 (match_operand:SI 3 "mask_operand" "n,n"))
4709 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4710 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4711 "includes_rshift_p (operands[2], operands[3])"
4713 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4715 [(set_attr "type" "delayed_compare")
4716 (set_attr "length" "4,8")])
4719 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4721 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4722 (match_operand:SI 2 "const_int_operand" ""))
4723 (match_operand:SI 3 "mask_operand" ""))
4725 (set (match_operand:SI 0 "gpc_reg_operand" "")
4726 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4727 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4729 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4731 (compare:CC (match_dup 0)
4736 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4739 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4740 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4741 "includes_rshift_p (operands[2], GEN_INT (255))"
4742 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4745 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4749 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4750 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4752 (clobber (match_scratch:SI 3 "=r,r"))]
4753 "includes_rshift_p (operands[2], GEN_INT (255))"
4755 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4757 [(set_attr "type" "delayed_compare")
4758 (set_attr "length" "4,8")])
4761 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4765 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4766 (match_operand:SI 2 "const_int_operand" "")) 0))
4768 (clobber (match_scratch:SI 3 ""))]
4769 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4771 (zero_extend:SI (subreg:QI
4772 (lshiftrt:SI (match_dup 1)
4775 (compare:CC (match_dup 3)
4780 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4784 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4785 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4787 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4788 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4789 "includes_rshift_p (operands[2], GEN_INT (255))"
4791 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4793 [(set_attr "type" "delayed_compare")
4794 (set_attr "length" "4,8")])
4797 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4801 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4802 (match_operand:SI 2 "const_int_operand" "")) 0))
4804 (set (match_operand:SI 0 "gpc_reg_operand" "")
4805 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4806 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4808 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4810 (compare:CC (match_dup 0)
4815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4818 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4819 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4820 "includes_rshift_p (operands[2], GEN_INT (65535))"
4821 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4824 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4828 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4829 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4831 (clobber (match_scratch:SI 3 "=r,r"))]
4832 "includes_rshift_p (operands[2], GEN_INT (65535))"
4834 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4836 [(set_attr "type" "delayed_compare")
4837 (set_attr "length" "4,8")])
4840 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4844 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4845 (match_operand:SI 2 "const_int_operand" "")) 0))
4847 (clobber (match_scratch:SI 3 ""))]
4848 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4850 (zero_extend:SI (subreg:HI
4851 (lshiftrt:SI (match_dup 1)
4854 (compare:CC (match_dup 3)
4859 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4863 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4864 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4866 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4867 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4868 "includes_rshift_p (operands[2], GEN_INT (65535))"
4870 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4872 [(set_attr "type" "delayed_compare")
4873 (set_attr "length" "4,8")])
4876 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4880 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4881 (match_operand:SI 2 "const_int_operand" "")) 0))
4883 (set (match_operand:SI 0 "gpc_reg_operand" "")
4884 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4885 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4887 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4889 (compare:CC (match_dup 0)
4894 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4896 (match_operand:SI 1 "gpc_reg_operand" "r"))
4897 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4903 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4905 (match_operand:SI 1 "gpc_reg_operand" "r"))
4906 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4912 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4914 (match_operand:SI 1 "gpc_reg_operand" "r"))
4915 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4921 (define_expand "ashrsi3"
4922 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4923 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4924 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4929 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4931 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4935 (define_insn "ashrsi3_power"
4936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4937 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4938 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4939 (clobber (match_scratch:SI 3 "=q,X"))]
4943 {srai|srawi} %0,%1,%h2")
4945 (define_insn "ashrsi3_no_power"
4946 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4947 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4948 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4950 "{sra|sraw}%I2 %0,%1,%h2")
4953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4954 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4955 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4957 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4958 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4962 {srai.|srawi.} %3,%1,%h2
4965 [(set_attr "type" "delayed_compare")
4966 (set_attr "length" "4,4,8,8")])
4969 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4970 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4971 (match_operand:SI 2 "reg_or_cint_operand" ""))
4973 (clobber (match_scratch:SI 3 ""))
4974 (clobber (match_scratch:SI 4 ""))]
4975 "TARGET_POWER && reload_completed"
4976 [(parallel [(set (match_dup 3)
4977 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4978 (clobber (match_dup 4))])
4980 (compare:CC (match_dup 3)
4985 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4986 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4987 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4989 (clobber (match_scratch:SI 3 "=r,r"))]
4992 {sra|sraw}%I2. %3,%1,%h2
4994 [(set_attr "type" "delayed_compare")
4995 (set_attr "length" "4,8")])
4998 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4999 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5000 (match_operand:SI 2 "reg_or_cint_operand" ""))
5002 (clobber (match_scratch:SI 3 ""))]
5003 "! TARGET_POWER && reload_completed"
5005 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5007 (compare:CC (match_dup 3)
5012 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5013 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
5014 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
5016 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
5017 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5018 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
5022 {srai.|srawi.} %0,%1,%h2
5025 [(set_attr "type" "delayed_compare")
5026 (set_attr "length" "4,4,8,8")])
5029 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5030 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5031 (match_operand:SI 2 "reg_or_cint_operand" ""))
5033 (set (match_operand:SI 0 "gpc_reg_operand" "")
5034 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5035 (clobber (match_scratch:SI 4 ""))]
5036 "TARGET_POWER && reload_completed"
5037 [(parallel [(set (match_dup 0)
5038 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5039 (clobber (match_dup 4))])
5041 (compare:CC (match_dup 0)
5046 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5047 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
5048 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
5050 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
5051 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5054 {sra|sraw}%I2. %0,%1,%h2
5056 [(set_attr "type" "delayed_compare")
5057 (set_attr "length" "4,8")])
5060 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5061 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
5062 (match_operand:SI 2 "reg_or_cint_operand" ""))
5064 (set (match_operand:SI 0 "gpc_reg_operand" "")
5065 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
5066 "! TARGET_POWER && reload_completed"
5068 (ashiftrt:SI (match_dup 1) (match_dup 2)))
5070 (compare:CC (match_dup 0)
5074 ;; Floating-point insns, excluding normal data motion.
5076 ;; PowerPC has a full set of single-precision floating point instructions.
5078 ;; For the POWER architecture, we pretend that we have both SFmode and
5079 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
5080 ;; The only conversions we will do will be when storing to memory. In that
5081 ;; case, we will use the "frsp" instruction before storing.
5083 ;; Note that when we store into a single-precision memory location, we need to
5084 ;; use the frsp insn first. If the register being stored isn't dead, we
5085 ;; need a scratch register for the frsp. But this is difficult when the store
5086 ;; is done by reload. It is not incorrect to do the frsp on the register in
5087 ;; this case, we just lose precision that we would have otherwise gotten but
5088 ;; is not guaranteed. Perhaps this should be tightened up at some point.
5090 (define_insn "extendsfdf2"
5091 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5092 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5093 "TARGET_HARD_FLOAT && TARGET_FPRS"
5096 if (REGNO (operands[0]) == REGNO (operands[1]))
5099 return \"fmr %0,%1\";
5101 [(set_attr "type" "fp")])
5103 (define_insn "truncdfsf2"
5104 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5105 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5106 "TARGET_HARD_FLOAT && TARGET_FPRS"
5108 [(set_attr "type" "fp")])
5110 (define_insn "aux_truncdfsf2"
5111 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5112 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
5113 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5115 [(set_attr "type" "fp")])
5117 (define_expand "negsf2"
5118 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5119 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5123 (define_insn "*negsf2"
5124 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5125 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5126 "TARGET_HARD_FLOAT && TARGET_FPRS"
5128 [(set_attr "type" "fp")])
5130 (define_expand "abssf2"
5131 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5132 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5136 (define_insn "*abssf2"
5137 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5138 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5139 "TARGET_HARD_FLOAT && TARGET_FPRS"
5141 [(set_attr "type" "fp")])
5144 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5145 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
5146 "TARGET_HARD_FLOAT && TARGET_FPRS"
5148 [(set_attr "type" "fp")])
5150 (define_expand "addsf3"
5151 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5152 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5153 (match_operand:SF 2 "gpc_reg_operand" "")))]
5158 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5159 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5160 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5161 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5163 [(set_attr "type" "fp")])
5166 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5167 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5168 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5169 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5170 "{fa|fadd} %0,%1,%2"
5171 [(set_attr "type" "fp")])
5173 (define_expand "subsf3"
5174 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5175 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
5176 (match_operand:SF 2 "gpc_reg_operand" "")))]
5181 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5182 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5183 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5184 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5186 [(set_attr "type" "fp")])
5189 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5190 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5191 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5192 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5193 "{fs|fsub} %0,%1,%2"
5194 [(set_attr "type" "fp")])
5196 (define_expand "mulsf3"
5197 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5198 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
5199 (match_operand:SF 2 "gpc_reg_operand" "")))]
5204 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5205 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5206 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5207 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5209 [(set_attr "type" "fp")])
5212 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5213 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5214 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5215 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5216 "{fm|fmul} %0,%1,%2"
5217 [(set_attr "type" "dmul")])
5219 (define_expand "divsf3"
5220 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5221 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
5222 (match_operand:SF 2 "gpc_reg_operand" "")))]
5227 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5228 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5229 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5230 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5232 [(set_attr "type" "sdiv")])
5235 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5236 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
5237 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5238 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
5239 "{fd|fdiv} %0,%1,%2"
5240 [(set_attr "type" "ddiv")])
5243 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5244 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5245 (match_operand:SF 2 "gpc_reg_operand" "f"))
5246 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5247 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5248 "fmadds %0,%1,%2,%3"
5249 [(set_attr "type" "fp")])
5252 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5253 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5254 (match_operand:SF 2 "gpc_reg_operand" "f"))
5255 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5256 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5257 "{fma|fmadd} %0,%1,%2,%3"
5258 [(set_attr "type" "dmul")])
5261 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5262 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5263 (match_operand:SF 2 "gpc_reg_operand" "f"))
5264 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5265 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5266 "fmsubs %0,%1,%2,%3"
5267 [(set_attr "type" "fp")])
5270 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5271 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5272 (match_operand:SF 2 "gpc_reg_operand" "f"))
5273 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5274 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5275 "{fms|fmsub} %0,%1,%2,%3"
5276 [(set_attr "type" "dmul")])
5279 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5280 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5281 (match_operand:SF 2 "gpc_reg_operand" "f"))
5282 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5283 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5284 "fnmadds %0,%1,%2,%3"
5285 [(set_attr "type" "fp")])
5288 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5289 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5290 (match_operand:SF 2 "gpc_reg_operand" "f"))
5291 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5292 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5293 "{fnma|fnmadd} %0,%1,%2,%3"
5294 [(set_attr "type" "dmul")])
5297 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5298 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5299 (match_operand:SF 2 "gpc_reg_operand" "f"))
5300 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5301 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5302 "fnmsubs %0,%1,%2,%3"
5303 [(set_attr "type" "fp")])
5306 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5307 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
5308 (match_operand:SF 2 "gpc_reg_operand" "f"))
5309 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
5310 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5311 "{fnms|fnmsub} %0,%1,%2,%3"
5312 [(set_attr "type" "dmul")])
5314 (define_expand "sqrtsf2"
5315 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5316 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
5317 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5321 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5322 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5323 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5325 [(set_attr "type" "ssqrt")])
5328 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5329 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
5330 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
5332 [(set_attr "type" "dsqrt")])
5334 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
5335 ;; fsel instruction and some auxiliary computations. Then we just have a
5336 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
5338 (define_expand "maxsf3"
5339 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5340 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5341 (match_operand:SF 2 "gpc_reg_operand" ""))
5344 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5345 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5347 (define_expand "minsf3"
5348 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5349 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
5350 (match_operand:SF 2 "gpc_reg_operand" ""))
5353 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5354 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5357 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5358 (match_operator:SF 3 "min_max_operator"
5359 [(match_operand:SF 1 "gpc_reg_operand" "")
5360 (match_operand:SF 2 "gpc_reg_operand" "")]))]
5361 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5364 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5365 operands[1], operands[2]);
5369 (define_expand "movsicc"
5370 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5371 (if_then_else:SI (match_operand 1 "comparison_operator" "")
5372 (match_operand:SI 2 "gpc_reg_operand" "")
5373 (match_operand:SI 3 "gpc_reg_operand" "")))]
5377 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5383 ;; We use the BASE_REGS for the isel input operands because, if rA is
5384 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
5385 ;; because we may switch the operands and rB may end up being rA.
5387 ;; We need 2 patterns: an unsigned and a signed pattern. We could
5388 ;; leave out the mode in operand 4 and use one pattern, but reload can
5389 ;; change the mode underneath our feet and then gets confused trying
5390 ;; to reload the value.
5391 (define_insn "isel_signed"
5392 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5394 (match_operator 1 "comparison_operator"
5395 [(match_operand:CC 4 "cc_reg_operand" "y")
5397 (match_operand:SI 2 "gpc_reg_operand" "b")
5398 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5401 { return output_isel (operands); }"
5402 [(set_attr "length" "4")])
5404 (define_insn "isel_unsigned"
5405 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5407 (match_operator 1 "comparison_operator"
5408 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
5410 (match_operand:SI 2 "gpc_reg_operand" "b")
5411 (match_operand:SI 3 "gpc_reg_operand" "b")))]
5414 { return output_isel (operands); }"
5415 [(set_attr "length" "4")])
5417 (define_expand "movsfcc"
5418 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5419 (if_then_else:SF (match_operand 1 "comparison_operator" "")
5420 (match_operand:SF 2 "gpc_reg_operand" "")
5421 (match_operand:SF 3 "gpc_reg_operand" "")))]
5422 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5425 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5431 (define_insn "*fselsfsf4"
5432 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5433 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5434 (match_operand:SF 4 "zero_fp_constant" "F"))
5435 (match_operand:SF 2 "gpc_reg_operand" "f")
5436 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5437 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5439 [(set_attr "type" "fp")])
5441 (define_insn "*fseldfsf4"
5442 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5443 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5444 (match_operand:DF 4 "zero_fp_constant" "F"))
5445 (match_operand:SF 2 "gpc_reg_operand" "f")
5446 (match_operand:SF 3 "gpc_reg_operand" "f")))]
5447 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5449 [(set_attr "type" "fp")])
5451 (define_insn "negdf2"
5452 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5453 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5454 "TARGET_HARD_FLOAT && TARGET_FPRS"
5456 [(set_attr "type" "fp")])
5458 (define_insn "absdf2"
5459 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5460 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5461 "TARGET_HARD_FLOAT && TARGET_FPRS"
5463 [(set_attr "type" "fp")])
5466 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5467 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5468 "TARGET_HARD_FLOAT && TARGET_FPRS"
5470 [(set_attr "type" "fp")])
5472 (define_insn "adddf3"
5473 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5474 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5475 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5476 "TARGET_HARD_FLOAT && TARGET_FPRS"
5477 "{fa|fadd} %0,%1,%2"
5478 [(set_attr "type" "fp")])
5480 (define_insn "subdf3"
5481 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5482 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5483 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5484 "TARGET_HARD_FLOAT && TARGET_FPRS"
5485 "{fs|fsub} %0,%1,%2"
5486 [(set_attr "type" "fp")])
5488 (define_insn "muldf3"
5489 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5490 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5491 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5492 "TARGET_HARD_FLOAT && TARGET_FPRS"
5493 "{fm|fmul} %0,%1,%2"
5494 [(set_attr "type" "dmul")])
5496 (define_insn "divdf3"
5497 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5498 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5499 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5500 "TARGET_HARD_FLOAT && TARGET_FPRS"
5501 "{fd|fdiv} %0,%1,%2"
5502 [(set_attr "type" "ddiv")])
5505 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5506 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5507 (match_operand:DF 2 "gpc_reg_operand" "f"))
5508 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5509 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5510 "{fma|fmadd} %0,%1,%2,%3"
5511 [(set_attr "type" "dmul")])
5514 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5515 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5516 (match_operand:DF 2 "gpc_reg_operand" "f"))
5517 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5518 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5519 "{fms|fmsub} %0,%1,%2,%3"
5520 [(set_attr "type" "dmul")])
5523 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5524 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5525 (match_operand:DF 2 "gpc_reg_operand" "f"))
5526 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5527 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5528 "{fnma|fnmadd} %0,%1,%2,%3"
5529 [(set_attr "type" "dmul")])
5532 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5533 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5534 (match_operand:DF 2 "gpc_reg_operand" "f"))
5535 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5536 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5537 "{fnms|fnmsub} %0,%1,%2,%3"
5538 [(set_attr "type" "dmul")])
5540 (define_insn "sqrtdf2"
5541 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5542 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5543 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5545 [(set_attr "type" "dsqrt")])
5547 ;; The conditional move instructions allow us to perform max and min
5548 ;; operations even when
5550 (define_expand "maxdf3"
5551 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5552 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5553 (match_operand:DF 2 "gpc_reg_operand" ""))
5556 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5557 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5559 (define_expand "mindf3"
5560 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5561 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5562 (match_operand:DF 2 "gpc_reg_operand" ""))
5565 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5566 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5569 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5570 (match_operator:DF 3 "min_max_operator"
5571 [(match_operand:DF 1 "gpc_reg_operand" "")
5572 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5573 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5576 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5577 operands[1], operands[2]);
5581 (define_expand "movdfcc"
5582 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5583 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5584 (match_operand:DF 2 "gpc_reg_operand" "")
5585 (match_operand:DF 3 "gpc_reg_operand" "")))]
5586 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5589 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5595 (define_insn "*fseldfdf4"
5596 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5597 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5598 (match_operand:DF 4 "zero_fp_constant" "F"))
5599 (match_operand:DF 2 "gpc_reg_operand" "f")
5600 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5601 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5603 [(set_attr "type" "fp")])
5605 (define_insn "*fselsfdf4"
5606 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5607 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5608 (match_operand:SF 4 "zero_fp_constant" "F"))
5609 (match_operand:DF 2 "gpc_reg_operand" "f")
5610 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5613 [(set_attr "type" "fp")])
5615 ;; Conversions to and from floating-point.
5617 (define_expand "fixunssfsi2"
5618 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5619 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "gpc_reg_operand" ""))))]
5620 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5623 (define_expand "fix_truncsfsi2"
5624 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5625 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5626 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5629 ; For each of these conversions, there is a define_expand, a define_insn
5630 ; with a '#' template, and a define_split (with C code). The idea is
5631 ; to allow constant folding with the template of the define_insn,
5632 ; then to have the insns split later (between sched1 and final).
5634 (define_expand "floatsidf2"
5635 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5636 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5639 (clobber (match_dup 4))
5640 (clobber (match_dup 5))
5641 (clobber (match_dup 6))])]
5642 "TARGET_HARD_FLOAT && TARGET_FPRS"
5645 if (TARGET_POWERPC64)
5647 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5648 rtx t1 = gen_reg_rtx (DImode);
5649 rtx t2 = gen_reg_rtx (DImode);
5650 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5654 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5655 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5656 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5657 operands[5] = gen_reg_rtx (DFmode);
5658 operands[6] = gen_reg_rtx (SImode);
5661 (define_insn "*floatsidf2_internal"
5662 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5663 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5664 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5665 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5666 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5667 (clobber (match_operand:DF 5 "gpc_reg_operand" "=f"))
5668 (clobber (match_operand:SI 6 "gpc_reg_operand" "=r"))]
5669 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5671 [(set_attr "length" "24")])
5674 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5675 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5676 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5677 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5678 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5679 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5680 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5681 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5682 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5683 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5684 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5685 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5686 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5687 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5688 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5691 rtx lowword, highword;
5692 if (GET_CODE (operands[4]) != MEM)
5694 highword = XEXP (operands[4], 0);
5695 lowword = plus_constant (highword, 4);
5696 if (! WORDS_BIG_ENDIAN)
5699 tmp = highword; highword = lowword; lowword = tmp;
5702 emit_insn (gen_xorsi3 (operands[6], operands[1],
5703 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5704 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5705 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5706 emit_move_insn (operands[5], operands[4]);
5707 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5711 (define_expand "floatunssisf2"
5712 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5713 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5714 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5717 (define_expand "floatunssidf2"
5718 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5719 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5722 (clobber (match_dup 4))
5723 (clobber (match_dup 5))])]
5724 "TARGET_HARD_FLOAT && TARGET_FPRS"
5727 if (TARGET_POWERPC64)
5729 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5730 rtx t1 = gen_reg_rtx (DImode);
5731 rtx t2 = gen_reg_rtx (DImode);
5732 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5737 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5738 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5739 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5740 operands[5] = gen_reg_rtx (DFmode);
5743 (define_insn "*floatunssidf2_internal"
5744 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5745 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5746 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5747 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5748 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5749 (clobber (match_operand:DF 5 "gpc_reg_operand" "=f"))]
5750 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5752 [(set_attr "length" "20")])
5755 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5756 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5757 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5758 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5759 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5760 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5761 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5762 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5763 (unsigned_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" ""))]
5770 rtx lowword, highword;
5771 if (GET_CODE (operands[4]) != MEM)
5773 highword = XEXP (operands[4], 0);
5774 lowword = plus_constant (highword, 4);
5775 if (! WORDS_BIG_ENDIAN)
5778 tmp = highword; highword = lowword; lowword = tmp;
5781 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5782 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5783 emit_move_insn (operands[5], operands[4]);
5784 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5788 (define_expand "fix_truncdfsi2"
5789 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5790 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5791 (clobber (match_dup 2))
5792 (clobber (match_dup 3))])]
5793 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5796 operands[2] = gen_reg_rtx (DImode);
5797 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5800 (define_insn "*fix_truncdfsi2_internal"
5801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5802 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5803 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5804 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5805 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5807 [(set_attr "length" "16")])
5810 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5811 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5812 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5813 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5814 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5815 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5816 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5817 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5818 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5822 if (GET_CODE (operands[3]) != MEM)
5824 lowword = XEXP (operands[3], 0);
5825 if (WORDS_BIG_ENDIAN)
5826 lowword = plus_constant (lowword, 4);
5828 emit_insn (gen_fctiwz (operands[2], operands[1]));
5829 emit_move_insn (operands[3], operands[2]);
5830 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5834 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] 10))
5835 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5836 ; because the first makes it clear that operand 0 is not live
5837 ; before the instruction.
5838 (define_insn "fctiwz"
5839 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5840 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))] 10))]
5841 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5842 "{fcirz|fctiwz} %0,%1"
5843 [(set_attr "type" "fp")])
5845 (define_expand "floatsisf2"
5846 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5847 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5848 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5851 (define_insn "floatdidf2"
5852 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5853 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5854 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5856 [(set_attr "type" "fp")])
5858 (define_insn_and_split "floatsidf_ppc64"
5859 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5860 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5861 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5862 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5863 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5864 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5867 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5868 (set (match_dup 2) (match_dup 3))
5869 (set (match_dup 4) (match_dup 2))
5870 (set (match_dup 0) (float:DF (match_dup 4)))]
5873 (define_insn_and_split "floatunssidf_ppc64"
5874 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5875 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5876 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5877 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5878 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5879 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5882 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5883 (set (match_dup 2) (match_dup 3))
5884 (set (match_dup 4) (match_dup 2))
5885 (set (match_dup 0) (float:DF (match_dup 4)))]
5888 (define_insn "fix_truncdfdi2"
5889 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5890 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5891 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5893 [(set_attr "type" "fp")])
5895 ;; This only is safe if rounding mode set appropriately.
5896 (define_insn_and_split "floatdisf2"
5897 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5898 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5899 (clobber (match_scratch:DF 2 "=f"))]
5900 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
5901 && flag_unsafe_math_optimizations"
5903 "&& reload_completed"
5905 (float:DF (match_dup 1)))
5907 (float_truncate:SF (match_dup 2)))]
5910 ;; Define the DImode operations that can be done in a small number
5911 ;; of instructions. The & constraints are to prevent the register
5912 ;; allocator from allocating registers that overlap with the inputs
5913 ;; (for example, having an input in 7,8 and an output in 6,7). We
5914 ;; also allow for the output being the same as one of the inputs.
5916 (define_insn "*adddi3_noppc64"
5917 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5918 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5919 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5920 "! TARGET_POWERPC64"
5923 if (WORDS_BIG_ENDIAN)
5924 return (GET_CODE (operands[2])) != CONST_INT
5925 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5926 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5928 return (GET_CODE (operands[2])) != CONST_INT
5929 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5930 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5932 [(set_attr "length" "8")])
5934 (define_insn "*subdi3_noppc64"
5935 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5936 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5937 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5938 "! TARGET_POWERPC64"
5941 if (WORDS_BIG_ENDIAN)
5942 return (GET_CODE (operands[1]) != CONST_INT)
5943 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5944 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5946 return (GET_CODE (operands[1]) != CONST_INT)
5947 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5948 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5950 [(set_attr "length" "8")])
5952 (define_insn "*negdi2_noppc64"
5953 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5954 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5955 "! TARGET_POWERPC64"
5958 return (WORDS_BIG_ENDIAN)
5959 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5960 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5962 [(set_attr "length" "8")])
5964 (define_expand "mulsidi3"
5965 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5966 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5967 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5968 "! TARGET_POWERPC64"
5971 if (! TARGET_POWER && ! TARGET_POWERPC)
5973 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5974 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5975 emit_insn (gen_mull_call ());
5976 if (WORDS_BIG_ENDIAN)
5977 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5980 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5981 gen_rtx_REG (SImode, 3));
5982 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5983 gen_rtx_REG (SImode, 4));
5987 else if (TARGET_POWER)
5989 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5994 (define_insn "mulsidi3_mq"
5995 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5996 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5997 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5998 (clobber (match_scratch:SI 3 "=q"))]
6000 "mul %0,%1,%2\;mfmq %L0"
6001 [(set_attr "type" "imul")
6002 (set_attr "length" "8")])
6004 (define_insn "*mulsidi3_no_mq"
6005 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6006 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6007 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6008 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6011 return (WORDS_BIG_ENDIAN)
6012 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
6013 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
6015 [(set_attr "type" "imul")
6016 (set_attr "length" "8")])
6019 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6020 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6021 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6022 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6025 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
6026 (sign_extend:DI (match_dup 2)))
6029 (mult:SI (match_dup 1)
6033 int endian = (WORDS_BIG_ENDIAN == 0);
6034 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6035 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6038 (define_expand "umulsidi3"
6039 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6040 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6041 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6042 "TARGET_POWERPC && ! TARGET_POWERPC64"
6047 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
6052 (define_insn "umulsidi3_mq"
6053 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6054 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6055 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
6056 (clobber (match_scratch:SI 3 "=q"))]
6057 "TARGET_POWERPC && TARGET_POWER"
6060 return (WORDS_BIG_ENDIAN)
6061 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6062 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6064 [(set_attr "type" "imul")
6065 (set_attr "length" "8")])
6067 (define_insn "*umulsidi3_no_mq"
6068 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6069 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
6070 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
6071 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
6074 return (WORDS_BIG_ENDIAN)
6075 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
6076 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
6078 [(set_attr "type" "imul")
6079 (set_attr "length" "8")])
6082 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6083 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
6084 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
6085 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
6088 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
6089 (zero_extend:DI (match_dup 2)))
6092 (mult:SI (match_dup 1)
6096 int endian = (WORDS_BIG_ENDIAN == 0);
6097 operands[3] = operand_subword (operands[0], endian, 0, DImode);
6098 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
6101 (define_expand "smulsi3_highpart"
6102 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6104 (lshiftrt:DI (mult:DI (sign_extend:DI
6105 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6107 (match_operand:SI 2 "gpc_reg_operand" "r")))
6112 if (! TARGET_POWER && ! TARGET_POWERPC)
6114 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
6115 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
6116 emit_insn (gen_mulh_call ());
6117 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
6120 else if (TARGET_POWER)
6122 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6127 (define_insn "smulsi3_highpart_mq"
6128 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6130 (lshiftrt:DI (mult:DI (sign_extend:DI
6131 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6133 (match_operand:SI 2 "gpc_reg_operand" "r")))
6135 (clobber (match_scratch:SI 3 "=q"))]
6138 [(set_attr "type" "imul")])
6140 (define_insn "*smulsi3_highpart_no_mq"
6141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6143 (lshiftrt:DI (mult:DI (sign_extend:DI
6144 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6146 (match_operand:SI 2 "gpc_reg_operand" "r")))
6148 "TARGET_POWERPC && ! TARGET_POWER"
6150 [(set_attr "type" "imul")])
6152 (define_expand "umulsi3_highpart"
6153 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6155 (lshiftrt:DI (mult:DI (zero_extend:DI
6156 (match_operand:SI 1 "gpc_reg_operand" ""))
6158 (match_operand:SI 2 "gpc_reg_operand" "")))
6165 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
6170 (define_insn "umulsi3_highpart_mq"
6171 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6173 (lshiftrt:DI (mult:DI (zero_extend:DI
6174 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6176 (match_operand:SI 2 "gpc_reg_operand" "r")))
6178 (clobber (match_scratch:SI 3 "=q"))]
6179 "TARGET_POWERPC && TARGET_POWER"
6181 [(set_attr "type" "imul")])
6183 (define_insn "*umulsi3_highpart_no_mq"
6184 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6186 (lshiftrt:DI (mult:DI (zero_extend:DI
6187 (match_operand:SI 1 "gpc_reg_operand" "%r"))
6189 (match_operand:SI 2 "gpc_reg_operand" "r")))
6191 "TARGET_POWERPC && ! TARGET_POWER"
6193 [(set_attr "type" "imul")])
6195 ;; If operands 0 and 2 are in the same register, we have a problem. But
6196 ;; operands 0 and 1 (the usual case) can be in the same register. That's
6197 ;; why we have the strange constraints below.
6198 (define_insn "ashldi3_power"
6199 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6200 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6201 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6202 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6205 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
6206 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6207 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
6208 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
6209 [(set_attr "length" "8")])
6211 (define_insn "lshrdi3_power"
6212 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
6213 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
6214 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
6215 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
6218 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
6219 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6220 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
6221 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
6222 [(set_attr "length" "8")])
6224 ;; Shift by a variable amount is too complex to be worth open-coding. We
6225 ;; just handle shifts by constants.
6226 (define_insn "ashrdi3_power"
6227 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6228 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6229 (match_operand:SI 2 "const_int_operand" "M,i")))
6230 (clobber (match_scratch:SI 3 "=X,q"))]
6233 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6234 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
6235 [(set_attr "length" "8")])
6237 (define_insn "ashrdi3_no_power"
6238 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
6239 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6240 (match_operand:SI 2 "const_int_operand" "M,i")))]
6241 "TARGET_32BIT && !TARGET_POWER"
6243 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
6244 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
6245 [(set_attr "length" "8,12")])
6247 ;; PowerPC64 DImode operations.
6249 (define_expand "adddi3"
6250 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6251 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6252 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
6256 if (! TARGET_POWERPC64)
6258 if (non_short_cint_operand (operands[2], DImode))
6262 if (GET_CODE (operands[2]) == CONST_INT
6263 && ! add_operand (operands[2], DImode))
6265 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
6266 ? operands[0] : gen_reg_rtx (DImode));
6268 HOST_WIDE_INT val = INTVAL (operands[2]);
6269 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
6270 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
6272 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
6275 /* The ordering here is important for the prolog expander.
6276 When space is allocated from the stack, adding 'low' first may
6277 produce a temporary deallocation (which would be bad). */
6278 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
6279 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
6284 ;; Discourage ai/addic because of carry but provide it in an alternative
6285 ;; allowing register zero as source.
6287 (define_insn "*adddi3_internal1"
6288 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
6289 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
6290 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
6298 (define_insn "*adddi3_internal2"
6299 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
6300 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
6301 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
6303 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
6310 [(set_attr "type" "compare")
6311 (set_attr "length" "4,4,8,8")])
6314 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6315 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6316 (match_operand:DI 2 "reg_or_short_operand" ""))
6318 (clobber (match_scratch:DI 3 ""))]
6319 "TARGET_POWERPC64 && reload_completed"
6321 (plus:DI (match_dup 1) (match_dup 2)))
6323 (compare:CC (match_dup 3)
6327 (define_insn "*adddi3_internal3"
6328 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
6329 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
6330 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
6332 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
6333 (plus:DI (match_dup 1) (match_dup 2)))]
6340 [(set_attr "type" "compare")
6341 (set_attr "length" "4,4,8,8")])
6344 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6345 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6346 (match_operand:DI 2 "reg_or_short_operand" ""))
6348 (set (match_operand:DI 0 "gpc_reg_operand" "")
6349 (plus:DI (match_dup 1) (match_dup 2)))]
6350 "TARGET_POWERPC64 && reload_completed"
6352 (plus:DI (match_dup 1) (match_dup 2)))
6354 (compare:CC (match_dup 0)
6358 ;; Split an add that we can't do in one insn into two insns, each of which
6359 ;; does one 16-bit part. This is used by combine. Note that the low-order
6360 ;; add should be last in case the result gets used in an address.
6363 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6364 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6365 (match_operand:DI 2 "non_add_cint_operand" "")))]
6367 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
6368 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
6371 HOST_WIDE_INT val = INTVAL (operands[2]);
6372 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
6373 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
6375 operands[4] = GEN_INT (low);
6376 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
6377 operands[3] = GEN_INT (rest);
6378 else if (! no_new_pseudos)
6380 operands[3] = gen_reg_rtx (DImode);
6381 emit_move_insn (operands[3], operands[2]);
6382 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
6389 (define_insn "one_cmpldi2"
6390 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6391 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6396 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6397 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6399 (clobber (match_scratch:DI 2 "=r,r"))]
6404 [(set_attr "type" "compare")
6405 (set_attr "length" "4,8")])
6408 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6409 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6411 (clobber (match_scratch:DI 2 ""))]
6412 "TARGET_POWERPC64 && reload_completed"
6414 (not:DI (match_dup 1)))
6416 (compare:CC (match_dup 2)
6421 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6422 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6424 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6425 (not:DI (match_dup 1)))]
6430 [(set_attr "type" "compare")
6431 (set_attr "length" "4,8")])
6434 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6435 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6437 (set (match_operand:DI 0 "gpc_reg_operand" "")
6438 (not:DI (match_dup 1)))]
6439 "TARGET_POWERPC64 && reload_completed"
6441 (not:DI (match_dup 1)))
6443 (compare:CC (match_dup 0)
6448 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6449 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
6450 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
6457 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6458 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6459 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6461 (clobber (match_scratch:DI 3 "=r,r"))]
6466 [(set_attr "type" "compare")
6467 (set_attr "length" "4,8")])
6470 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6471 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6472 (match_operand:DI 2 "gpc_reg_operand" ""))
6474 (clobber (match_scratch:DI 3 ""))]
6475 "TARGET_POWERPC64 && reload_completed"
6477 (minus:DI (match_dup 1) (match_dup 2)))
6479 (compare:CC (match_dup 3)
6484 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6485 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6486 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
6488 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6489 (minus:DI (match_dup 1) (match_dup 2)))]
6494 [(set_attr "type" "compare")
6495 (set_attr "length" "4,8")])
6498 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6499 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
6500 (match_operand:DI 2 "gpc_reg_operand" ""))
6502 (set (match_operand:DI 0 "gpc_reg_operand" "")
6503 (minus:DI (match_dup 1) (match_dup 2)))]
6504 "TARGET_POWERPC64 && reload_completed"
6506 (minus:DI (match_dup 1) (match_dup 2)))
6508 (compare:CC (match_dup 0)
6512 (define_expand "subdi3"
6513 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6514 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
6515 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
6519 if (GET_CODE (operands[2]) == CONST_INT)
6521 emit_insn (gen_adddi3 (operands[0], operands[1],
6522 negate_rtx (DImode, operands[2])));
6527 (define_insn_and_split "absdi2"
6528 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6529 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
6530 (clobber (match_scratch:DI 2 "=&r,&r"))]
6533 "&& reload_completed"
6534 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6535 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6536 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
6539 (define_insn_and_split "*nabsdi2"
6540 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
6541 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
6542 (clobber (match_scratch:DI 2 "=&r,&r"))]
6545 "&& reload_completed"
6546 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
6547 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
6548 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
6551 (define_expand "negdi2"
6552 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6553 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
6558 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6559 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6564 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6565 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6567 (clobber (match_scratch:DI 2 "=r,r"))]
6572 [(set_attr "type" "compare")
6573 (set_attr "length" "4,8")])
6576 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6577 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6579 (clobber (match_scratch:DI 2 ""))]
6580 "TARGET_POWERPC64 && reload_completed"
6582 (neg:DI (match_dup 1)))
6584 (compare:CC (match_dup 2)
6589 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
6590 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
6592 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6593 (neg:DI (match_dup 1)))]
6598 [(set_attr "type" "compare")
6599 (set_attr "length" "4,8")])
6602 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
6603 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
6605 (set (match_operand:DI 0 "gpc_reg_operand" "")
6606 (neg:DI (match_dup 1)))]
6607 "TARGET_POWERPC64 && reload_completed"
6609 (neg:DI (match_dup 1)))
6611 (compare:CC (match_dup 0)
6615 (define_insn "ffsdi2"
6616 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
6617 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
6619 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
6620 [(set_attr "length" "16")])
6622 (define_insn "muldi3"
6623 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6624 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6625 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6628 [(set_attr "type" "lmul")])
6630 (define_insn "smuldi3_highpart"
6631 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6633 (lshiftrt:TI (mult:TI (sign_extend:TI
6634 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6636 (match_operand:DI 2 "gpc_reg_operand" "r")))
6640 [(set_attr "type" "lmul")])
6642 (define_insn "umuldi3_highpart"
6643 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6645 (lshiftrt:TI (mult:TI (zero_extend:TI
6646 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6648 (match_operand:DI 2 "gpc_reg_operand" "r")))
6652 [(set_attr "type" "lmul")])
6654 (define_expand "divdi3"
6655 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6656 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6657 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6661 if (GET_CODE (operands[2]) == CONST_INT
6662 && INTVAL (operands[2]) > 0
6663 && exact_log2 (INTVAL (operands[2])) >= 0)
6666 operands[2] = force_reg (DImode, operands[2]);
6669 (define_expand "moddi3"
6670 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6671 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6672 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6680 if (GET_CODE (operands[2]) != CONST_INT
6681 || INTVAL (operands[2]) <= 0
6682 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6685 temp1 = gen_reg_rtx (DImode);
6686 temp2 = gen_reg_rtx (DImode);
6688 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6689 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6690 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6695 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6696 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6697 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6699 "sradi %0,%1,%p2\;addze %0,%0"
6700 [(set_attr "length" "8")])
6703 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6704 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6705 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6707 (clobber (match_scratch:DI 3 "=r,r"))]
6710 sradi %3,%1,%p2\;addze. %3,%3
6712 [(set_attr "type" "compare")
6713 (set_attr "length" "8,12")])
6716 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6717 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6718 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6720 (clobber (match_scratch:DI 3 ""))]
6721 "TARGET_POWERPC64 && reload_completed"
6723 (div:DI (match_dup 1) (match_dup 2)))
6725 (compare:CC (match_dup 3)
6730 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6731 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6732 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6734 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6735 (div:DI (match_dup 1) (match_dup 2)))]
6738 sradi %0,%1,%p2\;addze. %0,%0
6740 [(set_attr "type" "compare")
6741 (set_attr "length" "8,12")])
6744 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6745 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6746 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6748 (set (match_operand:DI 0 "gpc_reg_operand" "")
6749 (div:DI (match_dup 1) (match_dup 2)))]
6750 "TARGET_POWERPC64 && reload_completed"
6752 (div:DI (match_dup 1) (match_dup 2)))
6754 (compare:CC (match_dup 0)
6759 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6760 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6761 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6764 [(set_attr "type" "ldiv")])
6766 (define_insn "udivdi3"
6767 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6768 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6769 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6772 [(set_attr "type" "ldiv")])
6774 (define_insn "rotldi3"
6775 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6776 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6777 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6779 "rld%I2cl %0,%1,%H2,0")
6781 (define_insn "*rotldi3_internal2"
6782 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6783 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6784 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6786 (clobber (match_scratch:DI 3 "=r,r"))]
6789 rld%I2cl. %3,%1,%H2,0
6791 [(set_attr "type" "delayed_compare")
6792 (set_attr "length" "4,8")])
6795 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6796 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6797 (match_operand:DI 2 "reg_or_cint_operand" ""))
6799 (clobber (match_scratch:DI 3 ""))]
6800 "TARGET_POWERPC64 && reload_completed"
6802 (rotate:DI (match_dup 1) (match_dup 2)))
6804 (compare:CC (match_dup 3)
6808 (define_insn "*rotldi3_internal3"
6809 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6810 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6811 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6813 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6814 (rotate:DI (match_dup 1) (match_dup 2)))]
6817 rld%I2cl. %0,%1,%H2,0
6819 [(set_attr "type" "delayed_compare")
6820 (set_attr "length" "4,8")])
6823 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6824 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6825 (match_operand:DI 2 "reg_or_cint_operand" ""))
6827 (set (match_operand:DI 0 "gpc_reg_operand" "")
6828 (rotate:DI (match_dup 1) (match_dup 2)))]
6829 "TARGET_POWERPC64 && reload_completed"
6831 (rotate:DI (match_dup 1) (match_dup 2)))
6833 (compare:CC (match_dup 0)
6837 (define_insn "*rotldi3_internal4"
6838 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6839 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6840 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6841 (match_operand:DI 3 "mask64_operand" "n")))]
6843 "rld%I2c%B3 %0,%1,%H2,%S3")
6845 (define_insn "*rotldi3_internal5"
6846 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6848 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6849 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6850 (match_operand:DI 3 "mask64_operand" "n,n"))
6852 (clobber (match_scratch:DI 4 "=r,r"))]
6855 rld%I2c%B3. %4,%1,%H2,%S3
6857 [(set_attr "type" "delayed_compare")
6858 (set_attr "length" "4,8")])
6861 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6863 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6864 (match_operand:DI 2 "reg_or_cint_operand" ""))
6865 (match_operand:DI 3 "mask64_operand" ""))
6867 (clobber (match_scratch:DI 4 ""))]
6868 "TARGET_POWERPC64 && reload_completed"
6870 (and:DI (rotate:DI (match_dup 1)
6874 (compare:CC (match_dup 4)
6878 (define_insn "*rotldi3_internal6"
6879 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6881 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6882 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6883 (match_operand:DI 3 "mask64_operand" "n,n"))
6885 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6886 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6889 rld%I2c%B3. %0,%1,%H2,%S3
6891 [(set_attr "type" "delayed_compare")
6892 (set_attr "length" "4,8")])
6895 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6897 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6898 (match_operand:DI 2 "reg_or_cint_operand" ""))
6899 (match_operand:DI 3 "mask64_operand" ""))
6901 (set (match_operand:DI 0 "gpc_reg_operand" "")
6902 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6903 "TARGET_POWERPC64 && reload_completed"
6905 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6907 (compare:CC (match_dup 0)
6911 (define_insn "*rotldi3_internal7"
6912 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6915 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6916 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6918 "rld%I2cl %0,%1,%H2,56")
6920 (define_insn "*rotldi3_internal8"
6921 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6922 (compare:CC (zero_extend:DI
6924 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6925 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6927 (clobber (match_scratch:DI 3 "=r,r"))]
6930 rld%I2cl. %3,%1,%H2,56
6932 [(set_attr "type" "delayed_compare")
6933 (set_attr "length" "4,8")])
6936 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6937 (compare:CC (zero_extend:DI
6939 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6940 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6942 (clobber (match_scratch:DI 3 ""))]
6943 "TARGET_POWERPC64 && reload_completed"
6945 (zero_extend:DI (subreg:QI
6946 (rotate:DI (match_dup 1)
6949 (compare:CC (match_dup 3)
6953 (define_insn "*rotldi3_internal9"
6954 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6955 (compare:CC (zero_extend:DI
6957 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6958 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6960 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6961 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6964 rld%I2cl. %0,%1,%H2,56
6966 [(set_attr "type" "delayed_compare")
6967 (set_attr "length" "4,8")])
6970 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6971 (compare:CC (zero_extend:DI
6973 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6974 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6976 (set (match_operand:DI 0 "gpc_reg_operand" "")
6977 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6978 "TARGET_POWERPC64 && reload_completed"
6980 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6982 (compare:CC (match_dup 0)
6986 (define_insn "*rotldi3_internal10"
6987 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6990 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6991 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6993 "rld%I2cl %0,%1,%H2,48")
6995 (define_insn "*rotldi3_internal11"
6996 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6997 (compare:CC (zero_extend:DI
6999 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7000 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7002 (clobber (match_scratch:DI 3 "=r,r"))]
7005 rld%I2cl. %3,%1,%H2,48
7007 [(set_attr "type" "delayed_compare")
7008 (set_attr "length" "4,8")])
7011 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7012 (compare:CC (zero_extend:DI
7014 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7015 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7017 (clobber (match_scratch:DI 3 ""))]
7018 "TARGET_POWERPC64 && reload_completed"
7020 (zero_extend:DI (subreg:HI
7021 (rotate:DI (match_dup 1)
7024 (compare:CC (match_dup 3)
7028 (define_insn "*rotldi3_internal12"
7029 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7030 (compare:CC (zero_extend:DI
7032 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7033 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7035 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7036 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7039 rld%I2cl. %0,%1,%H2,48
7041 [(set_attr "type" "delayed_compare")
7042 (set_attr "length" "4,8")])
7045 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7046 (compare:CC (zero_extend:DI
7048 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7049 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7051 (set (match_operand:DI 0 "gpc_reg_operand" "")
7052 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7053 "TARGET_POWERPC64 && reload_completed"
7055 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7057 (compare:CC (match_dup 0)
7061 (define_insn "*rotldi3_internal13"
7062 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7065 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7066 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
7068 "rld%I2cl %0,%1,%H2,32")
7070 (define_insn "*rotldi3_internal14"
7071 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7072 (compare:CC (zero_extend:DI
7074 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7075 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7077 (clobber (match_scratch:DI 3 "=r,r"))]
7080 rld%I2cl. %3,%1,%H2,32
7082 [(set_attr "type" "delayed_compare")
7083 (set_attr "length" "4,8")])
7086 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7087 (compare:CC (zero_extend:DI
7089 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7090 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7092 (clobber (match_scratch:DI 3 ""))]
7093 "TARGET_POWERPC64 && reload_completed"
7095 (zero_extend:DI (subreg:SI
7096 (rotate:DI (match_dup 1)
7099 (compare:CC (match_dup 3)
7103 (define_insn "*rotldi3_internal15"
7104 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7105 (compare:CC (zero_extend:DI
7107 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7108 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
7110 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7111 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7114 rld%I2cl. %0,%1,%H2,32
7116 [(set_attr "type" "delayed_compare")
7117 (set_attr "length" "4,8")])
7120 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7121 (compare:CC (zero_extend:DI
7123 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
7124 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
7126 (set (match_operand:DI 0 "gpc_reg_operand" "")
7127 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
7128 "TARGET_POWERPC64 && reload_completed"
7130 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
7132 (compare:CC (match_dup 0)
7136 (define_expand "ashldi3"
7137 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7138 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7139 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7140 "TARGET_POWERPC64 || TARGET_POWER"
7143 if (TARGET_POWERPC64)
7145 else if (TARGET_POWER)
7147 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
7154 (define_insn "*ashldi3_internal1"
7155 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7156 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7157 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7160 [(set_attr "length" "8")])
7162 (define_insn "*ashldi3_internal2"
7163 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7164 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7165 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7167 (clobber (match_scratch:DI 3 "=r,r"))]
7172 [(set_attr "type" "delayed_compare")
7173 (set_attr "length" "4,8")])
7176 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7177 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7178 (match_operand:SI 2 "reg_or_cint_operand" ""))
7180 (clobber (match_scratch:DI 3 ""))]
7181 "TARGET_POWERPC64 && reload_completed"
7183 (ashift:DI (match_dup 1) (match_dup 2)))
7185 (compare:CC (match_dup 3)
7189 (define_insn "*ashldi3_internal3"
7190 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7191 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7192 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7194 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7195 (ashift:DI (match_dup 1) (match_dup 2)))]
7200 [(set_attr "type" "delayed_compare")
7201 (set_attr "length" "4,8")])
7204 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7205 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7206 (match_operand:SI 2 "reg_or_cint_operand" ""))
7208 (set (match_operand:DI 0 "gpc_reg_operand" "")
7209 (ashift:DI (match_dup 1) (match_dup 2)))]
7210 "TARGET_POWERPC64 && reload_completed"
7212 (ashift:DI (match_dup 1) (match_dup 2)))
7214 (compare:CC (match_dup 0)
7218 (define_insn "*ashldi3_internal4"
7219 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7220 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7221 (match_operand:SI 2 "const_int_operand" "i"))
7222 (match_operand:DI 3 "const_int_operand" "n")))]
7223 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7224 "rldic %0,%1,%H2,%W3")
7226 (define_insn "ashldi3_internal5"
7227 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7229 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7230 (match_operand:SI 2 "const_int_operand" "i,i"))
7231 (match_operand:DI 3 "const_int_operand" "n,n"))
7233 (clobber (match_scratch:DI 4 "=r,r"))]
7234 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7236 rldic. %4,%1,%H2,%W3
7238 [(set_attr "type" "delayed_compare")
7239 (set_attr "length" "4,8")])
7242 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7244 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7245 (match_operand:SI 2 "const_int_operand" ""))
7246 (match_operand:DI 3 "const_int_operand" ""))
7248 (clobber (match_scratch:DI 4 ""))]
7249 "TARGET_POWERPC64 && reload_completed
7250 && includes_rldic_lshift_p (operands[2], operands[3])"
7252 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7255 (compare:CC (match_dup 4)
7259 (define_insn "*ashldi3_internal6"
7260 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7262 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7263 (match_operand:SI 2 "const_int_operand" "i,i"))
7264 (match_operand:DI 3 "const_int_operand" "n,n"))
7266 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7267 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7268 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
7270 rldic. %0,%1,%H2,%W3
7272 [(set_attr "type" "delayed_compare")
7273 (set_attr "length" "4,8")])
7276 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7278 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7279 (match_operand:SI 2 "const_int_operand" ""))
7280 (match_operand:DI 3 "const_int_operand" ""))
7282 (set (match_operand:DI 0 "gpc_reg_operand" "")
7283 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7284 "TARGET_POWERPC64 && reload_completed
7285 && includes_rldic_lshift_p (operands[2], operands[3])"
7287 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7290 (compare:CC (match_dup 0)
7294 (define_insn "*ashldi3_internal7"
7295 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7296 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7297 (match_operand:SI 2 "const_int_operand" "i"))
7298 (match_operand:DI 3 "mask64_operand" "n")))]
7299 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7300 "rldicr %0,%1,%H2,%S3")
7302 (define_insn "ashldi3_internal8"
7303 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7305 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7306 (match_operand:SI 2 "const_int_operand" "i,i"))
7307 (match_operand:DI 3 "mask64_operand" "n,n"))
7309 (clobber (match_scratch:DI 4 "=r,r"))]
7310 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7312 rldicr. %4,%1,%H2,%S3
7314 [(set_attr "type" "delayed_compare")
7315 (set_attr "length" "4,8")])
7318 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7320 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7321 (match_operand:SI 2 "const_int_operand" ""))
7322 (match_operand:DI 3 "mask64_operand" ""))
7324 (clobber (match_scratch:DI 4 ""))]
7325 "TARGET_POWERPC64 && reload_completed
7326 && includes_rldicr_lshift_p (operands[2], operands[3])"
7328 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7331 (compare:CC (match_dup 4)
7335 (define_insn "*ashldi3_internal9"
7336 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
7338 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7339 (match_operand:SI 2 "const_int_operand" "i,i"))
7340 (match_operand:DI 3 "mask64_operand" "n,n"))
7342 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7343 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7344 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
7346 rldicr. %0,%1,%H2,%S3
7348 [(set_attr "type" "delayed_compare")
7349 (set_attr "length" "4,8")])
7352 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
7354 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
7355 (match_operand:SI 2 "const_int_operand" ""))
7356 (match_operand:DI 3 "mask64_operand" ""))
7358 (set (match_operand:DI 0 "gpc_reg_operand" "")
7359 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
7360 "TARGET_POWERPC64 && reload_completed
7361 && includes_rldicr_lshift_p (operands[2], operands[3])"
7363 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
7366 (compare:CC (match_dup 0)
7370 (define_expand "lshrdi3"
7371 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7372 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7373 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7374 "TARGET_POWERPC64 || TARGET_POWER"
7377 if (TARGET_POWERPC64)
7379 else if (TARGET_POWER)
7381 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
7388 (define_insn "*lshrdi3_internal1"
7389 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7390 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7391 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7395 (define_insn "*lshrdi3_internal2"
7396 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7397 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7398 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7400 (clobber (match_scratch:DI 3 "=r,r"))]
7405 [(set_attr "type" "delayed_compare")
7406 (set_attr "length" "4,8")])
7409 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7410 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7411 (match_operand:SI 2 "reg_or_cint_operand" ""))
7413 (clobber (match_scratch:DI 3 ""))]
7414 "TARGET_POWERPC64 && reload_completed"
7416 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7418 (compare:CC (match_dup 3)
7422 (define_insn "*lshrdi3_internal3"
7423 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7424 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7425 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7427 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7428 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7433 [(set_attr "type" "delayed_compare")
7434 (set_attr "length" "4,8")])
7437 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7438 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7439 (match_operand:SI 2 "reg_or_cint_operand" ""))
7441 (set (match_operand:DI 0 "gpc_reg_operand" "")
7442 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
7443 "TARGET_POWERPC64 && reload_completed"
7445 (lshiftrt:DI (match_dup 1) (match_dup 2)))
7447 (compare:CC (match_dup 0)
7451 (define_expand "ashrdi3"
7452 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7453 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7454 (match_operand:SI 2 "reg_or_cint_operand" "")))]
7458 if (TARGET_POWERPC64)
7460 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
7462 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
7465 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT)
7467 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
7474 (define_insn "*ashrdi3_internal1"
7475 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7476 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
7477 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
7479 "srad%I2 %0,%1,%H2")
7481 (define_insn "*ashrdi3_internal2"
7482 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7483 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7484 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7486 (clobber (match_scratch:DI 3 "=r,r"))]
7491 [(set_attr "type" "delayed_compare")
7492 (set_attr "length" "4,8")])
7495 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7496 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7497 (match_operand:SI 2 "reg_or_cint_operand" ""))
7499 (clobber (match_scratch:DI 3 ""))]
7500 "TARGET_POWERPC64 && reload_completed"
7502 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7504 (compare:CC (match_dup 3)
7508 (define_insn "*ashrdi3_internal3"
7509 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7510 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
7511 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
7513 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7514 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7519 [(set_attr "type" "delayed_compare")
7520 (set_attr "length" "4,8")])
7523 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7524 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
7525 (match_operand:SI 2 "reg_or_cint_operand" ""))
7527 (set (match_operand:DI 0 "gpc_reg_operand" "")
7528 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
7529 "TARGET_POWERPC64 && reload_completed"
7531 (ashiftrt:DI (match_dup 1) (match_dup 2)))
7533 (compare:CC (match_dup 0)
7537 (define_insn "anddi3"
7538 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
7539 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
7540 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
7541 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
7545 rldic%B2 %0,%1,0,%S2
7549 [(set_attr "length" "4,4,4,4,8")])
7552 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7553 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7554 (match_operand:DI 2 "mask64_2_operand" "")))
7555 (clobber (match_scratch:CC 3 ""))]
7557 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7558 && !mask64_operand (operands[2], DImode)"
7560 (and:DI (rotate:DI (match_dup 1)
7564 (and:DI (rotate:DI (match_dup 0)
7569 build_mask64_2_operands (operands[2], &operands[4]);
7572 (define_insn "*anddi3_internal2"
7573 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7574 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7575 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7577 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
7578 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7582 rldic%B2. %3,%1,0,%S2
7591 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7592 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7595 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7596 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7597 (match_operand:DI 2 "and64_operand" ""))
7599 (clobber (match_scratch:DI 3 ""))
7600 (clobber (match_scratch:CC 4 ""))]
7601 "TARGET_POWERPC64 && reload_completed"
7602 [(parallel [(set (match_dup 3)
7603 (and:DI (match_dup 1)
7605 (clobber (match_dup 4))])
7607 (compare:CC (match_dup 3)
7612 [(set (match_operand:CC 0 "cc_reg_operand" "")
7613 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7614 (match_operand:DI 2 "mask64_2_operand" ""))
7616 (clobber (match_scratch:DI 3 ""))
7617 (clobber (match_scratch:CC 4 ""))]
7618 "TARGET_POWERPC64 && reload_completed
7619 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7620 && !mask64_operand (operands[2], DImode)"
7622 (and:DI (rotate:DI (match_dup 1)
7625 (parallel [(set (match_dup 0)
7626 (compare:CC (and:DI (rotate:DI (match_dup 3)
7630 (clobber (match_dup 3))])]
7633 build_mask64_2_operands (operands[2], &operands[5]);
7636 (define_insn "*anddi3_internal3"
7637 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7638 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7639 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7641 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7642 (and:DI (match_dup 1) (match_dup 2)))
7643 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7647 rldic%B2. %0,%1,0,%S2
7656 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7657 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7660 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7661 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7662 (match_operand:DI 2 "and64_operand" ""))
7664 (set (match_operand:DI 0 "gpc_reg_operand" "")
7665 (and:DI (match_dup 1) (match_dup 2)))
7666 (clobber (match_scratch:CC 4 ""))]
7667 "TARGET_POWERPC64 && reload_completed"
7668 [(parallel [(set (match_dup 0)
7669 (and:DI (match_dup 1) (match_dup 2)))
7670 (clobber (match_dup 4))])
7672 (compare:CC (match_dup 0)
7677 [(set (match_operand:CC 3 "cc_reg_operand" "")
7678 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7679 (match_operand:DI 2 "mask64_2_operand" ""))
7681 (set (match_operand:DI 0 "gpc_reg_operand" "")
7682 (and:DI (match_dup 1) (match_dup 2)))
7683 (clobber (match_scratch:CC 4 ""))]
7684 "TARGET_POWERPC64 && reload_completed
7685 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7686 && !mask64_operand (operands[2], DImode)"
7688 (and:DI (rotate:DI (match_dup 1)
7691 (parallel [(set (match_dup 3)
7692 (compare:CC (and:DI (rotate:DI (match_dup 0)
7697 (and:DI (rotate:DI (match_dup 0)
7702 build_mask64_2_operands (operands[2], &operands[5]);
7705 (define_expand "iordi3"
7706 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7707 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7708 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7712 if (non_logical_cint_operand (operands[2], DImode))
7714 HOST_WIDE_INT value;
7715 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7716 ? operands[0] : gen_reg_rtx (DImode));
7718 if (GET_CODE (operands[2]) == CONST_INT)
7720 value = INTVAL (operands[2]);
7721 emit_insn (gen_iordi3 (tmp, operands[1],
7722 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7726 value = CONST_DOUBLE_LOW (operands[2]);
7727 emit_insn (gen_iordi3 (tmp, operands[1],
7728 immed_double_const (value
7729 & (~ (HOST_WIDE_INT) 0xffff),
7733 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7738 (define_expand "xordi3"
7739 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7740 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7741 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7745 if (non_logical_cint_operand (operands[2], DImode))
7747 HOST_WIDE_INT value;
7748 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7749 ? operands[0] : gen_reg_rtx (DImode));
7751 if (GET_CODE (operands[2]) == CONST_INT)
7753 value = INTVAL (operands[2]);
7754 emit_insn (gen_xordi3 (tmp, operands[1],
7755 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7759 value = CONST_DOUBLE_LOW (operands[2]);
7760 emit_insn (gen_xordi3 (tmp, operands[1],
7761 immed_double_const (value
7762 & (~ (HOST_WIDE_INT) 0xffff),
7766 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7771 (define_insn "*booldi3_internal1"
7772 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7773 (match_operator:DI 3 "boolean_or_operator"
7774 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7775 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7782 (define_insn "*booldi3_internal2"
7783 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7784 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7785 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7786 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7788 (clobber (match_scratch:DI 3 "=r,r"))]
7793 [(set_attr "type" "compare")
7794 (set_attr "length" "4,8")])
7797 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7798 (compare:CC (match_operator:DI 4 "boolean_operator"
7799 [(match_operand:DI 1 "gpc_reg_operand" "")
7800 (match_operand:DI 2 "gpc_reg_operand" "")])
7802 (clobber (match_scratch:DI 3 ""))]
7803 "TARGET_POWERPC64 && reload_completed"
7804 [(set (match_dup 3) (match_dup 4))
7806 (compare:CC (match_dup 3)
7810 (define_insn "*booldi3_internal3"
7811 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7812 (compare:CC (match_operator:DI 4 "boolean_operator"
7813 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7814 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7816 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7822 [(set_attr "type" "compare")
7823 (set_attr "length" "4,8")])
7826 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7827 (compare:CC (match_operator:DI 4 "boolean_operator"
7828 [(match_operand:DI 1 "gpc_reg_operand" "")
7829 (match_operand:DI 2 "gpc_reg_operand" "")])
7831 (set (match_operand:DI 0 "gpc_reg_operand" "")
7833 "TARGET_POWERPC64 && reload_completed"
7834 [(set (match_dup 0) (match_dup 4))
7836 (compare:CC (match_dup 0)
7840 ;; Split an logical operation that we can't do in one insn into two insns,
7841 ;; each of which does one 16-bit part. This is used by combine.
7844 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7845 (match_operator:DI 3 "boolean_or_operator"
7846 [(match_operand:DI 1 "gpc_reg_operand" "")
7847 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7849 [(set (match_dup 0) (match_dup 4))
7850 (set (match_dup 0) (match_dup 5))]
7855 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7857 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7858 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7860 i4 = GEN_INT (value & 0xffff);
7864 i3 = GEN_INT (INTVAL (operands[2])
7865 & (~ (HOST_WIDE_INT) 0xffff));
7866 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7868 operands[4] = gen_rtx (GET_CODE (operands[3]), DImode,
7870 operands[5] = gen_rtx (GET_CODE (operands[3]), DImode,
7874 (define_insn "*boolcdi3_internal1"
7875 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7876 (match_operator:DI 3 "boolean_operator"
7877 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7878 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7882 (define_insn "*boolcdi3_internal2"
7883 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7884 (compare:CC (match_operator:DI 4 "boolean_operator"
7885 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7886 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7888 (clobber (match_scratch:DI 3 "=r,r"))]
7893 [(set_attr "type" "compare")
7894 (set_attr "length" "4,8")])
7897 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7898 (compare:CC (match_operator:DI 4 "boolean_operator"
7899 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7900 (match_operand:DI 2 "gpc_reg_operand" "")])
7902 (clobber (match_scratch:DI 3 ""))]
7903 "TARGET_POWERPC64 && reload_completed"
7904 [(set (match_dup 3) (match_dup 4))
7906 (compare:CC (match_dup 3)
7910 (define_insn "*boolcdi3_internal3"
7911 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7912 (compare:CC (match_operator:DI 4 "boolean_operator"
7913 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7914 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7916 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7922 [(set_attr "type" "compare")
7923 (set_attr "length" "4,8")])
7926 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7927 (compare:CC (match_operator:DI 4 "boolean_operator"
7928 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7929 (match_operand:DI 2 "gpc_reg_operand" "")])
7931 (set (match_operand:DI 0 "gpc_reg_operand" "")
7933 "TARGET_POWERPC64 && reload_completed"
7934 [(set (match_dup 0) (match_dup 4))
7936 (compare:CC (match_dup 0)
7940 (define_insn "*boolccdi3_internal1"
7941 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7942 (match_operator:DI 3 "boolean_operator"
7943 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7944 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7948 (define_insn "*boolccdi3_internal2"
7949 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7950 (compare:CC (match_operator:DI 4 "boolean_operator"
7951 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7952 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7954 (clobber (match_scratch:DI 3 "=r,r"))]
7959 [(set_attr "type" "compare")
7960 (set_attr "length" "4,8")])
7963 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7964 (compare:CC (match_operator:DI 4 "boolean_operator"
7965 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7966 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7968 (clobber (match_scratch:DI 3 ""))]
7969 "TARGET_POWERPC64 && reload_completed"
7970 [(set (match_dup 3) (match_dup 4))
7972 (compare:CC (match_dup 3)
7976 (define_insn "*boolccdi3_internal3"
7977 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7978 (compare:CC (match_operator:DI 4 "boolean_operator"
7979 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7980 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7982 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7988 [(set_attr "type" "compare")
7989 (set_attr "length" "4,8")])
7992 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7993 (compare:CC (match_operator:DI 4 "boolean_operator"
7994 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7995 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7997 (set (match_operand:DI 0 "gpc_reg_operand" "")
7999 "TARGET_POWERPC64 && reload_completed"
8000 [(set (match_dup 0) (match_dup 4))
8002 (compare:CC (match_dup 0)
8006 ;; Now define ways of moving data around.
8008 ;; Elf specific ways of loading addresses for non-PIC code.
8009 ;; The output of this could be r0, but we make a very strong
8010 ;; preference for a base register because it will usually
8012 (define_insn "elf_high"
8013 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
8014 (high:SI (match_operand 1 "" "")))]
8015 "TARGET_ELF && ! TARGET_64BIT"
8016 "{liu|lis} %0,%1@ha")
8018 (define_insn "elf_low"
8019 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8020 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
8021 (match_operand 2 "" "")))]
8022 "TARGET_ELF && ! TARGET_64BIT"
8024 {cal|la} %0,%2@l(%1)
8025 {ai|addic} %0,%1,%K2")
8027 ;; Mach-O PIC trickery.
8028 (define_insn "macho_high"
8029 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
8030 (high:SI (match_operand 1 "" "")))]
8031 "TARGET_MACHO && ! TARGET_64BIT"
8032 "{liu|lis} %0,ha16(%1)")
8034 (define_insn "macho_low"
8035 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8036 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
8037 (match_operand 2 "" "")))]
8038 "TARGET_MACHO && ! TARGET_64BIT"
8040 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
8041 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
8043 ;; Set up a register with a value from the GOT table
8045 (define_expand "movsi_got"
8046 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8047 (unspec:SI [(match_operand:SI 1 "got_operand" "")
8049 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8052 if (GET_CODE (operands[1]) == CONST)
8054 rtx offset = const0_rtx;
8055 HOST_WIDE_INT value;
8057 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
8058 value = INTVAL (offset);
8061 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
8062 emit_insn (gen_movsi_got (tmp, operands[1]));
8063 emit_insn (gen_addsi3 (operands[0], tmp, offset));
8068 operands[2] = rs6000_got_register (operands[1]);
8071 (define_insn "*movsi_got_internal"
8072 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8073 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8074 (match_operand:SI 2 "gpc_reg_operand" "b")] 8))]
8075 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
8076 "{l|lwz} %0,%a1@got(%2)"
8077 [(set_attr "type" "load")])
8079 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
8080 ;; didn't get allocated to a hard register.
8082 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8083 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
8084 (match_operand:SI 2 "memory_operand" "")] 8))]
8085 "DEFAULT_ABI == ABI_V4
8087 && (reload_in_progress || reload_completed)"
8088 [(set (match_dup 0) (match_dup 2))
8089 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)] 8))]
8092 ;; For SI, we special-case integers that can't be loaded in one insn. We
8093 ;; do the load 16-bits at a time. We could do this by loading from memory,
8094 ;; and this is even supposed to be faster, but it is simpler not to get
8095 ;; integers in the TOC.
8096 (define_expand "movsi"
8097 [(set (match_operand:SI 0 "general_operand" "")
8098 (match_operand:SI 1 "any_operand" ""))]
8100 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
8102 (define_insn "movsi_low"
8103 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8104 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8105 (match_operand 2 "" ""))))]
8106 "TARGET_MACHO && ! TARGET_64BIT"
8107 "{l|lwz} %0,lo16(%2)(%1)"
8108 [(set_attr "type" "load")
8109 (set_attr "length" "4")])
8111 (define_insn "movsi_low_st"
8112 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8113 (match_operand 2 "" "")))
8114 (match_operand:SI 0 "gpc_reg_operand" "r"))]
8115 "TARGET_MACHO && ! TARGET_64BIT"
8116 "{st|stw} %0,lo16(%2)(%1)"
8117 [(set_attr "type" "store")
8118 (set_attr "length" "4")])
8120 (define_insn "movdf_low"
8121 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
8122 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
8123 (match_operand 2 "" ""))))]
8124 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8127 switch (which_alternative)
8130 return \"lfd %0,lo16(%2)(%1)\";
8134 operands2[0] = operands[0];
8135 operands2[1] = operands[1];
8136 operands2[2] = operands[2];
8137 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
8138 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
8139 /* We cannot rely on ha16(low half)==ha16(high half), alas,
8140 although in practice it almost always is. */
8141 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
8142 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
8148 [(set_attr "type" "load")
8149 (set_attr "length" "4,12")])
8151 (define_insn "movdf_low_st"
8152 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
8153 (match_operand 2 "" "")))
8154 (match_operand:DF 0 "gpc_reg_operand" "f"))]
8155 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8156 "stfd %0,lo16(%2)(%1)"
8157 [(set_attr "type" "store")
8158 (set_attr "length" "4")])
8160 (define_insn "movsf_low"
8161 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
8162 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
8163 (match_operand 2 "" ""))))]
8164 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8167 {l|lwz} %0,lo16(%2)(%1)"
8168 [(set_attr "type" "load")
8169 (set_attr "length" "4")])
8171 (define_insn "movsf_low_st"
8172 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
8173 (match_operand 2 "" "")))
8174 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
8175 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
8177 stfs %0,lo16(%2)(%1)
8178 {st|stw} %0,lo16(%2)(%1)"
8179 [(set_attr "type" "store")
8180 (set_attr "length" "4")])
8182 (define_insn "*movsi_internal1"
8183 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
8184 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
8185 "gpc_reg_operand (operands[0], SImode)
8186 || gpc_reg_operand (operands[1], SImode)"
8190 {l%U1%X1|lwz%U1%X1} %0,%1
8191 {st%U0%X0|stw%U0%X0} %1,%0
8201 [(set_attr "type" "*,*,load,store,*,*,*,*,*,*,mtjmpr,*,*")
8202 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
8204 ;; Split a load of a large constant into the appropriate two-insn
8208 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8209 (match_operand:SI 1 "const_int_operand" ""))]
8210 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
8211 && (INTVAL (operands[1]) & 0xffff) != 0"
8215 (ior:SI (match_dup 0)
8219 operands[2] = GEN_INT (INTVAL (operands[1]) & (~ (HOST_WIDE_INT) 0xffff));
8220 operands[3] = GEN_INT (INTVAL (operands[1]) & 0xffff);
8223 (define_insn "*movsi_internal2"
8224 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
8225 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r,r")
8227 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
8228 "! TARGET_POWERPC64"
8232 [(set_attr "type" "compare")
8233 (set_attr "length" "4,8")])
8236 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8237 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8239 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
8240 "! TARGET_POWERPC64 && reload_completed"
8241 [(set (match_dup 0) (match_dup 1))
8243 (compare:CC (match_dup 0)
8247 (define_expand "movhi"
8248 [(set (match_operand:HI 0 "general_operand" "")
8249 (match_operand:HI 1 "any_operand" ""))]
8251 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
8254 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8255 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8256 "gpc_reg_operand (operands[0], HImode)
8257 || gpc_reg_operand (operands[1], HImode)"
8267 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
8269 (define_expand "movqi"
8270 [(set (match_operand:QI 0 "general_operand" "")
8271 (match_operand:QI 1 "any_operand" ""))]
8273 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
8276 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
8277 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
8278 "gpc_reg_operand (operands[0], QImode)
8279 || gpc_reg_operand (operands[1], QImode)"
8289 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
8291 ;; Here is how to move condition codes around. When we store CC data in
8292 ;; an integer register or memory, we store just the high-order 4 bits.
8293 ;; This lets us not shift in the most common case of CR0.
8294 (define_expand "movcc"
8295 [(set (match_operand:CC 0 "nonimmediate_operand" "")
8296 (match_operand:CC 1 "nonimmediate_operand" ""))]
8300 (define_insn "*movcc_internal1"
8301 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
8302 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
8303 "register_operand (operands[0], CCmode)
8304 || register_operand (operands[1], CCmode)"
8308 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
8310 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
8312 {l%U1%X1|lwz%U1%X1} %0,%1
8313 {st%U0%U1|stw%U0%U1} %1,%0"
8314 [(set_attr "type" "cr_logical,cr_logical,cr_logical,cr_logical,cr_logical,*,load,store")
8315 (set_attr "length" "*,*,12,*,8,*,*,*")])
8317 ;; For floating-point, we normally deal with the floating-point registers
8318 ;; unless -msoft-float is used. The sole exception is that parameter passing
8319 ;; can produce floating-point values in fixed-point registers. Unless the
8320 ;; value is a simple constant or already in memory, we deal with this by
8321 ;; allocating memory and copying the value explicitly via that memory location.
8322 (define_expand "movsf"
8323 [(set (match_operand:SF 0 "nonimmediate_operand" "")
8324 (match_operand:SF 1 "any_operand" ""))]
8326 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
8329 [(set (match_operand:SF 0 "gpc_reg_operand" "")
8330 (match_operand:SF 1 "const_double_operand" ""))]
8332 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8333 || (GET_CODE (operands[0]) == SUBREG
8334 && GET_CODE (SUBREG_REG (operands[0])) == REG
8335 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8336 [(set (match_dup 2) (match_dup 3))]
8342 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8343 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
8345 if (! TARGET_POWERPC64)
8346 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
8348 operands[2] = gen_lowpart (SImode, operands[0]);
8350 operands[3] = gen_int_mode (l, SImode);
8353 (define_insn "*movsf_hardfloat"
8354 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!r,!r")
8355 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,G,Fn"))]
8356 "(gpc_reg_operand (operands[0], SFmode)
8357 || gpc_reg_operand (operands[1], SFmode))
8358 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
8361 {l%U1%X1|lwz%U1%X1} %0,%1
8362 {st%U0%X0|stw%U0%X0} %1,%0
8368 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*")
8369 (set_attr "length" "4,4,4,4,4,4,4,8")])
8371 (define_insn "*movsf_softfloat"
8372 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
8373 (match_operand:SF 1 "input_operand" "r,m,r,I,L,R,G,Fn"))]
8374 "(gpc_reg_operand (operands[0], SFmode)
8375 || gpc_reg_operand (operands[1], SFmode))
8376 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
8379 {l%U1%X1|lwz%U1%X1} %0,%1
8380 {st%U0%X0|stw%U0%X0} %1,%0
8386 [(set_attr "type" "*,load,store,*,*,*,*,*")
8387 (set_attr "length" "4,4,4,4,4,4,4,8")])
8390 (define_expand "movdf"
8391 [(set (match_operand:DF 0 "nonimmediate_operand" "")
8392 (match_operand:DF 1 "any_operand" ""))]
8394 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
8397 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8398 (match_operand:DF 1 "const_int_operand" ""))]
8399 "! TARGET_POWERPC64 && reload_completed
8400 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8401 || (GET_CODE (operands[0]) == SUBREG
8402 && GET_CODE (SUBREG_REG (operands[0])) == REG
8403 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8404 [(set (match_dup 2) (match_dup 4))
8405 (set (match_dup 3) (match_dup 1))]
8408 int endian = (WORDS_BIG_ENDIAN == 0);
8409 HOST_WIDE_INT value = INTVAL (operands[1]);
8411 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8412 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8413 #if HOST_BITS_PER_WIDE_INT == 32
8414 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8416 operands[4] = GEN_INT (value >> 32);
8417 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8422 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8423 (match_operand:DF 1 "const_double_operand" ""))]
8424 "! TARGET_POWERPC64 && reload_completed
8425 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8426 || (GET_CODE (operands[0]) == SUBREG
8427 && GET_CODE (SUBREG_REG (operands[0])) == REG
8428 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8429 [(set (match_dup 2) (match_dup 4))
8430 (set (match_dup 3) (match_dup 5))]
8433 int endian = (WORDS_BIG_ENDIAN == 0);
8437 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8438 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8440 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
8441 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
8442 operands[4] = gen_int_mode (l[endian], SImode);
8443 operands[5] = gen_int_mode (l[1 - endian], SImode);
8447 [(set (match_operand:DF 0 "gpc_reg_operand" "")
8448 (match_operand:DF 1 "easy_fp_constant" ""))]
8449 "TARGET_POWERPC64 && reload_completed
8450 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8451 || (GET_CODE (operands[0]) == SUBREG
8452 && GET_CODE (SUBREG_REG (operands[0])) == REG
8453 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8454 [(set (match_dup 2) (match_dup 3))]
8457 int endian = (WORDS_BIG_ENDIAN == 0);
8462 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8463 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
8465 operands[2] = gen_lowpart (DImode, operands[0]);
8466 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
8467 #if HOST_BITS_PER_WIDE_INT >= 64
8468 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32 |
8469 ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
8471 operands[3] = immed_double_const (val, -(val < 0), DImode);
8473 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
8477 ;; Don't have reload use general registers to load a constant. First,
8478 ;; it might not work if the output operand is the equivalent of
8479 ;; a non-offsettable memref, but also it is less efficient than loading
8480 ;; the constant into an FP register, since it will probably be used there.
8481 ;; The "??" is a kludge until we can figure out a more reasonable way
8482 ;; of handling these non-offsettable values.
8483 (define_insn "*movdf_hardfloat32"
8484 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,!r,!r,!r,f,f,m")
8485 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F,f,m,f"))]
8486 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8487 && (gpc_reg_operand (operands[0], DFmode)
8488 || gpc_reg_operand (operands[1], DFmode))"
8491 switch (which_alternative)
8496 /* We normally copy the low-numbered register first. However, if
8497 the first register operand 0 is the same as the second register
8498 of operand 1, we must copy in the opposite order. */
8499 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8500 return \"mr %L0,%L1\;mr %0,%1\";
8502 return \"mr %0,%1\;mr %L0,%L1\";
8504 if (offsettable_memref_p (operands[1])
8505 || (GET_CODE (operands[1]) == MEM
8506 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
8507 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
8508 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
8510 /* If the low-address word is used in the address, we must load
8511 it last. Otherwise, load it first. Note that we cannot have
8512 auto-increment in that case since the address register is
8513 known to be dead. */
8514 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8516 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8518 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8524 addreg = find_addr_reg (XEXP (operands[1], 0));
8525 if (refers_to_regno_p (REGNO (operands[0]),
8526 REGNO (operands[0]) + 1,
8529 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8530 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8531 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8532 return \"{lx|lwzx} %0,%1\";
8536 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
8537 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8538 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
8539 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8544 if (offsettable_memref_p (operands[0])
8545 || (GET_CODE (operands[0]) == MEM
8546 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
8547 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
8548 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
8549 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8554 addreg = find_addr_reg (XEXP (operands[0], 0));
8555 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
8556 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
8557 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
8558 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
8566 return \"fmr %0,%1\";
8568 return \"lfd%U1%X1 %0,%1\";
8570 return \"stfd%U0%X0 %1,%0\";
8573 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
8574 (set_attr "length" "8,16,16,8,12,16,*,*,*")])
8576 (define_insn "*movdf_softfloat32"
8577 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8578 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8579 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8580 && (gpc_reg_operand (operands[0], DFmode)
8581 || gpc_reg_operand (operands[1], DFmode))"
8584 switch (which_alternative)
8589 /* We normally copy the low-numbered register first. However, if
8590 the first register operand 0 is the same as the second register of
8591 operand 1, we must copy in the opposite order. */
8592 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8593 return \"mr %L0,%L1\;mr %0,%1\";
8595 return \"mr %0,%1\;mr %L0,%L1\";
8597 /* If the low-address word is used in the address, we must load
8598 it last. Otherwise, load it first. Note that we cannot have
8599 auto-increment in that case since the address register is
8600 known to be dead. */
8601 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8603 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8605 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8607 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8614 [(set_attr "type" "*,load,store,*,*,*")
8615 (set_attr "length" "8,8,8,8,12,16")])
8617 (define_insn "*movdf_hardfloat64"
8618 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,!r,!r,!r,f,f,m")
8619 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F,f,m,f"))]
8620 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8621 && (gpc_reg_operand (operands[0], DFmode)
8622 || gpc_reg_operand (operands[1], DFmode))"
8633 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
8634 (set_attr "length" "4,4,4,8,12,16,4,4,4")])
8636 (define_insn "*movdf_softfloat64"
8637 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
8638 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
8639 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8640 && (gpc_reg_operand (operands[0], DFmode)
8641 || gpc_reg_operand (operands[1], DFmode))"
8649 [(set_attr "type" "*,load,store,*,*,*")
8650 (set_attr "length" "*,*,*,8,12,16")])
8652 (define_expand "movtf"
8653 [(set (match_operand:TF 0 "general_operand" "")
8654 (match_operand:TF 1 "any_operand" ""))]
8655 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8656 && TARGET_LONG_DOUBLE_128"
8657 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8659 (define_insn "*movtf_internal"
8660 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,m,!r,!r,!r")
8661 (match_operand:TF 1 "input_operand" "f,m,f,G,H,F"))]
8662 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8663 && TARGET_LONG_DOUBLE_128
8664 && (gpc_reg_operand (operands[0], TFmode)
8665 || gpc_reg_operand (operands[1], TFmode))"
8668 switch (which_alternative)
8673 /* We normally copy the low-numbered register first. However, if
8674 the first register operand 0 is the same as the second register of
8675 operand 1, we must copy in the opposite order. */
8676 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8677 return \"fmr %L0,%L1\;fmr %0,%1\";
8679 return \"fmr %0,%1\;fmr %L0,%L1\";
8681 return \"lfd %0,%1\;lfd %L0,%L1\";
8683 return \"stfd %1,%0\;stfd %L1,%L0\";
8690 [(set_attr "type" "fp,fpload,fpstore,*,*,*")
8691 (set_attr "length" "8,8,8,12,16,20")])
8694 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8695 (match_operand:TF 1 "const_double_operand" ""))]
8696 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8697 && TARGET_LONG_DOUBLE_128"
8698 [(set (match_dup 3) (match_dup 1))
8700 (float_extend:TF (match_dup 3)))]
8703 operands[2] = operand_subword (operands[1], 0, 0, DFmode);
8704 operands[3] = gen_reg_rtx (DFmode);
8707 (define_insn_and_split "extenddftf2"
8708 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8709 (float_extend:TF (match_operand:DF 1 "gpc_reg_operand" "f")))]
8710 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8711 && TARGET_LONG_DOUBLE_128"
8714 [(set (match_dup 2) (match_dup 3))]
8717 operands[2] = gen_rtx_REG (DFmode, REGNO (operands[0] + 1));
8718 operands[3] = CONST0_RTX (DFmode);
8721 (define_insn_and_split "extendsftf2"
8722 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8723 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "f")))]
8724 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8725 && TARGET_LONG_DOUBLE_128"
8728 [(set (match_dup 2) (match_dup 3))]
8731 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0] + 1));
8732 operands[3] = CONST0_RTX (SFmode);
8735 (define_insn "trunctfdf2"
8736 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8737 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8738 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8739 && TARGET_LONG_DOUBLE_128"
8741 [(set_attr "type" "fp")
8742 (set_attr "length" "8")])
8744 (define_insn_and_split "trunctfsf2"
8745 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8746 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8747 (clobber (match_scratch:DF 2 "=f"))]
8748 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
8749 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8751 "&& reload_completed"
8753 (float_truncate:DF (match_dup 1)))
8755 (float_truncate:SF (match_dup 2)))]
8758 (define_insn_and_split "floatditf2"
8759 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8760 (float:TF (match_operand:DI 1 "gpc_reg_operand" "*f")))
8761 (clobber (match_scratch:DF 2 "=f"))]
8762 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8763 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8765 "&& reload_completed"
8767 (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))
8768 (set (match_operand:TF 0 "gpc_reg_operand" "")
8769 (float_extend:TF (match_dup 2)))]
8772 (define_insn_and_split "floatsitf2"
8773 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8774 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))
8775 (clobber (match_scratch:DF 2 "=f"))]
8776 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8777 && TARGET_LONG_DOUBLE_128"
8779 "&& reload_completed"
8781 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
8782 (set (match_operand:TF 0 "gpc_reg_operand" "")
8783 (float_extend:TF (match_dup 2)))]
8786 (define_insn_and_split "fix_trunctfdi2"
8787 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
8788 (fix:DI (match_operand:TF 1 "gpc_reg_operand" "f")))]
8789 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8790 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8792 "&& reload_completed"
8794 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
8795 (set (match_operand:DI 0 "gpc_reg_operand" "")
8796 (fix:SI (match_dup 2)))]
8799 (define_insn_and_split "fix_trunctfsi2"
8800 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8801 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))]
8802 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8803 && TARGET_LONG_DOUBLE_128"
8805 "&& reload_completed"
8807 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))
8808 (set (match_operand:SI 0 "gpc_reg_operand" "")
8809 (fix:SI (match_dup 2)))]
8812 (define_insn "negtf2"
8813 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8814 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8815 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8816 && TARGET_LONG_DOUBLE_128"
8819 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8820 return \"fneg %L0,%L1\;fneg %0,%1\";
8822 return \"fneg %0,%1\;fneg %L0,%L1\";
8824 [(set_attr "type" "fp")
8825 (set_attr "length" "8")])
8827 (define_insn "abstf2"
8828 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8829 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8830 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8831 && TARGET_LONG_DOUBLE_128"
8834 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8835 return \"fabs %L0,%L1\;fabs %0,%1\";
8837 return \"fabs %0,%1\;fabs %L0,%L1\";
8839 [(set_attr "type" "fp")
8840 (set_attr "length" "8")])
8843 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8844 (neg:TF (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f"))))]
8845 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8846 && TARGET_LONG_DOUBLE_128"
8849 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8850 return \"fnabs %L0,%L1\;fnabs %0,%1\";
8852 return \"fnabs %0,%1\;fnabs %L0,%L1\";
8854 [(set_attr "type" "fp")
8855 (set_attr "length" "8")])
8857 ;; Next come the multi-word integer load and store and the load and store
8859 (define_expand "movdi"
8860 [(set (match_operand:DI 0 "general_operand" "")
8861 (match_operand:DI 1 "any_operand" ""))]
8863 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8865 (define_insn "*movdi_internal32"
8866 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8867 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8869 && (gpc_reg_operand (operands[0], DImode)
8870 || gpc_reg_operand (operands[1], DImode))"
8873 switch (which_alternative)
8878 /* We normally copy the low-numbered register first. However, if
8879 the first register operand 0 is the same as the second register of
8880 operand 1, we must copy in the opposite order. */
8881 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8882 return \"mr %L0,%L1\;mr %0,%1\";
8884 return \"mr %0,%1\;mr %L0,%L1\";
8886 /* If the low-address word is used in the address, we must load it
8887 last. Otherwise, load it first. Note that we cannot have
8888 auto-increment in that case since the address register is known to be
8890 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8892 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8894 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8896 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8898 return \"fmr %0,%1\";
8900 return \"lfd%U1%X1 %0,%1\";
8902 return \"stfd%U0%X0 %1,%0\";
8911 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
8912 (set_attr "length" "8,8,8,*,*,*,8,12,8,12,16")])
8915 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8916 (match_operand:DI 1 "const_int_operand" ""))]
8917 "! TARGET_POWERPC64 && reload_completed"
8918 [(set (match_dup 2) (match_dup 4))
8919 (set (match_dup 3) (match_dup 1))]
8922 HOST_WIDE_INT value = INTVAL (operands[1]);
8923 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8925 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8927 #if HOST_BITS_PER_WIDE_INT == 32
8928 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8930 operands[4] = GEN_INT (value >> 32);
8931 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8936 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8937 (match_operand:DI 1 "const_double_operand" ""))]
8938 "HOST_BITS_PER_WIDE_INT == 32 && ! TARGET_POWERPC64 && reload_completed"
8939 [(set (match_dup 2) (match_dup 4))
8940 (set (match_dup 3) (match_dup 5))]
8943 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8945 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8947 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8948 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8951 (define_insn "*movdi_internal64"
8952 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
8953 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8955 && (gpc_reg_operand (operands[0], DImode)
8956 || gpc_reg_operand (operands[1], DImode))"
8971 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
8972 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8974 ;; immediate value valid for a single instruction hiding in a const_double
8976 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8977 (match_operand:DI 1 "const_double_operand" "F"))]
8978 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8979 && GET_CODE (operands[1]) == CONST_DOUBLE
8980 && num_insns_constant (operands[1], DImode) == 1"
8983 return ((unsigned HOST_WIDE_INT)
8984 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8985 ? \"li %0,%1\" : \"lis %0,%v1\";
8988 ;; Generate all one-bits and clear left or right.
8989 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8991 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8992 (match_operand:DI 1 "mask64_operand" ""))]
8993 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8994 [(set (match_dup 0) (const_int -1))
8996 (and:DI (rotate:DI (match_dup 0)
9001 ;; Split a load of a large constant into the appropriate five-instruction
9002 ;; sequence. Handle anything in a constant number of insns.
9003 ;; When non-easy constants can go in the TOC, this should use
9004 ;; easy_fp_constant predicate.
9006 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9007 (match_operand:DI 1 "const_int_operand" ""))]
9008 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9009 [(set (match_dup 0) (match_dup 2))
9010 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9012 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9014 if (tem == operands[0])
9021 [(set (match_operand:DI 0 "gpc_reg_operand" "")
9022 (match_operand:DI 1 "const_double_operand" ""))]
9023 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
9024 [(set (match_dup 0) (match_dup 2))
9025 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
9027 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
9029 if (tem == operands[0])
9035 ;; Split a load of a large constant into the appropriate five-instruction
9036 (define_insn "*movdi_internal2"
9037 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
9038 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r,r")
9040 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
9045 [(set_attr "type" "compare")
9046 (set_attr "length" "4,8")])
9049 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
9050 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
9052 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
9053 "TARGET_POWERPC64 && reload_completed"
9054 [(set (match_dup 0) (match_dup 1))
9056 (compare:CC (match_dup 0)
9060 ;; TImode is similar, except that we usually want to compute the address into
9061 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
9062 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
9063 (define_expand "movti"
9064 [(parallel [(set (match_operand:TI 0 "general_operand" "")
9065 (match_operand:TI 1 "general_operand" ""))
9066 (clobber (scratch:SI))])]
9067 "TARGET_STRING || TARGET_POWERPC64"
9068 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
9070 ;; We say that MQ is clobbered in the last alternative because the first
9071 ;; alternative would never get used otherwise since it would need a reload
9072 ;; while the 2nd alternative would not. We put memory cases first so they
9073 ;; are preferred. Otherwise, we'd try to reload the output instead of
9074 ;; giving the SCRATCH mq.
9075 (define_insn "*movti_power"
9076 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
9077 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
9078 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
9079 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9080 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9083 switch (which_alternative)
9089 return \"{stsi|stswi} %1,%P0,16\";
9092 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
9095 /* Normally copy registers with lowest numbered register copied first.
9096 But copy in the other order if the first register of the output
9097 is the second, third, or fourth register in the input. */
9098 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
9099 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
9100 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
9102 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
9104 /* If the address is not used in the output, we can use lsi. Otherwise,
9105 fall through to generating four loads. */
9106 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
9107 return \"{lsi|lswi} %0,%P1,16\";
9108 /* ... fall through ... */
9110 /* If the address register is the same as the register for the lowest-
9111 addressed word, load it last. Similarly for the next two words.
9112 Otherwise load lowest address to highest. */
9113 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9115 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
9116 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
9117 REGNO (operands[0]) + 2, operands[1], 0))
9118 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
9119 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
9120 REGNO (operands[0]) + 3, operands[1], 0))
9121 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
9123 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
9126 [(set_attr "type" "store,store,*,load,load")
9127 (set_attr "length" "*,16,16,*,16")])
9129 (define_insn "*movti_string"
9130 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
9131 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
9132 (clobber (match_scratch:SI 2 "=X,X,X"))]
9133 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9134 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
9137 switch (which_alternative)
9143 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
9146 /* Normally copy registers with lowest numbered register copied first.
9147 But copy in the other order if the first register of the output
9148 is the second, third, or fourth register in the input. */
9149 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
9150 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
9151 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
9153 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
9155 /* If the address register is the same as the register for the lowest-
9156 addressed word, load it last. Similarly for the next two words.
9157 Otherwise load lowest address to highest. */
9158 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9160 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
9161 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
9162 REGNO (operands[0]) + 2, operands[1], 0))
9163 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
9164 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
9165 REGNO (operands[0]) + 3, operands[1], 0))
9166 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
9168 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
9171 [(set_attr "type" "store,*,load")
9172 (set_attr "length" "16,16,16")])
9174 (define_insn "*movti_ppc64"
9175 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
9176 (match_operand:TI 1 "input_operand" "r,m,r"))]
9177 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
9178 || gpc_reg_operand (operands[1], TImode))"
9181 switch (which_alternative)
9186 /* We normally copy the low-numbered register first. However, if
9187 the first register operand 0 is the same as the second register of
9188 operand 1, we must copy in the opposite order. */
9189 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
9190 return \"mr %L0,%L1\;mr %0,%1\";
9192 return \"mr %0,%1\;mr %L0,%L1\";
9194 /* If the low-address word is used in the address, we must load it
9195 last. Otherwise, load it first. Note that we cannot have
9196 auto-increment in that case since the address register is known to be
9198 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
9200 return \"ld %L0,%L1\;ld %0,%1\";
9202 return \"ld%U1 %0,%1\;ld %L0,%L1\";
9204 return \"std%U0 %1,%0\;std %L1,%L0\";
9207 [(set_attr "type" "*,load,store")
9208 (set_attr "length" "8,8,8")])
9210 (define_expand "load_multiple"
9211 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9212 (match_operand:SI 1 "" ""))
9213 (use (match_operand:SI 2 "" ""))])]
9214 "TARGET_STRING && !TARGET_POWERPC64"
9222 /* Support only loading a constant number of fixed-point registers from
9223 memory and only bother with this if more than two; the machine
9224 doesn't support more than eight. */
9225 if (GET_CODE (operands[2]) != CONST_INT
9226 || INTVAL (operands[2]) <= 2
9227 || INTVAL (operands[2]) > 8
9228 || GET_CODE (operands[1]) != MEM
9229 || GET_CODE (operands[0]) != REG
9230 || REGNO (operands[0]) >= 32)
9233 count = INTVAL (operands[2]);
9234 regno = REGNO (operands[0]);
9236 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
9237 op1 = replace_equiv_address (operands[1],
9238 force_reg (SImode, XEXP (operands[1], 0)));
9240 for (i = 0; i < count; i++)
9241 XVECEXP (operands[3], 0, i)
9242 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
9243 adjust_address (op1, SImode, i * 4));
9247 [(match_parallel 0 "load_multiple_operation"
9248 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
9249 (mem:SI (match_operand:SI 2 "gpc_reg_operand" "b")))])]
9253 /* We have to handle the case where the pseudo used to contain the address
9254 is assigned to one of the output registers. */
9256 int words = XVECLEN (operands[0], 0);
9259 if (XVECLEN (operands[0], 0) == 1)
9260 return \"{l|lwz} %1,0(%2)\";
9262 for (i = 0; i < words; i++)
9263 if (refers_to_regno_p (REGNO (operands[1]) + i,
9264 REGNO (operands[1]) + i + 1, operands[2], 0))
9268 xop[0] = operands[1];
9269 xop[1] = operands[2];
9270 xop[2] = GEN_INT (4 * (words-1));
9271 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
9276 xop[0] = operands[1];
9277 xop[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
9278 xop[2] = GEN_INT (4 * (words-1));
9279 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
9284 for (j = 0; j < words; j++)
9287 xop[0] = gen_rtx_REG (SImode, REGNO (operands[1]) + j);
9288 xop[1] = operands[2];
9289 xop[2] = GEN_INT (j * 4);
9290 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
9292 xop[0] = operands[2];
9293 xop[1] = GEN_INT (i * 4);
9294 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
9299 return \"{lsi|lswi} %1,%2,%N0\";
9301 [(set_attr "type" "load")
9302 (set_attr "length" "32")])
9305 (define_expand "store_multiple"
9306 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
9307 (match_operand:SI 1 "" ""))
9308 (clobber (scratch:SI))
9309 (use (match_operand:SI 2 "" ""))])]
9310 "TARGET_STRING && !TARGET_POWERPC64"
9319 /* Support only storing a constant number of fixed-point registers to
9320 memory and only bother with this if more than two; the machine
9321 doesn't support more than eight. */
9322 if (GET_CODE (operands[2]) != CONST_INT
9323 || INTVAL (operands[2]) <= 2
9324 || INTVAL (operands[2]) > 8
9325 || GET_CODE (operands[0]) != MEM
9326 || GET_CODE (operands[1]) != REG
9327 || REGNO (operands[1]) >= 32)
9330 count = INTVAL (operands[2]);
9331 regno = REGNO (operands[1]);
9333 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
9334 to = force_reg (SImode, XEXP (operands[0], 0));
9335 op0 = replace_equiv_address (operands[0], to);
9337 XVECEXP (operands[3], 0, 0)
9338 = gen_rtx_SET (VOIDmode, adjust_address (op0, SImode, 0), operands[1]);
9339 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
9340 gen_rtx_SCRATCH (SImode));
9342 for (i = 1; i < count; i++)
9343 XVECEXP (operands[3], 0, i + 1)
9344 = gen_rtx_SET (VOIDmode,
9345 adjust_address (op0, SImode, i * 4),
9346 gen_rtx_REG (SImode, regno + i));
9350 [(match_parallel 0 "store_multiple_operation"
9351 [(set (match_operand:SI 1 "indirect_operand" "=Q")
9352 (match_operand:SI 2 "gpc_reg_operand" "r"))
9353 (clobber (match_scratch:SI 3 "=q"))])]
9354 "TARGET_STRING && TARGET_POWER"
9355 "{stsi|stswi} %2,%P1,%O0"
9356 [(set_attr "type" "store")])
9359 [(match_parallel 0 "store_multiple_operation"
9360 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
9361 (match_operand:SI 2 "gpc_reg_operand" "r"))
9362 (clobber (match_scratch:SI 3 "X"))])]
9363 "TARGET_STRING && ! TARGET_POWER"
9364 "{stsi|stswi} %2,%1,%O0"
9365 [(set_attr "type" "store")])
9368 ;; String/block move insn.
9369 ;; Argument 0 is the destination
9370 ;; Argument 1 is the source
9371 ;; Argument 2 is the length
9372 ;; Argument 3 is the alignment
9374 (define_expand "movstrsi"
9375 [(parallel [(set (match_operand:BLK 0 "" "")
9376 (match_operand:BLK 1 "" ""))
9377 (use (match_operand:SI 2 "" ""))
9378 (use (match_operand:SI 3 "" ""))])]
9382 if (expand_block_move (operands))
9388 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9389 ;; register allocator doesn't have a clue about allocating 8 word registers.
9390 ;; rD/rS = r5 is preferred, efficient form.
9391 (define_expand "movstrsi_8reg"
9392 [(parallel [(set (match_operand 0 "" "")
9393 (match_operand 1 "" ""))
9394 (use (match_operand 2 "" ""))
9395 (use (match_operand 3 "" ""))
9396 (clobber (reg:SI 5))
9397 (clobber (reg:SI 6))
9398 (clobber (reg:SI 7))
9399 (clobber (reg:SI 8))
9400 (clobber (reg:SI 9))
9401 (clobber (reg:SI 10))
9402 (clobber (reg:SI 11))
9403 (clobber (reg:SI 12))
9404 (clobber (match_scratch:SI 4 ""))])]
9409 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9410 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9411 (use (match_operand:SI 2 "immediate_operand" "i"))
9412 (use (match_operand:SI 3 "immediate_operand" "i"))
9413 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9414 (clobber (reg:SI 6))
9415 (clobber (reg:SI 7))
9416 (clobber (reg:SI 8))
9417 (clobber (reg:SI 9))
9418 (clobber (reg:SI 10))
9419 (clobber (reg:SI 11))
9420 (clobber (reg:SI 12))
9421 (clobber (match_scratch:SI 5 "=q"))]
9422 "TARGET_STRING && TARGET_POWER
9423 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9424 || INTVAL (operands[2]) == 0)
9425 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9426 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9427 && REGNO (operands[4]) == 5"
9428 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9429 [(set_attr "type" "load")
9430 (set_attr "length" "8")])
9433 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9434 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9435 (use (match_operand:SI 2 "immediate_operand" "i"))
9436 (use (match_operand:SI 3 "immediate_operand" "i"))
9437 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9438 (clobber (reg:SI 6))
9439 (clobber (reg:SI 7))
9440 (clobber (reg:SI 8))
9441 (clobber (reg:SI 9))
9442 (clobber (reg:SI 10))
9443 (clobber (reg:SI 11))
9444 (clobber (reg:SI 12))
9445 (clobber (match_scratch:SI 5 "X"))]
9446 "TARGET_STRING && ! TARGET_POWER
9447 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9448 || INTVAL (operands[2]) == 0)
9449 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9450 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9451 && REGNO (operands[4]) == 5"
9452 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9453 [(set_attr "type" "load")
9454 (set_attr "length" "8")])
9457 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9458 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9459 (use (match_operand:SI 2 "immediate_operand" "i"))
9460 (use (match_operand:SI 3 "immediate_operand" "i"))
9461 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9462 (clobber (reg:SI 6))
9463 (clobber (reg:SI 7))
9464 (clobber (reg:SI 8))
9465 (clobber (reg:SI 9))
9466 (clobber (reg:SI 10))
9467 (clobber (reg:SI 11))
9468 (clobber (reg:SI 12))
9469 (clobber (match_scratch:SI 5 "X"))]
9470 "TARGET_STRING && TARGET_POWERPC64
9471 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9472 || INTVAL (operands[2]) == 0)
9473 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9474 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9475 && REGNO (operands[4]) == 5"
9476 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9477 [(set_attr "type" "load")
9478 (set_attr "length" "8")])
9480 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9481 ;; register allocator doesn't have a clue about allocating 6 word registers.
9482 ;; rD/rS = r5 is preferred, efficient form.
9483 (define_expand "movstrsi_6reg"
9484 [(parallel [(set (match_operand 0 "" "")
9485 (match_operand 1 "" ""))
9486 (use (match_operand 2 "" ""))
9487 (use (match_operand 3 "" ""))
9488 (clobber (reg:SI 5))
9489 (clobber (reg:SI 6))
9490 (clobber (reg:SI 7))
9491 (clobber (reg:SI 8))
9492 (clobber (reg:SI 9))
9493 (clobber (reg:SI 10))
9494 (clobber (match_scratch:SI 4 ""))])]
9499 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9500 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9501 (use (match_operand:SI 2 "immediate_operand" "i"))
9502 (use (match_operand:SI 3 "immediate_operand" "i"))
9503 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9504 (clobber (reg:SI 6))
9505 (clobber (reg:SI 7))
9506 (clobber (reg:SI 8))
9507 (clobber (reg:SI 9))
9508 (clobber (reg:SI 10))
9509 (clobber (match_scratch:SI 5 "=q"))]
9510 "TARGET_STRING && TARGET_POWER
9511 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9512 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9513 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9514 && REGNO (operands[4]) == 5"
9515 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9516 [(set_attr "type" "load")
9517 (set_attr "length" "8")])
9520 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9521 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9522 (use (match_operand:SI 2 "immediate_operand" "i"))
9523 (use (match_operand:SI 3 "immediate_operand" "i"))
9524 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9525 (clobber (reg:SI 6))
9526 (clobber (reg:SI 7))
9527 (clobber (reg:SI 8))
9528 (clobber (reg:SI 9))
9529 (clobber (reg:SI 10))
9530 (clobber (match_scratch:SI 5 "X"))]
9531 "TARGET_STRING && ! TARGET_POWER
9532 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9533 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9534 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9535 && REGNO (operands[4]) == 5"
9536 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9537 [(set_attr "type" "load")
9538 (set_attr "length" "8")])
9541 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9542 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9543 (use (match_operand:SI 2 "immediate_operand" "i"))
9544 (use (match_operand:SI 3 "immediate_operand" "i"))
9545 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9546 (clobber (reg:SI 6))
9547 (clobber (reg:SI 7))
9548 (clobber (reg:SI 8))
9549 (clobber (reg:SI 9))
9550 (clobber (reg:SI 10))
9551 (clobber (match_scratch:SI 5 "X"))]
9552 "TARGET_STRING && TARGET_POWERPC64
9553 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9554 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9555 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9556 && REGNO (operands[4]) == 5"
9557 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9558 [(set_attr "type" "load")
9559 (set_attr "length" "8")])
9561 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9562 ;; problems with TImode.
9563 ;; rD/rS = r5 is preferred, efficient form.
9564 (define_expand "movstrsi_4reg"
9565 [(parallel [(set (match_operand 0 "" "")
9566 (match_operand 1 "" ""))
9567 (use (match_operand 2 "" ""))
9568 (use (match_operand 3 "" ""))
9569 (clobber (reg:SI 5))
9570 (clobber (reg:SI 6))
9571 (clobber (reg:SI 7))
9572 (clobber (reg:SI 8))
9573 (clobber (match_scratch:SI 4 ""))])]
9578 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9579 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9580 (use (match_operand:SI 2 "immediate_operand" "i"))
9581 (use (match_operand:SI 3 "immediate_operand" "i"))
9582 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9583 (clobber (reg:SI 6))
9584 (clobber (reg:SI 7))
9585 (clobber (reg:SI 8))
9586 (clobber (match_scratch:SI 5 "=q"))]
9587 "TARGET_STRING && TARGET_POWER
9588 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9589 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9590 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9591 && REGNO (operands[4]) == 5"
9592 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9593 [(set_attr "type" "load")
9594 (set_attr "length" "8")])
9597 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9598 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9599 (use (match_operand:SI 2 "immediate_operand" "i"))
9600 (use (match_operand:SI 3 "immediate_operand" "i"))
9601 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9602 (clobber (reg:SI 6))
9603 (clobber (reg:SI 7))
9604 (clobber (reg:SI 8))
9605 (clobber (match_scratch:SI 5 "X"))]
9606 "TARGET_STRING && ! TARGET_POWER
9607 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9608 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9609 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9610 && REGNO (operands[4]) == 5"
9611 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9612 [(set_attr "type" "load")
9613 (set_attr "length" "8")])
9616 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9617 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9618 (use (match_operand:SI 2 "immediate_operand" "i"))
9619 (use (match_operand:SI 3 "immediate_operand" "i"))
9620 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9621 (clobber (reg:SI 6))
9622 (clobber (reg:SI 7))
9623 (clobber (reg:SI 8))
9624 (clobber (match_scratch:SI 5 "X"))]
9625 "TARGET_STRING && TARGET_POWERPC64
9626 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9627 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9628 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9629 && REGNO (operands[4]) == 5"
9630 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9631 [(set_attr "type" "load")
9632 (set_attr "length" "8")])
9634 ;; Move up to 8 bytes at a time.
9635 (define_expand "movstrsi_2reg"
9636 [(parallel [(set (match_operand 0 "" "")
9637 (match_operand 1 "" ""))
9638 (use (match_operand 2 "" ""))
9639 (use (match_operand 3 "" ""))
9640 (clobber (match_scratch:DI 4 ""))
9641 (clobber (match_scratch:SI 5 ""))])]
9642 "TARGET_STRING && ! TARGET_POWERPC64"
9646 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9647 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9648 (use (match_operand:SI 2 "immediate_operand" "i"))
9649 (use (match_operand:SI 3 "immediate_operand" "i"))
9650 (clobber (match_scratch:DI 4 "=&r"))
9651 (clobber (match_scratch:SI 5 "=q"))]
9652 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9653 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9654 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9655 [(set_attr "type" "load")
9656 (set_attr "length" "8")])
9659 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9660 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9661 (use (match_operand:SI 2 "immediate_operand" "i"))
9662 (use (match_operand:SI 3 "immediate_operand" "i"))
9663 (clobber (match_scratch:DI 4 "=&r"))
9664 (clobber (match_scratch:SI 5 "X"))]
9665 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9666 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9667 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9668 [(set_attr "type" "load")
9669 (set_attr "length" "8")])
9671 ;; Move up to 4 bytes at a time.
9672 (define_expand "movstrsi_1reg"
9673 [(parallel [(set (match_operand 0 "" "")
9674 (match_operand 1 "" ""))
9675 (use (match_operand 2 "" ""))
9676 (use (match_operand 3 "" ""))
9677 (clobber (match_scratch:SI 4 ""))
9678 (clobber (match_scratch:SI 5 ""))])]
9683 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9684 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9685 (use (match_operand:SI 2 "immediate_operand" "i"))
9686 (use (match_operand:SI 3 "immediate_operand" "i"))
9687 (clobber (match_scratch:SI 4 "=&r"))
9688 (clobber (match_scratch:SI 5 "=q"))]
9689 "TARGET_STRING && TARGET_POWER
9690 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9691 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9692 [(set_attr "type" "load")
9693 (set_attr "length" "8")])
9696 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9697 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9698 (use (match_operand:SI 2 "immediate_operand" "i"))
9699 (use (match_operand:SI 3 "immediate_operand" "i"))
9700 (clobber (match_scratch:SI 4 "=&r"))
9701 (clobber (match_scratch:SI 5 "X"))]
9702 "TARGET_STRING && ! TARGET_POWER
9703 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9704 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9705 [(set_attr "type" "load")
9706 (set_attr "length" "8")])
9709 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9710 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9711 (use (match_operand:SI 2 "immediate_operand" "i"))
9712 (use (match_operand:SI 3 "immediate_operand" "i"))
9713 (clobber (match_scratch:SI 4 "=&r"))
9714 (clobber (match_scratch:SI 5 "X"))]
9715 "TARGET_STRING && TARGET_POWERPC64
9716 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9717 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9718 [(set_attr "type" "load")
9719 (set_attr "length" "8")])
9722 ;; Define insns that do load or store with update. Some of these we can
9723 ;; get by using pre-decrement or pre-increment, but the hardware can also
9724 ;; do cases where the increment is not the size of the object.
9726 ;; In all these cases, we use operands 0 and 1 for the register being
9727 ;; incremented because those are the operands that local-alloc will
9728 ;; tie and these are the pair most likely to be tieable (and the ones
9729 ;; that will benefit the most).
9731 (define_insn "*movdi_update1"
9732 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9733 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9734 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9735 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9736 (plus:DI (match_dup 1) (match_dup 2)))]
9737 "TARGET_POWERPC64 && TARGET_UPDATE"
9741 [(set_attr "type" "load")])
9743 (define_insn "*movdi_update2"
9744 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9746 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9747 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9748 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9749 (plus:DI (match_dup 1) (match_dup 2)))]
9752 [(set_attr "type" "load")])
9754 (define_insn "movdi_update"
9755 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9756 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9757 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9758 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9759 (plus:DI (match_dup 1) (match_dup 2)))]
9760 "TARGET_POWERPC64 && TARGET_UPDATE"
9764 [(set_attr "type" "store")])
9766 (define_insn "*movsi_update1"
9767 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9768 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9769 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9770 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9771 (plus:SI (match_dup 1) (match_dup 2)))]
9774 {lux|lwzux} %3,%0,%2
9775 {lu|lwzu} %3,%2(%0)"
9776 [(set_attr "type" "load")])
9778 (define_insn "movsi_update"
9779 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9780 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9781 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9782 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9783 (plus:SI (match_dup 1) (match_dup 2)))]
9786 {stux|stwux} %3,%0,%2
9787 {stu|stwu} %3,%2(%0)"
9788 [(set_attr "type" "store")])
9790 (define_insn "*movhi_update"
9791 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9792 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9793 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9794 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9795 (plus:SI (match_dup 1) (match_dup 2)))]
9800 [(set_attr "type" "load")])
9802 (define_insn "*movhi_update2"
9803 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9805 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9806 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9807 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9808 (plus:SI (match_dup 1) (match_dup 2)))]
9813 [(set_attr "type" "load")])
9815 (define_insn "*movhi_update3"
9816 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9818 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9819 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9820 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9821 (plus:SI (match_dup 1) (match_dup 2)))]
9826 [(set_attr "type" "load")])
9828 (define_insn "*movhi_update4"
9829 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9830 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9831 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9832 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9833 (plus:SI (match_dup 1) (match_dup 2)))]
9838 [(set_attr "type" "store")])
9840 (define_insn "*movqi_update1"
9841 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9842 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9843 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9844 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9845 (plus:SI (match_dup 1) (match_dup 2)))]
9850 [(set_attr "type" "load")])
9852 (define_insn "*movqi_update2"
9853 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9855 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9856 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9857 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9858 (plus:SI (match_dup 1) (match_dup 2)))]
9863 [(set_attr "type" "load")])
9865 (define_insn "*movqi_update3"
9866 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9867 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9868 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9869 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9870 (plus:SI (match_dup 1) (match_dup 2)))]
9875 [(set_attr "type" "store")])
9877 (define_insn "*movsf_update1"
9878 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9879 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9880 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9881 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9882 (plus:SI (match_dup 1) (match_dup 2)))]
9883 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9887 [(set_attr "type" "fpload")])
9889 (define_insn "*movsf_update2"
9890 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9891 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9892 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9893 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9894 (plus:SI (match_dup 1) (match_dup 2)))]
9895 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9899 [(set_attr "type" "fpstore")])
9901 (define_insn "*movsf_update3"
9902 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9903 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9904 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9905 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9906 (plus:SI (match_dup 1) (match_dup 2)))]
9907 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9909 {lux|lwzux} %3,%0,%2
9910 {lu|lwzu} %3,%2(%0)"
9911 [(set_attr "type" "load")])
9913 (define_insn "*movsf_update4"
9914 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9915 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9916 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9917 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9918 (plus:SI (match_dup 1) (match_dup 2)))]
9919 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9921 {stux|stwux} %3,%0,%2
9922 {stu|stwu} %3,%2(%0)"
9923 [(set_attr "type" "store")])
9925 (define_insn "*movdf_update1"
9926 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9927 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9928 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9929 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9930 (plus:SI (match_dup 1) (match_dup 2)))]
9931 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9935 [(set_attr "type" "fpload")])
9937 (define_insn "*movdf_update2"
9938 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9939 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9940 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9941 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9942 (plus:SI (match_dup 1) (match_dup 2)))]
9943 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9947 [(set_attr "type" "fpstore")])
9949 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9952 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
9953 (match_operand:DF 1 "memory_operand" ""))
9954 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
9955 (match_operand:DF 3 "memory_operand" ""))]
9957 && TARGET_HARD_FLOAT && TARGET_FPRS
9958 && registers_ok_for_quad_peep (operands[0], operands[2])
9959 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
9960 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
9964 [(set (match_operand:DF 0 "memory_operand" "")
9965 (match_operand:DF 1 "gpc_reg_operand" "f"))
9966 (set (match_operand:DF 2 "memory_operand" "")
9967 (match_operand:DF 3 "gpc_reg_operand" "f"))]
9969 && TARGET_HARD_FLOAT && TARGET_FPRS
9970 && registers_ok_for_quad_peep (operands[1], operands[3])
9971 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
9972 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
9975 ;; Next come insns related to the calling sequence.
9977 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9978 ;; We move the back-chain and decrement the stack pointer.
9980 (define_expand "allocate_stack"
9981 [(set (match_operand 0 "gpc_reg_operand" "=r")
9982 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9984 (minus (reg 1) (match_dup 1)))]
9987 { rtx chain = gen_reg_rtx (Pmode);
9988 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9991 emit_move_insn (chain, stack_bot);
9993 /* Check stack bounds if necessary. */
9994 if (current_function_limit_stack)
9997 available = expand_binop (Pmode, sub_optab,
9998 stack_pointer_rtx, stack_limit_rtx,
9999 NULL_RTX, 1, OPTAB_WIDEN);
10000 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
10003 if (GET_CODE (operands[1]) != CONST_INT
10004 || INTVAL (operands[1]) < -32767
10005 || INTVAL (operands[1]) > 32768)
10007 neg_op0 = gen_reg_rtx (Pmode);
10009 emit_insn (gen_negsi2 (neg_op0, operands[1]));
10011 emit_insn (gen_negdi2 (neg_op0, operands[1]));
10014 neg_op0 = GEN_INT (- INTVAL (operands[1]));
10017 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
10018 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
10022 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
10023 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
10024 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
10027 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
10031 ;; These patterns say how to save and restore the stack pointer. We need not
10032 ;; save the stack pointer at function level since we are careful to
10033 ;; preserve the backchain. At block level, we have to restore the backchain
10034 ;; when we restore the stack pointer.
10036 ;; For nonlocal gotos, we must save both the stack pointer and its
10037 ;; backchain and restore both. Note that in the nonlocal case, the
10038 ;; save area is a memory location.
10040 (define_expand "save_stack_function"
10041 [(match_operand 0 "any_operand" "")
10042 (match_operand 1 "any_operand" "")]
10046 (define_expand "restore_stack_function"
10047 [(match_operand 0 "any_operand" "")
10048 (match_operand 1 "any_operand" "")]
10052 (define_expand "restore_stack_block"
10053 [(use (match_operand 0 "register_operand" ""))
10054 (set (match_dup 2) (match_dup 3))
10055 (set (match_dup 0) (match_operand 1 "register_operand" ""))
10056 (set (match_dup 3) (match_dup 2))]
10060 operands[2] = gen_reg_rtx (Pmode);
10061 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
10064 (define_expand "save_stack_nonlocal"
10065 [(match_operand 0 "memory_operand" "")
10066 (match_operand 1 "register_operand" "")]
10070 rtx temp = gen_reg_rtx (Pmode);
10072 /* Copy the backchain to the first word, sp to the second. */
10073 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
10074 emit_move_insn (operand_subword (operands[0], 0, 0,
10075 (TARGET_32BIT ? DImode : TImode)),
10077 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
10082 (define_expand "restore_stack_nonlocal"
10083 [(match_operand 0 "register_operand" "")
10084 (match_operand 1 "memory_operand" "")]
10088 rtx temp = gen_reg_rtx (Pmode);
10090 /* Restore the backchain from the first word, sp from the second. */
10091 emit_move_insn (temp,
10092 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
10093 emit_move_insn (operands[0],
10094 operand_subword (operands[1], 1, 0,
10095 (TARGET_32BIT ? DImode : TImode)));
10096 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
10100 ;; TOC register handling.
10102 ;; Code to initialize the TOC register...
10104 (define_insn "load_toc_aix_si"
10105 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10106 (unspec:SI [(const_int 0)] 7))
10107 (use (reg:SI 2))])]
10108 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
10112 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10113 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10114 operands[2] = gen_rtx_REG (Pmode, 2);
10115 return \"{l|lwz} %0,%1(%2)\";
10117 [(set_attr "type" "load")])
10119 (define_insn "load_toc_aix_di"
10120 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
10121 (unspec:DI [(const_int 0)] 7))
10122 (use (reg:DI 2))])]
10123 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
10127 #ifdef TARGET_RELOCATABLE
10128 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
10129 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
10131 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
10134 strcat (buf, \"@toc\");
10135 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
10136 operands[2] = gen_rtx_REG (Pmode, 2);
10137 return \"ld %0,%1(%2)\";
10139 [(set_attr "type" "load")])
10141 (define_insn "load_toc_v4_pic_si"
10142 [(set (match_operand:SI 0 "register_operand" "=l")
10143 (unspec:SI [(const_int 0)] 7))]
10144 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
10145 "bl _GLOBAL_OFFSET_TABLE_@local-4"
10146 [(set_attr "type" "branch")
10147 (set_attr "length" "4")])
10149 (define_insn "load_toc_v4_PIC_1"
10150 [(set (match_operand:SI 0 "register_operand" "=l")
10151 (match_operand:SI 1 "immediate_operand" "s"))
10152 (unspec [(match_dup 1)] 7)]
10153 "TARGET_ELF && flag_pic == 2"
10155 [(set_attr "type" "branch")
10156 (set_attr "length" "4")])
10158 (define_insn "load_toc_v4_PIC_1b"
10159 [(set (match_operand:SI 0 "register_operand" "=l")
10160 (match_operand:SI 1 "immediate_operand" "s"))
10161 (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
10162 "TARGET_ELF && flag_pic == 2"
10163 "bl %1\\n\\t.long %2-%1+4\\n%1:"
10164 [(set_attr "type" "branch")
10165 (set_attr "length" "8")])
10167 (define_insn "load_toc_v4_PIC_2"
10168 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
10169 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
10170 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
10171 (match_operand:SI 3 "immediate_operand" "s")))))]
10172 "TARGET_ELF && flag_pic == 2"
10173 "{l|lwz} %0,%2-%3(%1)"
10174 [(set_attr "type" "load")])
10176 (define_insn "load_macho_picbase"
10177 [(set (match_operand:SI 0 "register_operand" "=l")
10178 (unspec:SI [(const_int 0)] 15))]
10179 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
10183 char *picbase = machopic_function_base_name ();
10184 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1));
10186 return \"bcl 20,31,%1\\n%1:\";
10188 [(set_attr "type" "branch")
10189 (set_attr "length" "4")])
10191 ;; If the TOC is shared over a translation unit, as happens with all
10192 ;; the kinds of PIC that we support, we need to restore the TOC
10193 ;; pointer only when jumping over units of translation.
10195 (define_expand "builtin_setjmp_receiver"
10196 [(use (label_ref (match_operand 0 "" "")))]
10197 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
10198 || (TARGET_TOC && TARGET_MINIMAL_TOC)"
10201 rs6000_emit_load_toc_table (FALSE);
10205 ;; A function pointer under AIX is a pointer to a data area whose first word
10206 ;; contains the actual address of the function, whose second word contains a
10207 ;; pointer to its TOC, and whose third word contains a value to place in the
10208 ;; static chain register (r11). Note that if we load the static chain, our
10209 ;; "trampoline" need not have any executable code.
10211 (define_expand "call_indirect_aix32"
10212 [(set (match_dup 2)
10213 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
10214 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10217 (mem:SI (plus:SI (match_dup 0)
10220 (mem:SI (plus:SI (match_dup 0)
10222 (parallel [(call (mem:SI (match_dup 2))
10223 (match_operand 1 "" ""))
10227 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10228 (clobber (scratch:SI))])]
10231 { operands[2] = gen_reg_rtx (SImode); }")
10233 (define_expand "call_indirect_aix64"
10234 [(set (match_dup 2)
10235 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
10236 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10239 (mem:DI (plus:DI (match_dup 0)
10242 (mem:DI (plus:DI (match_dup 0)
10244 (parallel [(call (mem:SI (match_dup 2))
10245 (match_operand 1 "" ""))
10249 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10250 (clobber (scratch:SI))])]
10253 { operands[2] = gen_reg_rtx (DImode); }")
10255 (define_expand "call_value_indirect_aix32"
10256 [(set (match_dup 3)
10257 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
10258 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
10261 (mem:SI (plus:SI (match_dup 1)
10264 (mem:SI (plus:SI (match_dup 1)
10266 (parallel [(set (match_operand 0 "" "")
10267 (call (mem:SI (match_dup 3))
10268 (match_operand 2 "" "")))
10272 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10273 (clobber (scratch:SI))])]
10276 { operands[3] = gen_reg_rtx (SImode); }")
10278 (define_expand "call_value_indirect_aix64"
10279 [(set (match_dup 3)
10280 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
10281 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
10284 (mem:DI (plus:DI (match_dup 1)
10287 (mem:DI (plus:DI (match_dup 1)
10289 (parallel [(set (match_operand 0 "" "")
10290 (call (mem:SI (match_dup 3))
10291 (match_operand 2 "" "")))
10295 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10296 (clobber (scratch:SI))])]
10299 { operands[3] = gen_reg_rtx (DImode); }")
10301 ;; Now the definitions for the call and call_value insns
10302 (define_expand "call"
10303 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10304 (match_operand 1 "" ""))
10305 (use (match_operand 2 "" ""))
10306 (clobber (scratch:SI))])]
10312 operands[0] = machopic_indirect_call_target (operands[0]);
10315 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10318 operands[0] = XEXP (operands[0], 0);
10320 if (GET_CODE (operands[0]) != SYMBOL_REF
10321 || (INTVAL (operands[2]) & CALL_LONG) != 0)
10323 if (INTVAL (operands[2]) & CALL_LONG)
10324 operands[0] = rs6000_longcall_ref (operands[0]);
10326 if (DEFAULT_ABI == ABI_V4
10327 || DEFAULT_ABI == ABI_AIX_NODESC
10328 || DEFAULT_ABI == ABI_DARWIN)
10329 operands[0] = force_reg (Pmode, operands[0]);
10331 else if (DEFAULT_ABI == ABI_AIX)
10333 /* AIX function pointers are really pointers to a three word
10335 emit_call_insn (TARGET_32BIT
10336 ? gen_call_indirect_aix32 (force_reg (SImode,
10339 : gen_call_indirect_aix64 (force_reg (DImode,
10349 (define_expand "call_value"
10350 [(parallel [(set (match_operand 0 "" "")
10351 (call (mem:SI (match_operand 1 "address_operand" ""))
10352 (match_operand 2 "" "")))
10353 (use (match_operand 3 "" ""))
10354 (clobber (scratch:SI))])]
10360 operands[1] = machopic_indirect_call_target (operands[1]);
10363 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10366 operands[1] = XEXP (operands[1], 0);
10368 if (GET_CODE (operands[1]) != SYMBOL_REF
10369 || (INTVAL (operands[3]) & CALL_LONG) != 0)
10371 if (INTVAL (operands[3]) & CALL_LONG)
10372 operands[1] = rs6000_longcall_ref (operands[1]);
10374 if (DEFAULT_ABI == ABI_V4
10375 || DEFAULT_ABI == ABI_AIX_NODESC
10376 || DEFAULT_ABI == ABI_DARWIN)
10377 operands[0] = force_reg (Pmode, operands[0]);
10379 else if (DEFAULT_ABI == ABI_AIX)
10381 /* AIX function pointers are really pointers to a three word
10383 emit_call_insn (TARGET_32BIT
10384 ? gen_call_value_indirect_aix32 (operands[0],
10388 : gen_call_value_indirect_aix64 (operands[0],
10399 ;; Call to function in current module. No TOC pointer reload needed.
10400 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
10401 ;; either the function was not prototyped, or it was prototyped as a
10402 ;; variable argument function. It is > 0 if FP registers were passed
10403 ;; and < 0 if they were not.
10405 (define_insn "*call_local32"
10406 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10407 (match_operand 1 "" "g,g"))
10408 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10409 (clobber (match_scratch:SI 3 "=l,l"))]
10410 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10413 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10414 output_asm_insn (\"crxor 6,6,6\", operands);
10416 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10417 output_asm_insn (\"creqv 6,6,6\", operands);
10419 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10421 [(set_attr "type" "branch")
10422 (set_attr "length" "4,8")])
10424 (define_insn "*call_local64"
10425 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10426 (match_operand 1 "" "g,g"))
10427 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10428 (clobber (match_scratch:SI 3 "=l,l"))]
10429 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10432 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10433 output_asm_insn (\"crxor 6,6,6\", operands);
10435 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10436 output_asm_insn (\"creqv 6,6,6\", operands);
10438 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10440 [(set_attr "type" "branch")
10441 (set_attr "length" "4,8")])
10443 (define_insn "*call_value_local32"
10444 [(set (match_operand 0 "" "")
10445 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10446 (match_operand 2 "" "g,g")))
10447 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10448 (clobber (match_scratch:SI 4 "=l,l"))]
10449 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10452 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10453 output_asm_insn (\"crxor 6,6,6\", operands);
10455 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10456 output_asm_insn (\"creqv 6,6,6\", operands);
10458 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10460 [(set_attr "type" "branch")
10461 (set_attr "length" "4,8")])
10464 (define_insn "*call_value_local64"
10465 [(set (match_operand 0 "" "")
10466 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10467 (match_operand 2 "" "g,g")))
10468 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10469 (clobber (match_scratch:SI 4 "=l,l"))]
10470 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10473 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10474 output_asm_insn (\"crxor 6,6,6\", operands);
10476 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10477 output_asm_insn (\"creqv 6,6,6\", operands);
10479 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10481 [(set_attr "type" "branch")
10482 (set_attr "length" "4,8")])
10484 ;; Call to function which may be in another module. Restore the TOC
10485 ;; pointer (r2) after the call unless this is System V.
10486 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
10487 ;; either the function was not prototyped, or it was prototyped as a
10488 ;; variable argument function. It is > 0 if FP registers were passed
10489 ;; and < 0 if they were not.
10491 (define_insn "*call_indirect_nonlocal_aix32"
10492 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10493 (match_operand 1 "" "g"))
10497 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10498 (clobber (match_scratch:SI 2 "=l"))]
10499 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10500 "b%T0l\;{l|lwz} 2,20(1)"
10501 [(set_attr "type" "jmpreg")
10502 (set_attr "length" "8")])
10504 (define_insn "*call_nonlocal_aix32"
10505 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10506 (match_operand 1 "" "g"))
10507 (use (match_operand:SI 2 "immediate_operand" "O"))
10508 (clobber (match_scratch:SI 3 "=l"))]
10510 && DEFAULT_ABI == ABI_AIX
10511 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10513 [(set_attr "type" "branch")
10514 (set_attr "length" "8")])
10516 (define_insn "*call_indirect_nonlocal_aix64"
10517 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10518 (match_operand 1 "" "g"))
10522 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10523 (clobber (match_scratch:SI 2 "=l"))]
10524 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10525 "b%T0l\;ld 2,40(1)"
10526 [(set_attr "type" "jmpreg")
10527 (set_attr "length" "8")])
10529 (define_insn "*call_nonlocal_aix64"
10530 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10531 (match_operand 1 "" "g"))
10532 (use (match_operand:SI 2 "immediate_operand" "O"))
10533 (clobber (match_scratch:SI 3 "=l"))]
10535 && DEFAULT_ABI == ABI_AIX
10536 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10538 [(set_attr "type" "branch")
10539 (set_attr "length" "8")])
10541 (define_insn "*call_value_indirect_nonlocal_aix32"
10542 [(set (match_operand 0 "" "")
10543 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10544 (match_operand 2 "" "g")))
10548 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10549 (clobber (match_scratch:SI 3 "=l"))]
10550 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10551 "b%T1l\;{l|lwz} 2,20(1)"
10552 [(set_attr "type" "jmpreg")
10553 (set_attr "length" "8")])
10555 (define_insn "*call_value_nonlocal_aix32"
10556 [(set (match_operand 0 "" "")
10557 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10558 (match_operand 2 "" "g")))
10559 (use (match_operand:SI 3 "immediate_operand" "O"))
10560 (clobber (match_scratch:SI 4 "=l"))]
10562 && DEFAULT_ABI == ABI_AIX
10563 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10565 [(set_attr "type" "branch")
10566 (set_attr "length" "8")])
10568 (define_insn "*call_value_indirect_nonlocal_aix64"
10569 [(set (match_operand 0 "" "")
10570 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10571 (match_operand 2 "" "g")))
10575 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10576 (clobber (match_scratch:SI 3 "=l"))]
10577 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10578 "b%T1l\;ld 2,40(1)"
10579 [(set_attr "type" "jmpreg")
10580 (set_attr "length" "8")])
10582 (define_insn "*call_value_nonlocal_aix64"
10583 [(set (match_operand 0 "" "")
10584 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10585 (match_operand 2 "" "g")))
10586 (use (match_operand:SI 3 "immediate_operand" "O"))
10587 (clobber (match_scratch:SI 4 "=l"))]
10589 && DEFAULT_ABI == ABI_AIX
10590 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10592 [(set_attr "type" "branch")
10593 (set_attr "length" "8")])
10595 ;; A function pointer under System V is just a normal pointer
10596 ;; operands[0] is the function pointer
10597 ;; operands[1] is the stack size to clean up
10598 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10599 ;; which indicates how to set cr1
10601 (define_insn "*call_indirect_nonlocal_sysv"
10602 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10603 (match_operand 1 "" "g,g"))
10604 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10605 (clobber (match_scratch:SI 3 "=l,l"))]
10606 "DEFAULT_ABI == ABI_AIX_NODESC
10607 || DEFAULT_ABI == ABI_V4
10608 || DEFAULT_ABI == ABI_DARWIN"
10610 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10611 output_asm_insn ("crxor 6,6,6", operands);
10613 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10614 output_asm_insn ("creqv 6,6,6", operands);
10618 [(set_attr "type" "jmpreg,jmpreg")
10619 (set_attr "length" "4,8")])
10621 (define_insn "*call_nonlocal_sysv"
10622 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10623 (match_operand 1 "" "g,g"))
10624 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10625 (clobber (match_scratch:SI 3 "=l,l"))]
10626 "(DEFAULT_ABI == ABI_AIX_NODESC
10627 || DEFAULT_ABI == ABI_V4
10628 || DEFAULT_ABI == ABI_DARWIN)
10629 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10631 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10632 output_asm_insn ("crxor 6,6,6", operands);
10634 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10635 output_asm_insn ("creqv 6,6,6", operands);
10637 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10639 [(set_attr "type" "branch,branch")
10640 (set_attr "length" "4,8")])
10642 (define_insn "*call_value_indirect_nonlocal_sysv"
10643 [(set (match_operand 0 "" "")
10644 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10645 (match_operand 2 "" "g,g")))
10646 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10647 (clobber (match_scratch:SI 4 "=l,l"))]
10648 "DEFAULT_ABI == ABI_AIX_NODESC
10649 || DEFAULT_ABI == ABI_V4
10650 || DEFAULT_ABI == ABI_DARWIN"
10652 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10653 output_asm_insn ("crxor 6,6,6", operands);
10655 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10656 output_asm_insn ("creqv 6,6,6", operands);
10660 [(set_attr "type" "jmpreg,jmpreg")
10661 (set_attr "length" "4,8")])
10663 (define_insn "*call_value_nonlocal_sysv"
10664 [(set (match_operand 0 "" "")
10665 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10666 (match_operand 2 "" "g,g")))
10667 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10668 (clobber (match_scratch:SI 4 "=l,l"))]
10669 "(DEFAULT_ABI == ABI_AIX_NODESC
10670 || DEFAULT_ABI == ABI_V4
10671 || DEFAULT_ABI == ABI_DARWIN)
10672 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10674 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10675 output_asm_insn ("crxor 6,6,6", operands);
10677 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10678 output_asm_insn ("creqv 6,6,6", operands);
10680 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10682 [(set_attr "type" "branch,branch")
10683 (set_attr "length" "4,8")])
10685 ;; Call subroutine returning any type.
10686 (define_expand "untyped_call"
10687 [(parallel [(call (match_operand 0 "" "")
10689 (match_operand 1 "" "")
10690 (match_operand 2 "" "")])]
10696 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10698 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10700 rtx set = XVECEXP (operands[2], 0, i);
10701 emit_move_insn (SET_DEST (set), SET_SRC (set));
10704 /* The optimizer does not know that the call sets the function value
10705 registers we stored in the result block. We avoid problems by
10706 claiming that all hard registers are used and clobbered at this
10708 emit_insn (gen_blockage ());
10713 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10714 ;; all of memory. This blocks insns from being moved across this point.
10716 (define_insn "blockage"
10717 [(unspec_volatile [(const_int 0)] 0)]
10721 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10722 ;; signed & unsigned, and one type of branch.
10724 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10725 ;; insns, and branches. We store the operands of compares until we see
10727 (define_expand "cmpsi"
10729 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10730 (match_operand:SI 1 "reg_or_short_operand" "")))]
10734 /* Take care of the possibility that operands[1] might be negative but
10735 this might be a logical operation. That insn doesn't exist. */
10736 if (GET_CODE (operands[1]) == CONST_INT
10737 && INTVAL (operands[1]) < 0)
10738 operands[1] = force_reg (SImode, operands[1]);
10740 rs6000_compare_op0 = operands[0];
10741 rs6000_compare_op1 = operands[1];
10742 rs6000_compare_fp_p = 0;
10746 (define_expand "cmpdi"
10748 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10749 (match_operand:DI 1 "reg_or_short_operand" "")))]
10753 /* Take care of the possibility that operands[1] might be negative but
10754 this might be a logical operation. That insn doesn't exist. */
10755 if (GET_CODE (operands[1]) == CONST_INT
10756 && INTVAL (operands[1]) < 0)
10757 operands[1] = force_reg (DImode, operands[1]);
10759 rs6000_compare_op0 = operands[0];
10760 rs6000_compare_op1 = operands[1];
10761 rs6000_compare_fp_p = 0;
10765 (define_expand "cmpsf"
10766 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10767 (match_operand:SF 1 "gpc_reg_operand" "")))]
10768 "TARGET_HARD_FLOAT"
10771 rs6000_compare_op0 = operands[0];
10772 rs6000_compare_op1 = operands[1];
10773 rs6000_compare_fp_p = 1;
10777 (define_expand "cmpdf"
10778 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10779 (match_operand:DF 1 "gpc_reg_operand" "")))]
10780 "TARGET_HARD_FLOAT && TARGET_FPRS"
10783 rs6000_compare_op0 = operands[0];
10784 rs6000_compare_op1 = operands[1];
10785 rs6000_compare_fp_p = 1;
10789 (define_expand "cmptf"
10790 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10791 (match_operand:TF 1 "gpc_reg_operand" "")))]
10792 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
10793 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10796 rs6000_compare_op0 = operands[0];
10797 rs6000_compare_op1 = operands[1];
10798 rs6000_compare_fp_p = 1;
10802 (define_expand "beq"
10803 [(use (match_operand 0 "" ""))]
10805 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10807 (define_expand "bne"
10808 [(use (match_operand 0 "" ""))]
10810 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10812 (define_expand "bge"
10813 [(use (match_operand 0 "" ""))]
10815 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10817 (define_expand "bgt"
10818 [(use (match_operand 0 "" ""))]
10820 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10822 (define_expand "ble"
10823 [(use (match_operand 0 "" ""))]
10825 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10827 (define_expand "blt"
10828 [(use (match_operand 0 "" ""))]
10830 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10832 (define_expand "bgeu"
10833 [(use (match_operand 0 "" ""))]
10835 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10837 (define_expand "bgtu"
10838 [(use (match_operand 0 "" ""))]
10840 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10842 (define_expand "bleu"
10843 [(use (match_operand 0 "" ""))]
10845 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10847 (define_expand "bltu"
10848 [(use (match_operand 0 "" ""))]
10850 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10852 (define_expand "bunordered"
10853 [(use (match_operand 0 "" ""))]
10855 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10857 (define_expand "bordered"
10858 [(use (match_operand 0 "" ""))]
10860 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10862 (define_expand "buneq"
10863 [(use (match_operand 0 "" ""))]
10865 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10867 (define_expand "bunge"
10868 [(use (match_operand 0 "" ""))]
10870 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10872 (define_expand "bungt"
10873 [(use (match_operand 0 "" ""))]
10875 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10877 (define_expand "bunle"
10878 [(use (match_operand 0 "" ""))]
10880 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10882 (define_expand "bunlt"
10883 [(use (match_operand 0 "" ""))]
10885 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10887 (define_expand "bltgt"
10888 [(use (match_operand 0 "" ""))]
10890 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10892 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10893 ;; For SEQ, likewise, except that comparisons with zero should be done
10894 ;; with an scc insns. However, due to the order that combine see the
10895 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10896 ;; the cases we don't want to handle.
10897 (define_expand "seq"
10898 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10900 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10902 (define_expand "sne"
10903 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10907 if (! rs6000_compare_fp_p)
10910 rs6000_emit_sCOND (NE, operands[0]);
10914 ;; A > 0 is best done using the portable sequence, so fail in that case.
10915 (define_expand "sgt"
10916 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10920 if (! rs6000_compare_fp_p
10921 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10924 rs6000_emit_sCOND (GT, operands[0]);
10928 ;; A < 0 is best done in the portable way for A an integer.
10929 (define_expand "slt"
10930 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10934 if (! rs6000_compare_fp_p
10935 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10938 rs6000_emit_sCOND (LT, operands[0]);
10942 ;; A >= 0 is best done the portable way for A an integer.
10943 (define_expand "sge"
10944 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10948 if (! rs6000_compare_fp_p
10949 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10952 rs6000_emit_sCOND (GE, operands[0]);
10956 ;; A <= 0 is best done the portable way for A an integer.
10957 (define_expand "sle"
10958 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10962 if (! rs6000_compare_fp_p
10963 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10966 rs6000_emit_sCOND (LE, operands[0]);
10970 (define_expand "sgtu"
10971 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10973 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10975 (define_expand "sltu"
10976 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10978 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10980 (define_expand "sgeu"
10981 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10983 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10985 (define_expand "sleu"
10986 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10988 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10990 ;; Here are the actual compare insns.
10991 (define_insn "*cmpsi_internal1"
10992 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10993 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10994 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
10996 "{cmp%I2|cmpw%I2} %0,%1,%2"
10997 [(set_attr "type" "compare")])
10999 (define_insn "*cmpdi_internal1"
11000 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
11001 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
11002 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11005 [(set_attr "type" "compare")])
11007 ;; If we are comparing a register for equality with a large constant,
11008 ;; we can do this with an XOR followed by a compare. But we need a scratch
11009 ;; register for the result of the XOR.
11012 [(set (match_operand:CC 0 "cc_reg_operand" "")
11013 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11014 (match_operand:SI 2 "non_short_cint_operand" "")))
11015 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
11016 "find_single_use (operands[0], insn, 0)
11017 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
11018 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
11019 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
11020 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
11023 /* Get the constant we are comparing against, C, and see what it looks like
11024 sign-extended to 16 bits. Then see what constant could be XOR'ed
11025 with C to get the sign-extended value. */
11027 HOST_WIDE_INT c = INTVAL (operands[2]);
11028 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
11029 HOST_WIDE_INT xorv = c ^ sextc;
11031 operands[4] = GEN_INT (xorv);
11032 operands[5] = GEN_INT (sextc);
11035 (define_insn "*cmpsi_internal2"
11036 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11037 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11038 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
11040 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
11041 [(set_attr "type" "compare")])
11043 (define_insn "*cmpdi_internal2"
11044 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
11045 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
11046 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
11048 "cmpld%I2 %0,%1,%b2"
11049 [(set_attr "type" "compare")])
11051 ;; The following two insns don't exist as single insns, but if we provide
11052 ;; them, we can swap an add and compare, which will enable us to overlap more
11053 ;; of the required delay between a compare and branch. We generate code for
11054 ;; them by splitting.
11057 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
11058 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
11059 (match_operand:SI 2 "short_cint_operand" "i")))
11060 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11061 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11064 [(set_attr "length" "8")])
11067 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
11068 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
11069 (match_operand:SI 2 "u_short_cint_operand" "i")))
11070 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
11071 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
11074 [(set_attr "length" "8")])
11077 [(set (match_operand:CC 3 "cc_reg_operand" "")
11078 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
11079 (match_operand:SI 2 "short_cint_operand" "")))
11080 (set (match_operand:SI 0 "gpc_reg_operand" "")
11081 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11083 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
11084 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11087 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
11088 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
11089 (match_operand:SI 2 "u_short_cint_operand" "")))
11090 (set (match_operand:SI 0 "gpc_reg_operand" "")
11091 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
11093 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
11094 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
11096 (define_insn "*cmpsf_internal1"
11097 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11098 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
11099 (match_operand:SF 2 "gpc_reg_operand" "f")))]
11100 "TARGET_HARD_FLOAT && TARGET_FPRS"
11102 [(set_attr "type" "fpcompare")])
11104 (define_insn "*cmpdf_internal1"
11105 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11106 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11107 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11108 "TARGET_HARD_FLOAT && TARGET_FPRS"
11110 [(set_attr "type" "fpcompare")])
11112 ;; Only need to compare second words if first words equal
11113 (define_insn "*cmptf_internal1"
11114 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11115 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11116 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11117 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
11118 && TARGET_LONG_DOUBLE_128"
11119 "fcmpu %0,%1,%2\;bne %0,$+4\;fcmpu %0,%L1,%L2"
11120 [(set_attr "type" "fpcompare")
11121 (set_attr "length" "12")])
11123 ;; Now we have the scc insns. We can do some combinations because of the
11124 ;; way the machine works.
11126 ;; Note that this is probably faster if we can put an insn between the
11127 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11128 ;; cases the insns below which don't use an intermediate CR field will
11129 ;; be used instead.
11131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11132 (match_operator:SI 1 "scc_comparison_operator"
11133 [(match_operand 2 "cc_reg_operand" "y")
11136 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11137 [(set_attr "type" "cr_logical")
11138 (set_attr "length" "12")])
11140 ;; Same as above, but get the OV/ORDERED bit.
11141 (define_insn "move_from_CR_ov_bit"
11142 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11143 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] 724))]
11145 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11146 [(set_attr "length" "12")])
11149 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11150 (match_operator:DI 1 "scc_comparison_operator"
11151 [(match_operand 2 "cc_reg_operand" "y")
11154 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11155 [(set_attr "type" "cr_logical")
11156 (set_attr "length" "12")])
11159 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11160 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11161 [(match_operand 2 "cc_reg_operand" "y,y")
11164 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11165 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11166 "! TARGET_POWERPC64"
11168 %D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1
11170 [(set_attr "type" "delayed_compare")
11171 (set_attr "length" "12,16")])
11174 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11175 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11176 [(match_operand 2 "cc_reg_operand" "")
11179 (set (match_operand:SI 3 "gpc_reg_operand" "")
11180 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11181 "! TARGET_POWERPC64 && reload_completed"
11182 [(set (match_dup 3)
11183 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11185 (compare:CC (match_dup 3)
11190 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11191 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11192 [(match_operand 2 "cc_reg_operand" "y")
11194 (match_operand:SI 3 "const_int_operand" "n")))]
11198 int is_bit = ccr_bit (operands[1], 1);
11199 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11202 if (is_bit >= put_bit)
11203 count = is_bit - put_bit;
11205 count = 32 - (put_bit - is_bit);
11207 operands[4] = GEN_INT (count);
11208 operands[5] = GEN_INT (put_bit);
11210 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11212 [(set_attr "type" "cr_logical")
11213 (set_attr "length" "12")])
11216 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11218 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11219 [(match_operand 2 "cc_reg_operand" "y,y")
11221 (match_operand:SI 3 "const_int_operand" "n,n"))
11223 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11224 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11229 int is_bit = ccr_bit (operands[1], 1);
11230 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11233 /* Force split for non-cc0 compare. */
11234 if (which_alternative == 1)
11237 if (is_bit >= put_bit)
11238 count = is_bit - put_bit;
11240 count = 32 - (put_bit - is_bit);
11242 operands[5] = GEN_INT (count);
11243 operands[6] = GEN_INT (put_bit);
11245 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11247 [(set_attr "type" "delayed_compare")
11248 (set_attr "length" "12,16")])
11251 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11253 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11254 [(match_operand 2 "cc_reg_operand" "")
11256 (match_operand:SI 3 "const_int_operand" ""))
11258 (set (match_operand:SI 4 "gpc_reg_operand" "")
11259 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11262 [(set (match_dup 4)
11263 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11266 (compare:CC (match_dup 4)
11270 ;; There is a 3 cycle delay between consecutive mfcr instructions
11271 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11274 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11275 (match_operator:SI 1 "scc_comparison_operator"
11276 [(match_operand 2 "cc_reg_operand" "y")
11278 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11279 (match_operator:SI 4 "scc_comparison_operator"
11280 [(match_operand 5 "cc_reg_operand" "y")
11282 "REGNO (operands[2]) != REGNO (operands[5])"
11283 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11284 [(set_attr "type" "cr_logical")
11285 (set_attr "length" "20")])
11288 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11289 (match_operator:DI 1 "scc_comparison_operator"
11290 [(match_operand 2 "cc_reg_operand" "y")
11292 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11293 (match_operator:DI 4 "scc_comparison_operator"
11294 [(match_operand 5 "cc_reg_operand" "y")
11296 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11297 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11298 [(set_attr "type" "cr_logical")
11299 (set_attr "length" "20")])
11301 ;; There are some scc insns that can be done directly, without a compare.
11302 ;; These are faster because they don't involve the communications between
11303 ;; the FXU and branch units. In fact, we will be replacing all of the
11304 ;; integer scc insns here or in the portable methods in emit_store_flag.
11306 ;; Also support (neg (scc ..)) since that construct is used to replace
11307 ;; branches, (plus (scc ..) ..) since that construct is common and
11308 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11309 ;; cases where it is no more expensive than (neg (scc ..)).
11311 ;; Have reload force a constant into a register for the simple insns that
11312 ;; otherwise won't accept constants. We do this because it is faster than
11313 ;; the cmp/mfcr sequence we would otherwise generate.
11316 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11317 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11318 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11319 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11320 "! TARGET_POWERPC64"
11322 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11323 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11324 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11325 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11326 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11327 [(set_attr "length" "12,8,12,12,12")])
11330 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11331 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11332 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11333 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11336 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11337 subfic %3,%1,0\;adde %0,%3,%1
11338 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11339 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11340 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11341 [(set_attr "length" "12,8,12,12,12")])
11344 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11346 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11347 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11349 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11350 (eq:SI (match_dup 1) (match_dup 2)))
11351 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11352 "! TARGET_POWERPC64"
11354 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11355 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11356 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11357 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11358 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11364 [(set_attr "type" "compare")
11365 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11368 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11370 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11371 (match_operand:SI 2 "reg_or_cint_operand" ""))
11373 (set (match_operand:SI 0 "gpc_reg_operand" "")
11374 (eq:SI (match_dup 1) (match_dup 2)))
11375 (clobber (match_scratch:SI 3 ""))]
11376 "! TARGET_POWERPC64 && reload_completed"
11377 [(parallel [(set (match_dup 0)
11378 (eq:SI (match_dup 1) (match_dup 2)))
11379 (clobber (match_dup 3))])
11381 (compare:CC (match_dup 0)
11386 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11388 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11389 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11391 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11392 (eq:DI (match_dup 1) (match_dup 2)))
11393 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11396 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11397 subfic %3,%1,0\;adde. %0,%3,%1
11398 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11399 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11400 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11406 [(set_attr "type" "compare")
11407 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11410 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11412 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11413 (match_operand:DI 2 "reg_or_cint_operand" ""))
11415 (set (match_operand:DI 0 "gpc_reg_operand" "")
11416 (eq:DI (match_dup 1) (match_dup 2)))
11417 (clobber (match_scratch:DI 3 ""))]
11418 "TARGET_POWERPC64 && reload_completed"
11419 [(parallel [(set (match_dup 0)
11420 (eq:DI (match_dup 1) (match_dup 2)))
11421 (clobber (match_dup 3))])
11423 (compare:CC (match_dup 0)
11427 ;; We have insns of the form shown by the first define_insn below. If
11428 ;; there is something inside the comparison operation, we must split it.
11430 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11431 (plus:SI (match_operator 1 "comparison_operator"
11432 [(match_operand:SI 2 "" "")
11433 (match_operand:SI 3
11434 "reg_or_cint_operand" "")])
11435 (match_operand:SI 4 "gpc_reg_operand" "")))
11436 (clobber (match_operand:SI 5 "register_operand" ""))]
11437 "! gpc_reg_operand (operands[2], SImode)"
11438 [(set (match_dup 5) (match_dup 2))
11439 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11443 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11444 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11445 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11446 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11447 "! TARGET_POWERPC64"
11449 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11450 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11451 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11452 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11453 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11454 [(set_attr "length" "12,8,12,12,12")])
11457 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11460 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11461 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11462 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11464 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11465 "! TARGET_POWERPC64"
11467 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11468 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11469 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11470 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11471 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11477 [(set_attr "type" "compare")
11478 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11481 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11484 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11485 (match_operand:SI 2 "reg_or_cint_operand" ""))
11486 (match_operand:SI 3 "gpc_reg_operand" ""))
11488 (clobber (match_scratch:SI 4 ""))]
11489 "! TARGET_POWERPC64 && reload_completed"
11490 [(set (match_dup 4)
11491 (plus:SI (eq:SI (match_dup 1)
11495 (compare:CC (match_dup 4)
11500 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11503 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11504 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11505 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11507 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11508 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11509 "! TARGET_POWERPC64"
11511 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11512 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11513 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11514 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11515 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11521 [(set_attr "type" "compare")
11522 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11525 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11528 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11529 (match_operand:SI 2 "reg_or_cint_operand" ""))
11530 (match_operand:SI 3 "gpc_reg_operand" ""))
11532 (set (match_operand:SI 0 "gpc_reg_operand" "")
11533 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11534 "! TARGET_POWERPC64 && reload_completed"
11535 [(set (match_dup 0)
11536 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11538 (compare:CC (match_dup 0)
11543 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11544 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11545 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11546 "! TARGET_POWERPC64"
11548 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11549 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11550 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11551 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11552 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11553 [(set_attr "length" "12,8,12,12,12")])
11555 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11556 ;; since it nabs/sr is just as fast.
11557 (define_insn "*ne0"
11558 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11559 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11561 (clobber (match_scratch:SI 2 "=&r"))]
11562 "! TARGET_POWER && ! TARGET_POWERPC64 && !TARGET_ISEL"
11563 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11564 [(set_attr "length" "8")])
11567 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11568 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11570 (clobber (match_scratch:DI 2 "=&r"))]
11572 "addic %2,%1,-1\;subfe %0,%2,%1"
11573 [(set_attr "length" "8")])
11575 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11577 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11578 (plus:SI (lshiftrt:SI
11579 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11581 (match_operand:SI 2 "gpc_reg_operand" "r")))
11582 (clobber (match_scratch:SI 3 "=&r"))]
11583 "! TARGET_POWERPC64"
11584 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11585 [(set_attr "length" "8")])
11588 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11589 (plus:DI (lshiftrt:DI
11590 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11592 (match_operand:DI 2 "gpc_reg_operand" "r")))
11593 (clobber (match_scratch:DI 3 "=&r"))]
11595 "addic %3,%1,-1\;addze %0,%2"
11596 [(set_attr "length" "8")])
11599 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11601 (plus:SI (lshiftrt:SI
11602 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11604 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11606 (clobber (match_scratch:SI 3 "=&r,&r"))
11607 (clobber (match_scratch:SI 4 "=X,&r"))]
11608 "! TARGET_POWERPC64"
11610 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11612 [(set_attr "type" "compare")
11613 (set_attr "length" "8,12")])
11616 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11618 (plus:SI (lshiftrt:SI
11619 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11621 (match_operand:SI 2 "gpc_reg_operand" ""))
11623 (clobber (match_scratch:SI 3 ""))
11624 (clobber (match_scratch:SI 4 ""))]
11625 "! TARGET_POWERPC64 && reload_completed"
11626 [(parallel [(set (match_dup 3)
11627 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11630 (clobber (match_dup 4))])
11632 (compare:CC (match_dup 3)
11637 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11639 (plus:DI (lshiftrt:DI
11640 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11642 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11644 (clobber (match_scratch:DI 3 "=&r,&r"))]
11647 addic %3,%1,-1\;addze. %3,%2
11649 [(set_attr "type" "compare")
11650 (set_attr "length" "8,12")])
11653 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11655 (plus:DI (lshiftrt:DI
11656 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11658 (match_operand:DI 2 "gpc_reg_operand" ""))
11660 (clobber (match_scratch:DI 3 ""))]
11661 "TARGET_POWERPC64 && reload_completed"
11662 [(set (match_dup 3)
11663 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11667 (compare:CC (match_dup 3)
11672 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11674 (plus:SI (lshiftrt:SI
11675 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11677 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11679 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11680 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11682 (clobber (match_scratch:SI 3 "=&r,&r"))]
11683 "! TARGET_POWERPC64"
11685 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11687 [(set_attr "type" "compare")
11688 (set_attr "length" "8,12")])
11691 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11693 (plus:SI (lshiftrt:SI
11694 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11696 (match_operand:SI 2 "gpc_reg_operand" ""))
11698 (set (match_operand:SI 0 "gpc_reg_operand" "")
11699 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11701 (clobber (match_scratch:SI 3 ""))]
11702 "! TARGET_POWERPC64 && reload_completed"
11703 [(parallel [(set (match_dup 0)
11704 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11706 (clobber (match_dup 3))])
11708 (compare:CC (match_dup 0)
11713 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11715 (plus:DI (lshiftrt:DI
11716 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11718 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11720 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11721 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11723 (clobber (match_scratch:DI 3 "=&r,&r"))]
11726 addic %3,%1,-1\;addze. %0,%2
11728 [(set_attr "type" "compare")
11729 (set_attr "length" "8,12")])
11732 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11734 (plus:DI (lshiftrt:DI
11735 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11737 (match_operand:DI 2 "gpc_reg_operand" ""))
11739 (set (match_operand:DI 0 "gpc_reg_operand" "")
11740 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11742 (clobber (match_scratch:DI 3 ""))]
11743 "TARGET_POWERPC64 && reload_completed"
11744 [(parallel [(set (match_dup 0)
11745 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11747 (clobber (match_dup 3))])
11749 (compare:CC (match_dup 0)
11754 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11755 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11756 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11757 (clobber (match_scratch:SI 3 "=r,X"))]
11760 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11761 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11762 [(set_attr "length" "12")])
11765 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11767 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11768 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11770 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11771 (le:SI (match_dup 1) (match_dup 2)))
11772 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11775 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11776 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11779 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11780 (set_attr "length" "12,12,16,16")])
11783 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11785 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11786 (match_operand:SI 2 "reg_or_short_operand" ""))
11788 (set (match_operand:SI 0 "gpc_reg_operand" "")
11789 (le:SI (match_dup 1) (match_dup 2)))
11790 (clobber (match_scratch:SI 3 ""))]
11791 "TARGET_POWER && reload_completed"
11792 [(parallel [(set (match_dup 0)
11793 (le:SI (match_dup 1) (match_dup 2)))
11794 (clobber (match_dup 3))])
11796 (compare:CC (match_dup 0)
11801 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11802 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11803 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11804 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11807 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11808 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11809 [(set_attr "length" "12")])
11812 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11814 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11815 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11816 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11818 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11821 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11822 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11825 [(set_attr "type" "compare")
11826 (set_attr "length" "12,12,16,16")])
11829 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11831 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11832 (match_operand:SI 2 "reg_or_short_operand" ""))
11833 (match_operand:SI 3 "gpc_reg_operand" ""))
11835 (clobber (match_scratch:SI 4 ""))]
11836 "TARGET_POWER && reload_completed"
11837 [(set (match_dup 4)
11838 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11841 (compare:CC (match_dup 4)
11846 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11848 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11849 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11850 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11852 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
11853 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11856 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11857 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
11860 [(set_attr "type" "compare")
11861 (set_attr "length" "12,12,16,16")])
11864 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11866 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11867 (match_operand:SI 2 "reg_or_short_operand" ""))
11868 (match_operand:SI 3 "gpc_reg_operand" ""))
11870 (set (match_operand:SI 0 "gpc_reg_operand" "")
11871 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11872 "TARGET_POWER && reload_completed"
11873 [(set (match_dup 0)
11874 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11876 (compare:CC (match_dup 0)
11881 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11882 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11883 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11886 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11887 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11888 [(set_attr "length" "12")])
11891 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11892 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11893 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11894 "! TARGET_POWERPC64"
11895 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11896 [(set_attr "length" "12")])
11899 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11900 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11901 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11903 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11904 [(set_attr "length" "12")])
11907 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11909 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11910 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11912 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11913 (leu:DI (match_dup 1) (match_dup 2)))]
11916 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11918 [(set_attr "type" "compare")
11919 (set_attr "length" "12,16")])
11922 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11924 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11925 (match_operand:DI 2 "reg_or_short_operand" ""))
11927 (set (match_operand:DI 0 "gpc_reg_operand" "")
11928 (leu:DI (match_dup 1) (match_dup 2)))]
11929 "TARGET_POWERPC64 && reload_completed"
11930 [(set (match_dup 0)
11931 (leu:DI (match_dup 1) (match_dup 2)))
11933 (compare:CC (match_dup 0)
11938 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11940 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11941 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11943 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11944 (leu:SI (match_dup 1) (match_dup 2)))]
11945 "! TARGET_POWERPC64"
11947 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11949 [(set_attr "type" "compare")
11950 (set_attr "length" "12,16")])
11953 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11955 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11956 (match_operand:SI 2 "reg_or_short_operand" ""))
11958 (set (match_operand:SI 0 "gpc_reg_operand" "")
11959 (leu:SI (match_dup 1) (match_dup 2)))]
11960 "! TARGET_POWERPC64 && reload_completed"
11961 [(set (match_dup 0)
11962 (leu:SI (match_dup 1) (match_dup 2)))
11964 (compare:CC (match_dup 0)
11969 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11971 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11972 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11974 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11975 (leu:DI (match_dup 1) (match_dup 2)))]
11978 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11980 [(set_attr "type" "compare")
11981 (set_attr "length" "12,16")])
11984 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11985 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11986 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11987 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11988 "! TARGET_POWERPC64"
11989 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11990 [(set_attr "length" "8")])
11993 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11995 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11996 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11997 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11999 (clobber (match_scratch:SI 4 "=&r,&r"))]
12000 "! TARGET_POWERPC64"
12002 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
12004 [(set_attr "type" "compare")
12005 (set_attr "length" "8,12")])
12008 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12010 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12011 (match_operand:SI 2 "reg_or_short_operand" ""))
12012 (match_operand:SI 3 "gpc_reg_operand" ""))
12014 (clobber (match_scratch:SI 4 ""))]
12015 "! TARGET_POWERPC64 && reload_completed"
12016 [(set (match_dup 4)
12017 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
12020 (compare:CC (match_dup 4)
12025 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12027 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12028 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12029 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12031 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12032 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12033 "! TARGET_POWERPC64"
12035 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
12037 [(set_attr "type" "compare")
12038 (set_attr "length" "8,12")])
12041 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12043 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12044 (match_operand:SI 2 "reg_or_short_operand" ""))
12045 (match_operand:SI 3 "gpc_reg_operand" ""))
12047 (set (match_operand:SI 0 "gpc_reg_operand" "")
12048 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12049 "! TARGET_POWERPC64 && reload_completed"
12050 [(set (match_dup 0)
12051 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12053 (compare:CC (match_dup 0)
12058 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12059 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12060 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12061 "! TARGET_POWERPC64"
12062 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
12063 [(set_attr "length" "12")])
12066 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12068 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12069 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12070 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12071 "! TARGET_POWERPC64"
12072 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12073 [(set_attr "length" "12")])
12076 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12079 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12080 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12081 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12083 (clobber (match_scratch:SI 4 "=&r,&r"))]
12084 "! TARGET_POWERPC64"
12086 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12088 [(set_attr "type" "compare")
12089 (set_attr "length" "12,16")])
12092 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12095 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12096 (match_operand:SI 2 "reg_or_short_operand" "")))
12097 (match_operand:SI 3 "gpc_reg_operand" ""))
12099 (clobber (match_scratch:SI 4 ""))]
12100 "! TARGET_POWERPC64 && reload_completed"
12101 [(set (match_dup 4)
12102 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12105 (compare:CC (match_dup 4)
12110 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12113 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12114 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12115 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12117 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12118 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12119 "! TARGET_POWERPC64"
12121 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12123 [(set_attr "type" "compare")
12124 (set_attr "length" "12,16")])
12127 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12130 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12131 (match_operand:SI 2 "reg_or_short_operand" "")))
12132 (match_operand:SI 3 "gpc_reg_operand" ""))
12134 (set (match_operand:SI 0 "gpc_reg_operand" "")
12135 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12136 "! TARGET_POWERPC64 && reload_completed"
12137 [(set (match_dup 0)
12138 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12141 (compare:CC (match_dup 0)
12146 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12147 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12148 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12150 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12151 [(set_attr "length" "12")])
12154 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12156 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12157 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12159 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12160 (lt:SI (match_dup 1) (match_dup 2)))]
12163 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12165 [(set_attr "type" "delayed_compare")
12166 (set_attr "length" "12,16")])
12169 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12171 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12172 (match_operand:SI 2 "reg_or_short_operand" ""))
12174 (set (match_operand:SI 0 "gpc_reg_operand" "")
12175 (lt:SI (match_dup 1) (match_dup 2)))]
12176 "TARGET_POWER && reload_completed"
12177 [(set (match_dup 0)
12178 (lt:SI (match_dup 1) (match_dup 2)))
12180 (compare:CC (match_dup 0)
12185 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12186 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12187 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12188 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12190 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12191 [(set_attr "length" "12")])
12194 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12196 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12197 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12198 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12200 (clobber (match_scratch:SI 4 "=&r,&r"))]
12203 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12205 [(set_attr "type" "compare")
12206 (set_attr "length" "12,16")])
12209 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12211 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12212 (match_operand:SI 2 "reg_or_short_operand" ""))
12213 (match_operand:SI 3 "gpc_reg_operand" ""))
12215 (clobber (match_scratch:SI 4 ""))]
12216 "TARGET_POWER && reload_completed"
12217 [(set (match_dup 4)
12218 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12221 (compare:CC (match_dup 4)
12226 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12228 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12229 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12230 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12232 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12233 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12236 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12238 [(set_attr "type" "compare")
12239 (set_attr "length" "12,16")])
12242 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12244 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12245 (match_operand:SI 2 "reg_or_short_operand" ""))
12246 (match_operand:SI 3 "gpc_reg_operand" ""))
12248 (set (match_operand:SI 0 "gpc_reg_operand" "")
12249 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12250 "TARGET_POWER && reload_completed"
12251 [(set (match_dup 0)
12252 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12254 (compare:CC (match_dup 0)
12259 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12260 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12261 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12263 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12264 [(set_attr "length" "12")])
12267 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12268 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12269 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12270 "! TARGET_POWERPC64"
12272 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12273 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12274 [(set_attr "length" "12")])
12277 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12279 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12280 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12282 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12283 (ltu:SI (match_dup 1) (match_dup 2)))]
12284 "! TARGET_POWERPC64"
12286 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12287 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12290 [(set_attr "type" "compare")
12291 (set_attr "length" "12,12,16,16")])
12294 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12296 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12297 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12299 (set (match_operand:SI 0 "gpc_reg_operand" "")
12300 (ltu:SI (match_dup 1) (match_dup 2)))]
12301 "! TARGET_POWERPC64 && reload_completed"
12302 [(set (match_dup 0)
12303 (ltu:SI (match_dup 1) (match_dup 2)))
12305 (compare:CC (match_dup 0)
12310 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12311 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12312 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12313 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12314 "! TARGET_POWERPC64"
12316 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12317 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12318 [(set_attr "length" "12")])
12321 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12323 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12324 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12325 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12327 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12328 "! TARGET_POWERPC64"
12330 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12331 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12334 [(set_attr "type" "compare")
12335 (set_attr "length" "12,12,16,16")])
12338 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12340 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12341 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12342 (match_operand:SI 3 "gpc_reg_operand" ""))
12344 (clobber (match_scratch:SI 4 ""))]
12345 "! TARGET_POWERPC64 && reload_completed"
12346 [(set (match_dup 4)
12347 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12350 (compare:CC (match_dup 4)
12355 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12357 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12358 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12359 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12361 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12362 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12363 "! TARGET_POWERPC64"
12365 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12366 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12369 [(set_attr "type" "compare")
12370 (set_attr "length" "12,12,16,16")])
12373 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12375 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12376 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12377 (match_operand:SI 3 "gpc_reg_operand" ""))
12379 (set (match_operand:SI 0 "gpc_reg_operand" "")
12380 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12381 "! TARGET_POWERPC64 && reload_completed"
12382 [(set (match_dup 0)
12383 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12385 (compare:CC (match_dup 0)
12390 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12391 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12392 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12393 "! TARGET_POWERPC64"
12395 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12396 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12397 [(set_attr "length" "8")])
12400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12401 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12402 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12403 (clobber (match_scratch:SI 3 "=r"))]
12405 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12406 [(set_attr "length" "12")])
12409 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12411 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12412 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12414 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12415 (ge:SI (match_dup 1) (match_dup 2)))
12416 (clobber (match_scratch:SI 3 "=r,r"))]
12419 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12421 [(set_attr "type" "compare")
12422 (set_attr "length" "12,16")])
12425 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12427 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12428 (match_operand:SI 2 "reg_or_short_operand" ""))
12430 (set (match_operand:SI 0 "gpc_reg_operand" "")
12431 (ge:SI (match_dup 1) (match_dup 2)))
12432 (clobber (match_scratch:SI 3 ""))]
12433 "TARGET_POWER && reload_completed"
12434 [(parallel [(set (match_dup 0)
12435 (ge:SI (match_dup 1) (match_dup 2)))
12436 (clobber (match_dup 3))])
12438 (compare:CC (match_dup 0)
12443 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12444 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12445 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12446 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12448 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12449 [(set_attr "length" "12")])
12452 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12454 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12455 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12456 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12458 (clobber (match_scratch:SI 4 "=&r,&r"))]
12461 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12463 [(set_attr "type" "compare")
12464 (set_attr "length" "12,16")])
12467 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12469 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12470 (match_operand:SI 2 "reg_or_short_operand" ""))
12471 (match_operand:SI 3 "gpc_reg_operand" ""))
12473 (clobber (match_scratch:SI 4 ""))]
12474 "TARGET_POWER && reload_completed"
12475 [(set (match_dup 4)
12476 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12479 (compare:CC (match_dup 4)
12484 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12486 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12487 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12488 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12490 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12491 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12494 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12496 [(set_attr "type" "compare")
12497 (set_attr "length" "12,16")])
12500 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12502 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12503 (match_operand:SI 2 "reg_or_short_operand" ""))
12504 (match_operand:SI 3 "gpc_reg_operand" ""))
12506 (set (match_operand:SI 0 "gpc_reg_operand" "")
12507 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12508 "TARGET_POWER && reload_completed"
12509 [(set (match_dup 0)
12510 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12512 (compare:CC (match_dup 0)
12517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12518 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12519 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12521 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12522 [(set_attr "length" "12")])
12525 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12526 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12527 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12528 "! TARGET_POWERPC64"
12530 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12531 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12532 [(set_attr "length" "12")])
12535 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12536 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12537 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12540 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12541 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12542 [(set_attr "length" "12")])
12545 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12547 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12548 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12550 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12551 (geu:SI (match_dup 1) (match_dup 2)))]
12552 "! TARGET_POWERPC64"
12554 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12555 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12558 [(set_attr "type" "compare")
12559 (set_attr "length" "12,12,16,16")])
12562 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12564 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12565 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12567 (set (match_operand:SI 0 "gpc_reg_operand" "")
12568 (geu:SI (match_dup 1) (match_dup 2)))]
12569 "! TARGET_POWERPC64 && reload_completed"
12570 [(set (match_dup 0)
12571 (geu:SI (match_dup 1) (match_dup 2)))
12573 (compare:CC (match_dup 0)
12578 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12580 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12581 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12583 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12584 (geu:DI (match_dup 1) (match_dup 2)))]
12587 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12588 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12591 [(set_attr "type" "compare")
12592 (set_attr "length" "12,12,16,16")])
12595 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12597 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12598 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12600 (set (match_operand:DI 0 "gpc_reg_operand" "")
12601 (geu:DI (match_dup 1) (match_dup 2)))]
12602 "TARGET_POWERPC64 && reload_completed"
12603 [(set (match_dup 0)
12604 (geu:DI (match_dup 1) (match_dup 2)))
12606 (compare:CC (match_dup 0)
12611 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12612 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12613 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12614 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12615 "! TARGET_POWERPC64"
12617 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12618 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12619 [(set_attr "length" "8")])
12622 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12624 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12625 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12626 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12628 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12629 "! TARGET_POWERPC64"
12631 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12632 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12635 [(set_attr "type" "compare")
12636 (set_attr "length" "8,8,12,12")])
12639 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12641 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12642 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12643 (match_operand:SI 3 "gpc_reg_operand" ""))
12645 (clobber (match_scratch:SI 4 ""))]
12646 "! TARGET_POWERPC64 && reload_completed"
12647 [(set (match_dup 4)
12648 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12651 (compare:CC (match_dup 4)
12656 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12658 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12659 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12660 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12662 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12663 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12664 "! TARGET_POWERPC64"
12666 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12667 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12670 [(set_attr "type" "compare")
12671 (set_attr "length" "8,8,12,12")])
12674 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12676 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12677 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12678 (match_operand:SI 3 "gpc_reg_operand" ""))
12680 (set (match_operand:SI 0 "gpc_reg_operand" "")
12681 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12682 "! TARGET_POWERPC64 && reload_completed"
12683 [(set (match_dup 0)
12684 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12686 (compare:CC (match_dup 0)
12691 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12692 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12693 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12694 "! TARGET_POWERPC64"
12696 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12697 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12698 [(set_attr "length" "12")])
12701 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12703 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12704 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12705 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12706 "! TARGET_POWERPC64"
12708 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12709 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12710 [(set_attr "length" "12")])
12713 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12716 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12717 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12718 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12720 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12721 "! TARGET_POWERPC64"
12723 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12724 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12727 [(set_attr "type" "compare")
12728 (set_attr "length" "12,12,16,16")])
12731 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12734 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12735 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12736 (match_operand:SI 3 "gpc_reg_operand" ""))
12738 (clobber (match_scratch:SI 4 ""))]
12739 "! TARGET_POWERPC64 && reload_completed"
12740 [(set (match_dup 4)
12741 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12744 (compare:CC (match_dup 4)
12749 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12752 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12753 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12754 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12756 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12757 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12758 "! TARGET_POWERPC64"
12760 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12761 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12764 [(set_attr "type" "compare")
12765 (set_attr "length" "12,12,16,16")])
12768 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12771 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12772 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12773 (match_operand:SI 3 "gpc_reg_operand" ""))
12775 (set (match_operand:SI 0 "gpc_reg_operand" "")
12776 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12777 "! TARGET_POWERPC64 && reload_completed"
12778 [(set (match_dup 0)
12779 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12781 (compare:CC (match_dup 0)
12786 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12787 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12789 "! TARGET_POWERPC64"
12790 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12791 [(set_attr "length" "12")])
12794 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12795 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12798 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12799 [(set_attr "length" "12")])
12802 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12804 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12807 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12808 (gt:SI (match_dup 1) (const_int 0)))]
12809 "! TARGET_POWERPC64"
12811 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12813 [(set_attr "type" "delayed_compare")
12814 (set_attr "length" "12,16")])
12817 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12819 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12822 (set (match_operand:SI 0 "gpc_reg_operand" "")
12823 (gt:SI (match_dup 1) (const_int 0)))]
12824 "! TARGET_POWERPC64 && reload_completed"
12825 [(set (match_dup 0)
12826 (gt:SI (match_dup 1) (const_int 0)))
12828 (compare:CC (match_dup 0)
12833 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12835 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12838 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12839 (gt:DI (match_dup 1) (const_int 0)))]
12842 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12844 [(set_attr "type" "delayed_compare")
12845 (set_attr "length" "12,16")])
12848 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12850 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12853 (set (match_operand:DI 0 "gpc_reg_operand" "")
12854 (gt:DI (match_dup 1) (const_int 0)))]
12855 "TARGET_POWERPC64 && reload_completed"
12856 [(set (match_dup 0)
12857 (gt:DI (match_dup 1) (const_int 0)))
12859 (compare:CC (match_dup 0)
12864 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12865 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12866 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12868 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12869 [(set_attr "length" "12")])
12872 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12874 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12875 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12877 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12878 (gt:SI (match_dup 1) (match_dup 2)))]
12881 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12883 [(set_attr "type" "delayed_compare")
12884 (set_attr "length" "12,16")])
12887 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12889 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12890 (match_operand:SI 2 "reg_or_short_operand" ""))
12892 (set (match_operand:SI 0 "gpc_reg_operand" "")
12893 (gt:SI (match_dup 1) (match_dup 2)))]
12894 "TARGET_POWER && reload_completed"
12895 [(set (match_dup 0)
12896 (gt:SI (match_dup 1) (match_dup 2)))
12898 (compare:CC (match_dup 0)
12903 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12904 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12906 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12907 "! TARGET_POWERPC64"
12908 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12909 [(set_attr "length" "12")])
12912 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
12913 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12915 (match_operand:DI 2 "gpc_reg_operand" "r")))]
12917 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12918 [(set_attr "length" "12")])
12921 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12923 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12925 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12927 (clobber (match_scratch:SI 3 "=&r,&r"))]
12928 "! TARGET_POWERPC64"
12930 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12932 [(set_attr "type" "compare")
12933 (set_attr "length" "12,16")])
12936 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12938 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12940 (match_operand:SI 2 "gpc_reg_operand" ""))
12942 (clobber (match_scratch:SI 3 ""))]
12943 "! TARGET_POWERPC64 && reload_completed"
12944 [(set (match_dup 3)
12945 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12948 (compare:CC (match_dup 3)
12953 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12955 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12957 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12959 (clobber (match_scratch:DI 3 "=&r,&r"))]
12962 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12964 [(set_attr "type" "compare")
12965 (set_attr "length" "12,16")])
12968 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12970 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12972 (match_operand:DI 2 "gpc_reg_operand" ""))
12974 (clobber (match_scratch:DI 3 ""))]
12975 "TARGET_POWERPC64 && reload_completed"
12976 [(set (match_dup 3)
12977 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12980 (compare:CC (match_dup 3)
12985 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12987 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12989 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12991 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12992 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12993 "! TARGET_POWERPC64"
12995 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
12997 [(set_attr "type" "compare")
12998 (set_attr "length" "12,16")])
13001 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13003 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13005 (match_operand:SI 2 "gpc_reg_operand" ""))
13007 (set (match_operand:SI 0 "gpc_reg_operand" "")
13008 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
13009 "! TARGET_POWERPC64 && reload_completed"
13010 [(set (match_dup 0)
13011 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
13013 (compare:CC (match_dup 0)
13018 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13020 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13022 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
13024 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13025 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13028 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
13030 [(set_attr "type" "compare")
13031 (set_attr "length" "12,16")])
13034 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13036 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
13038 (match_operand:DI 2 "gpc_reg_operand" ""))
13040 (set (match_operand:DI 0 "gpc_reg_operand" "")
13041 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
13042 "TARGET_POWERPC64 && reload_completed"
13043 [(set (match_dup 0)
13044 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
13046 (compare:CC (match_dup 0)
13051 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13052 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13053 (match_operand:SI 2 "reg_or_short_operand" "r"))
13054 (match_operand:SI 3 "gpc_reg_operand" "r")))]
13056 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
13057 [(set_attr "length" "12")])
13060 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
13062 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13063 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13064 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13066 (clobber (match_scratch:SI 4 "=&r,&r"))]
13069 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13071 [(set_attr "type" "compare")
13072 (set_attr "length" "12,16")])
13075 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13077 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13078 (match_operand:SI 2 "reg_or_short_operand" ""))
13079 (match_operand:SI 3 "gpc_reg_operand" ""))
13081 (clobber (match_scratch:SI 4 ""))]
13082 "TARGET_POWER && reload_completed"
13083 [(set (match_dup 4)
13084 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13086 (compare:CC (match_dup 4)
13091 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13093 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13094 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13095 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13097 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13098 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13101 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13103 [(set_attr "type" "compare")
13104 (set_attr "length" "12,16")])
13107 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13109 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13110 (match_operand:SI 2 "reg_or_short_operand" ""))
13111 (match_operand:SI 3 "gpc_reg_operand" ""))
13113 (set (match_operand:SI 0 "gpc_reg_operand" "")
13114 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13115 "TARGET_POWER && reload_completed"
13116 [(set (match_dup 0)
13117 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13119 (compare:CC (match_dup 0)
13124 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13125 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13127 "! TARGET_POWERPC64"
13128 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13129 [(set_attr "length" "12")])
13132 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13133 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13136 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13137 [(set_attr "length" "12")])
13140 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13141 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13142 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13144 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13145 [(set_attr "length" "12")])
13148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13149 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13150 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13151 "! TARGET_POWERPC64"
13152 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13153 [(set_attr "length" "12")])
13156 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13157 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13158 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13160 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13161 [(set_attr "length" "12")])
13164 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13166 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13167 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13169 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13170 (gtu:SI (match_dup 1) (match_dup 2)))]
13171 "! TARGET_POWERPC64"
13173 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13175 [(set_attr "type" "compare")
13176 (set_attr "length" "12,16")])
13179 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13181 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13182 (match_operand:SI 2 "reg_or_short_operand" ""))
13184 (set (match_operand:SI 0 "gpc_reg_operand" "")
13185 (gtu:SI (match_dup 1) (match_dup 2)))]
13186 "! TARGET_POWERPC64 && reload_completed"
13187 [(set (match_dup 0)
13188 (gtu:SI (match_dup 1) (match_dup 2)))
13190 (compare:CC (match_dup 0)
13195 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13197 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13198 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13200 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13201 (gtu:DI (match_dup 1) (match_dup 2)))]
13204 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13206 [(set_attr "type" "compare")
13207 (set_attr "length" "12,16")])
13210 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13212 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13213 (match_operand:DI 2 "reg_or_short_operand" ""))
13215 (set (match_operand:DI 0 "gpc_reg_operand" "")
13216 (gtu:DI (match_dup 1) (match_dup 2)))]
13217 "TARGET_POWERPC64 && reload_completed"
13218 [(set (match_dup 0)
13219 (gtu:DI (match_dup 1) (match_dup 2)))
13221 (compare:CC (match_dup 0)
13226 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13227 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13228 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13229 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13230 "! TARGET_POWERPC64"
13232 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13233 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13234 [(set_attr "length" "8,12")])
13237 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13238 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13239 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13240 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13243 addic %0,%1,%k2\;addze %0,%3
13244 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13245 [(set_attr "length" "8,12")])
13248 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13250 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13251 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13252 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13254 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13255 "! TARGET_POWERPC64"
13257 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13258 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13261 [(set_attr "type" "compare")
13262 (set_attr "length" "8,12,12,16")])
13265 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13267 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13268 (match_operand:SI 2 "reg_or_short_operand" ""))
13269 (match_operand:SI 3 "gpc_reg_operand" ""))
13271 (clobber (match_scratch:SI 4 ""))]
13272 "! TARGET_POWERPC64 && reload_completed"
13273 [(set (match_dup 4)
13274 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13277 (compare:CC (match_dup 4)
13282 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13284 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13285 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13286 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13288 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13291 addic %4,%1,%k2\;addze. %4,%3
13292 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13295 [(set_attr "type" "compare")
13296 (set_attr "length" "8,12,12,16")])
13299 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13301 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13302 (match_operand:DI 2 "reg_or_short_operand" ""))
13303 (match_operand:DI 3 "gpc_reg_operand" ""))
13305 (clobber (match_scratch:DI 4 ""))]
13306 "TARGET_POWERPC64 && reload_completed"
13307 [(set (match_dup 4)
13308 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13311 (compare:CC (match_dup 4)
13316 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13318 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13319 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13320 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13322 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13323 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13324 "! TARGET_POWERPC64"
13326 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13327 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13330 [(set_attr "type" "compare")
13331 (set_attr "length" "8,12,12,16")])
13334 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13336 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13337 (match_operand:SI 2 "reg_or_short_operand" ""))
13338 (match_operand:SI 3 "gpc_reg_operand" ""))
13340 (set (match_operand:SI 0 "gpc_reg_operand" "")
13341 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13342 "! TARGET_POWERPC64 && reload_completed"
13343 [(set (match_dup 0)
13344 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13346 (compare:CC (match_dup 0)
13351 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13353 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13354 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13355 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13357 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13358 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13361 addic %0,%1,%k2\;addze. %0,%3
13362 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13365 [(set_attr "type" "compare")
13366 (set_attr "length" "8,12,12,16")])
13369 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13371 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13372 (match_operand:DI 2 "reg_or_short_operand" ""))
13373 (match_operand:DI 3 "gpc_reg_operand" ""))
13375 (set (match_operand:DI 0 "gpc_reg_operand" "")
13376 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13377 "TARGET_POWERPC64 && reload_completed"
13378 [(set (match_dup 0)
13379 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13381 (compare:CC (match_dup 0)
13386 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13387 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13388 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13389 "! TARGET_POWERPC64"
13390 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13391 [(set_attr "length" "8")])
13394 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13395 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13396 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13398 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13399 [(set_attr "length" "8")])
13401 ;; Define both directions of branch and return. If we need a reload
13402 ;; register, we'd rather use CR0 since it is much easier to copy a
13403 ;; register CC value to there.
13407 (if_then_else (match_operator 1 "branch_comparison_operator"
13409 "cc_reg_operand" "x,?y")
13411 (label_ref (match_operand 0 "" ""))
13416 return output_cbranch (operands[1], \"%l0\", 0, insn);
13418 [(set_attr "type" "branch")])
13422 (if_then_else (match_operator 0 "branch_comparison_operator"
13424 "cc_reg_operand" "x,?y")
13431 return output_cbranch (operands[0], NULL, 0, insn);
13433 [(set_attr "type" "branch")
13434 (set_attr "length" "4")])
13438 (if_then_else (match_operator 1 "branch_comparison_operator"
13440 "cc_reg_operand" "x,?y")
13443 (label_ref (match_operand 0 "" ""))))]
13447 return output_cbranch (operands[1], \"%l0\", 1, insn);
13449 [(set_attr "type" "branch")])
13453 (if_then_else (match_operator 0 "branch_comparison_operator"
13455 "cc_reg_operand" "x,?y")
13462 return output_cbranch (operands[0], NULL, 1, insn);
13464 [(set_attr "type" "branch")
13465 (set_attr "length" "4")])
13467 ;; Logic on condition register values.
13469 ; This pattern matches things like
13470 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13471 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13473 ; which are generated by the branch logic.
13476 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13477 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13478 [(match_operator:SI 2
13479 "branch_positive_comparison_operator"
13481 "cc_reg_operand" "y")
13483 (match_operator:SI 4
13484 "branch_positive_comparison_operator"
13486 "cc_reg_operand" "y")
13490 "cr%q1 %E0,%j2,%j4"
13491 [(set_attr "type" "cr_logical")])
13493 ; Why is the constant -1 here, but 1 in the previous pattern?
13494 ; Because ~1 has all but the low bit set.
13496 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13497 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13498 [(not:SI (match_operator:SI 2
13499 "branch_positive_comparison_operator"
13501 "cc_reg_operand" "y")
13503 (match_operator:SI 4
13504 "branch_positive_comparison_operator"
13506 "cc_reg_operand" "y")
13510 "cr%q1 %E0,%j2,%j4"
13511 [(set_attr "type" "cr_logical")])
13514 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13515 (compare:CCEQ (match_operator:SI 1
13516 "branch_positive_comparison_operator"
13518 "cc_reg_operand" "y")
13522 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13523 [(set_attr "type" "cr_logical")])
13525 ;; If we are comparing the result of two comparisons, this can be done
13526 ;; using creqv or crxor.
13528 (define_insn_and_split ""
13529 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13530 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13531 [(match_operand 2 "cc_reg_operand" "y")
13533 (match_operator 3 "branch_comparison_operator"
13534 [(match_operand 4 "cc_reg_operand" "y")
13539 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13543 int positive_1, positive_2;
13545 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13546 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13549 operands[1] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[2]),
13550 GET_CODE (operands[1])),
13552 operands[2], const0_rtx);
13553 else if (GET_MODE (operands[1]) != SImode)
13554 operands[1] = gen_rtx (GET_CODE (operands[1]),
13556 operands[2], const0_rtx);
13559 operands[3] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[4]),
13560 GET_CODE (operands[3])),
13562 operands[4], const0_rtx);
13563 else if (GET_MODE (operands[3]) != SImode)
13564 operands[3] = gen_rtx (GET_CODE (operands[3]),
13566 operands[4], const0_rtx);
13568 if (positive_1 == positive_2)
13570 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13571 operands[5] = constm1_rtx;
13575 operands[5] = const1_rtx;
13579 ;; Unconditional branch and return.
13581 (define_insn "jump"
13583 (label_ref (match_operand 0 "" "")))]
13586 [(set_attr "type" "branch")])
13588 (define_insn "return"
13592 [(set_attr "type" "jmpreg")])
13594 (define_expand "indirect_jump"
13595 [(set (pc) (match_operand 0 "register_operand" ""))]
13600 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13602 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13606 (define_insn "indirect_jumpsi"
13607 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13612 [(set_attr "type" "jmpreg")])
13614 (define_insn "indirect_jumpdi"
13615 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13620 [(set_attr "type" "jmpreg")])
13622 ;; Table jump for switch statements:
13623 (define_expand "tablejump"
13624 [(use (match_operand 0 "" ""))
13625 (use (label_ref (match_operand 1 "" "")))]
13630 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13632 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13636 (define_expand "tablejumpsi"
13637 [(set (match_dup 3)
13638 (plus:SI (match_operand:SI 0 "" "")
13640 (parallel [(set (pc) (match_dup 3))
13641 (use (label_ref (match_operand 1 "" "")))])]
13644 { operands[0] = force_reg (SImode, operands[0]);
13645 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13646 operands[3] = gen_reg_rtx (SImode);
13649 (define_expand "tablejumpdi"
13650 [(set (match_dup 4)
13651 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13653 (plus:DI (match_dup 4)
13655 (parallel [(set (pc) (match_dup 3))
13656 (use (label_ref (match_operand 1 "" "")))])]
13659 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13660 operands[3] = gen_reg_rtx (DImode);
13661 operands[4] = gen_reg_rtx (DImode);
13666 (match_operand:SI 0 "register_operand" "c,*l"))
13667 (use (label_ref (match_operand 1 "" "")))]
13672 [(set_attr "type" "jmpreg")])
13676 (match_operand:DI 0 "register_operand" "c,*l"))
13677 (use (label_ref (match_operand 1 "" "")))]
13682 [(set_attr "type" "jmpreg")])
13687 "{cror 0,0,0|nop}")
13689 ;; Define the subtract-one-and-jump insns, starting with the template
13690 ;; so loop.c knows what to generate.
13692 (define_expand "doloop_end"
13693 [(use (match_operand 0 "" "")) ; loop pseudo
13694 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13695 (use (match_operand 2 "" "")) ; max iterations
13696 (use (match_operand 3 "" "")) ; loop level
13697 (use (match_operand 4 "" ""))] ; label
13701 /* Only use this on innermost loops. */
13702 if (INTVAL (operands[3]) > 1)
13704 if (TARGET_POWERPC64)
13706 if (GET_MODE (operands[0]) != DImode)
13708 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13712 if (GET_MODE (operands[0]) != SImode)
13714 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13719 (define_expand "ctrsi"
13720 [(parallel [(set (pc)
13721 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13723 (label_ref (match_operand 1 "" ""))
13726 (plus:SI (match_dup 0)
13728 (clobber (match_scratch:CC 2 ""))
13729 (clobber (match_scratch:SI 3 ""))])]
13730 "! TARGET_POWERPC64"
13733 (define_expand "ctrdi"
13734 [(parallel [(set (pc)
13735 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13737 (label_ref (match_operand 1 "" ""))
13740 (plus:DI (match_dup 0)
13742 (clobber (match_scratch:CC 2 ""))
13743 (clobber (match_scratch:DI 3 ""))])]
13747 ;; We need to be able to do this for any operand, including MEM, or we
13748 ;; will cause reload to blow up since we don't allow output reloads on
13750 ;; For the length attribute to be calculated correctly, the
13751 ;; label MUST be operand 0.
13753 (define_insn "*ctrsi_internal1"
13755 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13757 (label_ref (match_operand 0 "" ""))
13759 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13760 (plus:SI (match_dup 1)
13762 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13763 (clobber (match_scratch:SI 4 "=X,X,r"))]
13764 "! TARGET_POWERPC64"
13767 if (which_alternative != 0)
13769 else if (get_attr_length (insn) == 4)
13770 return \"{bdn|bdnz} %l0\";
13772 return \"bdz $+8\;b %l0\";
13774 [(set_attr "type" "branch")
13775 (set_attr "length" "*,12,16")])
13777 (define_insn "*ctrsi_internal2"
13779 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13782 (label_ref (match_operand 0 "" ""))))
13783 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13784 (plus:SI (match_dup 1)
13786 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13787 (clobber (match_scratch:SI 4 "=X,X,r"))]
13788 "! TARGET_POWERPC64"
13791 if (which_alternative != 0)
13793 else if (get_attr_length (insn) == 4)
13794 return \"bdz %l0\";
13796 return \"{bdn|bdnz} $+8\;b %l0\";
13798 [(set_attr "type" "branch")
13799 (set_attr "length" "*,12,16")])
13801 (define_insn "*ctrdi_internal1"
13803 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
13805 (label_ref (match_operand 0 "" ""))
13807 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13808 (plus:DI (match_dup 1)
13810 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13811 (clobber (match_scratch:DI 4 "=X,X,r"))]
13815 if (which_alternative != 0)
13817 else if (get_attr_length (insn) == 4)
13818 return \"{bdn|bdnz} %l0\";
13820 return \"bdz $+8\;b %l0\";
13822 [(set_attr "type" "branch")
13823 (set_attr "length" "*,12,16")])
13825 (define_insn "*ctrdi_internal2"
13827 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
13830 (label_ref (match_operand 0 "" ""))))
13831 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13832 (plus:DI (match_dup 1)
13834 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13835 (clobber (match_scratch:DI 4 "=X,X,r"))]
13839 if (which_alternative != 0)
13841 else if (get_attr_length (insn) == 4)
13842 return \"bdz %l0\";
13844 return \"{bdn|bdnz} $+8\;b %l0\";
13846 [(set_attr "type" "branch")
13847 (set_attr "length" "*,12,16")])
13849 ;; Similar, but we can use GE since we have a REG_NONNEG.
13851 (define_insn "*ctrsi_internal3"
13853 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13855 (label_ref (match_operand 0 "" ""))
13857 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13858 (plus:SI (match_dup 1)
13860 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13861 (clobber (match_scratch:SI 4 "=X,X,r"))]
13862 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13865 if (which_alternative != 0)
13867 else if (get_attr_length (insn) == 4)
13868 return \"{bdn|bdnz} %l0\";
13870 return \"bdz $+8\;b %l0\";
13872 [(set_attr "type" "branch")
13873 (set_attr "length" "*,12,16")])
13875 (define_insn "*ctrsi_internal4"
13877 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13880 (label_ref (match_operand 0 "" ""))))
13881 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13882 (plus:SI (match_dup 1)
13884 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13885 (clobber (match_scratch:SI 4 "=X,X,r"))]
13886 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13889 if (which_alternative != 0)
13891 else if (get_attr_length (insn) == 4)
13892 return \"bdz %l0\";
13894 return \"{bdn|bdnz} $+8\;b %l0\";
13896 [(set_attr "type" "branch")
13897 (set_attr "length" "*,12,16")])
13899 (define_insn "*ctrdi_internal3"
13901 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
13903 (label_ref (match_operand 0 "" ""))
13905 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13906 (plus:DI (match_dup 1)
13908 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13909 (clobber (match_scratch:DI 4 "=X,X,r"))]
13910 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13913 if (which_alternative != 0)
13915 else if (get_attr_length (insn) == 4)
13916 return \"{bdn|bdnz} %l0\";
13918 return \"bdz $+8\;b %l0\";
13920 [(set_attr "type" "branch")
13921 (set_attr "length" "*,12,16")])
13923 (define_insn "*ctrdi_internal4"
13925 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
13928 (label_ref (match_operand 0 "" ""))))
13929 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13930 (plus:DI (match_dup 1)
13932 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13933 (clobber (match_scratch:DI 4 "=X,X,r"))]
13934 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13937 if (which_alternative != 0)
13939 else if (get_attr_length (insn) == 4)
13940 return \"bdz %l0\";
13942 return \"{bdn|bdnz} $+8\;b %l0\";
13944 [(set_attr "type" "branch")
13945 (set_attr "length" "*,12,16")])
13947 ;; Similar but use EQ
13949 (define_insn "*ctrsi_internal5"
13951 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13953 (label_ref (match_operand 0 "" ""))
13955 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13956 (plus:SI (match_dup 1)
13958 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13959 (clobber (match_scratch:SI 4 "=X,X,r"))]
13960 "! TARGET_POWERPC64"
13963 if (which_alternative != 0)
13965 else if (get_attr_length (insn) == 4)
13966 return \"bdz %l0\";
13968 return \"{bdn|bdnz} $+8\;b %l0\";
13970 [(set_attr "type" "branch")
13971 (set_attr "length" "*,12,16")])
13973 (define_insn "*ctrsi_internal6"
13975 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13978 (label_ref (match_operand 0 "" ""))))
13979 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13980 (plus:SI (match_dup 1)
13982 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13983 (clobber (match_scratch:SI 4 "=X,X,r"))]
13984 "! TARGET_POWERPC64"
13987 if (which_alternative != 0)
13989 else if (get_attr_length (insn) == 4)
13990 return \"{bdn|bdnz} %l0\";
13992 return \"bdz $+8\;b %l0\";
13994 [(set_attr "type" "branch")
13995 (set_attr "length" "*,12,16")])
13997 (define_insn "*ctrdi_internal5"
13999 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
14001 (label_ref (match_operand 0 "" ""))
14003 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14004 (plus:DI (match_dup 1)
14006 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14007 (clobber (match_scratch:DI 4 "=X,X,r"))]
14011 if (which_alternative != 0)
14013 else if (get_attr_length (insn) == 4)
14014 return \"bdz %l0\";
14016 return \"{bdn|bdnz} $+8\;b %l0\";
14018 [(set_attr "type" "branch")
14019 (set_attr "length" "*,12,16")])
14021 (define_insn "*ctrdi_internal6"
14023 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
14026 (label_ref (match_operand 0 "" ""))))
14027 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
14028 (plus:DI (match_dup 1)
14030 (clobber (match_scratch:CC 3 "=X,&x,&x"))
14031 (clobber (match_scratch:DI 4 "=X,X,r"))]
14035 if (which_alternative != 0)
14037 else if (get_attr_length (insn) == 4)
14038 return \"{bdn|bdnz} %l0\";
14040 return \"bdz $+8\;b %l0\";
14042 [(set_attr "type" "branch")
14043 (set_attr "length" "*,12,16")])
14045 ;; Now the splitters if we could not allocate the CTR register
14049 (if_then_else (match_operator 2 "comparison_operator"
14050 [(match_operand:SI 1 "gpc_reg_operand" "")
14052 (match_operand 5 "" "")
14053 (match_operand 6 "" "")))
14054 (set (match_operand:SI 0 "gpc_reg_operand" "")
14055 (plus:SI (match_dup 1)
14057 (clobber (match_scratch:CC 3 ""))
14058 (clobber (match_scratch:SI 4 ""))]
14059 "! TARGET_POWERPC64 && reload_completed"
14060 [(parallel [(set (match_dup 3)
14061 (compare:CC (plus:SI (match_dup 1)
14065 (plus:SI (match_dup 1)
14067 (set (pc) (if_then_else (match_dup 7)
14071 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14076 (if_then_else (match_operator 2 "comparison_operator"
14077 [(match_operand:SI 1 "gpc_reg_operand" "")
14079 (match_operand 5 "" "")
14080 (match_operand 6 "" "")))
14081 (set (match_operand:SI 0 "nonimmediate_operand" "")
14082 (plus:SI (match_dup 1) (const_int -1)))
14083 (clobber (match_scratch:CC 3 ""))
14084 (clobber (match_scratch:SI 4 ""))]
14085 "! TARGET_POWERPC64 && reload_completed
14086 && ! gpc_reg_operand (operands[0], SImode)"
14087 [(parallel [(set (match_dup 3)
14088 (compare:CC (plus:SI (match_dup 1)
14092 (plus:SI (match_dup 1)
14096 (set (pc) (if_then_else (match_dup 7)
14100 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14104 (if_then_else (match_operator 2 "comparison_operator"
14105 [(match_operand:DI 1 "gpc_reg_operand" "")
14107 (match_operand 5 "" "")
14108 (match_operand 6 "" "")))
14109 (set (match_operand:DI 0 "gpc_reg_operand" "")
14110 (plus:DI (match_dup 1)
14112 (clobber (match_scratch:CC 3 ""))
14113 (clobber (match_scratch:DI 4 ""))]
14114 "TARGET_POWERPC64 && reload_completed"
14115 [(parallel [(set (match_dup 3)
14116 (compare:CC (plus:DI (match_dup 1)
14120 (plus:DI (match_dup 1)
14122 (set (pc) (if_then_else (match_dup 7)
14126 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14131 (if_then_else (match_operator 2 "comparison_operator"
14132 [(match_operand:DI 1 "gpc_reg_operand" "")
14134 (match_operand 5 "" "")
14135 (match_operand 6 "" "")))
14136 (set (match_operand:DI 0 "nonimmediate_operand" "")
14137 (plus:DI (match_dup 1) (const_int -1)))
14138 (clobber (match_scratch:CC 3 ""))
14139 (clobber (match_scratch:DI 4 ""))]
14140 "TARGET_POWERPC64 && reload_completed
14141 && ! gpc_reg_operand (operands[0], DImode)"
14142 [(parallel [(set (match_dup 3)
14143 (compare:CC (plus:DI (match_dup 1)
14147 (plus:DI (match_dup 1)
14151 (set (pc) (if_then_else (match_dup 7)
14155 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14159 (define_insn "trap"
14160 [(trap_if (const_int 1) (const_int 0))]
14164 (define_expand "conditional_trap"
14165 [(trap_if (match_operator 0 "trap_comparison_operator"
14166 [(match_dup 2) (match_dup 3)])
14167 (match_operand 1 "const_int_operand" ""))]
14169 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14170 operands[2] = rs6000_compare_op0;
14171 operands[3] = rs6000_compare_op1;")
14174 [(trap_if (match_operator 0 "trap_comparison_operator"
14175 [(match_operand:SI 1 "register_operand" "r")
14176 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14179 "{t|tw}%V0%I2 %1,%2")
14182 [(trap_if (match_operator 0 "trap_comparison_operator"
14183 [(match_operand:DI 1 "register_operand" "r")
14184 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14189 ;; Insns related to generating the function prologue and epilogue.
14191 (define_expand "prologue"
14192 [(use (const_int 0))]
14193 "TARGET_SCHED_PROLOG"
14196 rs6000_emit_prologue ();
14200 (define_insn "movesi_from_cr"
14201 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14202 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14203 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)] 19))]
14206 [(set_attr "type" "cr_logical")])
14208 (define_insn "*stmw"
14209 [(match_parallel 0 "stmw_operation"
14210 [(set (match_operand:SI 1 "memory_operand" "=m")
14211 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14213 "{stm|stmw} %2,%1")
14215 (define_insn "*save_fpregs_si"
14216 [(match_parallel 0 "any_operand"
14217 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14218 (use (match_operand:SI 2 "call_operand" "s"))
14219 (set (match_operand:DF 3 "memory_operand" "=m")
14220 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14224 (define_insn "*save_fpregs_di"
14225 [(match_parallel 0 "any_operand"
14226 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14227 (use (match_operand:DI 2 "call_operand" "s"))
14228 (set (match_operand:DF 3 "memory_operand" "=m")
14229 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14233 ; These are to explain that changes to the stack pointer should
14234 ; not be moved over stores to stack memory.
14235 (define_insn "stack_tie"
14236 [(set (match_operand:BLK 0 "memory_operand" "+m")
14237 (unspec:BLK [(match_dup 0)] 5))]
14240 [(set_attr "length" "0")])
14243 (define_expand "epilogue"
14244 [(use (const_int 0))]
14245 "TARGET_SCHED_PROLOG"
14248 rs6000_emit_epilogue (FALSE);
14252 ; On some processors, doing the mtcrf one CC register at a time is
14253 ; faster (like on the 604e). On others, doing them all at once is
14254 ; faster; for instance, on the 601 and 750.
14256 (define_expand "movsi_to_cr_one"
14257 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14258 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14259 (match_dup 2)] 20))]
14261 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14263 (define_insn "*movsi_to_cr"
14264 [(match_parallel 0 "mtcrf_operation"
14265 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14266 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14267 (match_operand 3 "immediate_operand" "n")]
14274 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14275 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14276 operands[4] = GEN_INT (mask);
14277 return \"mtcrf %4,%2\";
14279 [(set_attr "type" "cr_logical")])
14282 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14283 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14284 (match_operand 2 "immediate_operand" "n")] 20))]
14285 "GET_CODE (operands[0]) == REG
14286 && CR_REGNO_P (REGNO (operands[0]))
14287 && GET_CODE (operands[2]) == CONST_INT
14288 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14290 [(set_attr "type" "cr_logical")])
14292 ; The load-multiple instructions have similar properties.
14293 ; Note that "load_multiple" is a name known to the machine-independent
14294 ; code that actually corresponds to the powerpc load-string.
14296 (define_insn "*lmw"
14297 [(match_parallel 0 "lmw_operation"
14298 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14299 (match_operand:SI 2 "memory_operand" "m"))])]
14303 (define_insn "*return_internal_si"
14305 (use (match_operand:SI 0 "register_operand" "lc"))]
14308 [(set_attr "type" "jmpreg")])
14310 (define_insn "*return_internal_di"
14312 (use (match_operand:DI 0 "register_operand" "lc"))]
14315 [(set_attr "type" "jmpreg")])
14317 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14318 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14320 (define_insn "*return_and_restore_fpregs_si"
14321 [(match_parallel 0 "any_operand"
14323 (use (match_operand:SI 1 "register_operand" "l"))
14324 (use (match_operand:SI 2 "call_operand" "s"))
14325 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14326 (match_operand:DF 4 "memory_operand" "m"))])]
14330 (define_insn "*return_and_restore_fpregs_di"
14331 [(match_parallel 0 "any_operand"
14333 (use (match_operand:DI 1 "register_operand" "l"))
14334 (use (match_operand:DI 2 "call_operand" "s"))
14335 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14336 (match_operand:DF 4 "memory_operand" "m"))])]
14340 ; This is used in compiling the unwind routines.
14341 (define_expand "eh_return"
14342 [(use (match_operand 0 "general_operand" ""))
14343 (use (match_operand 1 "general_operand" ""))]
14348 rs6000_emit_eh_toc_restore (operands[0]);
14351 emit_insn (gen_eh_set_lr_si (operands[1]));
14353 emit_insn (gen_eh_set_lr_di (operands[1]));
14354 emit_move_insn (EH_RETURN_STACKADJ_RTX, operands[0]);
14358 ; We can't expand this before we know where the link register is stored.
14359 (define_insn "eh_set_lr_si"
14360 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] 9)
14361 (clobber (match_scratch:SI 1 "=&b"))]
14365 (define_insn "eh_set_lr_di"
14366 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 9)
14367 (clobber (match_scratch:DI 1 "=&b"))]
14372 [(unspec_volatile [(match_operand 0 "register_operand" "")] 9)
14373 (clobber (match_scratch 1 ""))]
14378 rs6000_stack_t *info = rs6000_stack_info ();
14380 if (info->lr_save_p)
14382 rtx frame_rtx = stack_pointer_rtx;
14386 if (frame_pointer_needed
14387 || current_function_calls_alloca
14388 || info->total_size > 32767)
14390 emit_move_insn (operands[1], gen_rtx_MEM (Pmode, frame_rtx));
14391 frame_rtx = operands[1];
14393 else if (info->push_p)
14394 sp_offset = info->total_size;
14396 tmp = plus_constant (frame_rtx, info->lr_save_offset + sp_offset);
14397 tmp = gen_rtx_MEM (Pmode, tmp);
14398 emit_move_insn (tmp, operands[0]);
14401 emit_move_insn (gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM), operands[0]);
14405 (define_insn "prefetch"
14406 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14407 (match_operand:SI 1 "const_int_operand" "n")
14408 (match_operand:SI 2 "const_int_operand" "n"))]
14412 if (GET_CODE (operands[0]) == REG)
14413 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14414 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14416 [(set_attr "type" "load")])
14418 (include "altivec.md")