1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GNU CC.
7 ;; GNU CC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU CC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU CC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; Define an insn type attribute. This is used in function unit delay
26 (define_attr "type" "integer,load,fpload,imul,idiv,branch,compare,delayed_compare,fpcompare,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg"
27 (const_string "integer"))
30 (define_attr "length" ""
31 (if_then_else (eq_attr "type" "branch")
32 (if_then_else (and (ge (minus (pc) (match_dup 0))
34 (lt (minus (pc) (match_dup 0))
40 ;; Processor type -- this attribute must exactly match the processor_type
41 ;; enumeration in rs6000.h.
43 (define_attr "cpu" "rios1,rios2,mpccore,ppc403,ppc601,ppc602,ppc603,ppc604,ppc620"
44 (const (symbol_ref "rs6000_cpu_attr")))
46 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
47 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
49 ; Load/Store Unit -- POWER/2 and pure PowerPC only
50 ; (POWER and 601 use Integer Unit)
51 (define_function_unit "lsu" 1 0
52 (and (eq_attr "type" "load")
53 (eq_attr "cpu" "mpccore,ppc602,ppc603,ppc604,ppc620"))
56 (define_function_unit "lsu" 1 0
57 (and (eq_attr "type" "fpload")
58 (eq_attr "cpu" "ppc604,ppc620"))
61 (define_function_unit "lsu" 1 0
62 (and (eq_attr "type" "fpload")
63 (eq_attr "cpu" "mpccore,ppc602,ppc603"))
66 (define_function_unit "iu" 1 0
67 (and (eq_attr "type" "load")
68 (eq_attr "cpu" "rios1,ppc601,ppc403"))
71 (define_function_unit "iu" 1 0
72 (and (eq_attr "type" "fpload")
73 (eq_attr "cpu" "rios1,ppc601"))
76 ; Integer Unit (RIOS1, PPC601, PPC603)
77 ; Trivial operations take one cycle which need not be listed here.
78 (define_function_unit "iu" 1 0
79 (and (eq_attr "type" "imul")
80 (eq_attr "cpu" "rios1"))
83 (define_function_unit "iu" 1 0
84 (and (eq_attr "type" "imul")
85 (eq_attr "cpu" "ppc403"))
88 (define_function_unit "iu" 1 0
89 (and (eq_attr "type" "imul")
90 (eq_attr "cpu" "ppc601,ppc602,ppc603"))
93 (define_function_unit "iu" 1 0
94 (and (eq_attr "type" "idiv")
95 (eq_attr "cpu" "rios1"))
98 (define_function_unit "iu" 1 0
99 (and (eq_attr "type" "idiv")
100 (eq_attr "cpu" "ppc601"))
103 (define_function_unit "iu" 1 0
104 (and (eq_attr "type" "idiv")
105 (eq_attr "cpu" "ppc403"))
108 (define_function_unit "iu" 1 0
109 (and (eq_attr "type" "idiv")
110 (eq_attr "cpu" "ppc602,ppc603"))
113 ; RIOS2 has two integer units: a primary one which can perform all
114 ; operations and a secondary one which is fed in lock step with the first
115 ; and can perform "simple" integer operations.
116 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
117 ; for the complex insns.
118 (define_function_unit "iu2" 2 0
119 (and (eq_attr "type" "integer")
120 (eq_attr "cpu" "rios2"))
123 (define_function_unit "iu2" 2 0
124 (and (eq_attr "type" "imul")
125 (eq_attr "cpu" "rios2"))
128 (define_function_unit "iu2" 2 0
129 (and (eq_attr "type" "idiv")
130 (eq_attr "cpu" "rios2"))
133 (define_function_unit "imuldiv" 1 0
134 (and (eq_attr "type" "imul")
135 (eq_attr "cpu" "rios2"))
139 (define_function_unit "imuldiv" 1 0
140 (and (eq_attr "type" "idiv")
141 (eq_attr "cpu" "rios2"))
144 ; MPCCORE has separate IMUL/IDIV unit for multicycle instructions
145 ; Divide latency varies greatly from 2-11, use 6 as average
146 (define_function_unit "imuldiv" 1 0
147 (and (eq_attr "type" "imul")
148 (eq_attr "cpu" "mpccore"))
151 (define_function_unit "imuldiv" 1 0
152 (and (eq_attr "type" "idiv")
153 (eq_attr "cpu" "mpccore"))
156 ; PPC604 has two units that perform integer operations
157 ; and one unit for divide/multiply operations (and move
159 (define_function_unit "iu2" 2 0
160 (and (eq_attr "type" "integer")
161 (eq_attr "cpu" "ppc604,ppc620"))
163 [(eq_attr "type" "imul,idiv")])
165 (define_function_unit "imuldiv" 1 0
166 (and (eq_attr "type" "imul")
167 (eq_attr "cpu" "ppc604,ppc620"))
169 [(eq_attr "type" "integer")])
171 (define_function_unit "imuldiv" 1 0
172 (and (eq_attr "type" "idiv")
173 (eq_attr "cpu" "ppc604,ppc620"))
175 [(eq_attr "type" "integer")])
177 ; compare is done on integer unit, but feeds insns which
178 ; execute on the branch unit. Ready-delay of the compare
179 ; on the branch unit is large (3-5 cycles). On the iu/fpu
180 ; it is 1. One drawback is that the compare will also be
181 ; assigned to the bpu, but this inaccuracy is worth for being
182 ; able to fill the compare-branch delay, with insns on iu/fpu.
183 (define_function_unit "iu" 1 0
184 (and (eq_attr "type" "compare")
185 (eq_attr "cpu" "rios1,mpccore,ppc601"))
188 (define_function_unit "iu2" 2 0
189 (and (eq_attr "type" "compare")
190 (eq_attr "cpu" "rios2"))
193 (define_function_unit "bpu" 1 0
194 (and (eq_attr "type" "compare")
195 (eq_attr "cpu" "rios1,rios2,ppc403,mpccore,ppc601,ppc603,ppc604,ppc620"))
198 ; different machines have different compare timings
199 ; in ppc604, compare is done on the one of the two
200 ; main integer units.
201 (define_function_unit "iu2" 2 0
202 (and (eq_attr "type" "compare")
203 (eq_attr "cpu" "ppc604,ppc620"))
206 (define_function_unit "bpu" 1 0
207 (eq_attr "type" "delayed_compare")
210 ; fp compare uses fp unit
211 (define_function_unit "fpu" 1 0
212 (and (eq_attr "type" "fpcompare")
213 (eq_attr "cpu" "rios1"))
216 ; rios1 and rios2 have different fpcompare delays
217 (define_function_unit "fpu2" 2 0
218 (and (eq_attr "type" "fpcompare")
219 (eq_attr "cpu" "rios2"))
222 ; on ppc601 and ppc603, fpcompare takes also 2 cycles from
224 ; here we do not define delays, just occupy the unit. The dependencies
225 ; will be signed by the fpcompare definition in the fpu.
226 (define_function_unit "iu" 1 0
227 (and (eq_attr "type" "fpcompare")
228 (eq_attr "cpu" "ppc601,ppc602,ppc603"))
231 ; fp compare uses fp unit
232 (define_function_unit "fpu" 1 0
233 (and (eq_attr "type" "fpcompare")
234 (eq_attr "cpu" "ppc601,ppc602,ppc603,ppc604,ppc620"))
237 (define_function_unit "fpu" 1 0
238 (and (eq_attr "type" "fpcompare")
239 (eq_attr "cpu" "mpccore"))
242 (define_function_unit "bpu" 1 0
243 (and (eq_attr "type" "mtjmpr")
244 (eq_attr "cpu" "rios1,rios2"))
247 (define_function_unit "bpu" 1 0
248 (and (eq_attr "type" "mtjmpr")
249 (eq_attr "cpu" "ppc403,mpccore,ppc601,ppc602,ppc603,ppc604,ppc620"))
252 ; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
253 (define_function_unit "bpu" 1 0
254 (eq_attr "type" "jmpreg")
257 (define_function_unit "bpu" 1 0
258 (eq_attr "type" "branch")
261 ; Floating Point Unit
262 (define_function_unit "fpu" 1 0
263 (and (eq_attr "type" "fp,dmul")
264 (eq_attr "cpu" "rios1"))
267 (define_function_unit "fpu" 1 0
268 (and (eq_attr "type" "fp")
269 (eq_attr "cpu" "mpccore"))
272 (define_function_unit "fpu" 1 0
273 (and (eq_attr "type" "fp")
274 (eq_attr "cpu" "ppc601"))
277 (define_function_unit "fpu" 1 0
278 (and (eq_attr "type" "fp")
279 (eq_attr "cpu" "ppc602,ppc603,ppc604,ppc620"))
282 (define_function_unit "fpu" 1 0
283 (and (eq_attr "type" "dmul")
284 (eq_attr "cpu" "mpccore"))
287 (define_function_unit "fpu" 1 0
288 (and (eq_attr "type" "dmul")
289 (eq_attr "cpu" "ppc601"))
293 (define_function_unit "fpu" 1 0
294 (and (eq_attr "type" "dmul")
295 (eq_attr "cpu" "ppc602,ppc603"))
298 (define_function_unit "fpu" 1 0
299 (and (eq_attr "type" "dmul")
300 (eq_attr "cpu" "ppc604,ppc620"))
303 (define_function_unit "fpu" 1 0
304 (and (eq_attr "type" "sdiv,ddiv")
305 (eq_attr "cpu" "rios1"))
308 (define_function_unit "fpu" 1 0
309 (and (eq_attr "type" "sdiv")
310 (eq_attr "cpu" "ppc601"))
313 (define_function_unit "fpu" 1 0
314 (and (eq_attr "type" "sdiv")
315 (eq_attr "cpu" "mpccore"))
318 (define_function_unit "fpu" 1 0
319 (and (eq_attr "type" "sdiv")
320 (eq_attr "cpu" "ppc602,ppc603,ppc604,ppc620"))
323 (define_function_unit "fpu" 1 0
324 (and (eq_attr "type" "ddiv")
325 (eq_attr "cpu" "mpccore"))
328 (define_function_unit "fpu" 1 0
329 (and (eq_attr "type" "ddiv")
330 (eq_attr "cpu" "ppc601,ppc604,ppc620"))
333 (define_function_unit "fpu" 1 0
334 (and (eq_attr "type" "ddiv")
335 (eq_attr "cpu" "ppc602,ppc603"))
338 (define_function_unit "fpu" 1 0
339 (and (eq_attr "type" "ssqrt")
340 (eq_attr "cpu" "ppc620"))
343 (define_function_unit "fpu" 1 0
344 (and (eq_attr "type" "dsqrt")
345 (eq_attr "cpu" "ppc620"))
348 ; RIOS2 has two symmetric FPUs.
349 (define_function_unit "fpu2" 2 0
350 (and (eq_attr "type" "fp")
351 (eq_attr "cpu" "rios2"))
354 (define_function_unit "fpu2" 2 0
355 (and (eq_attr "type" "dmul")
356 (eq_attr "cpu" "rios2"))
359 (define_function_unit "fpu2" 2 0
360 (and (eq_attr "type" "sdiv,ddiv")
361 (eq_attr "cpu" "rios2"))
364 (define_function_unit "fpu2" 2 0
365 (and (eq_attr "type" "ssqrt,dsqrt")
366 (eq_attr "cpu" "rios2"))
370 ;; Start with fixed-point load and store insns. Here we put only the more
371 ;; complex forms. Basic data transfer is done later.
373 (define_expand "zero_extendqidi2"
374 [(set (match_operand:DI 0 "gpc_reg_operand" "")
375 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
380 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
381 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
386 [(set_attr "type" "load,*")])
389 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
390 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
392 (clobber (match_scratch:DI 2 "=r"))]
395 [(set_attr "type" "compare")])
398 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
399 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
401 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
402 (zero_extend:DI (match_dup 1)))]
405 [(set_attr "type" "compare")])
407 (define_insn "extendqidi2"
408 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
409 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
414 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
415 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
417 (clobber (match_scratch:DI 2 "=r"))]
420 [(set_attr "type" "compare")])
423 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
424 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
426 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
427 (sign_extend:DI (match_dup 1)))]
430 [(set_attr "type" "compare")])
432 (define_expand "zero_extendhidi2"
433 [(set (match_operand:DI 0 "gpc_reg_operand" "")
434 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
439 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
440 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
445 [(set_attr "type" "load,*")])
448 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
449 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
451 (clobber (match_scratch:DI 2 "=r"))]
454 [(set_attr "type" "compare")])
457 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
458 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
460 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
461 (zero_extend:DI (match_dup 1)))]
464 [(set_attr "type" "compare")])
466 (define_expand "extendhidi2"
467 [(set (match_operand:DI 0 "gpc_reg_operand" "")
468 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
473 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
474 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
479 [(set_attr "type" "load,*")])
482 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
483 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
485 (clobber (match_scratch:DI 2 "=r"))]
488 [(set_attr "type" "compare")])
491 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
492 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
494 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
495 (sign_extend:DI (match_dup 1)))]
498 [(set_attr "type" "compare")])
500 (define_expand "zero_extendsidi2"
501 [(set (match_operand:DI 0 "gpc_reg_operand" "")
502 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
507 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
508 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
513 [(set_attr "type" "load,*")])
516 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
517 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
519 (clobber (match_scratch:DI 2 "=r"))]
522 [(set_attr "type" "compare")])
525 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
526 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
528 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
529 (zero_extend:DI (match_dup 1)))]
532 [(set_attr "type" "compare")])
534 (define_expand "extendsidi2"
535 [(set (match_operand:DI 0 "gpc_reg_operand" "")
536 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
541 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
542 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
547 [(set_attr "type" "load,*")])
550 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
551 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
553 (clobber (match_scratch:DI 2 "=r"))]
556 [(set_attr "type" "compare")])
559 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
560 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
562 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
563 (sign_extend:DI (match_dup 1)))]
566 [(set_attr "type" "compare")])
568 (define_expand "zero_extendqisi2"
569 [(set (match_operand:SI 0 "gpc_reg_operand" "")
570 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
575 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
576 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
580 {rlinm|rlwinm} %0,%1,0,0xff"
581 [(set_attr "type" "load,*")])
584 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
585 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
587 (clobber (match_scratch:SI 2 "=r"))]
589 "{andil.|andi.} %2,%1,0xff"
590 [(set_attr "type" "compare")])
593 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
594 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
596 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
597 (zero_extend:SI (match_dup 1)))]
599 "{andil.|andi.} %0,%1,0xff"
600 [(set_attr "type" "compare")])
602 (define_expand "extendqisi2"
603 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
604 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
609 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
610 else if (TARGET_POWER)
611 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
613 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
617 (define_insn "extendqisi2_ppc"
618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
619 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
624 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
625 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
627 (clobber (match_scratch:SI 2 "=r"))]
630 [(set_attr "type" "compare")])
633 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
634 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
636 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
637 (sign_extend:SI (match_dup 1)))]
640 [(set_attr "type" "compare")])
642 (define_expand "extendqisi2_power"
643 [(parallel [(set (match_dup 2)
644 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
646 (clobber (scratch:SI))])
647 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
648 (ashiftrt:SI (match_dup 2)
650 (clobber (scratch:SI))])]
653 { operands[1] = gen_lowpart (SImode, operands[1]);
654 operands[2] = gen_reg_rtx (SImode); }")
656 (define_expand "extendqisi2_no_power"
658 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
660 (set (match_operand:SI 0 "gpc_reg_operand" "")
661 (ashiftrt:SI (match_dup 2)
663 "! TARGET_POWER && ! TARGET_POWERPC"
665 { operands[1] = gen_lowpart (SImode, operands[1]);
666 operands[2] = gen_reg_rtx (SImode); }")
668 (define_expand "zero_extendqihi2"
669 [(set (match_operand:HI 0 "gpc_reg_operand" "")
670 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
675 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
676 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
680 {rlinm|rlwinm} %0,%1,0,0xff"
681 [(set_attr "type" "load,*")])
684 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
685 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
687 (clobber (match_scratch:HI 2 "=r"))]
689 "{andil.|andi.} %2,%1,0xff"
690 [(set_attr "type" "compare")])
693 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
694 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
696 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
697 (zero_extend:HI (match_dup 1)))]
699 "{andil.|andi.} %0,%1,0xff"
700 [(set_attr "type" "compare")])
702 (define_expand "extendqihi2"
703 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
704 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
709 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
710 else if (TARGET_POWER)
711 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
713 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
717 (define_insn "extendqihi2_ppc"
718 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
719 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
724 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
725 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
727 (clobber (match_scratch:HI 2 "=r"))]
730 [(set_attr "type" "compare")])
733 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
734 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
736 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
737 (sign_extend:HI (match_dup 1)))]
740 [(set_attr "type" "compare")])
742 (define_expand "extendqihi2_power"
743 [(parallel [(set (match_dup 2)
744 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
746 (clobber (scratch:SI))])
747 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
748 (ashiftrt:SI (match_dup 2)
750 (clobber (scratch:SI))])]
753 { operands[0] = gen_lowpart (SImode, operands[0]);
754 operands[1] = gen_lowpart (SImode, operands[1]);
755 operands[2] = gen_reg_rtx (SImode); }")
757 (define_expand "extendqihi2_no_power"
759 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
761 (set (match_operand:HI 0 "gpc_reg_operand" "")
762 (ashiftrt:SI (match_dup 2)
764 "! TARGET_POWER && ! TARGET_POWERPC"
766 { operands[0] = gen_lowpart (SImode, operands[0]);
767 operands[1] = gen_lowpart (SImode, operands[1]);
768 operands[2] = gen_reg_rtx (SImode); }")
770 (define_expand "zero_extendhisi2"
771 [(set (match_operand:SI 0 "gpc_reg_operand" "")
772 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
778 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
782 {rlinm|rlwinm} %0,%1,0,0xffff"
783 [(set_attr "type" "load,*")])
786 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
787 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
789 (clobber (match_scratch:SI 2 "=r"))]
791 "{andil.|andi.} %2,%1,0xffff"
792 [(set_attr "type" "compare")])
795 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
796 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
798 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
799 (zero_extend:SI (match_dup 1)))]
801 "{andil.|andi.} %0,%1,0xffff"
802 [(set_attr "type" "compare")])
804 (define_expand "extendhisi2"
805 [(set (match_operand:SI 0 "gpc_reg_operand" "")
806 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
811 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
812 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
817 [(set_attr "type" "load,*")])
820 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
821 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
823 (clobber (match_scratch:SI 2 "=r"))]
825 "{exts.|extsh.} %2,%1"
826 [(set_attr "type" "compare")])
829 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
830 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
832 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
833 (sign_extend:SI (match_dup 1)))]
835 "{exts.|extsh.} %0,%1"
836 [(set_attr "type" "compare")])
838 ;; Fixed-point arithmetic insns.
840 ;; Discourage ai/addic because of carry but provide it in an alternative
841 ;; allowing register zero as source.
842 (define_insn "addsi3"
843 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
844 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
845 (match_operand:SI 2 "add_operand" "r,I,I,J")))]
849 {cal %0,%2(%1)|addi %0,%1,%2}
851 {cau|addis} %0,%1,%u2")
854 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
855 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
856 (match_operand:SI 2 "reg_or_short_operand" "r,I"))
858 (clobber (match_scratch:SI 3 "=r,r"))]
862 {ai.|addic.} %3,%1,%2"
863 [(set_attr "type" "compare")])
866 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
867 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
868 (match_operand:SI 2 "reg_or_short_operand" "r,I"))
870 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
871 (plus:SI (match_dup 1) (match_dup 2)))]
875 {ai.|addic.} %0,%1,%2"
876 [(set_attr "type" "compare")])
878 ;; Split an add that we can't do in one insn into two insns, each of which
879 ;; does one 16-bit part. This is used by combine. Note that the low-order
880 ;; add should be last in case the result gets used in an address.
883 [(set (match_operand:SI 0 "gpc_reg_operand" "")
884 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
885 (match_operand:SI 2 "non_add_cint_operand" "")))]
887 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
888 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
891 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
892 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
895 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
897 operands[3] = GEN_INT (high);
898 operands[4] = GEN_INT (low);
901 (define_insn "one_cmplsi2"
902 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
903 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
908 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
909 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
911 (clobber (match_scratch:SI 2 "=r"))]
914 [(set_attr "type" "compare")])
917 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
918 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
920 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
921 (not:SI (match_dup 1)))]
924 [(set_attr "type" "compare")])
927 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
928 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
929 (match_operand:SI 2 "gpc_reg_operand" "r")))]
931 "{sf%I1|subf%I1c} %0,%2,%1")
934 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
935 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
936 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
943 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
944 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
945 (match_operand:SI 2 "gpc_reg_operand" "r"))
947 (clobber (match_scratch:SI 3 "=r"))]
949 "{sf.|subfc.} %3,%2,%1"
950 [(set_attr "type" "compare")])
953 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
954 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
955 (match_operand:SI 2 "gpc_reg_operand" "r"))
957 (clobber (match_scratch:SI 3 "=r"))]
960 [(set_attr "type" "compare")])
963 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
964 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
965 (match_operand:SI 2 "gpc_reg_operand" "r"))
967 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
968 (minus:SI (match_dup 1) (match_dup 2)))]
970 "{sf.|subfc.} %0,%2,%1"
971 [(set_attr "type" "compare")])
974 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
975 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
976 (match_operand:SI 2 "gpc_reg_operand" "r"))
978 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
979 (minus:SI (match_dup 1) (match_dup 2)))]
982 [(set_attr "type" "compare")])
984 (define_expand "subsi3"
985 [(set (match_operand:SI 0 "gpc_reg_operand" "")
986 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
987 (match_operand:SI 2 "reg_or_cint_operand" "")))]
991 if (GET_CODE (operands[2]) == CONST_INT)
993 emit_insn (gen_addsi3 (operands[0], operands[1],
994 negate_rtx (SImode, operands[2])));
999 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1000 ;; instruction and some auxiliary computations. Then we just have a single
1001 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1004 (define_expand "sminsi3"
1006 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1007 (match_operand:SI 2 "reg_or_short_operand" ""))
1009 (minus:SI (match_dup 2) (match_dup 1))))
1010 (set (match_operand:SI 0 "gpc_reg_operand" "")
1011 (minus:SI (match_dup 2) (match_dup 3)))]
1014 { operands[3] = gen_reg_rtx (SImode); }")
1017 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1018 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1019 (match_operand:SI 2 "reg_or_short_operand" "")))
1020 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1023 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1025 (minus:SI (match_dup 2) (match_dup 1))))
1026 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1029 (define_expand "smaxsi3"
1031 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1032 (match_operand:SI 2 "reg_or_short_operand" ""))
1034 (minus:SI (match_dup 2) (match_dup 1))))
1035 (set (match_operand:SI 0 "gpc_reg_operand" "")
1036 (plus:SI (match_dup 3) (match_dup 1)))]
1039 { operands[3] = gen_reg_rtx (SImode); }")
1042 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1043 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1044 (match_operand:SI 2 "reg_or_short_operand" "")))
1045 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1048 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1050 (minus:SI (match_dup 2) (match_dup 1))))
1051 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1054 (define_expand "uminsi3"
1055 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1057 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1059 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1061 (minus:SI (match_dup 4) (match_dup 3))))
1062 (set (match_operand:SI 0 "gpc_reg_operand" "")
1063 (minus:SI (match_dup 2) (match_dup 3)))]
1067 operands[3] = gen_reg_rtx (SImode);
1068 operands[4] = gen_reg_rtx (SImode);
1069 operands[5] = GEN_INT (-2147483647 - 1);
1072 (define_expand "umaxsi3"
1073 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1075 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1077 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1079 (minus:SI (match_dup 4) (match_dup 3))))
1080 (set (match_operand:SI 0 "gpc_reg_operand" "")
1081 (plus:SI (match_dup 3) (match_dup 1)))]
1085 operands[3] = gen_reg_rtx (SImode);
1086 operands[4] = gen_reg_rtx (SImode);
1087 operands[5] = GEN_INT (-2147483647 - 1);
1091 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1092 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1093 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1095 (minus:SI (match_dup 2) (match_dup 1))))]
1100 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1102 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1103 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1105 (minus:SI (match_dup 2) (match_dup 1)))
1107 (clobber (match_scratch:SI 3 "=r"))]
1110 [(set_attr "type" "delayed_compare")])
1113 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1115 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1116 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1118 (minus:SI (match_dup 2) (match_dup 1)))
1120 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1121 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1123 (minus:SI (match_dup 2) (match_dup 1))))]
1126 [(set_attr "type" "delayed_compare")])
1128 ;; We don't need abs with condition code because such comparisons should
1130 (define_expand "abssi2"
1131 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1132 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1138 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1143 (define_insn "abssi2_power"
1144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1145 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1149 (define_insn "abssi2_nopower"
1150 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1151 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1152 (clobber (match_scratch:SI 2 "=&r,&r"))]
1156 return (TARGET_POWERPC)
1157 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0\"
1158 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%2,%0\";
1160 [(set_attr "length" "12")])
1163 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1164 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1165 (clobber (match_scratch:SI 2 "=&r,&r"))]
1166 "!TARGET_POWER && reload_completed"
1167 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1168 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1169 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1173 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1174 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1179 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1180 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1181 (clobber (match_scratch:SI 2 "=&r,&r"))]
1185 return (TARGET_POWERPC)
1186 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2\"
1187 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%0,%2\";
1189 [(set_attr "length" "12")])
1192 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1193 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1194 (clobber (match_scratch:SI 2 "=&r,&r"))]
1195 "!TARGET_POWER && reload_completed"
1196 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1197 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1198 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1201 (define_insn "negsi2"
1202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1203 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1208 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1209 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1211 (clobber (match_scratch:SI 2 "=r"))]
1214 [(set_attr "type" "compare")])
1217 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
1218 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1220 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1221 (neg:SI (match_dup 1)))]
1224 [(set_attr "type" "compare")])
1226 (define_insn "ffssi2"
1227 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
1228 (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1230 "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
1231 [(set_attr "length" "16")])
1233 (define_expand "mulsi3"
1234 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1235 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1236 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1241 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1243 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1247 (define_insn "mulsi3_mq"
1248 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1249 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1250 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1251 (clobber (match_scratch:SI 3 "=q,q"))]
1254 {muls|mullw} %0,%1,%2
1255 {muli|mulli} %0,%1,%2"
1256 [(set_attr "type" "imul")])
1258 (define_insn "mulsi3_no_mq"
1259 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1260 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1261 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1264 {muls|mullw} %0,%1,%2
1265 {muli|mulli} %0,%1,%2"
1266 [(set_attr "type" "imul")])
1269 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1270 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1271 (match_operand:SI 2 "gpc_reg_operand" "r"))
1273 (clobber (match_scratch:SI 3 "=r"))
1274 (clobber (match_scratch:SI 4 "=q"))]
1276 "{muls.|mullw.} %3,%1,%2"
1277 [(set_attr "type" "delayed_compare")])
1280 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1281 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1282 (match_operand:SI 2 "gpc_reg_operand" "r"))
1284 (clobber (match_scratch:SI 3 "=r"))]
1286 "{muls.|mullw.} %3,%1,%2"
1287 [(set_attr "type" "delayed_compare")])
1290 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1291 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1292 (match_operand:SI 2 "gpc_reg_operand" "r"))
1294 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1295 (mult:SI (match_dup 1) (match_dup 2)))
1296 (clobber (match_scratch:SI 4 "=q"))]
1298 "{muls.|mullw.} %0,%1,%2"
1299 [(set_attr "type" "delayed_compare")])
1302 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1303 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1304 (match_operand:SI 2 "gpc_reg_operand" "r"))
1306 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1307 (mult:SI (match_dup 1) (match_dup 2)))]
1309 "{muls.|mullw.} %0,%1,%2"
1310 [(set_attr "type" "delayed_compare")])
1312 ;; Operand 1 is divided by operand 2; quotient goes to operand
1313 ;; 0 and remainder to operand 3.
1314 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1316 (define_expand "divmodsi4"
1317 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1318 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1319 (match_operand:SI 2 "gpc_reg_operand" "")))
1320 (set (match_operand:SI 3 "gpc_reg_operand" "")
1321 (mod:SI (match_dup 1) (match_dup 2)))])]
1322 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1325 if (! TARGET_POWER && ! TARGET_POWERPC)
1327 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1328 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1329 emit_insn (gen_divss_call ());
1330 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1331 emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
1337 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1338 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1339 (match_operand:SI 2 "gpc_reg_operand" "r")))
1340 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
1341 (mod:SI (match_dup 1) (match_dup 2)))]
1344 [(set_attr "type" "idiv")])
1347 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1348 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1349 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1352 [(set_attr "type" "idiv")])
1354 (define_expand "udivsi3"
1355 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1356 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1357 (match_operand:SI 2 "gpc_reg_operand" "")))]
1358 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1361 if (! TARGET_POWER && ! TARGET_POWERPC)
1363 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1364 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1365 emit_insn (gen_quous_call ());
1366 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1372 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1373 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1374 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1377 [(set_attr "type" "idiv")])
1379 ;; For powers of two we can do srai/aze for divide and then adjust for
1380 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1381 ;; used; for PowerPC, force operands into register and do a normal divide;
1382 ;; for AIX common-mode, use quoss call on register operands.
1383 (define_expand "divsi3"
1384 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1385 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1386 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1390 if (GET_CODE (operands[2]) == CONST_INT
1391 && exact_log2 (INTVAL (operands[2])) >= 0)
1393 else if (TARGET_POWERPC)
1394 operands[2] = force_reg (SImode, operands[2]);
1395 else if (TARGET_POWER)
1399 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1400 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1401 emit_insn (gen_quoss_call ());
1402 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1407 (define_expand "modsi3"
1408 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1409 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1410 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1414 int i = exact_log2 (INTVAL (operands[2]));
1418 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
1421 temp1 = gen_reg_rtx (SImode);
1422 temp2 = gen_reg_rtx (SImode);
1424 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1425 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1426 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1431 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1432 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1433 (match_operand:SI 2 "const_int_operand" "N")))]
1434 "exact_log2 (INTVAL (operands[2])) >= 0"
1435 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1436 [(set_attr "length" "8")])
1439 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1440 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1441 (match_operand:SI 2 "const_int_operand" "N"))
1443 (clobber (match_scratch:SI 3 "=r"))]
1444 "exact_log2 (INTVAL (operands[2])) >= 0"
1445 "{srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3"
1446 [(set_attr "type" "compare")
1447 (set_attr "length" "8")])
1450 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1451 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1452 (match_operand:SI 2 "const_int_operand" "N"))
1454 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1455 (div:SI (match_dup 1) (match_dup 2)))]
1456 "exact_log2 (INTVAL (operands[2])) >= 0"
1457 "{srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0"
1458 [(set_attr "type" "compare")
1459 (set_attr "length" "8")])
1462 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1465 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
1467 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
1468 (match_operand:SI 3 "gpc_reg_operand" "r")))
1469 (set (match_operand:SI 2 "register_operand" "=*q")
1472 (zero_extend:DI (match_dup 1)) (const_int 32))
1473 (zero_extend:DI (match_dup 4)))
1477 [(set_attr "type" "idiv")])
1479 ;; To do unsigned divide we handle the cases of the divisor looking like a
1480 ;; negative number. If it is a constant that is less than 2**31, we don't
1481 ;; have to worry about the branches. So make a few subroutines here.
1483 ;; First comes the normal case.
1484 (define_expand "udivmodsi4_normal"
1485 [(set (match_dup 4) (const_int 0))
1486 (parallel [(set (match_operand:SI 0 "" "")
1487 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1489 (zero_extend:DI (match_operand:SI 1 "" "")))
1490 (match_operand:SI 2 "" "")))
1491 (set (match_operand:SI 3 "" "")
1492 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1494 (zero_extend:DI (match_dup 1)))
1498 { operands[4] = gen_reg_rtx (SImode); }")
1500 ;; This handles the branches.
1501 (define_expand "udivmodsi4_tests"
1502 [(set (match_operand:SI 0 "" "") (const_int 0))
1503 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
1504 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
1505 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
1506 (label_ref (match_operand:SI 4 "" "")) (pc)))
1507 (set (match_dup 0) (const_int 1))
1508 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
1509 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
1510 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
1511 (label_ref (match_dup 4)) (pc)))]
1514 { operands[5] = gen_reg_rtx (CCUNSmode);
1515 operands[6] = gen_reg_rtx (CCmode);
1518 (define_expand "udivmodsi4"
1519 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1520 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1521 (match_operand:SI 2 "reg_or_cint_operand" "")))
1522 (set (match_operand:SI 3 "gpc_reg_operand" "")
1523 (umod:SI (match_dup 1) (match_dup 2)))])]
1530 if (! TARGET_POWERPC)
1532 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1533 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1534 emit_insn (gen_divus_call ());
1535 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1536 emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
1542 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
1544 operands[2] = force_reg (SImode, operands[2]);
1545 label = gen_label_rtx ();
1546 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
1547 operands[3], label));
1550 operands[2] = force_reg (SImode, operands[2]);
1552 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
1560 ;; AIX architecture-independent common-mode multiply (DImode),
1561 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
1562 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
1563 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
1564 ;; assumed unused if generating common-mode, so ignore.
1565 (define_insn "mulh_call"
1568 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
1569 (sign_extend:DI (reg:SI 4)))
1571 (clobber (match_scratch:SI 0 "=l"))]
1572 "! TARGET_POWER && ! TARGET_POWERPC"
1575 (define_insn "mull_call"
1577 (mult:DI (sign_extend:DI (reg:SI 3))
1578 (sign_extend:DI (reg:SI 4))))
1579 (clobber (match_scratch:SI 0 "=l"))
1580 (clobber (reg:SI 0))]
1581 "! TARGET_POWER && ! TARGET_POWERPC"
1584 (define_insn "divss_call"
1586 (div:SI (reg:SI 3) (reg:SI 4)))
1588 (mod:SI (reg:SI 3) (reg:SI 4)))
1589 (clobber (match_scratch:SI 0 "=l"))
1590 (clobber (reg:SI 0))]
1591 "! TARGET_POWER && ! TARGET_POWERPC"
1594 (define_insn "divus_call"
1596 (udiv:SI (reg:SI 3) (reg:SI 4)))
1598 (umod:SI (reg:SI 3) (reg:SI 4)))
1599 (clobber (match_scratch:SI 0 "=l"))
1600 (clobber (reg:SI 0))
1601 (clobber (match_scratch:CC 1 "=x"))
1602 (clobber (reg:CC 69))]
1603 "! TARGET_POWER && ! TARGET_POWERPC"
1606 (define_insn "quoss_call"
1608 (div:SI (reg:SI 3) (reg:SI 4)))
1609 (clobber (match_scratch:SI 0 "=l"))]
1610 "! TARGET_POWER && ! TARGET_POWERPC"
1613 (define_insn "quous_call"
1615 (udiv:SI (reg:SI 3) (reg:SI 4)))
1616 (clobber (match_scratch:SI 0 "=l"))
1617 (clobber (reg:SI 0))
1618 (clobber (match_scratch:CC 1 "=x"))
1619 (clobber (reg:CC 69))]
1620 "! TARGET_POWER && ! TARGET_POWERPC"
1623 (define_insn "andsi3"
1624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1625 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1626 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
1627 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
1631 {rlinm|rlwinm} %0,%1,0,%m2,%M2
1632 {andil.|andi.} %0,%1,%b2
1633 {andiu.|andis.} %0,%1,%u2")
1636 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
1637 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1638 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1640 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1644 {andil.|andi.} %3,%1,%b2
1645 {andiu.|andis.} %3,%1,%u2
1646 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2"
1647 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1650 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
1651 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1652 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1654 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1655 (and:SI (match_dup 1) (match_dup 2)))]
1659 {andil.|andi.} %0,%1,%b2
1660 {andiu.|andis.} %0,%1,%u2
1661 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2"
1662 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1664 ;; Take a AND with a constant that cannot be done in a single insn and try to
1665 ;; split it into two insns. This does not verify that the insns are valid
1666 ;; since this need not be done as combine will do it.
1669 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1670 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
1671 (match_operand:SI 2 "non_and_cint_operand" "")))]
1673 [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3)))
1674 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
1677 int maskval = INTVAL (operands[2]);
1678 int i, transitions, last_bit_value;
1679 int orig = maskval, first_c = maskval, second_c;
1681 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
1682 the low-order bit and count for the third transition. When we get there,
1683 make a first mask that has everything to the left of that position
1684 a one. Then make the second mask to turn off whatever else is needed. */
1686 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
1688 if (((maskval >>= 1) & 1) != last_bit_value)
1689 last_bit_value ^= 1, transitions++;
1691 if (transitions > 2)
1693 first_c |= (~0) << i;
1698 second_c = orig | ~ first_c;
1700 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
1701 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
1704 (define_insn "iorsi3"
1705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1706 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1707 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1711 {oril|ori} %0,%1,%b2
1712 {oriu|oris} %0,%1,%u2")
1715 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1716 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1717 (match_operand:SI 2 "gpc_reg_operand" "r"))
1719 (clobber (match_scratch:SI 3 "=r"))]
1722 [(set_attr "type" "compare")])
1725 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1726 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1727 (match_operand:SI 2 "gpc_reg_operand" "r"))
1729 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1730 (ior:SI (match_dup 1) (match_dup 2)))]
1733 [(set_attr "type" "compare")])
1735 ;; Split an IOR that we can't do in one insn into two insns, each of which
1736 ;; does one 16-bit part. This is used by combine.
1739 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1740 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
1741 (match_operand:SI 2 "non_logical_cint_operand" "")))]
1743 [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
1744 (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
1747 operands[3] = gen_rtx (CONST_INT, VOIDmode,
1748 INTVAL (operands[2]) & 0xffff0000);
1749 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
1752 (define_insn "xorsi3"
1753 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1754 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1755 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1759 {xoril|xori} %0,%1,%b2
1760 {xoriu|xoris} %0,%1,%u2")
1763 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1764 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1765 (match_operand:SI 2 "gpc_reg_operand" "r"))
1767 (clobber (match_scratch:SI 3 "=r"))]
1770 [(set_attr "type" "compare")])
1773 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1774 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1775 (match_operand:SI 2 "gpc_reg_operand" "r"))
1777 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1778 (xor:SI (match_dup 1) (match_dup 2)))]
1781 [(set_attr "type" "compare")])
1783 ;; Split an XOR that we can't do in one insn into two insns, each of which
1784 ;; does one 16-bit part. This is used by combine.
1787 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1788 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1789 (match_operand:SI 2 "non_logical_cint_operand" "")))]
1791 [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
1792 (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
1795 operands[3] = gen_rtx (CONST_INT, VOIDmode,
1796 INTVAL (operands[2]) & 0xffff0000);
1797 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
1801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1802 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1803 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1808 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1809 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1810 (match_operand:SI 2 "gpc_reg_operand" "r")))
1812 (clobber (match_scratch:SI 3 "=r"))]
1815 [(set_attr "type" "compare")])
1818 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1819 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1820 (match_operand:SI 2 "gpc_reg_operand" "r")))
1822 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1823 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
1826 [(set_attr "type" "compare")])
1829 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1830 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1831 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1836 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1837 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1838 (match_operand:SI 2 "gpc_reg_operand" "r"))
1840 (clobber (match_scratch:SI 3 "=r"))]
1843 [(set_attr "type" "compare")])
1846 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1847 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1848 (match_operand:SI 2 "gpc_reg_operand" "r"))
1850 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1851 (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
1854 [(set_attr "type" "compare")])
1857 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1858 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1859 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1864 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1865 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1866 (match_operand:SI 2 "gpc_reg_operand" "r"))
1868 (clobber (match_scratch:SI 3 "=r"))]
1871 [(set_attr "type" "compare")])
1874 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1875 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1876 (match_operand:SI 2 "gpc_reg_operand" "r"))
1878 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1879 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
1882 [(set_attr "type" "compare")])
1885 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1886 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1887 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1892 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1893 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1894 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1896 (clobber (match_scratch:SI 3 "=r"))]
1899 [(set_attr "type" "compare")])
1902 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1903 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1904 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1906 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1907 (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1910 [(set_attr "type" "compare")])
1913 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1914 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1915 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1920 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1921 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1922 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1924 (clobber (match_scratch:SI 3 "=r"))]
1927 [(set_attr "type" "compare")])
1930 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1931 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1932 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1934 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1935 (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1938 [(set_attr "type" "compare")])
1940 ;; maskir insn. We need four forms because things might be in arbitrary
1941 ;; orders. Don't define forms that only set CR fields because these
1942 ;; would modify an input register.
1945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1946 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1947 (match_operand:SI 1 "gpc_reg_operand" "0"))
1948 (and:SI (match_dup 2)
1949 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
1954 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1955 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1956 (match_operand:SI 1 "gpc_reg_operand" "0"))
1957 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1963 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1964 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1965 (match_operand:SI 3 "gpc_reg_operand" "r"))
1966 (and:SI (not:SI (match_dup 2))
1967 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
1972 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1973 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1974 (match_operand:SI 2 "gpc_reg_operand" "r"))
1975 (and:SI (not:SI (match_dup 2))
1976 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
1981 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1983 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1984 (match_operand:SI 1 "gpc_reg_operand" "0"))
1985 (and:SI (match_dup 2)
1986 (match_operand:SI 3 "gpc_reg_operand" "r")))
1988 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1989 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
1990 (and:SI (match_dup 2) (match_dup 3))))]
1993 [(set_attr "type" "compare")])
1996 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1998 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1999 (match_operand:SI 1 "gpc_reg_operand" "0"))
2000 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2003 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2004 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2005 (and:SI (match_dup 3) (match_dup 2))))]
2008 [(set_attr "type" "compare")])
2011 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2013 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2014 (match_operand:SI 3 "gpc_reg_operand" "r"))
2015 (and:SI (not:SI (match_dup 2))
2016 (match_operand:SI 1 "gpc_reg_operand" "0")))
2018 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2019 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2020 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2023 [(set_attr "type" "compare")])
2026 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2028 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2029 (match_operand:SI 2 "gpc_reg_operand" "r"))
2030 (and:SI (not:SI (match_dup 2))
2031 (match_operand:SI 1 "gpc_reg_operand" "0")))
2033 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2034 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2035 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2038 [(set_attr "type" "compare")])
2040 ;; Rotate and shift insns, in all their variants. These support shifts,
2041 ;; field inserts and extracts, and various combinations thereof.
2042 (define_expand "insv"
2043 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2044 (match_operand:SI 1 "const_int_operand" "i")
2045 (match_operand:SI 2 "const_int_operand" "i"))
2046 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2050 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2051 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2052 compiler if the address of the structure is taken later. */
2053 if (GET_CODE (operands[0]) == SUBREG
2054 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2059 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2060 (match_operand:SI 1 "const_int_operand" "i")
2061 (match_operand:SI 2 "const_int_operand" "i"))
2062 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2066 int start = INTVAL (operands[2]) & 31;
2067 int size = INTVAL (operands[1]) & 31;
2069 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
2070 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2071 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
2075 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2076 (match_operand:SI 1 "const_int_operand" "i")
2077 (match_operand:SI 2 "const_int_operand" "i"))
2078 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2079 (match_operand:SI 4 "const_int_operand" "i")))]
2083 int shift = INTVAL (operands[4]) & 31;
2084 int start = INTVAL (operands[2]) & 31;
2085 int size = INTVAL (operands[1]) & 31;
2087 operands[4] = gen_rtx (CONST_INT, VOIDmode, (shift - start - size) & 31);
2088 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2089 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
2093 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2094 (match_operand:SI 1 "const_int_operand" "i")
2095 (match_operand:SI 2 "const_int_operand" "i"))
2096 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2097 (match_operand:SI 4 "const_int_operand" "i")))]
2101 int shift = INTVAL (operands[4]) & 31;
2102 int start = INTVAL (operands[2]) & 31;
2103 int size = INTVAL (operands[1]) & 31;
2105 operands[4] = gen_rtx (CONST_INT, VOIDmode, (32 - shift - start - size) & 31);
2106 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2107 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
2111 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2112 (match_operand:SI 1 "const_int_operand" "i")
2113 (match_operand:SI 2 "const_int_operand" "i"))
2114 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2115 (match_operand:SI 4 "const_int_operand" "i")))]
2119 int shift = INTVAL (operands[4]) & 31;
2120 int start = INTVAL (operands[2]) & 31;
2121 int size = INTVAL (operands[1]) & 31;
2123 operands[4] = gen_rtx (CONST_INT, VOIDmode, (32 - shift - start - size) & 31);
2124 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2125 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
2129 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2130 (match_operand:SI 1 "const_int_operand" "i")
2131 (match_operand:SI 2 "const_int_operand" "i"))
2132 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2133 (match_operand:SI 4 "const_int_operand" "i")
2134 (match_operand:SI 5 "const_int_operand" "i")))]
2135 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2138 int extract_start = INTVAL (operands[5]) & 31;
2139 int extract_size = INTVAL (operands[4]) & 31;
2140 int insert_start = INTVAL (operands[2]) & 31;
2141 int insert_size = INTVAL (operands[1]) & 31;
2143 /* Align extract field with insert field */
2144 operands[5] = gen_rtx (CONST_INT, VOIDmode,
2145 (extract_start + extract_size - insert_start - insert_size) & 31);
2146 operands[1] = gen_rtx (CONST_INT, VOIDmode, insert_start + insert_size - 1);
2147 return \"{rlimi|rlwimi} %0,%3,%5,%h2,%h1\";
2150 (define_expand "extzv"
2151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2152 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2153 (match_operand:SI 2 "const_int_operand" "i")
2154 (match_operand:SI 3 "const_int_operand" "i")))]
2158 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2159 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2160 compiler if the address of the structure is taken later. */
2161 if (GET_CODE (operands[0]) == SUBREG
2162 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2167 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2168 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2169 (match_operand:SI 2 "const_int_operand" "i")
2170 (match_operand:SI 3 "const_int_operand" "i")))]
2174 int start = INTVAL (operands[3]) & 31;
2175 int size = INTVAL (operands[2]) & 31;
2177 if (start + size >= 32)
2178 operands[3] = const0_rtx;
2180 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2181 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
2185 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2186 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2187 (match_operand:SI 2 "const_int_operand" "i")
2188 (match_operand:SI 3 "const_int_operand" "i"))
2190 (clobber (match_scratch:SI 4 "=r"))]
2194 int start = INTVAL (operands[3]) & 31;
2195 int size = INTVAL (operands[2]) & 31;
2197 /* If the bitfield being tested fits in the upper or lower half of a
2198 word, it is possible to use andiu. or andil. to test it. This is
2199 useful because the condition register set-use delay is smaller for
2200 andi[ul]. than for rlinm. This doesn't work when the starting bit
2201 position is 0 because the LT and GT bits may be set wrong. */
2203 if ((start > 0 && start + size <= 16) || start >= 16)
2205 operands[3] = gen_rtx (CONST_INT, VOIDmode,
2206 ((1 << (16 - (start & 15)))
2207 - (1 << (16 - (start & 15) - size))));
2209 return \"{andiu.|andis.} %4,%1,%3\";
2211 return \"{andil.|andi.} %4,%1,%3\";
2214 if (start + size >= 32)
2215 operands[3] = const0_rtx;
2217 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2218 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
2220 [(set_attr "type" "compare")])
2223 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2224 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2225 (match_operand:SI 2 "const_int_operand" "i")
2226 (match_operand:SI 3 "const_int_operand" "i"))
2228 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2229 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
2233 int start = INTVAL (operands[3]) & 31;
2234 int size = INTVAL (operands[2]) & 31;
2236 if (start >= 16 && start + size == 32)
2238 operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
2239 return \"{andil.|andi.} %0,%1,%3\";
2242 if (start + size >= 32)
2243 operands[3] = const0_rtx;
2245 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2246 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
2248 [(set_attr "type" "delayed_compare")])
2250 (define_insn "rotlsi3"
2251 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2252 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2253 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2255 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
2258 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2259 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2260 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2262 (clobber (match_scratch:SI 3 "=r"))]
2264 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff"
2265 [(set_attr "type" "delayed_compare")])
2268 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2269 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2270 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2272 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2273 (rotate:SI (match_dup 1) (match_dup 2)))]
2275 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff"
2276 [(set_attr "type" "delayed_compare")])
2279 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2280 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2281 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2282 (match_operand:SI 3 "mask_operand" "L")))]
2284 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
2287 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2289 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2290 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2291 (match_operand:SI 3 "mask_operand" "L"))
2293 (clobber (match_scratch:SI 4 "=r"))]
2295 "{rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3"
2296 [(set_attr "type" "delayed_compare")])
2299 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2301 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2302 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2303 (match_operand:SI 3 "mask_operand" "L"))
2305 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2306 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2308 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3"
2309 [(set_attr "type" "delayed_compare")])
2312 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2315 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2316 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2318 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
2321 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2322 (compare:CC (zero_extend:SI
2324 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2325 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2327 (clobber (match_scratch:SI 3 "=r"))]
2329 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff"
2330 [(set_attr "type" "delayed_compare")])
2333 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2334 (compare:CC (zero_extend:SI
2336 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2337 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2339 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2340 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2342 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff"
2343 [(set_attr "type" "delayed_compare")])
2346 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2349 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2350 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2352 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
2355 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2356 (compare:CC (zero_extend:SI
2358 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2359 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2361 (clobber (match_scratch:SI 3 "=r"))]
2363 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff"
2364 [(set_attr "type" "delayed_compare")])
2367 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2368 (compare:CC (zero_extend:SI
2370 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2371 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2373 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2374 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2376 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff"
2377 [(set_attr "type" "delayed_compare")])
2379 ;; Note that we use "sle." instead of "sl." so that we can set
2380 ;; SHIFT_COUNT_TRUNCATED.
2382 (define_expand "ashlsi3"
2383 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2384 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2385 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2390 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
2392 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
2396 (define_insn "ashlsi3_power"
2397 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2398 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2399 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2400 (clobber (match_scratch:SI 3 "=q,X"))]
2404 {sli|slwi} %0,%1,%h2"
2405 [(set_attr "length" "8")])
2407 (define_insn "ashlsi3_no_power"
2408 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2409 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2410 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2412 "{sl|slw}%I2 %0,%1,%h2"
2413 [(set_attr "length" "8")])
2416 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2417 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2418 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2420 (clobber (match_scratch:SI 3 "=r,r"))
2421 (clobber (match_scratch:SI 4 "=q,X"))]
2425 {sli.|slwi.} %3,%1,%h2"
2426 [(set_attr "type" "delayed_compare")])
2429 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2430 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2431 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2433 (clobber (match_scratch:SI 3 "=r"))]
2435 "{sl|slw}%I2. %3,%1,%h2"
2436 [(set_attr "type" "delayed_compare")])
2439 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2440 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2441 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2443 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2444 (ashift:SI (match_dup 1) (match_dup 2)))
2445 (clobber (match_scratch:SI 4 "=q,X"))]
2449 {sli.|slwi.} %0,%1,%h2"
2450 [(set_attr "type" "delayed_compare")])
2453 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2454 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2455 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2457 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2458 (ashift:SI (match_dup 1) (match_dup 2)))]
2460 "{sl|slw}%I2. %0,%1,%h2"
2461 [(set_attr "type" "delayed_compare")])
2464 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2465 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2466 (match_operand:SI 2 "const_int_operand" "i"))
2467 (match_operand:SI 3 "mask_operand" "L")))]
2468 "includes_lshift_p (operands[2], operands[3])"
2469 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
2472 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2474 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2475 (match_operand:SI 2 "const_int_operand" "i"))
2476 (match_operand:SI 3 "mask_operand" "L"))
2478 (clobber (match_scratch:SI 4 "=r"))]
2479 "includes_lshift_p (operands[2], operands[3])"
2480 "{rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3"
2481 [(set_attr "type" "delayed_compare")])
2484 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2486 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2487 (match_operand:SI 2 "const_int_operand" "i"))
2488 (match_operand:SI 3 "mask_operand" "L"))
2490 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2491 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2492 "includes_lshift_p (operands[2], operands[3])"
2493 "{rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3"
2494 [(set_attr "type" "delayed_compare")])
2496 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
2498 (define_expand "lshrsi3"
2499 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2500 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2501 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2506 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
2508 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
2512 (define_insn "lshrsi3_power"
2513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2514 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2515 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2516 (clobber (match_scratch:SI 3 "=q,X"))]
2520 {s%A2i|s%A2wi} %0,%1,%h2")
2522 (define_insn "lshrsi3_no_power"
2523 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2524 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2525 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2527 "{sr|srw}%I2 %0,%1,%h2")
2530 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2531 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2532 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2534 (clobber (match_scratch:SI 3 "=r,r"))
2535 (clobber (match_scratch:SI 4 "=q,X"))]
2539 {s%A2i.|s%A2wi.} %3,%1,%h2"
2540 [(set_attr "type" "delayed_compare")])
2543 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2544 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2545 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2547 (clobber (match_scratch:SI 3 "=r"))]
2549 "{sr|srw}%I2. %3,%1,%h2"
2550 [(set_attr "type" "delayed_compare")])
2553 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2554 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2555 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2557 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2558 (lshiftrt:SI (match_dup 1) (match_dup 2)))
2559 (clobber (match_scratch:SI 4 "=q,X"))]
2563 {s%A2i.|s%A2wi.} %0,%1,%h2"
2564 [(set_attr "type" "delayed_compare")])
2567 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2568 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2569 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2571 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2572 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
2574 "{sr|srw}%I2. %0,%1,%h2"
2575 [(set_attr "type" "delayed_compare")])
2578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2579 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2580 (match_operand:SI 2 "const_int_operand" "i"))
2581 (match_operand:SI 3 "mask_operand" "L")))]
2582 "includes_rshift_p (operands[2], operands[3])"
2583 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
2586 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2588 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2589 (match_operand:SI 2 "const_int_operand" "i"))
2590 (match_operand:SI 3 "mask_operand" "L"))
2592 (clobber (match_scratch:SI 4 "=r"))]
2593 "includes_rshift_p (operands[2], operands[3])"
2594 "{rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3"
2595 [(set_attr "type" "delayed_compare")])
2598 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2600 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2601 (match_operand:SI 2 "const_int_operand" "i"))
2602 (match_operand:SI 3 "mask_operand" "L"))
2604 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2605 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2606 "includes_rshift_p (operands[2], operands[3])"
2607 "{rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3"
2608 [(set_attr "type" "delayed_compare")])
2611 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2614 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2615 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2616 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2617 "{rlinm|rlwinm} %0,%1,%s2,0xff")
2620 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2624 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2625 (match_operand:SI 2 "const_int_operand" "i")) 0))
2627 (clobber (match_scratch:SI 3 "=r"))]
2628 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2629 "{rlinm.|rlwinm.} %3,%1,%s2,0xff"
2630 [(set_attr "type" "delayed_compare")])
2633 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2637 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2638 (match_operand:SI 2 "const_int_operand" "i")) 0))
2640 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2641 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2642 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2643 "{rlinm.|rlwinm.} %0,%1,%s2,0xff"
2644 [(set_attr "type" "delayed_compare")])
2647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2650 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2651 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2652 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2653 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
2656 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2660 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2661 (match_operand:SI 2 "const_int_operand" "i")) 0))
2663 (clobber (match_scratch:SI 3 "=r"))]
2664 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2665 "{rlinm.|rlwinm.} %3,%1,%s2,0xffff"
2666 [(set_attr "type" "delayed_compare")])
2669 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2673 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2674 (match_operand:SI 2 "const_int_operand" "i")) 0))
2676 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2677 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2678 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2679 "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
2680 [(set_attr "type" "delayed_compare")])
2683 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2685 (match_operand:SI 1 "gpc_reg_operand" "r"))
2686 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2692 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2694 (match_operand:SI 1 "gpc_reg_operand" "r"))
2695 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2701 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2703 (match_operand:SI 1 "gpc_reg_operand" "r"))
2704 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2710 (define_expand "ashrsi3"
2711 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2712 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2713 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2718 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
2720 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
2724 (define_insn "ashrsi3_power"
2725 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2726 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2727 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2728 (clobber (match_scratch:SI 3 "=q,X"))]
2732 {srai|srawi} %0,%1,%h2")
2734 (define_insn "ashrsi3_no_power"
2735 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2736 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2737 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2739 "{sra|sraw}%I2 %0,%1,%h2")
2742 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2743 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2744 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2746 (clobber (match_scratch:SI 3 "=r,r"))
2747 (clobber (match_scratch:SI 4 "=q,X"))]
2751 {srai.|srawi.} %3,%1,%h2"
2752 [(set_attr "type" "delayed_compare")])
2755 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2756 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2757 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2759 (clobber (match_scratch:SI 3 "=r"))]
2761 "{sra|sraw}%I2. %3,%1,%h2"
2762 [(set_attr "type" "delayed_compare")])
2765 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2766 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2767 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2769 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2770 (ashiftrt:SI (match_dup 1) (match_dup 2)))
2771 (clobber (match_scratch:SI 4 "=q,X"))]
2775 {srai.|srawi.} %0,%1,%h2"
2776 [(set_attr "type" "delayed_compare")])
2779 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2780 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2781 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2783 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2784 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
2786 "{sra|sraw}%I2. %0,%1,%h2"
2787 [(set_attr "type" "delayed_compare")])
2789 ;; Floating-point insns, excluding normal data motion.
2791 ;; PowerPC has a full set of single-precision floating point instructions.
2793 ;; For the POWER architecture, we pretend that we have both SFmode and
2794 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
2795 ;; The only conversions we will do will be when storing to memory. In that
2796 ;; case, we will use the "frsp" instruction before storing.
2798 ;; Note that when we store into a single-precision memory location, we need to
2799 ;; use the frsp insn first. If the register being stored isn't dead, we
2800 ;; need a scratch register for the frsp. But this is difficult when the store
2801 ;; is done by reload. It is not incorrect to do the frsp on the register in
2802 ;; this case, we just lose precision that we would have otherwise gotten but
2803 ;; is not guaranteed. Perhaps this should be tightened up at some point.
2805 (define_insn "extendsfdf2"
2806 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
2807 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2811 if (REGNO (operands[0]) == REGNO (operands[1]))
2814 return \"fmr %0,%1\";
2816 [(set_attr "type" "fp")])
2818 (define_insn "truncdfsf2"
2819 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2820 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
2823 [(set_attr "type" "fp")])
2825 (define_insn "aux_truncdfsf2"
2826 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2827 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
2828 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2830 [(set_attr "type" "fp")])
2832 (define_insn "negsf2"
2833 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2834 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2837 [(set_attr "type" "fp")])
2839 (define_insn "abssf2"
2840 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2841 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2844 [(set_attr "type" "fp")])
2847 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2848 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
2851 [(set_attr "type" "fp")])
2853 (define_expand "addsf3"
2854 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2855 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2856 (match_operand:SF 2 "gpc_reg_operand" "")))]
2861 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2862 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2863 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2864 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2866 [(set_attr "type" "fp")])
2869 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2870 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2871 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2872 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2873 "{fa|fadd} %0,%1,%2"
2874 [(set_attr "type" "fp")])
2876 (define_expand "subsf3"
2877 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2878 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2879 (match_operand:SF 2 "gpc_reg_operand" "")))]
2884 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2885 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2886 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2887 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2889 [(set_attr "type" "fp")])
2892 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2893 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2894 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2895 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2896 "{fs|fsub} %0,%1,%2"
2897 [(set_attr "type" "fp")])
2899 (define_expand "mulsf3"
2900 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2901 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
2902 (match_operand:SF 2 "gpc_reg_operand" "")))]
2907 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2908 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2909 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2910 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2912 [(set_attr "type" "fp")])
2915 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2916 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2917 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2918 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2919 "{fm|fmul} %0,%1,%2"
2920 [(set_attr "type" "dmul")])
2922 (define_expand "divsf3"
2923 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2924 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
2925 (match_operand:SF 2 "gpc_reg_operand" "")))]
2930 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2931 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2932 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2933 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2935 [(set_attr "type" "sdiv")])
2938 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2939 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2940 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2941 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2942 "{fd|fdiv} %0,%1,%2"
2943 [(set_attr "type" "ddiv")])
2946 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2947 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2948 (match_operand:SF 2 "gpc_reg_operand" "f"))
2949 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2950 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2951 "fmadds %0,%1,%2,%3"
2952 [(set_attr "type" "fp")])
2955 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2956 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2957 (match_operand:SF 2 "gpc_reg_operand" "f"))
2958 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2959 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2960 "{fma|fmadd} %0,%1,%2,%3"
2961 [(set_attr "type" "dmul")])
2964 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2965 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2966 (match_operand:SF 2 "gpc_reg_operand" "f"))
2967 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2968 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2969 "fmsubs %0,%1,%2,%3"
2970 [(set_attr "type" "fp")])
2973 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2974 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2975 (match_operand:SF 2 "gpc_reg_operand" "f"))
2976 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2977 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2978 "{fms|fmsub} %0,%1,%2,%3"
2979 [(set_attr "type" "dmul")])
2982 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2983 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2984 (match_operand:SF 2 "gpc_reg_operand" "f"))
2985 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
2986 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2987 "fnmadds %0,%1,%2,%3"
2988 [(set_attr "type" "fp")])
2991 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2992 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2993 (match_operand:SF 2 "gpc_reg_operand" "f"))
2994 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
2995 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2996 "{fnma|fnmadd} %0,%1,%2,%3"
2997 [(set_attr "type" "dmul")])
3000 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3001 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3002 (match_operand:SF 2 "gpc_reg_operand" "f"))
3003 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3004 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3005 "fnmsubs %0,%1,%2,%3"
3006 [(set_attr "type" "fp")])
3009 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3010 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3011 (match_operand:SF 2 "gpc_reg_operand" "f"))
3012 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3013 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3014 "{fnms|fnmsub} %0,%1,%2,%3"
3015 [(set_attr "type" "dmul")])
3017 (define_expand "sqrtsf2"
3018 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3019 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
3020 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3024 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3025 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3026 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
3028 [(set_attr "type" "ssqrt")])
3031 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3032 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3033 "TARGET_POWER2 && TARGET_HARD_FLOAT"
3035 [(set_attr "type" "dsqrt")])
3037 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3038 ;; fsel instruction and some auxiliary computations. Then we just have a
3039 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3041 (define_expand "maxsf3"
3043 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
3044 (match_operand:SF 2 "gpc_reg_operand" "")))
3045 (set (match_operand:SF 0 "gpc_reg_operand" "")
3046 (if_then_else:SF (ge (match_dup 3)
3050 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3052 { operands[3] = gen_reg_rtx (SFmode); }")
3055 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3056 (smax:SF (match_operand:SF 1 "gpc_reg_operand" "")
3057 (match_operand:SF 2 "gpc_reg_operand" "")))
3058 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3059 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3061 (minus:SF (match_dup 1) (match_dup 2)))
3063 (if_then_else:SF (ge (match_dup 3)
3069 (define_expand "minsf3"
3071 (minus:SF (match_operand:SF 2 "gpc_reg_operand" "")
3072 (match_operand:SF 1 "gpc_reg_operand" "")))
3073 (set (match_operand:SF 0 "gpc_reg_operand" "")
3074 (if_then_else:SF (ge (match_dup 3)
3078 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3080 { operands[3] = gen_reg_rtx (SFmode); }")
3083 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3084 (smin:SF (match_operand:SF 1 "gpc_reg_operand" "")
3085 (match_operand:SF 2 "gpc_reg_operand" "")))
3086 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3087 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3089 (minus:SF (match_dup 2) (match_dup 1)))
3091 (if_then_else:SF (ge (match_dup 3)
3097 (define_expand "movsfcc"
3098 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3099 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3100 (match_operand:SF 2 "gpc_reg_operand" "f")
3101 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3102 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3106 enum rtx_code code = GET_CODE (operands[1]);
3107 if (! rs6000_compare_fp_p)
3111 case GE: case EQ: case NE:
3112 op0 = rs6000_compare_op0;
3113 op1 = rs6000_compare_op1;
3116 op0 = rs6000_compare_op1;
3117 op1 = rs6000_compare_op0;
3118 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3121 op0 = rs6000_compare_op1;
3122 op1 = rs6000_compare_op0;
3125 op0 = rs6000_compare_op0;
3126 op1 = rs6000_compare_op1;
3127 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3132 if (GET_MODE (rs6000_compare_op0) == DFmode)
3134 temp = gen_reg_rtx (DFmode);
3135 emit_insn (gen_subdf3 (temp, op0, op1));
3136 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[2], operands[3]));
3139 emit_insn (gen_negdf2 (temp, temp));
3140 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[0], operands[3]));
3144 emit_insn (gen_negdf2 (temp, temp));
3145 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[3], operands[0]));
3150 temp = gen_reg_rtx (SFmode);
3151 emit_insn (gen_subsf3 (temp, op0, op1));
3152 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[2], operands[3]));
3155 emit_insn (gen_negsf2 (temp, temp));
3156 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[0], operands[3]));
3160 emit_insn (gen_negsf2 (temp, temp));
3161 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[3], operands[0]));
3167 (define_insn "fselsfsf4"
3168 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3169 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3171 (match_operand:SF 2 "gpc_reg_operand" "f")
3172 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3173 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3175 [(set_attr "type" "fp")])
3177 (define_insn "fseldfsf4"
3178 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3179 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3181 (match_operand:SF 2 "gpc_reg_operand" "f")
3182 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3183 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3185 [(set_attr "type" "fp")])
3187 (define_insn "negdf2"
3188 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3189 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3192 [(set_attr "type" "fp")])
3194 (define_insn "absdf2"
3195 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3196 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3199 [(set_attr "type" "fp")])
3202 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3203 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3206 [(set_attr "type" "fp")])
3208 (define_insn "adddf3"
3209 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3210 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3211 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3213 "{fa|fadd} %0,%1,%2"
3214 [(set_attr "type" "fp")])
3216 (define_insn "subdf3"
3217 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3218 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3219 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3221 "{fs|fsub} %0,%1,%2"
3222 [(set_attr "type" "fp")])
3224 (define_insn "muldf3"
3225 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3226 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3227 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3229 "{fm|fmul} %0,%1,%2"
3230 [(set_attr "type" "dmul")])
3232 (define_insn "divdf3"
3233 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3234 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3235 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3237 "{fd|fdiv} %0,%1,%2"
3238 [(set_attr "type" "ddiv")])
3241 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3242 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3243 (match_operand:DF 2 "gpc_reg_operand" "f"))
3244 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3246 "{fma|fmadd} %0,%1,%2,%3"
3247 [(set_attr "type" "dmul")])
3250 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3251 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3252 (match_operand:DF 2 "gpc_reg_operand" "f"))
3253 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3255 "{fms|fmsub} %0,%1,%2,%3"
3256 [(set_attr "type" "dmul")])
3259 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3260 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3261 (match_operand:DF 2 "gpc_reg_operand" "f"))
3262 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3264 "{fnma|fnmadd} %0,%1,%2,%3"
3265 [(set_attr "type" "dmul")])
3268 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3269 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3270 (match_operand:DF 2 "gpc_reg_operand" "f"))
3271 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3273 "{fnms|fnmsub} %0,%1,%2,%3"
3274 [(set_attr "type" "dmul")])
3276 (define_insn "sqrtdf2"
3277 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3278 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3279 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3281 [(set_attr "type" "dsqrt")])
3283 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3284 ;; fsel instruction and some auxiliary computations. Then we just have a
3285 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3288 (define_expand "maxdf3"
3290 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
3291 (match_operand:DF 2 "gpc_reg_operand" "")))
3292 (set (match_operand:DF 0 "gpc_reg_operand" "")
3293 (if_then_else:DF (ge (match_dup 3)
3297 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3299 { operands[3] = gen_reg_rtx (DFmode); }")
3302 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3303 (smax:DF (match_operand:DF 1 "gpc_reg_operand" "")
3304 (match_operand:DF 2 "gpc_reg_operand" "")))
3305 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3306 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3308 (minus:DF (match_dup 1) (match_dup 2)))
3310 (if_then_else:DF (ge (match_dup 3)
3316 (define_expand "mindf3"
3318 (minus:DF (match_operand:DF 2 "gpc_reg_operand" "")
3319 (match_operand:DF 1 "gpc_reg_operand" "")))
3320 (set (match_operand:DF 0 "gpc_reg_operand" "")
3321 (if_then_else:DF (ge (match_dup 3)
3325 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3327 { operands[3] = gen_reg_rtx (DFmode); }")
3330 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3331 (smin:DF (match_operand:DF 1 "gpc_reg_operand" "")
3332 (match_operand:DF 2 "gpc_reg_operand" "")))
3333 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3334 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3336 (minus:DF (match_dup 2) (match_dup 1)))
3338 (if_then_else:DF (ge (match_dup 3)
3344 (define_expand "movdfcc"
3345 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3346 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3347 (match_operand:DF 2 "gpc_reg_operand" "f")
3348 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3349 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3353 enum rtx_code code = GET_CODE (operands[1]);
3354 if (! rs6000_compare_fp_p)
3358 case GE: case EQ: case NE:
3359 op0 = rs6000_compare_op0;
3360 op1 = rs6000_compare_op1;
3363 op0 = rs6000_compare_op1;
3364 op1 = rs6000_compare_op0;
3365 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3368 op0 = rs6000_compare_op1;
3369 op1 = rs6000_compare_op0;
3372 op0 = rs6000_compare_op0;
3373 op1 = rs6000_compare_op1;
3374 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3379 if (GET_MODE (rs6000_compare_op0) == DFmode)
3381 temp = gen_reg_rtx (DFmode);
3382 emit_insn (gen_subdf3 (temp, op0, op1));
3383 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[2], operands[3]));
3386 emit_insn (gen_negdf2 (temp, temp));
3387 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[0], operands[3]));
3391 emit_insn (gen_negdf2 (temp, temp));
3392 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[3], operands[0]));
3397 temp = gen_reg_rtx (SFmode);
3398 emit_insn (gen_subsf3 (temp, op0, op1));
3399 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[2], operands[3]));
3402 emit_insn (gen_negsf2 (temp, temp));
3403 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[0], operands[3]));
3407 emit_insn (gen_negsf2 (temp, temp));
3408 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[3], operands[0]));
3414 (define_insn "fseldfdf4"
3415 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3416 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3418 (match_operand:DF 2 "gpc_reg_operand" "f")
3419 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3420 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3422 [(set_attr "type" "fp")])
3424 (define_insn "fselsfdf4"
3425 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3426 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3428 (match_operand:DF 2 "gpc_reg_operand" "f")
3429 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3432 [(set_attr "type" "fp")])
3434 ;; Conversions to and from floating-point.
3435 (define_expand "floatsidf2"
3436 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3437 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))]
3438 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3442 { /* prevent unused warning messages */
3443 rtx high = force_reg (SImode, GEN_INT (0x43300000));
3444 rtx low = gen_reg_rtx (SImode);
3445 rtx df = gen_reg_rtx (DFmode);
3446 rtx adjust = force_reg (DFmode, rs6000_float_const (\"4503601774854144\", DFmode));
3448 emit_insn (gen_xorsi3 (low, operands[1], GEN_INT (0x80000000)));
3449 emit_insn (gen_move_to_float (df, low, high));
3450 emit_insn (gen_subdf3 (operands[0], df, adjust));
3455 (define_expand "floatunssidf2"
3456 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3457 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))]
3458 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3462 { /* prevent unused warning messages */
3463 rtx high = force_reg (SImode, GEN_INT (0x43300000));
3464 rtx df = gen_reg_rtx (DFmode);
3465 rtx adjust = force_reg (DFmode, rs6000_float_const (\"4503599627370496\", DFmode));
3467 emit_insn (gen_move_to_float (df, operands[1], high));
3468 emit_insn (gen_subdf3 (operands[0], df, adjust));
3473 (define_expand "move_to_float"
3474 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3475 (unspec [(match_operand:SI 1 "gpc_reg_operand" "")
3476 (match_operand:SI 2 "gpc_reg_operand" "")
3478 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3481 operands[3] = XEXP (rs6000_stack_temp (DFmode, 8, 1), 0);
3485 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3486 (unspec [(match_operand:SI 1 "gpc_reg_operand" "")
3487 (match_operand:SI 2 "gpc_reg_operand" "")
3488 (match_operand:SI 3 "offsettable_addr_operand" "")] 2))]
3490 [(set (match_dup 4) (match_dup 1))
3491 (set (match_dup 5) (match_dup 2))
3492 (set (match_dup 0) (mem:DF (match_dup 3)))]
3495 rtx word1 = gen_rtx (MEM, SImode, operands[3]);
3496 rtx word2 = gen_rtx (MEM, SImode, plus_constant (operands[3], 4));
3498 MEM_IN_STRUCT_P (word1) = 1;
3499 MEM_IN_STRUCT_P (word2) = 1;
3501 if (WORDS_BIG_ENDIAN)
3503 operands[4] = word2;
3504 operands[5] = word1;
3508 operands[4] = word1;
3509 operands[5] = word2;
3514 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3515 (unspec [(match_operand:SI 1 "gpc_reg_operand" "r")
3516 (match_operand:SI 2 "gpc_reg_operand" "r")
3517 (match_operand:SI 3 "offsettable_addr_operand" "p")] 2))]
3518 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3520 [(set_attr "length" "12")])
3522 (define_expand "fix_truncdfsi2"
3523 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3524 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
3528 if (TARGET_POWER2 || TARGET_POWERPC)
3530 rtx stack_slot = rs6000_stack_temp (DImode, 8, 1);
3531 rtx temp = gen_reg_rtx (DImode);
3533 emit_insn (gen_fpcvtsi (temp, operands[1]));
3534 emit_move_insn (stack_slot, temp);
3535 emit_move_insn (operands[0],
3536 gen_rtx (SUBREG, SImode, stack_slot, WORDS_BIG_ENDIAN));
3541 emit_insn (gen_trunc_call (operands[0], operands[1],
3542 gen_rtx (SYMBOL_REF, Pmode, RS6000_ITRUNC)));
3547 (define_insn "fpcvtsi"
3548 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3550 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3551 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3552 "{fcirz|fctiwz} %0,%1"
3553 [(set_attr "type" "fp")])
3555 (define_expand "fixuns_truncdfsi2"
3556 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3557 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
3558 "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
3561 emit_insn (gen_trunc_call (operands[0], operands[1],
3562 gen_rtx (SYMBOL_REF, Pmode, RS6000_UITRUNC)));
3566 (define_expand "trunc_call"
3567 [(parallel [(set (match_operand:SI 0 "" "")
3568 (fix:SI (match_operand:DF 1 "" "")))
3569 (use (match_operand:SI 2 "" ""))])]
3573 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
3574 rtx first = XVECEXP (insns, 0, 0);
3575 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
3577 REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
3579 REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
3585 (define_expand "trunc_call_rtl"
3586 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
3588 (parallel [(set (reg:SI 3)
3589 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
3591 (clobber (scratch:SI))])
3592 (set (match_operand:SI 0 "gpc_reg_operand" "")
3597 rs6000_trunc_used = 1;
3600 (define_insn "floatdidf2"
3601 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3602 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
3603 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3605 [(set_attr "type" "fp")])
3607 (define_insn "fix_truncdfdi2"
3608 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3609 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
3610 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3612 [(set_attr "type" "fp")])
3614 ;; Define the DImode operations that can be done in a small number
3615 ;; of instructions. The & constraints are to prevent the register
3616 ;; allocator from allocating registers that overlap with the inputs
3617 ;; (for example, having an input in 7,8 and an output in 6,7). We
3618 ;; also allow for the the output being the same as one of the inputs.
3620 (define_insn "*adddi3_noppc64"
3621 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
3622 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
3623 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
3624 "! TARGET_POWERPC64"
3627 if (WORDS_BIG_ENDIAN)
3628 return (GET_CODE (operands[2])) != CONST_INT
3629 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
3630 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
3632 return (GET_CODE (operands[2])) != CONST_INT
3633 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
3634 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
3636 [(set_attr "length" "8")])
3638 (define_insn "*subdi3_noppc64"
3639 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
3640 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
3641 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
3642 "! TARGET_POWERPC64"
3645 if (WORDS_BIG_ENDIAN)
3646 return (GET_CODE (operands[1]) != CONST_INT)
3647 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
3648 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
3650 return (GET_CODE (operands[1]) != CONST_INT)
3651 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
3652 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
3654 [(set_attr "length" "8")])
3656 (define_insn "*negdi2_noppc64"
3657 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
3658 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
3659 "! TARGET_POWERPC64"
3662 return (WORDS_BIG_ENDIAN)
3663 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
3664 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
3666 [(set_attr "length" "8")])
3668 (define_expand "mulsidi3"
3669 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3670 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3671 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3675 if (! TARGET_POWER && ! TARGET_POWERPC)
3677 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
3678 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
3679 emit_insn (gen_mull_call ());
3680 if (WORDS_BIG_ENDIAN)
3681 emit_move_insn (operands[0], gen_rtx (REG, DImode, 3));
3684 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
3685 gen_rtx (REG, SImode, 3));
3686 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
3687 gen_rtx (REG, SImode, 4));
3691 else if (TARGET_POWER)
3693 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
3698 (define_insn "mulsidi3_mq"
3699 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3700 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3701 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
3702 (clobber (match_scratch:SI 3 "=q"))]
3704 "mul %0,%1,%2\;mfmq %L0"
3705 [(set_attr "type" "imul")
3706 (set_attr "length" "8")])
3708 (define_insn "*mulsidi3_powerpc"
3709 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
3710 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3711 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
3712 "TARGET_POWERPC && ! TARGET_POWERPC64"
3715 return (WORDS_BIG_ENDIAN)
3716 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
3717 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
3719 [(set_attr "type" "imul")
3720 (set_attr "length" "8")])
3723 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3724 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3725 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3726 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
3729 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3730 (sign_extend:DI (match_dup 2)))
3733 (mult:SI (match_dup 1)
3737 int endian = (WORDS_BIG_ENDIAN == 0);
3738 operands[3] = operand_subword (operands[0], endian, 0, DImode);
3739 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
3742 (define_insn "umulsidi3"
3743 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
3744 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3745 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
3746 "TARGET_POWERPC && ! TARGET_POWERPC64"
3749 return (WORDS_BIG_ENDIAN)
3750 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
3751 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
3753 [(set_attr "type" "imul")
3754 (set_attr "length" "8")])
3757 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3758 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3759 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3760 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
3763 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3764 (zero_extend:DI (match_dup 2)))
3767 (mult:SI (match_dup 1)
3771 int endian = (WORDS_BIG_ENDIAN == 0);
3772 operands[3] = operand_subword (operands[0], endian, 0, DImode);
3773 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
3776 (define_expand "smulsi3_highpart"
3777 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3779 (lshiftrt:DI (mult:DI (sign_extend:DI
3780 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3782 (match_operand:SI 2 "gpc_reg_operand" "r")))
3787 if (! TARGET_POWER && ! TARGET_POWERPC)
3789 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
3790 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
3791 emit_insn (gen_mulh_call ());
3792 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
3795 else if (TARGET_POWER)
3797 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
3802 (define_insn "smulsi3_highpart_mq"
3803 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3805 (lshiftrt:DI (mult:DI (sign_extend:DI
3806 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3808 (match_operand:SI 2 "gpc_reg_operand" "r")))
3810 (clobber (match_scratch:SI 3 "=q"))]
3813 [(set_attr "type" "imul")])
3816 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3818 (lshiftrt:DI (mult:DI (sign_extend:DI
3819 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3821 (match_operand:SI 2 "gpc_reg_operand" "r")))
3825 [(set_attr "type" "imul")])
3827 (define_insn "umulsi3_highpart"
3828 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3830 (lshiftrt:DI (mult:DI (zero_extend:DI
3831 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3833 (match_operand:SI 2 "gpc_reg_operand" "r")))
3837 [(set_attr "type" "imul")])
3839 ;; If operands 0 and 2 are in the same register, we have a problem. But
3840 ;; operands 0 and 1 (the usual case) can be in the same register. That's
3841 ;; why we have the strange constraints below.
3842 (define_insn "ashldi3_power"
3843 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
3844 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
3845 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
3846 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
3849 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
3850 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
3851 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
3852 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
3853 [(set_attr "length" "8")])
3855 (define_insn "lshrdi3_power"
3856 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
3857 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
3858 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
3859 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
3862 {cal %0,0(0)|li %0,0}\;{s%A2i|s%A2wi} %L0,%1,%h2
3863 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
3864 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
3865 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
3866 [(set_attr "length" "8")])
3868 ;; Shift by a variable amount is too complex to be worth open-coding. We
3869 ;; just handle shifts by constants.
3870 (define_insn "ashrdi3_power"
3871 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3872 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
3873 (match_operand:SI 2 "const_int_operand" "M,i")))
3874 (clobber (match_scratch:SI 3 "=X,q"))]
3877 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
3878 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
3879 [(set_attr "length" "8")])
3881 ;; PowerPC64 DImode operations.
3883 (define_expand "adddi3"
3884 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3885 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
3886 (match_operand:DI 2 "add_operand" "")))]
3890 if (! TARGET_POWERPC64 && non_add_cint_operand (operands[2], DImode))
3894 ;; Discourage ai/addic because of carry but provide it in an alternative
3895 ;; allowing register zero as source.
3898 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
3899 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
3900 (match_operand:DI 2 "add_operand" "r,I,I,J")))]
3909 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
3910 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
3911 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
3913 (clobber (match_scratch:DI 3 "=r,r"))]
3918 [(set_attr "type" "compare")])
3921 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
3922 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
3923 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
3925 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3926 (plus:DI (match_dup 1) (match_dup 2)))]
3931 [(set_attr "type" "compare")])
3933 ;; Split an add that we can't do in one insn into two insns, each of which
3934 ;; does one 16-bit part. This is used by combine. Note that the low-order
3935 ;; add should be last in case the result gets used in an address.
3938 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3939 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
3940 (match_operand:DI 2 "non_add_cint_operand" "")))]
3942 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
3943 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
3946 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
3947 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
3950 high+=0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
3952 operands[3] = GEN_INT (high);
3953 operands[4] = GEN_INT (low);
3956 (define_insn "one_cmpldi2"
3957 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3958 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
3963 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3964 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
3966 (clobber (match_scratch:DI 2 "=r"))]
3969 [(set_attr "type" "compare")])
3972 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
3973 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
3975 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3976 (not:DI (match_dup 1)))]
3979 [(set_attr "type" "compare")])
3982 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3983 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
3984 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
3991 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3992 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3993 (match_operand:DI 2 "gpc_reg_operand" "r"))
3995 (clobber (match_scratch:DI 3 "=r"))]
3998 [(set_attr "type" "compare")])
4001 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4002 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4003 (match_operand:DI 2 "gpc_reg_operand" "r"))
4005 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4006 (minus:DI (match_dup 1) (match_dup 2)))]
4009 [(set_attr "type" "compare")])
4011 (define_expand "subdi3"
4012 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4013 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
4014 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4018 if (GET_CODE (operands[2]) == CONST_INT)
4020 emit_insn (gen_adddi3 (operands[0], operands[1],
4021 negate_rtx (DImode, operands[2])));
4026 (define_insn "absdi2"
4027 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4028 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4029 (clobber (match_scratch:DI 2 "=&r,&r"))]
4031 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0"
4032 [(set_attr "length" "12")])
4035 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4036 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4037 (clobber (match_scratch:DI 2 "=&r,&r"))]
4038 "TARGET_POWERPC64 && reload_completed"
4039 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4040 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4041 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
4045 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4046 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4047 (clobber (match_scratch:DI 2 "=&r,&r"))]
4049 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2"
4050 [(set_attr "length" "12")])
4053 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4054 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4055 (clobber (match_scratch:DI 2 "=&r,&r"))]
4056 "TARGET_POWERPC64 && reload_completed"
4057 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4058 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4059 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
4062 (define_expand "negdi2"
4063 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4064 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
4069 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4070 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4075 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4076 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4078 (clobber (match_scratch:DI 2 "=r"))]
4081 [(set_attr "type" "compare")])
4084 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4085 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4087 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4088 (neg:DI (match_dup 1)))]
4091 [(set_attr "type" "compare")])
4093 (define_insn "ffsdi2"
4094 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4095 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4097 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
4098 [(set_attr "length" "16")])
4100 (define_insn "muldi3"
4101 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4102 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4103 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4106 [(set_attr "type" "imul")])
4108 (define_insn "smuldi3_highpart"
4109 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4111 (lshiftrt:TI (mult:TI (sign_extend:TI
4112 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4114 (match_operand:DI 2 "gpc_reg_operand" "r")))
4118 [(set_attr "type" "imul")])
4120 (define_insn "umuldi3_highpart"
4121 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4123 (lshiftrt:TI (mult:TI (zero_extend:TI
4124 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4126 (match_operand:DI 2 "gpc_reg_operand" "r")))
4130 [(set_attr "type" "imul")])
4132 (define_expand "divdi3"
4133 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4134 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
4135 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4139 if (GET_CODE (operands[2]) == CONST_INT
4140 && exact_log2 (INTVAL (operands[2])) >= 0)
4143 operands[2] = force_reg (DImode, operands[2]);
4146 (define_expand "moddi3"
4147 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
4148 (use (match_operand:DI 1 "gpc_reg_operand" ""))
4149 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
4153 int i = exact_log2 (INTVAL (operands[2]));
4157 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
4160 temp1 = gen_reg_rtx (DImode);
4161 temp2 = gen_reg_rtx (DImode);
4163 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
4164 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
4165 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
4170 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4171 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4172 (match_operand:DI 2 "const_int_operand" "N")))]
4173 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4174 "sradi %0,%1,%p2\;addze %0,%0"
4175 [(set_attr "length" "8")])
4178 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4179 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4180 (match_operand:DI 2 "const_int_operand" "N"))
4182 (clobber (match_scratch:DI 3 "=r"))]
4183 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4184 "sradi %3,%1,%p2\;addze. %3,%3"
4185 [(set_attr "type" "compare")
4186 (set_attr "length" "8")])
4189 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4190 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4191 (match_operand:DI 2 "const_int_operand" "N"))
4193 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4194 (div:DI (match_dup 1) (match_dup 2)))]
4195 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4196 "sradi %0,%1,%p2\;addze. %0,%0"
4197 [(set_attr "type" "compare")
4198 (set_attr "length" "8")])
4201 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4202 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4203 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4206 [(set_attr "type" "idiv")])
4208 (define_insn "udivdi3"
4209 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4210 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4211 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4214 [(set_attr "type" "idiv")])
4216 (define_insn "rotldi3"
4217 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4218 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4219 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
4221 "rld%I2cl %0,%1,%h2,0")
4224 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4225 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4226 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4228 (clobber (match_scratch:DI 3 "=r"))]
4230 "rld%I2cl. %3,%1,%h2,0"
4231 [(set_attr "type" "delayed_compare")])
4234 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4235 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4236 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4238 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4239 (rotate:DI (match_dup 1) (match_dup 2)))]
4241 "rld%I2cl. %0,%1,%h2,0"
4242 [(set_attr "type" "delayed_compare")])
4244 (define_expand "ashldi3"
4245 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4246 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
4247 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4248 "TARGET_POWERPC64 || TARGET_POWER"
4251 if (TARGET_POWERPC64)
4253 else if (TARGET_POWER)
4255 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
4263 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4264 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4265 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4268 [(set_attr "length" "8")])
4271 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4272 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4273 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4275 (clobber (match_scratch:DI 3 "=r"))]
4278 [(set_attr "type" "delayed_compare")])
4281 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4282 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4283 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4285 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4286 (ashift:DI (match_dup 1) (match_dup 2)))]
4289 [(set_attr "type" "delayed_compare")])
4291 (define_expand "lshrdi3"
4292 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4293 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4294 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4295 "TARGET_POWERPC64 || TARGET_POWER"
4298 if (TARGET_POWERPC64)
4300 else if (TARGET_POWER)
4302 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
4310 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4311 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4312 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4317 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4318 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4319 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4321 (clobber (match_scratch:DI 3 "=r"))]
4324 [(set_attr "type" "delayed_compare")])
4327 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4328 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4329 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4331 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4332 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
4335 [(set_attr "type" "delayed_compare")])
4337 (define_expand "ashrdi3"
4338 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4339 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4340 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4341 "TARGET_POWERPC64 || TARGET_POWER"
4344 if (TARGET_POWERPC64)
4346 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
4348 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
4356 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4357 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4358 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4363 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4364 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4365 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4367 (clobber (match_scratch:DI 3 "=r"))]
4370 [(set_attr "type" "delayed_compare")])
4373 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4374 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4375 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4377 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4378 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
4381 [(set_attr "type" "delayed_compare")])
4383 (define_insn "anddi3"
4384 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4385 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4386 (match_operand:DI 2 "and_operand" "?r,K,J")))
4387 (clobber (match_scratch:CC 3 "=X,x,x"))]
4395 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
4396 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4397 (match_operand:DI 2 "and_operand" "r,K,J"))
4399 (clobber (match_scratch:DI 3 "=r,r,r"))]
4405 [(set_attr "type" "compare,compare,compare")])
4408 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
4409 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4410 (match_operand:DI 2 "and_operand" "r,K,J"))
4412 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4413 (and:DI (match_dup 1) (match_dup 2)))]
4419 [(set_attr "type" "compare,compare,compare")])
4421 ;; Take a AND with a constant that cannot be done in a single insn and try to
4422 ;; split it into two insns. This does not verify that the insns are valid
4423 ;; since this need not be done as combine will do it.
4426 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4427 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
4428 (match_operand:DI 2 "non_and_cint_operand" "")))]
4430 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
4431 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
4434 int maskval = INTVAL (operands[2]);
4435 int i, transitions, last_bit_value;
4436 int orig = maskval, first_c = maskval, second_c;
4438 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
4439 the low-order bit and count for the third transition. When we get there,
4440 make a first mask that has everything to the left of that position
4441 a one. Then make the second mask to turn off whatever else is needed. */
4443 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
4445 if (((maskval >>= 1) & 1) != last_bit_value)
4446 last_bit_value ^= 1, transitions++;
4448 if (transitions > 2)
4450 first_c |= (~0) << i;
4455 second_c = orig | ~ first_c;
4457 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
4458 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
4461 (define_insn "iordi3"
4462 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4463 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4464 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4472 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4473 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4474 (match_operand:DI 2 "gpc_reg_operand" "r"))
4476 (clobber (match_scratch:DI 3 "=r"))]
4479 [(set_attr "type" "compare")])
4482 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4483 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4484 (match_operand:DI 2 "gpc_reg_operand" "r"))
4486 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4487 (ior:DI (match_dup 1) (match_dup 2)))]
4490 [(set_attr "type" "compare")])
4492 ;; Split an IOR that we can't do in one insn into two insns, each of which
4493 ;; does one 16-bit part. This is used by combine.
4496 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4497 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
4498 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4500 [(set (match_dup 0) (ior:DI (match_dup 1) (match_dup 3)))
4501 (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 4)))]
4504 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4505 INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
4506 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4509 (define_insn "xordi3"
4510 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4511 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4512 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4520 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4521 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4522 (match_operand:DI 2 "gpc_reg_operand" "r"))
4524 (clobber (match_scratch:DI 3 "=r"))]
4527 [(set_attr "type" "compare")])
4530 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4531 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4532 (match_operand:DI 2 "gpc_reg_operand" "r"))
4534 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4535 (xor:DI (match_dup 1) (match_dup 2)))]
4538 [(set_attr "type" "compare")])
4540 ;; Split an XOR that we can't do in one insn into two insns, each of which
4541 ;; does one 16-bit part. This is used by combine.
4544 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4545 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
4546 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4548 [(set (match_dup 0) (xor:DI (match_dup 1) (match_dup 3)))
4549 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 4)))]
4552 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4553 INTVAL (operands[2]) & 0xffff0000);
4554 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4558 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4559 (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4560 (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4565 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4566 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4567 (match_operand:DI 2 "gpc_reg_operand" "r")))
4569 (clobber (match_scratch:DI 3 "=r"))]
4572 [(set_attr "type" "compare")])
4575 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4576 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4577 (match_operand:DI 2 "gpc_reg_operand" "r")))
4579 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4580 (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
4583 [(set_attr "type" "compare")])
4586 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4587 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4588 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4593 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4594 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4595 (match_operand:DI 2 "gpc_reg_operand" "r"))
4597 (clobber (match_scratch:DI 3 "=r"))]
4600 [(set_attr "type" "compare")])
4603 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4604 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4605 (match_operand:DI 2 "gpc_reg_operand" "r"))
4607 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4608 (and:DI (not:DI (match_dup 1)) (match_dup 2)))]
4611 [(set_attr "type" "compare")])
4614 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4615 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4616 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4621 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4622 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4623 (match_operand:DI 2 "gpc_reg_operand" "r"))
4625 (clobber (match_scratch:DI 3 "=r"))]
4628 [(set_attr "type" "compare")])
4631 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4632 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4633 (match_operand:DI 2 "gpc_reg_operand" "r"))
4635 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4636 (ior:DI (not:DI (match_dup 1)) (match_dup 2)))]
4639 [(set_attr "type" "compare")])
4642 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4643 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4644 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4649 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4650 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4651 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4653 (clobber (match_scratch:DI 3 "=r"))]
4656 [(set_attr "type" "compare")])
4659 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4660 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4661 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4663 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4664 (ior:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
4667 [(set_attr "type" "compare")])
4670 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4671 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4672 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4677 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4678 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4679 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4681 (clobber (match_scratch:DI 3 "=r"))]
4684 [(set_attr "type" "compare")])
4687 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4688 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4689 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4691 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4692 (and:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
4695 [(set_attr "type" "compare")])
4697 ;; Now define ways of moving data around.
4699 ;; Elf specific ways of loading addresses for non-PIC code.
4700 ;; The output of this could be r0, but we limit it to base
4701 ;; registers, since almost all uses of this will need it
4702 ;; in a base register shortly.
4703 (define_insn "elf_high"
4704 [(set (match_operand:SI 0 "register_operand" "=b")
4705 (high:SI (match_operand 1 "" "")))]
4706 "TARGET_ELF && !TARGET_64BIT"
4707 "{cau|addis} %0,0,%1@ha")
4709 (define_insn "elf_low"
4710 [(set (match_operand:SI 0 "register_operand" "=r")
4711 (lo_sum:SI (match_operand:SI 1 "register_operand" "b")
4712 (match_operand 2 "" "")))]
4713 "TARGET_ELF && !TARGET_64BIT"
4714 "{cal %0,%a2@l(%1)|addi %0,%1,%2@l}")
4716 ;; For SI, we special-case integers that can't be loaded in one insn. We
4717 ;; do the load 16-bits at a time. We could do this by loading from memory,
4718 ;; and this is even supposed to be faster, but it is simpler not to get
4719 ;; integers in the TOC.
4720 (define_expand "movsi"
4721 [(set (match_operand:SI 0 "general_operand" "")
4722 (match_operand:SI 1 "any_operand" ""))]
4726 if (GET_CODE (operands[0]) != REG)
4727 operands[1] = force_reg (SImode, operands[1]);
4729 /* Convert a move of a CONST_DOUBLE into a CONST_INT */
4730 if (GET_CODE (operands[1]) == CONST_DOUBLE)
4731 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
4733 /* Use default pattern for address of ELF small data */
4735 && DEFAULT_ABI == ABI_V4
4736 && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
4737 && small_data_operand (operands[1], SImode))
4739 emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
4743 if (TARGET_ELF && TARGET_NO_TOC && !TARGET_64BIT
4744 && CONSTANT_P (operands[1])
4745 && GET_CODE (operands[1]) != HIGH
4746 && GET_CODE (operands[1]) != CONST_INT)
4748 rtx target = (reload_completed || reload_in_progress)
4749 ? operands[0] : gen_reg_rtx (SImode);
4751 /* If this is a function address on -mcall-aixdesc or -mcall-nt,
4752 convert it to the address of the descriptor. */
4753 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
4754 && GET_CODE (operands[1]) == SYMBOL_REF
4755 && XSTR (operands[1], 0)[0] == '.')
4757 char *name = XSTR (operands[1], 0);
4759 while (*name == '.')
4761 new_ref = gen_rtx (SYMBOL_REF, Pmode, name);
4762 CONSTANT_POOL_ADDRESS_P (new_ref) = CONSTANT_POOL_ADDRESS_P (operands[1]);
4763 SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
4764 SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
4765 operands[1] = new_ref;
4768 emit_insn (gen_elf_high (target, operands[1]));
4769 emit_insn (gen_elf_low (operands[0], target, operands[1]));
4773 if (GET_CODE (operands[1]) == CONST
4774 && DEFAULT_ABI == ABI_NT
4775 && !side_effects_p (operands[0]))
4777 rtx const_term = const0_rtx;
4778 rtx sym = eliminate_constant_term (XEXP (operands[1], 0), &const_term);
4779 if (sym && GET_CODE (const_term) == CONST_INT
4780 && (GET_CODE (sym) == SYMBOL_REF || GET_CODE (sym) == LABEL_REF))
4782 unsigned HOST_WIDE_INT value = INTVAL (const_term);
4783 int new_reg_p = (flag_expensive_optimizations
4784 && !reload_completed
4785 && !reload_in_progress);
4786 rtx tmp1 = (new_reg_p && value != 0) ? gen_reg_rtx (SImode) : operands[0];
4788 emit_insn (gen_movsi (tmp1, sym));
4789 if (INTVAL (const_term) != 0)
4791 if (value + 0x8000 < 0x10000)
4792 emit_insn (gen_addsi3 (operands[0], tmp1, GEN_INT (value)));
4796 HOST_WIDE_INT high_int = value & (~ (HOST_WIDE_INT) 0xffff);
4797 HOST_WIDE_INT low_int = value & 0xffff;
4798 rtx tmp2 = (!new_reg_p || !low_int) ? operands[0] : gen_reg_rtx (Pmode);
4800 if (low_int & 0x8000)
4801 high_int += 0x10000, low_int |= ((HOST_WIDE_INT) -1) << 16;
4803 emit_insn (gen_addsi3 (tmp2, tmp1, GEN_INT (high_int)));
4805 emit_insn (gen_addsi3 (operands[0], tmp2, GEN_INT (low_int)));
4811 fatal_insn (\"bad address\", operands[1]);
4814 if ((!TARGET_WINDOWS_NT || DEFAULT_ABI != ABI_NT)
4815 && CONSTANT_P (operands[1])
4816 && GET_CODE (operands[1]) != CONST_INT
4817 && GET_CODE (operands[1]) != HIGH
4818 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
4820 /* If we are to limit the number of things we put in the TOC and
4821 this is a symbol plus a constant we can add in one insn,
4822 just put the symbol in the TOC and add the constant. Don't do
4823 this if reload is in progress. */
4824 if (GET_CODE (operands[1]) == CONST
4825 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
4826 && GET_CODE (XEXP (operands[1], 0)) == PLUS
4827 && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
4828 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
4829 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
4830 && ! side_effects_p (operands[0]))
4832 rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
4833 rtx other = XEXP (XEXP (operands[1], 0), 1);
4835 emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
4839 operands[1] = force_const_mem (SImode, operands[1]);
4840 if (! memory_address_p (SImode, XEXP (operands[1], 0))
4841 && ! reload_in_progress)
4842 operands[1] = change_address (operands[1], SImode,
4843 XEXP (operands[1], 0));
4848 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,r,r,r,r,r,*q,*c*l,*h")
4849 (match_operand:SI 1 "input_operand" "r,S,T,U,m,r,I,J,n,R,*h,r,r,0"))]
4850 "gpc_reg_operand (operands[0], SImode)
4851 || gpc_reg_operand (operands[1], SImode)"
4854 {l|lwz} %0,[toc]%1(2)
4855 {l|lwz} %0,[toc]%l1(2)
4857 {l%U1%X1|lwz%U1%X1} %0,%1
4858 {st%U0%X0|stw%U0%X0} %1,%0
4867 [(set_attr "type" "*,load,load,*,load,*,*,*,*,*,*,*,mtjmpr,*")
4868 (set_attr "length" "4,4,4,4,4,4,4,4,8,4,4,4,4,4")])
4870 ;; Split a load of a large constant into the appropriate two-insn
4874 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4875 (match_operand:SI 1 "const_int_operand" ""))]
4876 "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
4877 && (INTVAL (operands[1]) & 0xffff) != 0"
4881 (ior:SI (match_dup 0)
4885 operands[2] = gen_rtx (CONST_INT, VOIDmode,
4886 INTVAL (operands[1]) & 0xffff0000);
4887 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
4891 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4892 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
4894 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
4897 [(set_attr "type" "compare")])
4899 (define_expand "movhi"
4900 [(set (match_operand:HI 0 "general_operand" "")
4901 (match_operand:HI 1 "any_operand" ""))]
4905 if (GET_CODE (operands[0]) != REG)
4906 operands[1] = force_reg (HImode, operands[1]);
4908 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
4910 operands[1] = force_const_mem (HImode, operands[1]);
4911 if (! memory_address_p (HImode, XEXP (operands[1], 0))
4912 && ! reload_in_progress)
4913 operands[1] = change_address (operands[1], HImode,
4914 XEXP (operands[1], 0));
4919 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
4920 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
4921 "gpc_reg_operand (operands[0], HImode)
4922 || gpc_reg_operand (operands[1], HImode)"
4932 [(set_attr "type" "*,load,*,*,*,*,mtjmpr,*")])
4934 (define_expand "movqi"
4935 [(set (match_operand:QI 0 "general_operand" "")
4936 (match_operand:QI 1 "any_operand" ""))]
4940 if (GET_CODE (operands[0]) != REG)
4941 operands[1] = force_reg (QImode, operands[1]);
4943 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
4945 operands[1] = force_const_mem (QImode, operands[1]);
4946 if (! memory_address_p (QImode, XEXP (operands[1], 0))
4947 && ! reload_in_progress)
4948 operands[1] = change_address (operands[1], QImode,
4949 XEXP (operands[1], 0));
4954 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
4955 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
4956 "gpc_reg_operand (operands[0], QImode)
4957 || gpc_reg_operand (operands[1], QImode)"
4967 [(set_attr "type" "*,load,*,*,*,*,mtjmpr,*")])
4969 ;; Here is how to move condition codes around. When we store CC data in
4970 ;; an integer register or memory, we store just the high-order 4 bits.
4971 ;; This lets us not shift in the most common case of CR0.
4972 (define_expand "movcc"
4973 [(set (match_operand:CC 0 "nonimmediate_operand" "")
4974 (match_operand:CC 1 "nonimmediate_operand" ""))]
4979 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
4980 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
4981 "register_operand (operands[0], CCmode)
4982 || register_operand (operands[1], CCmode)"
4986 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
4988 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
4990 {l%U1%X1|lwz%U1%X1} %0,%1
4991 {st%U0%U1|stw%U0%U1} %1,%0"
4992 [(set_attr "type" "*,*,*,compare,*,*,load,*")
4993 (set_attr "length" "*,*,12,*,8,*,*,*")])
4995 ;; For floating-point, we normally deal with the floating-point registers
4996 ;; unless -msoft-float is used. The sole exception is that parameter passing
4997 ;; can produce floating-point values in fixed-point registers. Unless the
4998 ;; value is a simple constant or already in memory, we deal with this by
4999 ;; allocating memory and copying the value explicitly via that memory location.
5000 (define_expand "movsf"
5001 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5002 (match_operand:SF 1 "any_operand" ""))]
5006 /* If we are called from reload, we might be getting a SUBREG of a hard
5007 reg. So expand it. */
5008 if (GET_CODE (operands[0]) == SUBREG
5009 && GET_CODE (SUBREG_REG (operands[0])) == REG
5010 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
5011 operands[0] = alter_subreg (operands[0]);
5012 if (GET_CODE (operands[1]) == SUBREG
5013 && GET_CODE (SUBREG_REG (operands[1])) == REG
5014 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
5015 operands[1] = alter_subreg (operands[1]);
5017 if (TARGET_SOFT_FLOAT && GET_CODE (operands[0]) == MEM)
5018 operands[1] = force_reg (SFmode, operands[1]);
5020 else if (TARGET_HARD_FLOAT)
5022 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
5024 /* If this is a store to memory or another integer register do the
5025 move directly. Otherwise store to a temporary stack slot and
5026 load from there into a floating point register. */
5028 if (GET_CODE (operands[0]) == MEM
5029 || (GET_CODE (operands[0]) == REG
5030 && (REGNO (operands[0]) < 32
5031 || (reload_in_progress
5032 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
5034 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5035 operand_subword (operands[1], 0, 0, SFmode));
5040 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5042 emit_move_insn (stack_slot, operands[1]);
5043 emit_move_insn (operands[0], stack_slot);
5048 if (GET_CODE (operands[0]) == MEM)
5050 /* If operands[1] is a register, it may have double-precision data
5051 in it, so truncate it to single precision. We need not do
5052 this for POWERPC. */
5053 if (! TARGET_POWERPC && TARGET_HARD_FLOAT
5054 && GET_CODE (operands[1]) == REG)
5057 = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
5058 emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
5059 operands[1] = newreg;
5062 operands[1] = force_reg (SFmode, operands[1]);
5065 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
5067 if (GET_CODE (operands[1]) == MEM
5068 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
5069 || GET_CODE (operands[1]) == CONST_DOUBLE
5071 || (GET_CODE (operands[1]) == REG
5072 && (REGNO (operands[1]) < 32
5073 || (reload_in_progress
5074 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))))
5076 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5077 operand_subword (operands[1], 0, 0, SFmode));
5082 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5084 emit_move_insn (stack_slot, operands[1]);
5085 emit_move_insn (operands[0], stack_slot);
5091 if (CONSTANT_P (operands[1]))
5093 operands[1] = force_const_mem (SFmode, operands[1]);
5094 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
5095 && ! reload_in_progress)
5096 operands[1] = change_address (operands[1], SFmode,
5097 XEXP (operands[1], 0));
5102 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5103 (match_operand:SF 1 "easy_fp_constant" ""))]
5104 "reload_completed && REGNO (operands[0]) <= 31"
5105 [(set (match_dup 2) (match_dup 3))]
5107 { operands[2] = operand_subword (operands[0], 0, 0, SFmode);
5108 operands[3] = operand_subword (operands[1], 0, 0, SFmode); }")
5111 [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m")
5112 (match_operand:SF 1 "input_operand" "f,m,f"))]
5113 "(gpc_reg_operand (operands[0], SFmode)
5114 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
5119 [(set_attr "type" "fp,fpload,*")])
5122 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
5123 (match_operand:SF 1 "input_operand" "r,m,r,I,J,R"))]
5124 "(gpc_reg_operand (operands[0], SFmode)
5125 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
5128 {l%U1%X1|lwz%U1%X1} %0,%1
5129 {st%U0%X0|stw%U0%X0} %1,%0
5133 [(set_attr "type" "*,load,*,*,*,*")])
5136 (define_expand "movdf"
5137 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5138 (match_operand:DF 1 "any_operand" ""))]
5142 if (GET_CODE (operands[0]) != REG)
5143 operands[1] = force_reg (DFmode, operands[1]);
5145 /* Stores between FPR and any non-FPR registers must go through a
5146 temporary stack slot. */
5148 if (TARGET_POWERPC64
5149 && GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
5150 && ((FP_REGNO_P (REGNO (operands[0]))
5151 && ! FP_REGNO_P (REGNO (operands[1])))
5152 || (FP_REGNO_P (REGNO (operands[1]))
5153 && ! FP_REGNO_P (REGNO (operands[0])))))
5155 rtx stack_slot = assign_stack_temp (DFmode, 8, 0);
5157 emit_move_insn (stack_slot, operands[1]);
5158 emit_move_insn (operands[0], stack_slot);
5162 if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
5164 operands[1] = force_const_mem (DFmode, operands[1]);
5165 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
5166 && ! reload_in_progress)
5167 operands[1] = change_address (operands[1], DFmode,
5168 XEXP (operands[1], 0));
5173 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5174 (match_operand:DF 1 "easy_fp_constant" ""))]
5175 "reload_completed && REGNO (operands[0]) <= 31"
5176 [(set (match_dup 2) (match_dup 3))
5177 (set (match_dup 4) (match_dup 5))]
5179 { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
5180 operands[3] = operand_subword (operands[1], 0, 0, DFmode);
5181 operands[4] = operand_subword (operands[0], 1, 0, DFmode);
5182 operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
5184 ;; Don't have reload use general registers to load a constant. First,
5185 ;; it might not work if the output operand has is the equivalent of
5186 ;; a non-offsettable memref, but also it is less efficient than loading
5187 ;; the constant into an FP register, since it will probably be used there.
5188 ;; The "??" is a kludge until we can figure out a more reasonable way
5189 ;; of handling these non-offsettable values.
5191 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,f,f,m")
5192 (match_operand:DF 1 "input_operand" "r,o,r,G,f,m,f"))]
5193 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
5194 && (register_operand (operands[0], DFmode)
5195 || register_operand (operands[1], DFmode))"
5198 switch (which_alternative)
5201 /* We normally copy the low-numbered register first. However, if
5202 the first register operand 0 is the same as the second register of
5203 operand 1, we must copy in the opposite order. */
5204 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5205 return \"mr %L0,%L1\;mr %0,%1\";
5207 return \"mr %0,%1\;mr %L0,%L1\";
5209 /* If the low-address word is used in the address, we must load it
5210 last. Otherwise, load it first. Note that we cannot have
5211 auto-increment in that case since the address register is known to be
5213 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5215 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5217 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5219 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5223 return \"fmr %0,%1\";
5225 return \"lfd%U1%X1 %0,%1\";
5227 return \"stfd%U0%X0 %1,%0\";
5230 [(set_attr "type" "*,load,*,*,fp,fpload,*")
5231 (set_attr "length" "8,8,8,8,*,*,*")])
5234 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r")
5235 (match_operand:DF 1 "input_operand" "r,o,r,G"))]
5236 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5237 && (register_operand (operands[0], DFmode)
5238 || register_operand (operands[1], DFmode))"
5241 switch (which_alternative)
5244 /* We normally copy the low-numbered register first. However, if
5245 the first register operand 0 is the same as the second register of
5246 operand 1, we must copy in the opposite order. */
5247 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5248 return \"mr %L0,%L1\;mr %0,%1\";
5250 return \"mr %0,%1\;mr %L0,%L1\";
5252 /* If the low-address word is used in the address, we must load it
5253 last. Otherwise, load it first. Note that we cannot have
5254 auto-increment in that case since the address register is known to be
5256 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5258 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5260 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5262 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5267 [(set_attr "type" "*,load,*,*")
5268 (set_attr "length" "8,8,8,8")])
5271 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,f,f,m")
5272 (match_operand:DF 1 "input_operand" "r,o,r,G,f,m,f"))]
5273 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
5274 && (register_operand (operands[0], DFmode)
5275 || register_operand (operands[1], DFmode))"
5284 [(set_attr "type" "*,load,*,*,fp,fpload,*")])
5287 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r")
5288 (match_operand:DF 1 "input_operand" "r,o,r,G"))]
5289 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5290 && (register_operand (operands[0], DFmode)
5291 || register_operand (operands[1], DFmode))"
5297 [(set_attr "type" "*,load,*,*")])
5299 ;; Next come the multi-word integer load and store and the load and store
5301 (define_expand "movdi"
5302 [(set (match_operand:DI 0 "general_operand" "")
5303 (match_operand:DI 1 "any_operand" ""))]
5307 if (! TARGET_64BIT && ! general_operand (operands[1], DImode))
5310 if (GET_CODE (operands[0]) != REG)
5311 operands[1] = force_reg (DImode, operands[1]);
5313 if (GET_CODE (operands[1]) == CONST_DOUBLE
5314 || GET_CODE (operands[1]) == CONST_INT)
5319 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5321 low = CONST_DOUBLE_LOW (operands[1]);
5322 high = CONST_DOUBLE_HIGH (operands[1]);
5325 #if HOST_BITS_PER_WIDE_INT == 32
5327 low = INTVAL (operands[1]);
5328 high = (low < 0) ? ~0 : 0;
5332 low = INTVAL (operands[1]) & 0xffffffff;
5333 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
5337 if (! TARGET_POWERPC64)
5339 emit_move_insn (gen_rtx (SUBREG, SImode, operands[0],
5340 WORDS_BIG_ENDIAN), GEN_INT (low));
5342 emit_move_insn (gen_rtx (SUBREG, SImode, operands[0],
5343 ! WORDS_BIG_ENDIAN), GEN_INT (high));
5348 if (high + 0x8000 >= 0x10000)
5350 emit_move_insn (gen_rtx (SUBREG, SImode, operands[0], 1),
5352 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT(32)));
5355 HOST_WIDE_INT low_low = low & 0xffff;
5356 HOST_WIDE_INT low_high = low & (~ (HOST_WIDE_INT) 0xffff);
5358 emit_insn (gen_iordi3 (operands[0], operands[0],
5359 GEN_INT (low_high)));
5361 emit_insn (gen_iordi3 (operands[0], operands[0],
5362 GEN_INT (low_low)));
5366 emit_move_insn (gen_rtx (SUBREG, SImode, operands[0], 1),
5372 /* Stores between FPR and any non-FPR registers must go through a
5373 temporary stack slot. */
5375 if (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
5376 && ((FP_REGNO_P (REGNO (operands[0]))
5377 && ! FP_REGNO_P (REGNO (operands[1])))
5378 || (FP_REGNO_P (REGNO (operands[1]))
5379 && ! FP_REGNO_P (REGNO (operands[0])))))
5381 rtx stack_slot = assign_stack_temp (DImode, 8, 0);
5383 emit_move_insn (stack_slot, operands[1]);
5384 emit_move_insn (operands[0], stack_slot);
5390 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m")
5391 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f"))]
5392 "! TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode)
5393 || gpc_reg_operand (operands[1], DImode))"
5396 switch (which_alternative)
5399 /* We normally copy the low-numbered register first. However, if
5400 the first register operand 0 is the same as the second register of
5401 operand 1, we must copy in the opposite order. */
5402 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5403 return \"mr %L0,%L1\;mr %0,%1\";
5405 return \"mr %0,%1\;mr %L0,%L1\";
5407 /* If the low-address word is used in the address, we must load it
5408 last. Otherwise, load it first. Note that we cannot have
5409 auto-increment in that case since the address register is known to be
5411 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5413 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5415 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5417 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5419 return \"fmr %0,%1\";
5421 return \"lfd%U1%X1 %0,%1\";
5423 return \"stfd%U0%X0 %1,%0\";
5426 [(set_attr "type" "*,load,*,fp,fpload,*")
5427 (set_attr "length" "8,8,8,*,*,*")])
5430 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
5431 (match_operand:DI 1 "input_operand" "r,m,r,I,J,n,R,f,m,f,*h,r,0"))]
5432 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode)
5433 || gpc_reg_operand (operands[1], DImode))"
5448 [(set_attr "type" "*,load,*,*,*,*,*,fp,fpload,*,*,mtjmpr,*")
5449 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
5451 ;; Split a load of a large constant into the appropriate five-instruction
5452 ;; sequence. The expansion in movdi tries to perform the minimum number of
5453 ;; steps, but here we have to handle anything in a constant number of insns.
5456 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5457 (match_operand:DI 1 "const_double_operand" ""))]
5462 (ior:DI (match_dup 0)
5465 (ashift:DI (match_dup 0)
5468 (ior:DI (match_dup 0)
5471 (ior:DI (match_dup 0)
5478 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5480 low = CONST_DOUBLE_LOW (operands[1]);
5481 high = CONST_DOUBLE_HIGH (operands[1]);
5484 #if HOST_BITS_PER_WIDE_INT == 32
5486 low = INTVAL (operands[1]);
5487 high = (low < 0) ? ~0 : 0;
5491 low = INTVAL (operands[1]) & 0xffffffff;
5492 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
5496 if ((high + 0x8000) < 0x10000
5497 && ((low & 0xffff) == 0 || (low & (~ (HOST_WIDE_INT) 0xffff)) == 0))
5500 operands[2] = GEN_INT (high & (~ (HOST_WIDE_INT) 0xffff));
5501 operands[3] = GEN_INT (high & 0xffff);
5502 operands[4] = GEN_INT (low & (~ (HOST_WIDE_INT) 0xffff));
5503 operands[5] = GEN_INT (low & 0xffff);
5507 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
5508 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
5510 (set (match_operand:DI 0 "gpc_reg_operand" "=r") (match_dup 1))]
5513 [(set_attr "type" "compare")])
5515 ;; TImode is similar, except that we usually want to compute the address into
5516 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
5517 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
5518 (define_expand "movti"
5519 [(parallel [(set (match_operand:TI 0 "general_operand" "")
5520 (match_operand:TI 1 "general_operand" ""))
5521 (clobber (scratch:SI))])]
5522 "TARGET_STRING || TARGET_POWERPC64"
5525 if (GET_CODE (operands[0]) == MEM)
5526 operands[1] = force_reg (TImode, operands[1]);
5528 if (GET_CODE (operands[0]) == MEM
5529 && GET_CODE (XEXP (operands[0], 0)) != REG
5530 && ! reload_in_progress)
5531 operands[0] = change_address (operands[0], TImode,
5532 copy_addr_to_reg (XEXP (operands[0], 0)));
5534 if (GET_CODE (operands[1]) == MEM
5535 && GET_CODE (XEXP (operands[1], 0)) != REG
5536 && ! reload_in_progress)
5537 operands[1] = change_address (operands[1], TImode,
5538 copy_addr_to_reg (XEXP (operands[1], 0)));
5541 ;; We say that MQ is clobbered in the last alternative because the first
5542 ;; alternative would never get used otherwise since it would need a reload
5543 ;; while the 2nd alternative would not. We put memory cases first so they
5544 ;; are preferred. Otherwise, we'd try to reload the output instead of
5545 ;; giving the SCRATCH mq.
5547 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
5548 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
5549 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
5550 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
5551 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
5554 switch (which_alternative)
5560 return \"{stsi|stswi} %1,%P0,16\";
5563 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
5566 /* Normally copy registers with lowest numbered register copied first.
5567 But copy in the other order if the first register of the output
5568 is the second, third, or fourth register in the input. */
5569 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
5570 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
5571 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
5573 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
5575 /* If the address is not used in the output, we can use lsi. Otherwise,
5576 fall through to generating four loads. */
5577 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
5578 return \"{lsi|lswi} %0,%P1,16\";
5579 /* ... fall through ... */
5581 /* If the address register is the same as the register for the lowest-
5582 addressed word, load it last. Similarly for the next two words.
5583 Otherwise load lowest address to highest. */
5584 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5586 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
5587 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
5588 REGNO (operands[0]) + 2, operands[1], 0))
5589 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
5590 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
5591 REGNO (operands[0]) + 3, operands[1], 0))
5592 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
5594 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
5597 [(set_attr "type" "*,load,load,*,*")
5598 (set_attr "length" "*,16,16,*,16")])
5601 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
5602 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
5603 (clobber (match_scratch:SI 2 "=X,X,X"))]
5604 "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
5605 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
5608 switch (which_alternative)
5614 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
5617 /* Normally copy registers with lowest numbered register copied first.
5618 But copy in the other order if the first register of the output
5619 is the second, third, or fourth register in the input. */
5620 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
5621 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
5622 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
5624 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
5626 /* If the address register is the same as the register for the lowest-
5627 addressed word, load it last. Similarly for the next two words.
5628 Otherwise load lowest address to highest. */
5629 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5631 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
5632 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
5633 REGNO (operands[0]) + 2, operands[1], 0))
5634 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
5635 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
5636 REGNO (operands[0]) + 3, operands[1], 0))
5637 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
5639 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
5642 [(set_attr "type" "load,*,*")
5643 (set_attr "length" "16,16,16")])
5646 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
5647 (match_operand:TI 1 "input_operand" "r,m,r"))]
5648 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
5649 || gpc_reg_operand (operands[1], TImode))"
5652 switch (which_alternative)
5655 /* We normally copy the low-numbered register first. However, if
5656 the first register operand 0 is the same as the second register of
5657 operand 1, we must copy in the opposite order. */
5658 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5659 return \"mr %L0,%L1\;mr %0,%1\";
5661 return \"mr %0,%1\;mr %L0,%L1\";
5663 /* If the low-address word is used in the address, we must load it
5664 last. Otherwise, load it first. Note that we cannot have
5665 auto-increment in that case since the address register is known to be
5667 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5669 return \"ld %L0,%L1\;ld %0,%1\";
5671 return \"ld%U1 %0,%1\;ld %L0,%L1\";
5673 return \"std%U0 %1,%0\;std %L1,%L0\";
5676 [(set_attr "type" "*,load,*")
5677 (set_attr "length" "8,8,8")])
5679 (define_expand "load_multiple"
5680 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
5681 (match_operand:SI 1 "" ""))
5682 (use (match_operand:SI 2 "" ""))])]
5691 /* Support only loading a constant number of fixed-point registers from
5692 memory and only bother with this if more than two; the machine
5693 doesn't support more than eight. */
5694 if (GET_CODE (operands[2]) != CONST_INT
5695 || INTVAL (operands[2]) <= 2
5696 || INTVAL (operands[2]) > 8
5697 || GET_CODE (operands[1]) != MEM
5698 || GET_CODE (operands[0]) != REG
5699 || REGNO (operands[0]) >= 32)
5702 count = INTVAL (operands[2]);
5703 regno = REGNO (operands[0]);
5705 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
5706 from = force_reg (SImode, XEXP (operands[1], 0));
5708 for (i = 0; i < count; i++)
5709 XVECEXP (operands[3], 0, i)
5710 = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
5711 gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
5715 [(match_parallel 0 "load_multiple_operation"
5716 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
5717 (mem:SI (match_operand:SI 2 "register_operand" "b")))])]
5721 /* We have to handle the case where the pseudo used to contain the address
5722 is assigned to one of the output registers. */
5724 int words = XVECLEN (operands[0], 0);
5727 if (XVECLEN (operands[0], 0) == 1)
5728 return \"{l|lwz} %1,0(%2)\";
5730 for (i = 0; i < words; i++)
5731 if (refers_to_regno_p (REGNO (operands[1]) + i,
5732 REGNO (operands[1]) + i + 1, operands[2], 0))
5736 xop[0] = operands[1];
5737 xop[1] = operands[2];
5738 xop[2] = GEN_INT (4 * (words-1));
5739 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
5744 xop[0] = operands[1];
5745 xop[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
5746 xop[2] = GEN_INT (4 * (words-1));
5747 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
5752 for (j = 0; j < words; j++)
5755 xop[0] = gen_rtx (REG, SImode, REGNO (operands[1]) + j);
5756 xop[1] = operands[2];
5757 xop[2] = GEN_INT (j * 4);
5758 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
5760 xop[0] = operands[2];
5761 xop[1] = GEN_INT (i * 4);
5762 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
5767 return \"{lsi|lswi} %1,%2,%N0\";
5769 [(set_attr "type" "load")
5770 (set_attr "length" "32")])
5773 (define_expand "store_multiple"
5774 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
5775 (match_operand:SI 1 "" ""))
5776 (clobber (scratch:SI))
5777 (use (match_operand:SI 2 "" ""))])]
5786 /* Support only storing a constant number of fixed-point registers to
5787 memory and only bother with this if more than two; the machine
5788 doesn't support more than eight. */
5789 if (GET_CODE (operands[2]) != CONST_INT
5790 || INTVAL (operands[2]) <= 2
5791 || INTVAL (operands[2]) > 8
5792 || GET_CODE (operands[0]) != MEM
5793 || GET_CODE (operands[1]) != REG
5794 || REGNO (operands[1]) >= 32)
5797 count = INTVAL (operands[2]);
5798 regno = REGNO (operands[1]);
5800 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
5801 to = force_reg (SImode, XEXP (operands[0], 0));
5803 XVECEXP (operands[3], 0, 0)
5804 = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]);
5805 XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
5806 gen_rtx (SCRATCH, SImode));
5808 for (i = 1; i < count; i++)
5809 XVECEXP (operands[3], 0, i + 1)
5810 = gen_rtx (SET, VOIDmode,
5811 gen_rtx (MEM, SImode, plus_constant (to, i * 4)),
5812 gen_rtx (REG, SImode, regno + i));
5816 [(match_parallel 0 "store_multiple_operation"
5817 [(set (match_operand:SI 1 "indirect_operand" "=Q")
5818 (match_operand:SI 2 "gpc_reg_operand" "r"))
5819 (clobber (match_scratch:SI 3 "=q"))])]
5820 "TARGET_STRING && TARGET_POWER"
5821 "{stsi|stswi} %2,%P1,%O0")
5824 [(match_parallel 0 "store_multiple_operation"
5825 [(set (mem:SI (match_operand:SI 1 "register_operand" "b"))
5826 (match_operand:SI 2 "gpc_reg_operand" "r"))
5827 (clobber (match_scratch:SI 3 "X"))])]
5828 "TARGET_STRING && !TARGET_POWER"
5829 "{stsi|stswi} %2,%1,%O0")
5832 ;; String/block move insn.
5833 ;; Argument 0 is the destination
5834 ;; Argument 1 is the source
5835 ;; Argument 2 is the length
5836 ;; Argument 3 is the alignment
5838 (define_expand "movstrsi"
5839 [(parallel [(set (match_operand:BLK 0 "" "")
5840 (match_operand:BLK 1 "" ""))
5841 (use (match_operand:SI 2 "" ""))
5842 (use (match_operand:SI 3 "" ""))])]
5846 if (expand_block_move (operands))
5852 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
5853 ;; register allocator doesn't have a clue about allocating 8 word registers
5854 (define_expand "movstrsi_8reg"
5855 [(parallel [(set (match_operand 0 "" "")
5856 (match_operand 1 "" ""))
5857 (use (match_operand 2 "" ""))
5858 (use (match_operand 3 "" ""))
5859 (clobber (reg:SI 5))
5860 (clobber (reg:SI 6))
5861 (clobber (reg:SI 7))
5862 (clobber (reg:SI 8))
5863 (clobber (reg:SI 9))
5864 (clobber (reg:SI 10))
5865 (clobber (reg:SI 11))
5866 (clobber (reg:SI 12))
5867 (clobber (match_scratch:SI 4 ""))])]
5872 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5873 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5874 (use (match_operand:SI 2 "immediate_operand" "i"))
5875 (use (match_operand:SI 3 "immediate_operand" "i"))
5876 (clobber (match_operand:SI 4 "register_operand" "=r"))
5877 (clobber (reg:SI 6))
5878 (clobber (reg:SI 7))
5879 (clobber (reg:SI 8))
5880 (clobber (reg:SI 9))
5881 (clobber (reg:SI 10))
5882 (clobber (reg:SI 11))
5883 (clobber (reg:SI 12))
5884 (clobber (match_scratch:SI 5 "=q"))]
5885 "TARGET_STRING && TARGET_POWER
5886 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
5887 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
5888 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
5889 && REGNO (operands[4]) == 5"
5890 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5891 [(set_attr "length" "8")])
5894 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5895 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5896 (use (match_operand:SI 2 "immediate_operand" "i"))
5897 (use (match_operand:SI 3 "immediate_operand" "i"))
5898 (clobber (match_operand:SI 4 "register_operand" "=r"))
5899 (clobber (reg:SI 6))
5900 (clobber (reg:SI 7))
5901 (clobber (reg:SI 8))
5902 (clobber (reg:SI 9))
5903 (clobber (reg:SI 10))
5904 (clobber (reg:SI 11))
5905 (clobber (reg:SI 12))
5906 (clobber (match_scratch:SI 5 "X"))]
5907 "TARGET_STRING && !TARGET_POWER
5908 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
5909 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
5910 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
5911 && REGNO (operands[4]) == 5"
5912 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5913 [(set_attr "length" "8")])
5915 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
5916 ;; register allocator doesn't have a clue about allocating 6 word registers
5917 (define_expand "movstrsi_6reg"
5918 [(parallel [(set (match_operand 0 "" "")
5919 (match_operand 1 "" ""))
5920 (use (match_operand 2 "" ""))
5921 (use (match_operand 3 "" ""))
5922 (clobber (reg:SI 7))
5923 (clobber (reg:SI 8))
5924 (clobber (reg:SI 9))
5925 (clobber (reg:SI 10))
5926 (clobber (reg:SI 11))
5927 (clobber (reg:SI 12))
5928 (clobber (match_scratch:SI 4 ""))])]
5933 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5934 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5935 (use (match_operand:SI 2 "immediate_operand" "i"))
5936 (use (match_operand:SI 3 "immediate_operand" "i"))
5937 (clobber (match_operand:SI 4 "register_operand" "=r"))
5938 (clobber (reg:SI 8))
5939 (clobber (reg:SI 9))
5940 (clobber (reg:SI 10))
5941 (clobber (reg:SI 11))
5942 (clobber (reg:SI 12))
5943 (clobber (match_scratch:SI 5 "=q"))]
5944 "TARGET_STRING && TARGET_POWER
5945 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
5946 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
5947 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
5948 && REGNO (operands[4]) == 7"
5949 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5950 [(set_attr "length" "8")])
5953 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5954 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5955 (use (match_operand:SI 2 "immediate_operand" "i"))
5956 (use (match_operand:SI 3 "immediate_operand" "i"))
5957 (clobber (match_operand:SI 4 "register_operand" "=r"))
5958 (clobber (reg:SI 8))
5959 (clobber (reg:SI 9))
5960 (clobber (reg:SI 10))
5961 (clobber (reg:SI 11))
5962 (clobber (reg:SI 12))
5963 (clobber (match_scratch:SI 5 "X"))]
5964 "TARGET_STRING && !TARGET_POWER
5965 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
5966 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
5967 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
5968 && REGNO (operands[4]) == 7"
5969 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5970 [(set_attr "length" "8")])
5972 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
5974 (define_expand "movstrsi_4reg"
5975 [(parallel [(set (match_operand 0 "" "")
5976 (match_operand 1 "" ""))
5977 (use (match_operand 2 "" ""))
5978 (use (match_operand 3 "" ""))
5979 (clobber (reg:SI 9))
5980 (clobber (reg:SI 10))
5981 (clobber (reg:SI 11))
5982 (clobber (reg:SI 12))
5983 (clobber (match_scratch:SI 4 ""))])]
5988 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5989 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5990 (use (match_operand:SI 2 "immediate_operand" "i"))
5991 (use (match_operand:SI 3 "immediate_operand" "i"))
5992 (clobber (match_operand:SI 4 "register_operand" "=r"))
5993 (clobber (reg:SI 10))
5994 (clobber (reg:SI 11))
5995 (clobber (reg:SI 12))
5996 (clobber (match_scratch:SI 5 "=q"))]
5997 "TARGET_STRING && TARGET_POWER
5998 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
5999 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
6000 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
6001 && REGNO (operands[4]) == 9"
6002 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6003 [(set_attr "length" "8")])
6006 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6007 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6008 (use (match_operand:SI 2 "immediate_operand" "i"))
6009 (use (match_operand:SI 3 "immediate_operand" "i"))
6010 (clobber (match_operand:SI 4 "register_operand" "=r"))
6011 (clobber (reg:SI 10))
6012 (clobber (reg:SI 11))
6013 (clobber (reg:SI 12))
6014 (clobber (match_scratch:SI 5 "X"))]
6015 "TARGET_STRING && !TARGET_POWER
6016 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
6017 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
6018 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
6019 && REGNO (operands[4]) == 9"
6020 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6021 [(set_attr "length" "8")])
6023 ;; Move up to 8 bytes at a time.
6024 (define_expand "movstrsi_2reg"
6025 [(parallel [(set (match_operand 0 "" "")
6026 (match_operand 1 "" ""))
6027 (use (match_operand 2 "" ""))
6028 (use (match_operand 3 "" ""))
6029 (clobber (match_scratch:DI 4 ""))
6030 (clobber (match_scratch:SI 5 ""))])]
6031 "TARGET_STRING && !TARGET_64BIT"
6035 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6036 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6037 (use (match_operand:SI 2 "immediate_operand" "i"))
6038 (use (match_operand:SI 3 "immediate_operand" "i"))
6039 (clobber (match_scratch:DI 4 "=&r"))
6040 (clobber (match_scratch:SI 5 "=q"))]
6041 "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
6042 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
6043 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6044 [(set_attr "length" "8")])
6047 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6048 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6049 (use (match_operand:SI 2 "immediate_operand" "i"))
6050 (use (match_operand:SI 3 "immediate_operand" "i"))
6051 (clobber (match_scratch:DI 4 "=&r"))
6052 (clobber (match_scratch:SI 5 "X"))]
6053 "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
6054 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
6055 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6056 [(set_attr "length" "8")])
6058 ;; Move up to 4 bytes at a time.
6059 (define_expand "movstrsi_1reg"
6060 [(parallel [(set (match_operand 0 "" "")
6061 (match_operand 1 "" ""))
6062 (use (match_operand 2 "" ""))
6063 (use (match_operand 3 "" ""))
6064 (clobber (match_scratch:SI 4 ""))
6065 (clobber (match_scratch:SI 5 ""))])]
6070 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6071 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6072 (use (match_operand:SI 2 "immediate_operand" "i"))
6073 (use (match_operand:SI 3 "immediate_operand" "i"))
6074 (clobber (match_scratch:SI 4 "=&r"))
6075 (clobber (match_scratch:SI 5 "=q"))]
6076 "TARGET_STRING && TARGET_POWER
6077 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
6078 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6079 [(set_attr "length" "8")])
6082 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6083 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6084 (use (match_operand:SI 2 "immediate_operand" "i"))
6085 (use (match_operand:SI 3 "immediate_operand" "i"))
6086 (clobber (match_scratch:SI 4 "=&r"))
6087 (clobber (match_scratch:SI 5 "X"))]
6088 "TARGET_STRING && !TARGET_POWER
6089 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
6090 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6091 [(set_attr "length" "8")])
6094 ;; Define insns that do load or store with update. Some of these we can
6095 ;; get by using pre-decrement or pre-increment, but the hardware can also
6096 ;; do cases where the increment is not the size of the object.
6098 ;; In all these cases, we use operands 0 and 1 for the register being
6099 ;; incremented because those are the operands that local-alloc will
6100 ;; tie and these are the pair most likely to be tieable (and the ones
6101 ;; that will benefit the most).
6104 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
6105 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
6106 (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
6107 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
6108 (plus:DI (match_dup 1) (match_dup 2)))]
6113 [(set_attr "type" "load")])
6116 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
6118 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
6119 (match_operand:DI 2 "gpc_reg_operand" "r")))))
6120 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
6121 (plus:DI (match_dup 1) (match_dup 2)))]
6124 [(set_attr "type" "load")])
6126 (define_insn "movdi_update"
6127 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
6128 (match_operand:DI 2 "reg_or_short_operand" "r,I")))
6129 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
6130 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
6131 (plus:DI (match_dup 1) (match_dup 2)))]
6138 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6139 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6140 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6141 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6142 (plus:SI (match_dup 1) (match_dup 2)))]
6145 {lux|lwzux} %3,%0,%2
6146 {lu|lwzu} %3,%2(%0)"
6147 [(set_attr "type" "load")])
6149 (define_insn "movsi_update"
6150 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6151 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6152 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6153 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6154 (plus:SI (match_dup 1) (match_dup 2)))]
6157 {stux|stwux} %3,%0,%2
6158 {stu|stwu} %3,%2(%0)")
6161 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
6162 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6163 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6164 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6165 (plus:SI (match_dup 1) (match_dup 2)))]
6170 [(set_attr "type" "load")])
6173 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6175 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6176 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6177 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6178 (plus:SI (match_dup 1) (match_dup 2)))]
6183 [(set_attr "type" "load")])
6186 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6188 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6189 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6190 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6191 (plus:SI (match_dup 1) (match_dup 2)))]
6196 [(set_attr "type" "load")])
6199 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6200 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6201 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
6202 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6203 (plus:SI (match_dup 1) (match_dup 2)))]
6210 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
6211 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6212 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6213 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6214 (plus:SI (match_dup 1) (match_dup 2)))]
6219 [(set_attr "type" "load")])
6222 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6224 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6225 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6226 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6227 (plus:SI (match_dup 1) (match_dup 2)))]
6232 [(set_attr "type" "load")])
6235 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6236 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6237 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
6238 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6239 (plus:SI (match_dup 1) (match_dup 2)))]
6246 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
6247 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6248 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6249 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6250 (plus:SI (match_dup 1) (match_dup 2)))]
6255 [(set_attr "type" "fpload")])
6258 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6259 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6260 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
6261 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6262 (plus:SI (match_dup 1) (match_dup 2)))]
6269 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
6270 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6271 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6272 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6273 (plus:SI (match_dup 1) (match_dup 2)))]
6278 [(set_attr "type" "fpload")])
6281 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6282 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6283 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
6284 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6285 (plus:SI (match_dup 1) (match_dup 2)))]
6291 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
6294 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6295 (match_operand:DF 1 "memory_operand" ""))
6296 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
6297 (match_operand:DF 3 "memory_operand" ""))]
6299 && TARGET_HARD_FLOAT
6300 && registers_ok_for_quad_peep (operands[0], operands[2])
6301 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
6302 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
6306 [(set (match_operand:DF 0 "memory_operand" "")
6307 (match_operand:DF 1 "gpc_reg_operand" "f"))
6308 (set (match_operand:DF 2 "memory_operand" "")
6309 (match_operand:DF 3 "gpc_reg_operand" "f"))]
6311 && TARGET_HARD_FLOAT
6312 && registers_ok_for_quad_peep (operands[1], operands[3])
6313 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
6314 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
6317 ;; Next come insns related to the calling sequence.
6319 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
6320 ;; We move the back-chain and decrement the stack pointer.
6322 (define_expand "allocate_stack"
6324 (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
6327 { rtx chain = gen_reg_rtx (Pmode);
6328 rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
6331 emit_move_insn (chain, stack_bot);
6333 /* Under Windows NT, we need to add stack probes for large/variable allocations,
6334 so do it via a call to the external function alloca, instead of doing it
6336 if (DEFAULT_ABI == ABI_NT
6337 && (GET_CODE (operands[0]) != CONST_INT || INTVAL (operands[0]) > 4096))
6339 rtx tmp = gen_reg_rtx (SImode);
6340 emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"__allocate_stack\"),
6341 tmp, 0, SImode, 1, operands[0], Pmode);
6342 emit_insn (gen_set_sp (tmp));
6346 if (GET_CODE (operands[0]) != CONST_INT
6347 || INTVAL (operands[0]) < -32767
6348 || INTVAL (operands[0]) > 32768)
6350 neg_op0 = gen_reg_rtx (Pmode);
6352 emit_insn (gen_negsi2 (neg_op0, operands[0]));
6354 emit_insn (gen_negdi2 (neg_op0, operands[0]));
6357 neg_op0 = GEN_INT (- INTVAL (operands[0]));
6360 emit_insn (gen_movsi_update (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
6362 emit_insn (gen_movdi_update (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
6367 ;; Marker to indicate that the stack pointer was changed under NT in
6368 ;; ways not known to the compiler
6370 (define_insn "set_sp"
6372 (unspec [(match_operand:SI 0 "register_operand" "r")] 7))]
6375 [(set_attr "length" "0")])
6377 ;; These patterns say how to save and restore the stack pointer. We need not
6378 ;; save the stack pointer at function level since we are careful to
6379 ;; preserve the backchain. At block level, we have to restore the backchain
6380 ;; when we restore the stack pointer.
6382 ;; For nonlocal gotos, we must save both the stack pointer and its
6383 ;; backchain and restore both. Note that in the nonlocal case, the
6384 ;; save area is a memory location.
6386 (define_expand "save_stack_function"
6387 [(use (const_int 0))]
6391 (define_expand "restore_stack_function"
6392 [(use (const_int 0))]
6396 (define_expand "restore_stack_block"
6397 [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
6398 (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
6399 (set (mem:SI (match_dup 0)) (match_dup 2))]
6402 { operands[2] = gen_reg_rtx (SImode); }")
6404 (define_expand "save_stack_nonlocal"
6405 [(match_operand:DI 0 "memory_operand" "")
6406 (match_operand:SI 1 "register_operand" "")]
6410 rtx temp = gen_reg_rtx (SImode);
6412 /* Copy the backchain to the first word, sp to the second. */
6413 emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
6414 emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
6415 emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
6419 (define_expand "restore_stack_nonlocal"
6420 [(match_operand:SI 0 "register_operand" "")
6421 (match_operand:DI 1 "memory_operand" "")]
6425 rtx temp = gen_reg_rtx (SImode);
6427 /* Restore the backchain from the first word, sp from the second. */
6428 emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
6429 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
6430 emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
6435 ;; A function pointer under AIX is a pointer to a data area whose first word
6436 ;; contains the actual address of the function, whose second word contains a
6437 ;; pointer to its TOC, and whose third word contains a value to place in the
6438 ;; static chain register (r11). Note that if we load the static chain, our
6439 ;; "trampoline" need not have any executable code.
6441 ;; operands[0] is a register pointing to the 3 word descriptor (aka, the function address)
6442 ;; operands[1] is the stack size to clean up
6443 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for AIX)
6444 ;; operands[3] is location to store the TOC
6445 ;; operands[4] is the TOC register
6446 ;; operands[5] is the static chain register
6448 ;; We do not break this into separate insns, so that the scheduler will not try
6449 ;; to move the load of the new TOC before any loads from the TOC.
6451 (define_insn "call_indirect_aix"
6452 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
6453 (match_operand 1 "const_int_operand" "n"))
6454 (use (match_operand 2 "const_int_operand" "O"))
6455 (use (match_operand 3 "offsettable_addr_operand" "p"))
6456 (use (match_operand 4 "register_operand" "r"))
6457 (clobber (match_operand 5 "register_operand" "=r"))
6458 (clobber (match_scratch:SI 6 "=&r"))
6459 (clobber (match_scratch:SI 7 "=l"))]
6460 "DEFAULT_ABI == ABI_AIX"
6461 "{st|stw} %4,%a3\;{l|lwz} %6,0(%0)\;{l|lwz} %4,4(%0);\;mt%7 %6\;{l|lwz} %5,8(%0)\;{brl|blrl}\;{l|lwz} %4,%a3"
6462 [(set_attr "length" "28")])
6464 (define_insn "call_value_indirect_aix"
6465 [(set (match_operand 0 "register_operand" "fg")
6466 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
6467 (match_operand 2 "const_int_operand" "n")))
6468 (use (match_operand 3 "const_int_operand" "O"))
6469 (use (match_operand 4 "offsettable_addr_operand" "p"))
6470 (use (match_operand 5 "register_operand" "r"))
6471 (clobber (match_operand 6 "register_operand" "=r"))
6472 (clobber (match_scratch:SI 7 "=&r"))
6473 (clobber (match_scratch:SI 8 "=l"))]
6474 "DEFAULT_ABI == ABI_AIX"
6475 "{st|stw} %5,%a4\;{l|lwz} %7,0(%1)\;{l|lwz} %5,4(%1);\;mt%8 %7\;{l|lwz} %6,8(%1)\;{brl|blrl}\;{l|lwz} %5,%a4"
6476 [(set_attr "length" "28")])
6478 ;; A function pointer undef NT is a pointer to a data area whose first word
6479 ;; contains the actual address of the function, whose second word contains a
6480 ;; pointer to its TOC. The static chain is not stored under NT, which means
6481 ;; that we need a trampoline.
6483 ;; operands[0] is an SImode pseudo in which we place the address of the function.
6484 ;; operands[1] is the stack size to clean up
6485 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for NT)
6486 ;; operands[3] is location to store the TOC
6487 ;; operands[4] is the TOC register
6489 ;; We do not break this into separate insns, so that the scheduler will not try
6490 ;; to move the load of the new TOC before any loads from the TOC.
6492 (define_insn "call_indirect_nt"
6493 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
6494 (match_operand 1 "const_int_operand" "n"))
6495 (use (match_operand 2 "const_int_operand" "O"))
6496 (use (match_operand 3 "offsettable_addr_operand" "p"))
6497 (use (match_operand 4 "register_operand" "r"))
6498 (clobber (match_scratch:SI 5 "=&r"))
6499 (clobber (match_scratch:SI 6 "=l"))]
6500 "DEFAULT_ABI == ABI_NT"
6501 "{st|stw} %4,%a3\;{l|lwz} %5,0(%0)\;{l|lwz} %4,4(%0)\;mt%6 %5\;{brl|blrl}\;{l|lwz} %4,%a3"
6502 [(set_attr "length" "24")])
6504 (define_insn "call_value_indirect_nt"
6505 [(set (match_operand 0 "register_operand" "fg")
6506 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
6507 (match_operand 2 "const_int_operand" "n")))
6508 (use (match_operand 3 "const_int_operand" "O"))
6509 (use (match_operand 4 "offsettable_addr_operand" "p"))
6510 (use (match_operand 5 "register_operand" "r"))
6511 (clobber (match_scratch:SI 6 "=&r"))
6512 (clobber (match_scratch:SI 7 "=l"))]
6513 "DEFAULT_ABI == ABI_NT"
6514 "{st|stw} %5,%a4\;{l|lwz} %6,0(%1)\;{l|lwz} %5,4(%1)\;mt%7 %6\;{brl|blrl}\;{l|lwz} %5,%a4"
6515 [(set_attr "length" "24")])
6517 ;; A function pointer under System V is just a normal pointer
6518 ;; operands[0] is the function pointer
6519 ;; operands[1] is the stack size to clean up
6520 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument which indicates how to set cr1
6522 (define_insn "call_indirect_sysv"
6523 [(call (mem:SI (match_operand:SI 0 "register_operand" "l,l"))
6524 (match_operand 1 "const_int_operand" "n,n"))
6525 (use (match_operand 2 "const_int_operand" "O,n"))
6526 (clobber (match_scratch:SI 3 "=l,l"))]
6527 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC"
6530 if (INTVAL (operands[2]) > 0)
6531 return \"creqv 6,6,6\;{brl|blrl}\";
6533 else if (INTVAL (operands[2]) < 0)
6534 return \"crxor 6,6,6\;{brl|blrl}\";
6536 return \"{brl|blrl}\";
6538 [(set_attr "length" "4,8")])
6540 (define_insn "call_value_indirect_sysv"
6541 [(set (match_operand 0 "register_operand" "=fg,fg")
6542 (call (mem:SI (match_operand:SI 1 "register_operand" "l,l"))
6543 (match_operand 2 "const_int_operand" "n,n")))
6544 (use (match_operand 3 "const_int_operand" "O,n"))
6545 (clobber (match_scratch:SI 4 "=l,l"))]
6546 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC"
6549 if (INTVAL (operands[3]) > 0)
6550 return \"creqv 6,6,6\;{brl|blrl}\";
6552 else if (INTVAL (operands[3]) < 0)
6553 return \"crxor 6,6,6\;{brl|blrl}\";
6555 return \"{brl|blrl}\";
6557 [(set_attr "length" "4,8")])
6559 ;; Now the definitions for the call and call_value insns
6560 (define_expand "call"
6561 [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
6562 (match_operand 1 "" ""))
6563 (use (match_operand 2 "" ""))
6564 (clobber (scratch:SI))])]
6568 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
6571 operands[0] = XEXP (operands[0], 0);
6573 /* Convert NT DLL imports into an indirect call. */
6574 if (GET_CODE (operands[0]) == SYMBOL_REF
6575 && INTVAL (operands[2]) == (int)CALL_NT_DLLIMPORT)
6577 operands[0] = rs6000_dll_import_ref (operands[0]);
6578 operands[2] = GEN_INT ((int)CALL_NORMAL);
6581 if (GET_CODE (operands[0]) != SYMBOL_REF)
6583 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC)
6584 emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
6585 operands[1], operands[2]));
6588 rtx toc_reg = gen_rtx (REG, Pmode, 2);
6589 rtx toc_addr = RS6000_SAVE_TOC;
6591 if (DEFAULT_ABI == ABI_AIX)
6593 /* AIX function pointers are really pointers to a three word area */
6594 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
6595 emit_call_insn (gen_call_indirect_aix (force_reg (Pmode, operands[0]),
6596 operands[1], operands[2],
6597 toc_addr, toc_reg, static_chain));
6599 else if (DEFAULT_ABI == ABI_NT)
6601 /* NT function pointers are really pointers to a two word area */
6602 rs6000_save_toc_p = 1;
6603 emit_call_insn (gen_call_indirect_nt (force_reg (Pmode, operands[0]),
6604 operands[1], operands[2],
6605 toc_addr, toc_reg));
6614 (define_expand "call_value"
6615 [(parallel [(set (match_operand 0 "" "")
6616 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
6617 (match_operand 2 "" "")))
6618 (use (match_operand 3 "" ""))
6619 (clobber (scratch:SI))])]
6623 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
6626 operands[1] = XEXP (operands[1], 0);
6628 /* Convert NT DLL imports into an indirect call. */
6629 if (GET_CODE (operands[1]) == SYMBOL_REF
6630 && INTVAL (operands[3]) == (int)CALL_NT_DLLIMPORT)
6632 operands[1] = rs6000_dll_import_ref (operands[1]);
6633 operands[3] = GEN_INT ((int)CALL_NORMAL);
6636 if (GET_CODE (operands[1]) != SYMBOL_REF)
6638 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC)
6639 emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
6640 operands[2], operands[3]));
6643 rtx toc_reg = gen_rtx (REG, Pmode, 2);
6644 rtx toc_addr = RS6000_SAVE_TOC;
6646 if (DEFAULT_ABI == ABI_AIX)
6648 /* AIX function pointers are really pointers to a three word area */
6649 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
6650 emit_call_insn (gen_call_value_indirect_aix (operands[0],
6651 force_reg (Pmode, operands[1]),
6652 operands[2], operands[3],
6653 toc_addr, toc_reg, static_chain));
6655 else if (DEFAULT_ABI == ABI_NT)
6657 /* NT function pointers are really pointers to a two word area */
6658 rs6000_save_toc_p = 1;
6659 emit_call_insn (gen_call_value_indirect_nt (operands[0],
6660 force_reg (Pmode, operands[1]),
6661 operands[2], operands[3],
6662 toc_addr, toc_reg));
6671 ;; Call to function in current module. No TOC pointer reload needed.
6672 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
6673 ;; either the function was not prototyped, or it was prototyped as a
6674 ;; variable argument function. It is > 0 if FP registers were passed
6675 ;; and < 0 if they were not.
6678 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
6679 (match_operand 1 "" "g,g"))
6680 (use (match_operand:SI 2 "immediate_operand" "O,n"))
6681 (clobber (match_scratch:SI 3 "=l,l"))]
6685 switch ((enum rs6000_call_cookie)INTVAL (operands[2]))
6687 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6688 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6693 [(set_attr "length" "4,8")])
6695 ;; Call to function which may be in another module. Restore the TOC
6696 ;; pointer (r2) after the call unless this is System V.
6697 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
6698 ;; either the function was not prototyped, or it was prototyped as a
6699 ;; variable argument function. It is > 0 if FP registers were passed
6700 ;; and < 0 if they were not.
6703 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
6704 (match_operand 1 "" "fg,fg"))
6705 (use (match_operand:SI 2 "immediate_operand" "O,n"))
6706 (clobber (match_scratch:SI 3 "=l,l"))]
6707 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT"
6710 /* Indirect calls should go through call_indirect */
6711 if (GET_CODE (operands[0]) == REG)
6714 switch ((enum rs6000_call_cookie)INTVAL (operands[2]))
6716 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6717 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6720 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
6722 [(set_attr "length" "8,12")])
6725 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
6726 (match_operand 1 "" "fg,fg"))
6727 (use (match_operand:SI 2 "immediate_operand" "O,n"))
6728 (clobber (match_scratch:SI 3 "=l,l"))]
6729 "DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4"
6732 /* Indirect calls should go through call_indirect */
6733 if (GET_CODE (operands[0]) == REG)
6736 switch ((enum rs6000_call_cookie)INTVAL (operands[2]))
6738 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6739 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6744 [(set_attr "length" "4,8")])
6747 [(set (match_operand 0 "" "=fg,fg")
6748 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
6749 (match_operand 2 "" "g,g")))
6750 (use (match_operand:SI 3 "immediate_operand" "O,n"))
6751 (clobber (match_scratch:SI 4 "=l,l"))]
6755 switch ((enum rs6000_call_cookie)INTVAL (operands[3]))
6757 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6758 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6763 [(set_attr "length" "4,8")])
6766 [(set (match_operand 0 "" "=fg,fg")
6767 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
6768 (match_operand 2 "" "fg,fg")))
6769 (use (match_operand:SI 3 "immediate_operand" "O,n"))
6770 (clobber (match_scratch:SI 4 "=l,l"))]
6771 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT"
6774 /* This should be handled by call_value_indirect */
6775 if (GET_CODE (operands[1]) == REG)
6778 switch ((enum rs6000_call_cookie)INTVAL (operands[3]))
6780 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6781 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6784 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
6786 [(set_attr "length" "8,12")])
6789 [(set (match_operand 0 "" "=fg,fg")
6790 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
6791 (match_operand 2 "" "fg,fg")))
6792 (use (match_operand:SI 3 "immediate_operand" "O,n"))
6793 (clobber (match_scratch:SI 4 "=l,l"))]
6794 "DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4"
6797 /* This should be handled by call_value_indirect */
6798 if (GET_CODE (operands[1]) == REG)
6801 switch ((enum rs6000_call_cookie)INTVAL (operands[3]))
6803 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6804 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6809 [(set_attr "length" "4,8")])
6812 ;; Call subroutine returning any type.
6814 (define_expand "untyped_call"
6815 [(parallel [(call (match_operand 0 "" "")
6817 (match_operand 1 "" "")
6818 (match_operand 2 "" "")])]
6824 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
6826 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6828 rtx set = XVECEXP (operands[2], 0, i);
6829 emit_move_insn (SET_DEST (set), SET_SRC (set));
6832 /* The optimizer does not know that the call sets the function value
6833 registers we stored in the result block. We avoid problems by
6834 claiming that all hard registers are used and clobbered at this
6836 emit_insn (gen_blockage ());
6841 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6842 ;; all of memory. This blocks insns from being moved across this point.
6844 (define_insn "blockage"
6845 [(unspec_volatile [(const_int 0)] 0)]
6849 ;; Synchronize instructions/data caches for V.4 trampolines
6850 ;; The extra memory_operand is to prevent the optimizer from
6851 ;; deleting insns with "no" effect.
6853 [(unspec [(match_operand 0 "memory_operand" "=m")
6854 (match_operand 1 "register_operand" "b")
6855 (match_operand 2 "register_operand" "r")] 3)]
6859 (define_insn "dcbst"
6860 [(unspec [(match_operand 0 "memory_operand" "=m")
6861 (match_operand 1 "register_operand" "b")
6862 (match_operand 2 "register_operand" "r")] 4)]
6867 [(unspec [(match_operand 0 "memory_operand" "=m")] 5)]
6871 (define_insn "isync"
6872 [(unspec [(match_operand 0 "memory_operand" "=m")] 6)]
6877 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
6878 ;; signed & unsigned, and one type of branch.
6880 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
6881 ;; insns, and branches. We store the operands of compares until we see
6883 (define_expand "cmpsi"
6885 (compare (match_operand:SI 0 "gpc_reg_operand" "")
6886 (match_operand:SI 1 "reg_or_short_operand" "")))]
6890 /* Take care of the possibility that operands[1] might be negative but
6891 this might be a logical operation. That insn doesn't exist. */
6892 if (GET_CODE (operands[1]) == CONST_INT
6893 && INTVAL (operands[1]) < 0)
6894 operands[1] = force_reg (SImode, operands[1]);
6896 rs6000_compare_op0 = operands[0];
6897 rs6000_compare_op1 = operands[1];
6898 rs6000_compare_fp_p = 0;
6902 (define_expand "cmpdi"
6904 (compare (match_operand:DI 0 "gpc_reg_operand" "")
6905 (match_operand:DI 1 "reg_or_short_operand" "")))]
6909 /* Take care of the possibility that operands[1] might be negative but
6910 this might be a logical operation. That insn doesn't exist. */
6911 if (GET_CODE (operands[1]) == CONST_INT
6912 && INTVAL (operands[1]) < 0)
6913 operands[1] = force_reg (DImode, operands[1]);
6915 rs6000_compare_op0 = operands[0];
6916 rs6000_compare_op1 = operands[1];
6917 rs6000_compare_fp_p = 0;
6921 (define_expand "cmpsf"
6922 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
6923 (match_operand:SF 1 "gpc_reg_operand" "")))]
6927 rs6000_compare_op0 = operands[0];
6928 rs6000_compare_op1 = operands[1];
6929 rs6000_compare_fp_p = 1;
6933 (define_expand "cmpdf"
6934 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
6935 (match_operand:DF 1 "gpc_reg_operand" "")))]
6939 rs6000_compare_op0 = operands[0];
6940 rs6000_compare_op1 = operands[1];
6941 rs6000_compare_fp_p = 1;
6945 (define_expand "beq"
6946 [(set (match_dup 2) (match_dup 1))
6948 (if_then_else (eq (match_dup 2)
6950 (label_ref (match_operand 0 "" ""))
6954 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6955 operands[1] = gen_rtx (COMPARE, mode,
6956 rs6000_compare_op0, rs6000_compare_op1);
6957 operands[2] = gen_reg_rtx (mode);
6960 (define_expand "bne"
6961 [(set (match_dup 2) (match_dup 1))
6963 (if_then_else (ne (match_dup 2)
6965 (label_ref (match_operand 0 "" ""))
6969 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6970 operands[1] = gen_rtx (COMPARE, mode,
6971 rs6000_compare_op0, rs6000_compare_op1);
6972 operands[2] = gen_reg_rtx (mode);
6975 (define_expand "blt"
6976 [(set (match_dup 2) (match_dup 1))
6978 (if_then_else (lt (match_dup 2)
6980 (label_ref (match_operand 0 "" ""))
6984 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6985 operands[1] = gen_rtx (COMPARE, mode,
6986 rs6000_compare_op0, rs6000_compare_op1);
6987 operands[2] = gen_reg_rtx (mode);
6990 (define_expand "bgt"
6991 [(set (match_dup 2) (match_dup 1))
6993 (if_then_else (gt (match_dup 2)
6995 (label_ref (match_operand 0 "" ""))
6999 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7000 operands[1] = gen_rtx (COMPARE, mode,
7001 rs6000_compare_op0, rs6000_compare_op1);
7002 operands[2] = gen_reg_rtx (mode);
7005 (define_expand "ble"
7006 [(set (match_dup 2) (match_dup 1))
7008 (if_then_else (le (match_dup 2)
7010 (label_ref (match_operand 0 "" ""))
7014 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7015 operands[1] = gen_rtx (COMPARE, mode,
7016 rs6000_compare_op0, rs6000_compare_op1);
7017 operands[2] = gen_reg_rtx (mode);
7020 (define_expand "bge"
7021 [(set (match_dup 2) (match_dup 1))
7023 (if_then_else (ge (match_dup 2)
7025 (label_ref (match_operand 0 "" ""))
7029 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7030 operands[1] = gen_rtx (COMPARE, mode,
7031 rs6000_compare_op0, rs6000_compare_op1);
7032 operands[2] = gen_reg_rtx (mode);
7035 (define_expand "bgtu"
7036 [(set (match_dup 2) (match_dup 1))
7038 (if_then_else (gtu (match_dup 2)
7040 (label_ref (match_operand 0 "" ""))
7044 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7045 rs6000_compare_op0, rs6000_compare_op1);
7046 operands[2] = gen_reg_rtx (CCUNSmode);
7049 (define_expand "bltu"
7050 [(set (match_dup 2) (match_dup 1))
7052 (if_then_else (ltu (match_dup 2)
7054 (label_ref (match_operand 0 "" ""))
7058 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7059 rs6000_compare_op0, rs6000_compare_op1);
7060 operands[2] = gen_reg_rtx (CCUNSmode);
7063 (define_expand "bgeu"
7064 [(set (match_dup 2) (match_dup 1))
7066 (if_then_else (geu (match_dup 2)
7068 (label_ref (match_operand 0 "" ""))
7072 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7073 rs6000_compare_op0, rs6000_compare_op1);
7074 operands[2] = gen_reg_rtx (CCUNSmode);
7077 (define_expand "bleu"
7078 [(set (match_dup 2) (match_dup 1))
7080 (if_then_else (leu (match_dup 2)
7082 (label_ref (match_operand 0 "" ""))
7086 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7087 rs6000_compare_op0, rs6000_compare_op1);
7088 operands[2] = gen_reg_rtx (CCUNSmode);
7091 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
7092 ;; For SEQ, likewise, except that comparisons with zero should be done
7093 ;; with an scc insns. However, due to the order that combine see the
7094 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
7095 ;; the cases we don't want to handle.
7096 (define_expand "seq"
7097 [(set (match_dup 2) (match_dup 1))
7098 (set (match_operand:SI 0 "gpc_reg_operand" "")
7099 (eq:SI (match_dup 2) (const_int 0)))]
7102 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7103 operands[1] = gen_rtx (COMPARE, mode,
7104 rs6000_compare_op0, rs6000_compare_op1);
7105 operands[2] = gen_reg_rtx (mode);
7108 (define_expand "sne"
7109 [(set (match_dup 2) (match_dup 1))
7110 (set (match_operand:SI 0 "gpc_reg_operand" "")
7111 (ne:SI (match_dup 2) (const_int 0)))]
7114 { if (! rs6000_compare_fp_p)
7117 operands[1] = gen_rtx (COMPARE, CCFPmode,
7118 rs6000_compare_op0, rs6000_compare_op1);
7119 operands[2] = gen_reg_rtx (CCFPmode);
7122 ;; A > 0 is best done using the portable sequence, so fail in that case.
7123 (define_expand "sgt"
7124 [(set (match_dup 2) (match_dup 1))
7125 (set (match_operand:SI 0 "gpc_reg_operand" "")
7126 (gt:SI (match_dup 2) (const_int 0)))]
7129 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7131 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7134 operands[1] = gen_rtx (COMPARE, mode,
7135 rs6000_compare_op0, rs6000_compare_op1);
7136 operands[2] = gen_reg_rtx (mode);
7139 ;; A < 0 is best done in the portable way for A an integer.
7140 (define_expand "slt"
7141 [(set (match_dup 2) (match_dup 1))
7142 (set (match_operand:SI 0 "gpc_reg_operand" "")
7143 (lt:SI (match_dup 2) (const_int 0)))]
7146 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7148 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7151 operands[1] = gen_rtx (COMPARE, mode,
7152 rs6000_compare_op0, rs6000_compare_op1);
7153 operands[2] = gen_reg_rtx (mode);
7156 (define_expand "sge"
7157 [(set (match_dup 2) (match_dup 1))
7158 (set (match_operand:SI 0 "gpc_reg_operand" "")
7159 (ge:SI (match_dup 2) (const_int 0)))]
7162 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7163 operands[1] = gen_rtx (COMPARE, mode,
7164 rs6000_compare_op0, rs6000_compare_op1);
7165 operands[2] = gen_reg_rtx (mode);
7168 ;; A <= 0 is best done the portable way for A an integer.
7169 (define_expand "sle"
7170 [(set (match_dup 2) (match_dup 1))
7171 (set (match_operand:SI 0 "gpc_reg_operand" "")
7172 (le:SI (match_dup 2) (const_int 0)))]
7175 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7177 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7180 operands[1] = gen_rtx (COMPARE, mode,
7181 rs6000_compare_op0, rs6000_compare_op1);
7182 operands[2] = gen_reg_rtx (mode);
7185 (define_expand "sgtu"
7186 [(set (match_dup 2) (match_dup 1))
7187 (set (match_operand:SI 0 "gpc_reg_operand" "")
7188 (gtu:SI (match_dup 2) (const_int 0)))]
7191 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7192 rs6000_compare_op0, rs6000_compare_op1);
7193 operands[2] = gen_reg_rtx (CCUNSmode);
7196 (define_expand "sltu"
7197 [(set (match_dup 2) (match_dup 1))
7198 (set (match_operand:SI 0 "gpc_reg_operand" "")
7199 (ltu:SI (match_dup 2) (const_int 0)))]
7202 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7203 rs6000_compare_op0, rs6000_compare_op1);
7204 operands[2] = gen_reg_rtx (CCUNSmode);
7207 (define_expand "sgeu"
7208 [(set (match_dup 2) (match_dup 1))
7209 (set (match_operand:SI 0 "gpc_reg_operand" "")
7210 (geu:SI (match_dup 2) (const_int 0)))]
7213 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7214 rs6000_compare_op0, rs6000_compare_op1);
7215 operands[2] = gen_reg_rtx (CCUNSmode);
7218 (define_expand "sleu"
7219 [(set (match_dup 2) (match_dup 1))
7220 (set (match_operand:SI 0 "gpc_reg_operand" "")
7221 (leu:SI (match_dup 2) (const_int 0)))]
7224 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7225 rs6000_compare_op0, rs6000_compare_op1);
7226 operands[2] = gen_reg_rtx (CCUNSmode);
7229 ;; Here are the actual compare insns.
7231 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
7232 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
7233 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
7235 "{cmp%I2|cmpw%I2} %0,%1,%2"
7236 [(set_attr "type" "compare")])
7239 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
7240 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
7241 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
7244 [(set_attr "type" "compare")])
7246 ;; If we are comparing a register for equality with a large constant,
7247 ;; we can do this with an XOR followed by a compare. But we need a scratch
7248 ;; register for the result of the XOR.
7251 [(set (match_operand:CC 0 "cc_reg_operand" "")
7252 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7253 (match_operand:SI 2 "non_short_cint_operand" "")))
7254 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
7255 "find_single_use (operands[0], insn, 0)
7256 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
7257 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
7258 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
7259 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
7262 /* Get the constant we are comparing against, C, and see what it looks like
7263 sign-extended to 16 bits. Then see what constant could be XOR'ed
7264 with C to get the sign-extended value. */
7266 int c = INTVAL (operands[2]);
7267 int sextc = (c << 16) >> 16;
7268 int xorv = c ^ sextc;
7270 operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
7271 operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
7275 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
7276 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
7277 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
7279 "{cmpl%I2|cmplw%I2} %0,%1,%W2"
7280 [(set_attr "type" "compare")])
7283 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
7284 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
7285 (match_operand:DI 2 "reg_or_u_short_operand" "rI")))]
7287 "cmpld%I2 %0,%1,%W2"
7288 [(set_attr "type" "compare")])
7290 ;; The following two insns don't exist as single insns, but if we provide
7291 ;; them, we can swap an add and compare, which will enable us to overlap more
7292 ;; of the required delay between a compare and branch. We generate code for
7293 ;; them by splitting.
7296 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
7297 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
7298 (match_operand:SI 2 "short_cint_operand" "i")))
7299 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7300 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
7303 [(set_attr "length" "8")])
7306 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
7307 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
7308 (match_operand:SI 2 "u_short_cint_operand" "i")))
7309 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7310 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
7313 [(set_attr "length" "8")])
7316 [(set (match_operand:CC 3 "cc_reg_operand" "")
7317 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7318 (match_operand:SI 2 "short_cint_operand" "")))
7319 (set (match_operand:SI 0 "gpc_reg_operand" "")
7320 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
7322 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
7323 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
7326 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
7327 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
7328 (match_operand:SI 2 "u_short_cint_operand" "")))
7329 (set (match_operand:SI 0 "gpc_reg_operand" "")
7330 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
7332 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
7333 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
7336 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
7337 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
7338 (match_operand:SF 2 "gpc_reg_operand" "f")))]
7341 [(set_attr "type" "fpcompare")])
7344 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
7345 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
7346 (match_operand:DF 2 "gpc_reg_operand" "f")))]
7349 [(set_attr "type" "fpcompare")])
7351 ;; Now we have the scc insns. We can do some combinations because of the
7352 ;; way the machine works.
7354 ;; Note that this is probably faster if we can put an insn between the
7355 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
7356 ;; cases the insns below which don't use an intermediate CR field will
7359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7360 (match_operator:SI 1 "scc_comparison_operator"
7361 [(match_operand 2 "cc_reg_operand" "y")
7364 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
7365 [(set_attr "length" "12")])
7368 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7369 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
7370 [(match_operand 2 "cc_reg_operand" "y")
7373 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
7374 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
7376 "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
7377 [(set_attr "type" "delayed_compare")
7378 (set_attr "length" "12")])
7381 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7382 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
7383 [(match_operand 2 "cc_reg_operand" "y")
7385 (match_operand:SI 3 "const_int_operand" "n")))]
7389 int is_bit = ccr_bit (operands[1], 1);
7390 int put_bit = 31 - (INTVAL (operands[3]) & 31);
7393 if (is_bit >= put_bit)
7394 count = is_bit - put_bit;
7396 count = 32 - (put_bit - is_bit);
7398 operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
7399 operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
7401 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
7403 [(set_attr "length" "12")])
7406 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7408 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
7409 [(match_operand 2 "cc_reg_operand" "y")
7411 (match_operand:SI 3 "const_int_operand" "n"))
7413 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
7414 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
7419 int is_bit = ccr_bit (operands[1], 1);
7420 int put_bit = 31 - (INTVAL (operands[3]) & 31);
7423 if (is_bit >= put_bit)
7424 count = is_bit - put_bit;
7426 count = 32 - (put_bit - is_bit);
7428 operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
7429 operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
7431 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
7433 [(set_attr "type" "delayed_compare")
7434 (set_attr "length" "12")])
7436 ;; If we are comparing the result of two comparisons, this can be done
7437 ;; using creqv or crxor.
7440 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
7441 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
7442 [(match_operand 2 "cc_reg_operand" "y")
7444 (match_operator 3 "scc_comparison_operator"
7445 [(match_operand 4 "cc_reg_operand" "y")
7447 "REGNO (operands[2]) != REGNO (operands[4])"
7450 enum rtx_code code1, code2;
7452 code1 = GET_CODE (operands[1]);
7453 code2 = GET_CODE (operands[3]);
7455 if ((code1 == EQ || code1 == LT || code1 == GT
7456 || code1 == LTU || code1 == GTU
7457 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
7459 (code2 == EQ || code2 == LT || code2 == GT
7460 || code2 == LTU || code2 == GTU
7461 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
7462 return \"%C1%C3crxor %E0,%j1,%j3\";
7464 return \"%C1%C3creqv %E0,%j1,%j3\";
7466 [(set_attr "length" "12")])
7468 ;; There is a 3 cycle delay between consecutive mfcr instructions
7469 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
7472 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7473 (match_operator:SI 1 "scc_comparison_operator"
7474 [(match_operand 2 "cc_reg_operand" "y")
7476 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
7477 (match_operator:SI 4 "scc_comparison_operator"
7478 [(match_operand 5 "cc_reg_operand" "y")
7480 "REGNO (operands[2]) != REGNO (operands[5])"
7481 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
7482 [(set_attr "length" "20")])
7484 ;; There are some scc insns that can be done directly, without a compare.
7485 ;; These are faster because they don't involve the communications between
7486 ;; the FXU and branch units. In fact, we will be replacing all of the
7487 ;; integer scc insns here or in the portable methods in emit_store_flag.
7489 ;; Also support (neg (scc ..)) since that construct is used to replace
7490 ;; branches, (plus (scc ..) ..) since that construct is common and
7491 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
7492 ;; cases where it is no more expensive than (neg (scc ..)).
7494 ;; Have reload force a constant into a register for the simple insns that
7495 ;; otherwise won't accept constants. We do this because it is faster than
7496 ;; the cmp/mfcr sequence we would otherwise generate.
7499 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7500 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7501 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
7502 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
7505 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
7506 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
7507 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
7508 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
7509 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
7510 [(set_attr "length" "12,8,12,12,12")])
7513 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
7515 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7516 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7518 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7519 (eq:SI (match_dup 1) (match_dup 2)))
7520 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
7523 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
7524 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
7525 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
7526 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
7527 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
7528 [(set_attr "type" "compare")
7529 (set_attr "length" "12,8,12,12,12")])
7531 ;; We have insns of the form shown by the first define_insn below. If
7532 ;; there is something inside the comparison operation, we must split it.
7534 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7535 (plus:SI (match_operator 1 "comparison_operator"
7536 [(match_operand:SI 2 "" "")
7538 "reg_or_cint_operand" "")])
7539 (match_operand:SI 4 "gpc_reg_operand" "")))
7540 (clobber (match_operand:SI 5 "register_operand" ""))]
7541 "! gpc_reg_operand (operands[2], SImode)"
7542 [(set (match_dup 5) (match_dup 2))
7543 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
7547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7548 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7549 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7550 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
7551 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
7554 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7555 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
7556 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7557 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7558 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
7559 [(set_attr "length" "12,8,12,12,12")])
7562 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
7565 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7566 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7567 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
7569 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
7572 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7573 {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
7574 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7575 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7576 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
7577 [(set_attr "type" "compare")
7578 (set_attr "length" "12,8,12,12,12")])
7581 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
7584 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7585 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7586 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
7588 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7589 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7590 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
7593 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7594 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
7595 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7596 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7597 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
7598 [(set_attr "type" "compare")
7599 (set_attr "length" "12,8,12,12,12")])
7602 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7603 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7604 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
7607 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7608 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
7609 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7610 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7611 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
7612 [(set_attr "length" "12,8,12,12,12")])
7614 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
7615 ;; since it nabs/sr is just as fast.
7617 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7618 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7620 (clobber (match_scratch:SI 2 "=&r"))]
7622 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
7623 [(set_attr "length" "8")])
7625 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
7627 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7628 (plus:SI (lshiftrt:SI
7629 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7631 (match_operand:SI 2 "gpc_reg_operand" "r")))
7632 (clobber (match_scratch:SI 3 "=&r"))]
7634 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
7635 [(set_attr "length" "8")])
7638 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7640 (plus:SI (lshiftrt:SI
7641 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7643 (match_operand:SI 2 "gpc_reg_operand" "r"))
7645 (clobber (match_scratch:SI 3 "=&r"))]
7647 "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
7648 [(set_attr "type" "compare")
7649 (set_attr "length" "8")])
7652 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
7654 (plus:SI (lshiftrt:SI
7655 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7657 (match_operand:SI 2 "gpc_reg_operand" "r"))
7659 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7660 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
7662 (clobber (match_scratch:SI 3 "=&r"))]
7664 "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
7665 [(set_attr "type" "compare")
7666 (set_attr "length" "8")])
7669 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7670 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7671 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
7672 (clobber (match_scratch:SI 3 "=r,X"))]
7675 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
7676 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
7677 [(set_attr "length" "12")])
7680 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
7682 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7683 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7685 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7686 (le:SI (match_dup 1) (match_dup 2)))
7687 (clobber (match_scratch:SI 3 "=r,X"))]
7690 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
7691 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
7692 [(set_attr "type" "compare,delayed_compare")
7693 (set_attr "length" "12")])
7696 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7697 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7698 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7699 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
7700 (clobber (match_scratch:SI 4 "=&r,&r"))]
7703 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7704 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
7705 [(set_attr "length" "12")])
7708 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
7710 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7711 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7712 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7714 (clobber (match_scratch:SI 4 "=&r,&r"))]
7717 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7718 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
7719 [(set_attr "type" "compare")
7720 (set_attr "length" "12")])
7723 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
7725 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7726 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7727 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7729 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7730 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7731 (clobber (match_scratch:SI 4 "=&r,&r"))]
7734 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7735 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
7736 [(set_attr "type" "compare")
7737 (set_attr "length" "12")])
7740 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7741 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7742 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
7745 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7746 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
7747 [(set_attr "length" "12")])
7750 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7751 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7752 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
7754 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
7755 [(set_attr "length" "12")])
7758 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
7760 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7761 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7763 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7764 (leu:SI (match_dup 1) (match_dup 2)))]
7766 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
7767 [(set_attr "type" "compare")
7768 (set_attr "length" "12")])
7771 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7772 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7773 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7774 (match_operand:SI 3 "gpc_reg_operand" "r")))
7775 (clobber (match_scratch:SI 4 "=&r"))]
7777 "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
7778 [(set_attr "length" "8")])
7781 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7783 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7784 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7785 (match_operand:SI 3 "gpc_reg_operand" "r"))
7787 (clobber (match_scratch:SI 4 "=&r"))]
7789 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
7790 [(set_attr "type" "compare")
7791 (set_attr "length" "8")])
7794 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
7796 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7797 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7798 (match_operand:SI 3 "gpc_reg_operand" "r"))
7800 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7801 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7802 (clobber (match_scratch:SI 4 "=&r"))]
7804 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
7805 [(set_attr "type" "compare")
7806 (set_attr "length" "8")])
7809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7810 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7811 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
7813 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
7814 [(set_attr "length" "12")])
7817 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7819 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7820 (match_operand:SI 2 "reg_or_short_operand" "rI")))
7821 (match_operand:SI 3 "gpc_reg_operand" "r")))
7822 (clobber (match_scratch:SI 4 "=&r"))]
7824 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
7825 [(set_attr "length" "12")])
7828 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7831 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7832 (match_operand:SI 2 "reg_or_short_operand" "rI")))
7833 (match_operand:SI 3 "gpc_reg_operand" "r"))
7835 (clobber (match_scratch:SI 4 "=&r"))]
7837 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
7838 [(set_attr "type" "compare")
7839 (set_attr "length" "12")])
7842 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
7845 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7846 (match_operand:SI 2 "reg_or_short_operand" "rI")))
7847 (match_operand:SI 3 "gpc_reg_operand" "r"))
7849 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7850 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
7851 (clobber (match_scratch:SI 4 "=&r"))]
7853 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
7854 [(set_attr "type" "compare")
7855 (set_attr "length" "12")])
7858 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7859 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7860 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
7862 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
7863 [(set_attr "length" "12")])
7866 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
7868 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7869 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7871 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7872 (lt:SI (match_dup 1) (match_dup 2)))]
7874 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
7875 [(set_attr "type" "delayed_compare")
7876 (set_attr "length" "12")])
7879 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7880 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7881 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7882 (match_operand:SI 3 "gpc_reg_operand" "r")))
7883 (clobber (match_scratch:SI 4 "=&r"))]
7885 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
7886 [(set_attr "length" "12")])
7889 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7891 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7892 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7893 (match_operand:SI 3 "gpc_reg_operand" "r"))
7895 (clobber (match_scratch:SI 4 "=&r"))]
7897 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
7898 [(set_attr "type" "compare")
7899 (set_attr "length" "12")])
7902 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
7904 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7905 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7906 (match_operand:SI 3 "gpc_reg_operand" "r"))
7908 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7909 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7910 (clobber (match_scratch:SI 4 "=&r"))]
7912 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
7913 [(set_attr "type" "compare")
7914 (set_attr "length" "12")])
7917 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7918 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7919 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
7921 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
7922 [(set_attr "length" "12")])
7925 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7926 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7927 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
7930 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
7931 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
7932 [(set_attr "length" "12")])
7935 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
7937 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7938 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7940 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7941 (ltu:SI (match_dup 1) (match_dup 2)))]
7944 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
7945 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
7946 [(set_attr "type" "compare")
7947 (set_attr "length" "12")])
7950 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
7951 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
7952 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
7953 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
7954 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
7957 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
7958 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
7959 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
7960 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
7961 [(set_attr "length" "12")])
7964 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
7966 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7967 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7968 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7970 (clobber (match_scratch:SI 4 "=&r,&r"))]
7973 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
7974 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
7975 [(set_attr "type" "compare")
7976 (set_attr "length" "12")])
7979 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
7981 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7982 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7983 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7985 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7986 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7987 (clobber (match_scratch:SI 4 "=&r,&r"))]
7990 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
7991 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
7992 [(set_attr "type" "compare")
7993 (set_attr "length" "12")])
7996 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7997 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7998 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
8001 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
8002 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
8003 [(set_attr "length" "8")])
8006 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8007 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8008 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8009 (clobber (match_scratch:SI 3 "=r"))]
8011 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
8012 [(set_attr "length" "12")])
8015 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8017 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8018 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8020 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8021 (ge:SI (match_dup 1) (match_dup 2)))
8022 (clobber (match_scratch:SI 3 "=r"))]
8024 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
8025 [(set_attr "type" "compare")
8026 (set_attr "length" "12")])
8029 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8030 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8031 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8032 (match_operand:SI 3 "gpc_reg_operand" "r")))
8033 (clobber (match_scratch:SI 4 "=&r"))]
8035 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
8036 [(set_attr "length" "12")])
8039 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8041 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8042 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8043 (match_operand:SI 3 "gpc_reg_operand" "r"))
8045 (clobber (match_scratch:SI 4 "=&r"))]
8047 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
8048 [(set_attr "type" "compare")
8049 (set_attr "length" "12")])
8052 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8054 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8055 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8056 (match_operand:SI 3 "gpc_reg_operand" "r"))
8058 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8059 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8060 (clobber (match_scratch:SI 4 "=&r"))]
8062 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
8063 [(set_attr "type" "compare")
8064 (set_attr "length" "12")])
8067 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8068 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8069 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8071 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
8072 [(set_attr "length" "12")])
8074 ;; This is (and (neg (ge X (const_int 0))) Y).
8076 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8079 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8081 (match_operand:SI 2 "gpc_reg_operand" "r")))
8082 (clobber (match_scratch:SI 3 "=&r"))]
8084 "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
8085 [(set_attr "length" "8")])
8088 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8092 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8094 (match_operand:SI 2 "gpc_reg_operand" "r"))
8096 (clobber (match_scratch:SI 3 "=&r"))]
8098 "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
8099 [(set_attr "type" "compare")
8100 (set_attr "length" "8")])
8103 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8107 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8109 (match_operand:SI 2 "gpc_reg_operand" "r"))
8111 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8112 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
8115 (clobber (match_scratch:SI 3 "=&r"))]
8117 "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
8118 [(set_attr "type" "compare")
8119 (set_attr "length" "8")])
8122 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8123 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8124 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
8127 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
8128 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
8129 [(set_attr "length" "12")])
8132 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
8134 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8135 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8137 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8138 (geu:SI (match_dup 1) (match_dup 2)))]
8141 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
8142 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
8143 [(set_attr "type" "compare")
8144 (set_attr "length" "12")])
8147 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8148 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8149 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8150 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8151 (clobber (match_scratch:SI 4 "=&r,&r"))]
8154 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
8155 {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
8156 [(set_attr "length" "8")])
8159 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8161 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8162 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8163 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8165 (clobber (match_scratch:SI 4 "=&r,&r"))]
8168 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
8169 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
8170 [(set_attr "type" "compare")
8171 (set_attr "length" "8")])
8174 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8176 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8177 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8178 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8180 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8181 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8182 (clobber (match_scratch:SI 4 "=&r,&r"))]
8185 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
8186 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
8187 [(set_attr "type" "compare")
8188 (set_attr "length" "8")])
8191 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8192 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8193 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
8196 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
8197 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
8198 [(set_attr "length" "12")])
8201 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8203 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8204 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8205 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8206 (clobber (match_scratch:SI 4 "=&r,&r"))]
8209 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
8210 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
8211 [(set_attr "length" "12")])
8214 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8217 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8218 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8219 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8221 (clobber (match_scratch:SI 4 "=&r,&r"))]
8224 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
8225 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
8226 [(set_attr "type" "compare")
8227 (set_attr "length" "12")])
8230 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8233 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8234 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8235 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8237 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8238 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
8239 (clobber (match_scratch:SI 4 "=&r,&r"))]
8242 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
8243 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
8244 [(set_attr "type" "compare")
8245 (set_attr "length" "12")])
8248 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8249 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8252 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
8253 [(set_attr "length" "12")])
8256 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
8258 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8261 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8262 (gt:SI (match_dup 1) (const_int 0)))]
8264 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
8265 [(set_attr "type" "delayed_compare")
8266 (set_attr "length" "12")])
8269 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8270 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8271 (match_operand:SI 2 "reg_or_short_operand" "r")))]
8273 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
8274 [(set_attr "length" "12")])
8277 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8279 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8280 (match_operand:SI 2 "reg_or_short_operand" "r"))
8282 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8283 (gt:SI (match_dup 1) (match_dup 2)))]
8285 "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
8286 [(set_attr "type" "delayed_compare")
8287 (set_attr "length" "12")])
8290 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8291 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8293 (match_operand:SI 2 "gpc_reg_operand" "r")))
8294 (clobber (match_scratch:SI 3 "=&r"))]
8296 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
8297 [(set_attr "length" "12")])
8300 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8302 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8304 (match_operand:SI 2 "gpc_reg_operand" "r"))
8306 (clobber (match_scratch:SI 3 "=&r"))]
8308 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
8309 [(set_attr "type" "compare")
8310 (set_attr "length" "12")])
8313 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8315 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8317 (match_operand:SI 2 "gpc_reg_operand" "r"))
8319 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8320 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
8321 (clobber (match_scratch:SI 3 "=&r"))]
8323 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
8324 [(set_attr "type" "compare")
8325 (set_attr "length" "12")])
8328 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8329 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8330 (match_operand:SI 2 "reg_or_short_operand" "r"))
8331 (match_operand:SI 3 "gpc_reg_operand" "r")))
8332 (clobber (match_scratch:SI 4 "=&r"))]
8334 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
8335 [(set_attr "length" "12")])
8338 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8340 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8341 (match_operand:SI 2 "reg_or_short_operand" "r"))
8342 (match_operand:SI 3 "gpc_reg_operand" "r"))
8344 (clobber (match_scratch:SI 4 "=&r"))]
8346 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
8347 [(set_attr "type" "compare")
8348 (set_attr "length" "12")])
8351 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8353 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8354 (match_operand:SI 2 "reg_or_short_operand" "r"))
8355 (match_operand:SI 3 "gpc_reg_operand" "r"))
8357 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8358 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8359 (clobber (match_scratch:SI 4 "=&r"))]
8361 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
8362 [(set_attr "type" "compare")
8363 (set_attr "length" "12")])
8366 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8367 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8370 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
8371 [(set_attr "length" "12")])
8374 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8375 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8376 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
8378 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
8379 [(set_attr "length" "12")])
8382 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8383 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8384 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8386 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
8387 [(set_attr "length" "12")])
8390 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8392 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8393 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8395 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8396 (gtu:SI (match_dup 1) (match_dup 2)))]
8398 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
8399 [(set_attr "type" "compare")
8400 (set_attr "length" "12")])
8403 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
8404 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
8405 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
8406 (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
8407 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
8410 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
8411 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8412 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
8413 [(set_attr "length" "8,12,12")])
8416 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8418 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8419 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
8420 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8422 (clobber (match_scratch:SI 4 "=&r,&r"))]
8425 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
8426 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
8427 [(set_attr "type" "compare")
8428 (set_attr "length" "8,12")])
8431 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8433 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8434 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
8435 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8437 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8438 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8439 (clobber (match_scratch:SI 4 "=&r,&r"))]
8442 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
8443 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
8444 [(set_attr "type" "compare")
8445 (set_attr "length" "8,12")])
8448 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8449 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8450 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8452 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
8453 [(set_attr "length" "8")])
8455 ;; Define both directions of branch and return. If we need a reload
8456 ;; register, we'd rather use CR0 since it is much easier to copy a
8457 ;; register CC value to there.
8461 (if_then_else (match_operator 1 "branch_comparison_operator"
8463 "cc_reg_operand" "x,?y")
8465 (label_ref (match_operand 0 "" ""))
8470 if (get_attr_length (insn) == 8)
8471 return \"%C1bc %t1,%j1,%l0\";
8473 return \"%C1bc %T1,%j1,$+8\;b %l0\";
8475 [(set_attr "type" "branch")])
8479 (if_then_else (match_operator 0 "branch_comparison_operator"
8481 "cc_reg_operand" "x,?y")
8486 "{%C0bcr|%C0bclr} %t0,%j0"
8487 [(set_attr "length" "8")])
8491 (if_then_else (match_operator 1 "branch_comparison_operator"
8493 "cc_reg_operand" "x,?y")
8496 (label_ref (match_operand 0 "" ""))))]
8500 if (get_attr_length (insn) == 8)
8501 return \"%C1bc %T1,%j1,%l0\";
8503 return \"%C1bc %t1,%j1,$+8\;b %l0\";
8505 [(set_attr "type" "branch")])
8509 (if_then_else (match_operator 0 "branch_comparison_operator"
8511 "cc_reg_operand" "x,?y")
8516 "{%C0bcr|%C0bclr} %T0,%j0"
8517 [(set_attr "length" "8")])
8519 ;; Unconditional branch and return.
8523 (label_ref (match_operand 0 "" "")))]
8527 (define_insn "return"
8531 [(set_attr "type" "jmpreg")])
8533 (define_insn "indirect_jump"
8534 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
8539 [(set_attr "type" "jmpreg")])
8542 [(set (pc) (match_operand:DI 0 "register_operand" "c,l"))]
8547 [(set_attr "type" "jmpreg")])
8549 ;; Table jump for switch statements:
8550 (define_expand "tablejump"
8551 [(use (match_operand 0 "" ""))
8552 (use (label_ref (match_operand 1 "" "")))]
8557 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
8559 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
8563 (define_expand "tablejumpsi"
8565 (plus:SI (match_operand:SI 0 "" "")
8567 (parallel [(set (pc) (match_dup 3))
8568 (use (label_ref (match_operand 1 "" "")))])]
8571 { operands[0] = force_reg (SImode, operands[0]);
8572 operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
8573 operands[3] = gen_reg_rtx (SImode);
8576 (define_expand "tablejumpdi"
8578 (plus:DI (match_operand:DI 0 "" "")
8580 (parallel [(set (pc) (match_dup 3))
8581 (use (label_ref (match_operand 1 "" "")))])]
8584 { operands[0] = force_reg (DImode, operands[0]);
8585 operands[2] = force_reg (DImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
8586 operands[3] = gen_reg_rtx (DImode);
8591 (match_operand:SI 0 "register_operand" "c,l"))
8592 (use (label_ref (match_operand 1 "" "")))]
8597 [(set_attr "type" "jmpreg")])
8601 (match_operand:DI 0 "register_operand" "c,l"))
8602 (use (label_ref (match_operand 1 "" "")))]
8607 [(set_attr "type" "jmpreg")])
8614 ;; Define the subtract-one-and-jump insns, starting with the template
8615 ;; so loop.c knows what to generate.
8617 (define_expand "decrement_and_branch_on_count"
8618 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "")
8620 (label_ref (match_operand 1 "" ""))
8623 (plus:SI (match_dup 0)
8625 (clobber (match_scratch:CC 2 ""))
8626 (clobber (match_scratch:SI 3 ""))])]
8630 ;; We need to be able to do this for any operand, including MEM, or we
8631 ;; will cause reload to blow up since we don't allow output reloads on
8633 ;; In order that the length attribute is calculated correctly, the
8634 ;; label MUST be operand 0.
8638 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
8640 (label_ref (match_operand 0 "" ""))
8642 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8643 (plus:SI (match_dup 1)
8645 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8646 (clobber (match_scratch:SI 4 "=X,X,r"))]
8650 if (which_alternative != 0)
8652 else if (get_attr_length (insn) == 8)
8653 return \"{bdn|bdnz} %l0\";
8655 return \"bdz $+8\;b %l0\";
8657 [(set_attr "type" "branch")
8658 (set_attr "length" "*,12,16")])
8662 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
8665 (label_ref (match_operand 0 "" ""))))
8666 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8667 (plus:SI (match_dup 1)
8669 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8670 (clobber (match_scratch:SI 4 "=X,X,r"))]
8674 if (which_alternative != 0)
8676 else if (get_attr_length (insn) == 8)
8679 return \"{bdn|bdnz} $+8\;b %l0\";
8681 [(set_attr "type" "branch")
8682 (set_attr "length" "*,12,16")])
8684 ;; Similar, but we can use GE since we have a REG_NONNEG.
8687 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
8689 (label_ref (match_operand 0 "" ""))
8691 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8692 (plus:SI (match_dup 1)
8694 (clobber (match_scratch:CC 3 "=X,&x,&X"))
8695 (clobber (match_scratch:SI 4 "=X,X,r"))]
8696 "find_reg_note (insn, REG_NONNEG, 0)"
8699 if (which_alternative != 0)
8701 else if (get_attr_length (insn) == 8)
8702 return \"{bdn|bdnz} %l0\";
8704 return \"bdz $+8\;b %l0\";
8706 [(set_attr "type" "branch")
8707 (set_attr "length" "*,12,16")])
8711 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
8714 (label_ref (match_operand 0 "" ""))))
8715 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8716 (plus:SI (match_dup 1)
8718 (clobber (match_scratch:CC 3 "=X,&x,&X"))
8719 (clobber (match_scratch:SI 4 "=X,X,r"))]
8720 "find_reg_note (insn, REG_NONNEG, 0)"
8723 if (which_alternative != 0)
8725 else if (get_attr_length (insn) == 8)
8728 return \"{bdn|bdnz} $+8\;b %l0\";
8730 [(set_attr "type" "branch")
8731 (set_attr "length" "*,12,16")])
8735 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
8737 (label_ref (match_operand 0 "" ""))
8739 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8740 (plus:SI (match_dup 1)
8742 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8743 (clobber (match_scratch:SI 4 "=X,X,r"))]
8747 if (which_alternative != 0)
8749 else if (get_attr_length (insn) == 8)
8752 return \"{bdn|bdnz} $+8\;b %l0\";
8754 [(set_attr "type" "branch")
8755 (set_attr "length" "*,12,16")])
8759 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
8762 (label_ref (match_operand 0 "" ""))))
8763 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8764 (plus:SI (match_dup 1)
8766 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8767 (clobber (match_scratch:SI 4 "=X,X,r"))]
8771 if (which_alternative != 0)
8773 else if (get_attr_length (insn) == 8)
8774 return \"{bdn|bdnz} %l0\";
8776 return \"bdz $+8\;b %l0\";
8778 [(set_attr "type" "branch")
8779 (set_attr "length" "*,12,16")])
8783 (if_then_else (match_operator 2 "comparison_operator"
8784 [(match_operand:SI 1 "gpc_reg_operand" "")
8786 (match_operand 5 "" "")
8787 (match_operand 6 "" "")))
8788 (set (match_operand:SI 0 "gpc_reg_operand" "")
8789 (plus:SI (match_dup 1)
8791 (clobber (match_scratch:CC 3 ""))
8792 (clobber (match_scratch:SI 4 ""))]
8794 [(parallel [(set (match_dup 3)
8795 (compare:CC (plus:SI (match_dup 1)
8799 (plus:SI (match_dup 1)
8801 (set (pc) (if_then_else (match_dup 7)
8805 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
8810 (if_then_else (match_operator 2 "comparison_operator"
8811 [(match_operand:SI 1 "gpc_reg_operand" "")
8813 (match_operand 5 "" "")
8814 (match_operand 6 "" "")))
8815 (set (match_operand:SI 0 "general_operand" "")
8816 (plus:SI (match_dup 1) (const_int -1)))
8817 (clobber (match_scratch:CC 3 ""))
8818 (clobber (match_scratch:SI 4 ""))]
8819 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
8820 [(parallel [(set (match_dup 3)
8821 (compare:CC (plus:SI (match_dup 1)
8825 (plus:SI (match_dup 1)
8829 (set (pc) (if_then_else (match_dup 7)
8833 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],