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 int low = INTVAL (operands[2]) & 0xffff;
892 int high = (unsigned) INTVAL (operands[2]) >> 16;
895 high++, low |= 0xffff0000;
897 operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);
898 operands[4] = gen_rtx (CONST_INT, VOIDmode, 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 int endian = (WORDS_BIG_ENDIAN == 0);
3531 rtx stack_slot = rs6000_stack_temp (DImode, 8, 1);
3532 rtx temp = gen_reg_rtx (DImode);
3534 emit_insn (gen_fpcvtsi (temp, operands[1]));
3535 emit_move_insn (stack_slot, temp);
3536 emit_move_insn (operands[0],
3537 operand_subword (stack_slot, 1 - endian, 0, DImode));
3542 emit_insn (gen_trunc_call (operands[0], operands[1],
3543 gen_rtx (SYMBOL_REF, Pmode, RS6000_ITRUNC)));
3548 (define_insn "fpcvtsi"
3549 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3551 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3552 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3553 "{fcirz|fctiwz} %0,%1"
3554 [(set_attr "type" "fp")])
3556 (define_expand "fixuns_truncdfsi2"
3557 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3558 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
3559 "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
3562 emit_insn (gen_trunc_call (operands[0], operands[1],
3563 gen_rtx (SYMBOL_REF, Pmode, RS6000_UITRUNC)));
3567 (define_expand "trunc_call"
3568 [(parallel [(set (match_operand:SI 0 "" "")
3569 (fix:SI (match_operand:DF 1 "" "")))
3570 (use (match_operand:SI 2 "" ""))])]
3574 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
3575 rtx first = XVECEXP (insns, 0, 0);
3576 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
3578 REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
3580 REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
3586 (define_expand "trunc_call_rtl"
3587 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
3589 (parallel [(set (reg:SI 3)
3590 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
3592 (clobber (scratch:SI))])
3593 (set (match_operand:SI 0 "gpc_reg_operand" "")
3598 rs6000_trunc_used = 1;
3601 (define_insn "floatdidf2"
3602 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3603 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
3604 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3606 [(set_attr "type" "fp")])
3608 (define_insn "fix_truncdfdi2"
3609 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3610 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
3611 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3613 [(set_attr "type" "fp")])
3615 ;; Define the DImode operations that can be done in a small number
3616 ;; of instructions. The & constraints are to prevent the register
3617 ;; allocator from allocating registers that overlap with the inputs
3618 ;; (for example, having an input in 7,8 and an output in 6,7). We
3619 ;; also allow for the the output being the same as one of the inputs.
3621 (define_insn "*adddi3_noppc64"
3622 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
3623 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
3624 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
3625 "! TARGET_POWERPC64"
3628 if (WORDS_BIG_ENDIAN)
3629 return (GET_CODE (operands[2])) != CONST_INT
3630 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
3631 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
3633 return (GET_CODE (operands[2])) != CONST_INT
3634 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
3635 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
3637 [(set_attr "length" "8")])
3639 (define_insn "*subdi3_noppc64"
3640 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
3641 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
3642 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
3643 "! TARGET_POWERPC64"
3646 if (WORDS_BIG_ENDIAN)
3647 return (GET_CODE (operands[1]) != CONST_INT)
3648 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
3649 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
3651 return (GET_CODE (operands[1]) != CONST_INT)
3652 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
3653 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
3655 [(set_attr "length" "8")])
3657 (define_insn "*negdi2_noppc64"
3658 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
3659 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
3660 "! TARGET_POWERPC64"
3663 return (WORDS_BIG_ENDIAN)
3664 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
3665 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
3667 [(set_attr "length" "8")])
3669 (define_expand "mulsidi3"
3670 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3671 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3672 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3676 if (! TARGET_POWER && ! TARGET_POWERPC)
3678 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
3679 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
3680 emit_insn (gen_mull_call ());
3681 if (WORDS_BIG_ENDIAN)
3682 emit_move_insn (operands[0], gen_rtx (REG, DImode, 3));
3685 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
3686 gen_rtx (REG, SImode, 3));
3687 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
3688 gen_rtx (REG, SImode, 4));
3692 else if (TARGET_POWER)
3694 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
3699 (define_insn "mulsidi3_mq"
3700 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3701 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3702 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
3703 (clobber (match_scratch:SI 3 "=q"))]
3705 "mul %0,%1,%2\;mfmq %L0"
3706 [(set_attr "type" "imul")
3707 (set_attr "length" "8")])
3709 (define_insn "*mulsidi3_powerpc"
3710 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
3711 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3712 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
3713 "TARGET_POWERPC && ! TARGET_POWERPC64"
3716 return (WORDS_BIG_ENDIAN)
3717 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
3718 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
3720 [(set_attr "type" "imul")
3721 (set_attr "length" "8")])
3724 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3725 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3726 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3727 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
3730 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3731 (sign_extend:DI (match_dup 2)))
3734 (mult:SI (match_dup 1)
3738 int endian = (WORDS_BIG_ENDIAN == 0);
3739 operands[3] = operand_subword (operands[0], endian, 0, DImode);
3740 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
3743 (define_insn "umulsidi3"
3744 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
3745 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3746 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
3747 "TARGET_POWERPC && ! TARGET_POWERPC64"
3750 return (WORDS_BIG_ENDIAN)
3751 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
3752 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
3754 [(set_attr "type" "imul")
3755 (set_attr "length" "8")])
3758 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3759 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3760 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3761 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
3764 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3765 (zero_extend:DI (match_dup 2)))
3768 (mult:SI (match_dup 1)
3772 int endian = (WORDS_BIG_ENDIAN == 0);
3773 operands[3] = operand_subword (operands[0], endian, 0, DImode);
3774 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
3777 (define_expand "smulsi3_highpart"
3778 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3780 (lshiftrt:DI (mult:DI (sign_extend:DI
3781 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3783 (match_operand:SI 2 "gpc_reg_operand" "r")))
3788 if (! TARGET_POWER && ! TARGET_POWERPC)
3790 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
3791 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
3792 emit_insn (gen_mulh_call ());
3793 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
3796 else if (TARGET_POWER)
3798 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
3803 (define_insn "smulsi3_highpart_mq"
3804 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3806 (lshiftrt:DI (mult:DI (sign_extend:DI
3807 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3809 (match_operand:SI 2 "gpc_reg_operand" "r")))
3811 (clobber (match_scratch:SI 3 "=q"))]
3814 [(set_attr "type" "imul")])
3817 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3819 (lshiftrt:DI (mult:DI (sign_extend:DI
3820 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3822 (match_operand:SI 2 "gpc_reg_operand" "r")))
3826 [(set_attr "type" "imul")])
3828 (define_insn "umulsi3_highpart"
3829 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3831 (lshiftrt:DI (mult:DI (zero_extend:DI
3832 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3834 (match_operand:SI 2 "gpc_reg_operand" "r")))
3838 [(set_attr "type" "imul")])
3840 ;; If operands 0 and 2 are in the same register, we have a problem. But
3841 ;; operands 0 and 1 (the usual case) can be in the same register. That's
3842 ;; why we have the strange constraints below.
3843 (define_insn "ashldi3_power"
3844 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
3845 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
3846 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
3847 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
3850 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
3851 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
3852 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
3853 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
3854 [(set_attr "length" "8")])
3856 (define_insn "lshrdi3_power"
3857 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
3858 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
3859 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
3860 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
3863 {cal %0,0(0)|li %0,0}\;{s%A2i|s%A2wi} %L0,%1,%h2
3864 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
3865 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
3866 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
3867 [(set_attr "length" "8")])
3869 ;; Shift by a variable amount is too complex to be worth open-coding. We
3870 ;; just handle shifts by constants.
3871 (define_insn "ashrdi3_power"
3872 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3873 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
3874 (match_operand:SI 2 "const_int_operand" "M,i")))
3875 (clobber (match_scratch:SI 3 "=X,q"))]
3878 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
3879 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
3880 [(set_attr "length" "8")])
3882 ;; PowerPC64 DImode operations.
3884 (define_expand "adddi3"
3885 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3886 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
3887 (match_operand:DI 2 "add_operand" "")))]
3891 if (! TARGET_POWERPC64 && non_add_cint_operand (operands[2], DImode))
3895 ;; Discourage ai/addic because of carry but provide it in an alternative
3896 ;; allowing register zero as source.
3899 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
3900 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
3901 (match_operand:DI 2 "add_operand" "r,I,I,J")))]
3910 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
3911 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
3912 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
3914 (clobber (match_scratch:DI 3 "=r,r"))]
3919 [(set_attr "type" "compare")])
3922 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
3923 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
3924 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
3926 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3927 (plus:DI (match_dup 1) (match_dup 2)))]
3932 [(set_attr "type" "compare")])
3934 ;; Split an add that we can't do in one insn into two insns, each of which
3935 ;; does one 16-bit part. This is used by combine. Note that the low-order
3936 ;; add should be last in case the result gets used in an address.
3939 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3940 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
3941 (match_operand:DI 2 "non_add_cint_operand" "")))]
3943 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
3944 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
3947 int low = INTVAL (operands[2]) & 0xffff;
3948 int high = (unsigned) INTVAL (operands[2]) >> 16;
3951 high++, low |= 0xffff0000;
3953 operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);
3954 operands[4] = gen_rtx (CONST_INT, VOIDmode, low);
3957 (define_insn "one_cmpldi2"
3958 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3959 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
3964 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3965 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
3967 (clobber (match_scratch:DI 2 "=r"))]
3970 [(set_attr "type" "compare")])
3973 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
3974 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
3976 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3977 (not:DI (match_dup 1)))]
3980 [(set_attr "type" "compare")])
3983 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3984 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
3985 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
3992 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3993 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3994 (match_operand:DI 2 "gpc_reg_operand" "r"))
3996 (clobber (match_scratch:DI 3 "=r"))]
3999 [(set_attr "type" "compare")])
4002 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4003 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4004 (match_operand:DI 2 "gpc_reg_operand" "r"))
4006 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4007 (minus:DI (match_dup 1) (match_dup 2)))]
4010 [(set_attr "type" "compare")])
4012 (define_expand "subdi3"
4013 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4014 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
4015 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4019 if (GET_CODE (operands[2]) == CONST_INT)
4021 emit_insn (gen_adddi3 (operands[0], operands[1],
4022 negate_rtx (DImode, operands[2])));
4027 (define_insn "absdi2"
4028 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4029 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4030 (clobber (match_scratch:DI 2 "=&r,&r"))]
4032 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0"
4033 [(set_attr "length" "12")])
4036 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4037 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4038 (clobber (match_scratch:DI 2 "=&r,&r"))]
4039 "TARGET_POWERPC64 && reload_completed"
4040 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4041 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4042 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
4046 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4047 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4048 (clobber (match_scratch:DI 2 "=&r,&r"))]
4050 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2"
4051 [(set_attr "length" "12")])
4054 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4055 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4056 (clobber (match_scratch:DI 2 "=&r,&r"))]
4057 "TARGET_POWERPC64 && reload_completed"
4058 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4059 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4060 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
4063 (define_expand "negdi2"
4064 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4065 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
4070 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4071 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4076 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4077 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4079 (clobber (match_scratch:DI 2 "=r"))]
4082 [(set_attr "type" "compare")])
4085 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4086 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4088 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4089 (neg:DI (match_dup 1)))]
4092 [(set_attr "type" "compare")])
4094 (define_insn "ffsdi2"
4095 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4096 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4098 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
4099 [(set_attr "length" "16")])
4101 (define_insn "muldi3"
4102 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4103 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4104 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4107 [(set_attr "type" "imul")])
4109 (define_insn "smuldi3_highpart"
4110 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4112 (lshiftrt:TI (mult:TI (sign_extend:TI
4113 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4115 (match_operand:DI 2 "gpc_reg_operand" "r")))
4119 [(set_attr "type" "imul")])
4121 (define_insn "umuldi3_highpart"
4122 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4124 (lshiftrt:TI (mult:TI (zero_extend:TI
4125 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4127 (match_operand:DI 2 "gpc_reg_operand" "r")))
4131 [(set_attr "type" "imul")])
4133 (define_expand "divdi3"
4134 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4135 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
4136 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4140 if (GET_CODE (operands[2]) == CONST_INT
4141 && exact_log2 (INTVAL (operands[2])) >= 0)
4144 operands[2] = force_reg (DImode, operands[2]);
4147 (define_expand "moddi3"
4148 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
4149 (use (match_operand:DI 1 "gpc_reg_operand" ""))
4150 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
4154 int i = exact_log2 (INTVAL (operands[2]));
4158 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
4161 temp1 = gen_reg_rtx (DImode);
4162 temp2 = gen_reg_rtx (DImode);
4164 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
4165 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
4166 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
4171 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4172 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4173 (match_operand:DI 2 "const_int_operand" "N")))]
4174 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4175 "sradi %0,%1,%p2\;addze %0,%0"
4176 [(set_attr "length" "8")])
4179 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4180 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4181 (match_operand:DI 2 "const_int_operand" "N"))
4183 (clobber (match_scratch:DI 3 "=r"))]
4184 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4185 "sradi %3,%1,%p2\;addze. %3,%3"
4186 [(set_attr "type" "compare")
4187 (set_attr "length" "8")])
4190 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4191 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4192 (match_operand:DI 2 "const_int_operand" "N"))
4194 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4195 (div:DI (match_dup 1) (match_dup 2)))]
4196 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4197 "sradi %0,%1,%p2\;addze. %0,%0"
4198 [(set_attr "type" "compare")
4199 (set_attr "length" "8")])
4202 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4203 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4204 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4207 [(set_attr "type" "idiv")])
4209 (define_insn "udivdi3"
4210 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4211 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4212 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4215 [(set_attr "type" "idiv")])
4217 (define_insn "rotldi3"
4218 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4219 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4220 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
4222 "rld%I2cl %0,%1,%h2,0")
4225 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4226 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4227 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4229 (clobber (match_scratch:DI 3 "=r"))]
4231 "rld%I2cl. %3,%1,%h2,0"
4232 [(set_attr "type" "delayed_compare")])
4235 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4236 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4237 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4239 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4240 (rotate:DI (match_dup 1) (match_dup 2)))]
4242 "rld%I2cl. %0,%1,%h2,0"
4243 [(set_attr "type" "delayed_compare")])
4245 (define_expand "ashldi3"
4246 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4247 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
4248 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4249 "TARGET_POWERPC64 || TARGET_POWER"
4252 if (TARGET_POWERPC64)
4254 else if (TARGET_POWER)
4256 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
4264 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4265 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4266 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4269 [(set_attr "length" "8")])
4272 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4273 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4274 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4276 (clobber (match_scratch:DI 3 "=r"))]
4279 [(set_attr "type" "delayed_compare")])
4282 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4283 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4284 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4286 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4287 (ashift:DI (match_dup 1) (match_dup 2)))]
4290 [(set_attr "type" "delayed_compare")])
4292 (define_expand "lshrdi3"
4293 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4294 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4295 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4296 "TARGET_POWERPC64 || TARGET_POWER"
4299 if (TARGET_POWERPC64)
4301 else if (TARGET_POWER)
4303 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
4311 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4312 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4313 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4318 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4319 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4320 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4322 (clobber (match_scratch:DI 3 "=r"))]
4325 [(set_attr "type" "delayed_compare")])
4328 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4329 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4330 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4332 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4333 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
4336 [(set_attr "type" "delayed_compare")])
4338 (define_expand "ashrdi3"
4339 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4340 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4341 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4342 "TARGET_POWERPC64 || TARGET_POWER"
4345 if (TARGET_POWERPC64)
4347 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
4349 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
4357 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4358 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4359 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4364 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4365 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4366 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4368 (clobber (match_scratch:DI 3 "=r"))]
4371 [(set_attr "type" "delayed_compare")])
4374 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4375 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4376 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4378 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4379 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
4382 [(set_attr "type" "delayed_compare")])
4384 (define_insn "anddi3"
4385 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4386 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4387 (match_operand:DI 2 "and_operand" "?r,K,J")))
4388 (clobber (match_scratch:CC 3 "=X,x,x"))]
4396 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
4397 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4398 (match_operand:DI 2 "and_operand" "r,K,J"))
4400 (clobber (match_scratch:DI 3 "=r,r,r"))]
4406 [(set_attr "type" "compare,compare,compare")])
4409 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
4410 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4411 (match_operand:DI 2 "and_operand" "r,K,J"))
4413 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4414 (and:DI (match_dup 1) (match_dup 2)))]
4420 [(set_attr "type" "compare,compare,compare")])
4422 ;; Take a AND with a constant that cannot be done in a single insn and try to
4423 ;; split it into two insns. This does not verify that the insns are valid
4424 ;; since this need not be done as combine will do it.
4427 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4428 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
4429 (match_operand:DI 2 "non_and_cint_operand" "")))]
4431 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
4432 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
4435 int maskval = INTVAL (operands[2]);
4436 int i, transitions, last_bit_value;
4437 int orig = maskval, first_c = maskval, second_c;
4439 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
4440 the low-order bit and count for the third transition. When we get there,
4441 make a first mask that has everything to the left of that position
4442 a one. Then make the second mask to turn off whatever else is needed. */
4444 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
4446 if (((maskval >>= 1) & 1) != last_bit_value)
4447 last_bit_value ^= 1, transitions++;
4449 if (transitions > 2)
4451 first_c |= (~0) << i;
4456 second_c = orig | ~ first_c;
4458 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
4459 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
4462 (define_insn "iordi3"
4463 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4464 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4465 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4473 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4474 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4475 (match_operand:DI 2 "gpc_reg_operand" "r"))
4477 (clobber (match_scratch:DI 3 "=r"))]
4480 [(set_attr "type" "compare")])
4483 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4484 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4485 (match_operand:DI 2 "gpc_reg_operand" "r"))
4487 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4488 (ior:DI (match_dup 1) (match_dup 2)))]
4491 [(set_attr "type" "compare")])
4493 ;; Split an IOR that we can't do in one insn into two insns, each of which
4494 ;; does one 16-bit part. This is used by combine.
4497 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4498 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
4499 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4501 [(set (match_dup 0) (ior:DI (match_dup 1) (match_dup 3)))
4502 (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 4)))]
4505 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4506 INTVAL (operands[2]) & 0xffff0000);
4507 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4510 (define_insn "xordi3"
4511 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4512 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4513 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4521 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4522 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4523 (match_operand:DI 2 "gpc_reg_operand" "r"))
4525 (clobber (match_scratch:DI 3 "=r"))]
4528 [(set_attr "type" "compare")])
4531 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4532 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4533 (match_operand:DI 2 "gpc_reg_operand" "r"))
4535 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4536 (xor:DI (match_dup 1) (match_dup 2)))]
4539 [(set_attr "type" "compare")])
4541 ;; Split an XOR that we can't do in one insn into two insns, each of which
4542 ;; does one 16-bit part. This is used by combine.
4545 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4546 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
4547 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4549 [(set (match_dup 0) (xor:DI (match_dup 1) (match_dup 3)))
4550 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 4)))]
4553 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4554 INTVAL (operands[2]) & 0xffff0000);
4555 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4559 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4560 (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4561 (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4566 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4567 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4568 (match_operand:DI 2 "gpc_reg_operand" "r")))
4570 (clobber (match_scratch:DI 3 "=r"))]
4573 [(set_attr "type" "compare")])
4576 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4577 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4578 (match_operand:DI 2 "gpc_reg_operand" "r")))
4580 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4581 (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
4584 [(set_attr "type" "compare")])
4587 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4588 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4589 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4594 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4595 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4596 (match_operand:DI 2 "gpc_reg_operand" "r"))
4598 (clobber (match_scratch:DI 3 "=r"))]
4601 [(set_attr "type" "compare")])
4604 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4605 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4606 (match_operand:DI 2 "gpc_reg_operand" "r"))
4608 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4609 (and:DI (not:DI (match_dup 1)) (match_dup 2)))]
4612 [(set_attr "type" "compare")])
4615 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4616 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4617 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4622 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4623 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4624 (match_operand:DI 2 "gpc_reg_operand" "r"))
4626 (clobber (match_scratch:DI 3 "=r"))]
4629 [(set_attr "type" "compare")])
4632 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4633 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4634 (match_operand:DI 2 "gpc_reg_operand" "r"))
4636 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4637 (ior:DI (not:DI (match_dup 1)) (match_dup 2)))]
4640 [(set_attr "type" "compare")])
4643 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4644 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4645 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4650 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4651 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4652 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4654 (clobber (match_scratch:DI 3 "=r"))]
4657 [(set_attr "type" "compare")])
4660 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4661 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4662 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4664 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4665 (ior:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
4668 [(set_attr "type" "compare")])
4671 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4672 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4673 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4678 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4679 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4680 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4682 (clobber (match_scratch:DI 3 "=r"))]
4685 [(set_attr "type" "compare")])
4688 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4689 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4690 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4692 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4693 (and:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
4696 [(set_attr "type" "compare")])
4698 ;; Now define ways of moving data around.
4700 ;; Elf specific ways of loading addresses for non-PIC code.
4701 ;; The output of this could be r0, but we limit it to base
4702 ;; registers, since almost all uses of this will need it
4703 ;; in a base register shortly.
4704 (define_insn "elf_high"
4705 [(set (match_operand:SI 0 "register_operand" "=b")
4706 (high:SI (match_operand 1 "" "")))]
4707 "TARGET_ELF && !TARGET_64BIT"
4708 "{cau|addis} %0,0,%1@ha")
4710 (define_insn "elf_low"
4711 [(set (match_operand:SI 0 "register_operand" "=r")
4712 (lo_sum:SI (match_operand:SI 1 "register_operand" "b")
4713 (match_operand 2 "" "")))]
4714 "TARGET_ELF && !TARGET_64BIT"
4715 "{cal %0,%a2@l(%1)|addi %0,%1,%2@l}")
4717 ;; For SI, we special-case integers that can't be loaded in one insn. We
4718 ;; do the load 16-bits at a time. We could do this by loading from memory,
4719 ;; and this is even supposed to be faster, but it is simpler not to get
4720 ;; integers in the TOC.
4721 (define_expand "movsi"
4722 [(set (match_operand:SI 0 "general_operand" "")
4723 (match_operand:SI 1 "any_operand" ""))]
4727 if (GET_CODE (operands[0]) != REG)
4728 operands[1] = force_reg (SImode, operands[1]);
4730 /* Convert a move of a CONST_DOUBLE into a CONST_INT */
4731 if (GET_CODE (operands[1]) == CONST_DOUBLE)
4732 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
4734 if (TARGET_ELF && TARGET_NO_TOC && !TARGET_64BIT
4735 && CONSTANT_P (operands[1])
4736 && GET_CODE (operands[1]) != HIGH
4737 && GET_CODE (operands[1]) != CONST_INT)
4739 rtx target = (reload_completed || reload_in_progress)
4740 ? operands[0] : gen_reg_rtx (SImode);
4742 /* If this is a function address on -mcall-aixdesc or -mcall-nt,
4743 convert it to the address of the descriptor. */
4744 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
4745 && GET_CODE (operands[1]) == SYMBOL_REF
4746 && XSTR (operands[1], 0)[0] == '.')
4748 char *name = XSTR (operands[1], 0);
4750 while (*name == '.')
4752 new_ref = gen_rtx (SYMBOL_REF, Pmode, name);
4753 CONSTANT_POOL_ADDRESS_P (new_ref) = CONSTANT_POOL_ADDRESS_P (operands[1]);
4754 SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
4755 SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
4756 operands[1] = new_ref;
4759 emit_insn (gen_elf_high (target, operands[1]));
4760 emit_insn (gen_elf_low (operands[0], target, operands[1]));
4764 if (GET_CODE (operands[1]) == CONST
4765 && DEFAULT_ABI == ABI_NT
4766 && !side_effects_p (operands[0]))
4768 rtx const_term = const0_rtx;
4769 rtx sym = eliminate_constant_term (XEXP (operands[1], 0), &const_term);
4770 if (sym && GET_CODE (const_term) == CONST_INT
4771 && (GET_CODE (sym) == SYMBOL_REF || GET_CODE (sym) == LABEL_REF))
4773 emit_insn (gen_movsi (operands[0], sym));
4774 if (INTVAL (const_term) != 0)
4776 unsigned HOST_WIDE_INT value = INTVAL (const_term);
4777 if (value + 0x8000 < 0x10000)
4778 emit_insn (gen_addsi3 (operands[0], operands[0], GEN_INT (value)));
4781 emit_insn (gen_addsi3 (operands[0], operands[0],
4782 GEN_INT ((value >> 16) + ((value >> 15) & 1))));
4784 if ((value & 0xffff) != 0)
4785 emit_insn (gen_addsi3 (operands[0], operands[0],
4786 GEN_INT (value & 0xffff)));
4792 fatal_insn (\"bad address\", operands[1]);
4795 if ((!TARGET_WINDOWS_NT || DEFAULT_ABI != ABI_NT)
4796 && CONSTANT_P (operands[1])
4797 && GET_CODE (operands[1]) != CONST_INT
4798 && GET_CODE (operands[1]) != HIGH
4799 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
4801 /* If we are to limit the number of things we put in the TOC and
4802 this is a symbol plus a constant we can add in one insn,
4803 just put the symbol in the TOC and add the constant. Don't do
4804 this if reload is in progress. */
4805 if (GET_CODE (operands[1]) == CONST
4806 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
4807 && GET_CODE (XEXP (operands[1], 0)) == PLUS
4808 && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
4809 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
4810 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
4811 && ! side_effects_p (operands[0]))
4813 rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
4814 rtx other = XEXP (XEXP (operands[1], 0), 1);
4816 emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
4820 operands[1] = force_const_mem (SImode, operands[1]);
4821 if (! memory_address_p (SImode, XEXP (operands[1], 0))
4822 && ! reload_in_progress)
4823 operands[1] = change_address (operands[1], SImode,
4824 XEXP (operands[1], 0));
4829 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,r,r,r,r,r,*q,*c*l,*h")
4830 (match_operand:SI 1 "input_operand" "r,S,T,m,r,I,J,n,R,*h,r,r,0"))]
4831 "gpc_reg_operand (operands[0], SImode)
4832 || gpc_reg_operand (operands[1], SImode)"
4835 {l|lwz} %0,[toc]%1(2)
4836 {l|lwz} %0,[toc]%l1(2)
4837 {l%U1%X1|lwz%U1%X1} %0,%1
4838 {st%U0%X0|stw%U0%X0} %1,%0
4847 [(set_attr "type" "*,load,load,load,*,*,*,*,*,*,*,mtjmpr,*")
4848 (set_attr "length" "4,4,4,4,4,4,4,8,4,4,4,4,4")])
4850 ;; Split a load of a large constant into the appropriate two-insn
4854 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4855 (match_operand:SI 1 "const_int_operand" ""))]
4856 "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
4857 && (INTVAL (operands[1]) & 0xffff) != 0"
4861 (ior:SI (match_dup 0)
4865 operands[2] = gen_rtx (CONST_INT, VOIDmode,
4866 INTVAL (operands[1]) & 0xffff0000);
4867 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
4871 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4872 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
4874 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
4877 [(set_attr "type" "compare")])
4879 (define_expand "movhi"
4880 [(set (match_operand:HI 0 "general_operand" "")
4881 (match_operand:HI 1 "any_operand" ""))]
4885 if (GET_CODE (operands[0]) != REG)
4886 operands[1] = force_reg (HImode, operands[1]);
4888 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
4890 operands[1] = force_const_mem (HImode, operands[1]);
4891 if (! memory_address_p (HImode, XEXP (operands[1], 0))
4892 && ! reload_in_progress)
4893 operands[1] = change_address (operands[1], HImode,
4894 XEXP (operands[1], 0));
4899 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
4900 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
4901 "gpc_reg_operand (operands[0], HImode)
4902 || gpc_reg_operand (operands[1], HImode)"
4912 [(set_attr "type" "*,load,*,*,*,*,mtjmpr,*")])
4914 (define_expand "movqi"
4915 [(set (match_operand:QI 0 "general_operand" "")
4916 (match_operand:QI 1 "any_operand" ""))]
4920 if (GET_CODE (operands[0]) != REG)
4921 operands[1] = force_reg (QImode, operands[1]);
4923 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
4925 operands[1] = force_const_mem (QImode, operands[1]);
4926 if (! memory_address_p (QImode, XEXP (operands[1], 0))
4927 && ! reload_in_progress)
4928 operands[1] = change_address (operands[1], QImode,
4929 XEXP (operands[1], 0));
4934 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
4935 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
4936 "gpc_reg_operand (operands[0], QImode)
4937 || gpc_reg_operand (operands[1], QImode)"
4947 [(set_attr "type" "*,load,*,*,*,*,mtjmpr,*")])
4949 ;; Here is how to move condition codes around. When we store CC data in
4950 ;; an integer register or memory, we store just the high-order 4 bits.
4951 ;; This lets us not shift in the most common case of CR0.
4952 (define_expand "movcc"
4953 [(set (match_operand:CC 0 "nonimmediate_operand" "")
4954 (match_operand:CC 1 "nonimmediate_operand" ""))]
4959 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
4960 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
4961 "register_operand (operands[0], CCmode)
4962 || register_operand (operands[1], CCmode)"
4966 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
4968 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
4970 {l%U1%X1|lwz%U1%X1} %0,%1
4971 {st%U0%U1|stw%U0%U1} %1,%0"
4972 [(set_attr "type" "*,*,*,compare,*,*,load,*")
4973 (set_attr "length" "*,*,12,*,8,*,*,*")])
4975 ;; For floating-point, we normally deal with the floating-point registers
4976 ;; unless -msoft-float is used. The sole exception is that parameter passing
4977 ;; can produce floating-point values in fixed-point registers. Unless the
4978 ;; value is a simple constant or already in memory, we deal with this by
4979 ;; allocating memory and copying the value explicitly via that memory location.
4980 (define_expand "movsf"
4981 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4982 (match_operand:SF 1 "any_operand" ""))]
4986 /* If we are called from reload, we might be getting a SUBREG of a hard
4987 reg. So expand it. */
4988 if (GET_CODE (operands[0]) == SUBREG
4989 && GET_CODE (SUBREG_REG (operands[0])) == REG
4990 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
4991 operands[0] = alter_subreg (operands[0]);
4992 if (GET_CODE (operands[1]) == SUBREG
4993 && GET_CODE (SUBREG_REG (operands[1])) == REG
4994 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
4995 operands[1] = alter_subreg (operands[1]);
4997 if (TARGET_SOFT_FLOAT && GET_CODE (operands[0]) == MEM)
4998 operands[1] = force_reg (SFmode, operands[1]);
5000 else if (TARGET_HARD_FLOAT)
5002 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
5004 /* If this is a store to memory or another integer register do the
5005 move directly. Otherwise store to a temporary stack slot and
5006 load from there into a floating point register. */
5008 if (GET_CODE (operands[0]) == MEM
5009 || (GET_CODE (operands[0]) == REG
5010 && (REGNO (operands[0]) < 32
5011 || (reload_in_progress
5012 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
5014 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5015 operand_subword (operands[1], 0, 0, SFmode));
5020 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5022 emit_move_insn (stack_slot, operands[1]);
5023 emit_move_insn (operands[0], stack_slot);
5028 if (GET_CODE (operands[0]) == MEM)
5030 /* If operands[1] is a register, it may have double-precision data
5031 in it, so truncate it to single precision. We need not do
5032 this for POWERPC. */
5033 if (! TARGET_POWERPC && TARGET_HARD_FLOAT
5034 && GET_CODE (operands[1]) == REG)
5037 = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
5038 emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
5039 operands[1] = newreg;
5042 operands[1] = force_reg (SFmode, operands[1]);
5045 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
5047 if (GET_CODE (operands[1]) == MEM
5048 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
5049 || GET_CODE (operands[1]) == CONST_DOUBLE
5051 || (GET_CODE (operands[1]) == REG
5052 && (REGNO (operands[1]) < 32
5053 || (reload_in_progress
5054 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))))
5056 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5057 operand_subword (operands[1], 0, 0, SFmode));
5062 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5064 emit_move_insn (stack_slot, operands[1]);
5065 emit_move_insn (operands[0], stack_slot);
5071 if (CONSTANT_P (operands[1]))
5073 operands[1] = force_const_mem (SFmode, operands[1]);
5074 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
5075 && ! reload_in_progress)
5076 operands[1] = change_address (operands[1], SFmode,
5077 XEXP (operands[1], 0));
5082 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5083 (match_operand:SF 1 "easy_fp_constant" ""))]
5084 "reload_completed && REGNO (operands[0]) <= 31"
5085 [(set (match_dup 2) (match_dup 3))]
5087 { operands[2] = operand_subword (operands[0], 0, 0, SFmode);
5088 operands[3] = operand_subword (operands[1], 0, 0, SFmode); }")
5091 [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m")
5092 (match_operand:SF 1 "input_operand" "f,m,f"))]
5093 "(gpc_reg_operand (operands[0], SFmode)
5094 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
5099 [(set_attr "type" "fp,fpload,*")])
5102 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
5103 (match_operand:SF 1 "input_operand" "r,m,r,I,J,R"))]
5104 "(gpc_reg_operand (operands[0], SFmode)
5105 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
5108 {l%U1%X1|lwz%U1%X1} %0,%1
5109 {st%U0%X0|stw%U0%X0} %1,%0
5113 [(set_attr "type" "*,load,*,*,*,*")])
5116 (define_expand "movdf"
5117 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5118 (match_operand:DF 1 "any_operand" ""))]
5122 if (GET_CODE (operands[0]) != REG)
5123 operands[1] = force_reg (DFmode, operands[1]);
5125 if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
5127 operands[1] = force_const_mem (DFmode, operands[1]);
5128 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
5129 && ! reload_in_progress)
5130 operands[1] = change_address (operands[1], DFmode,
5131 XEXP (operands[1], 0));
5136 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5137 (match_operand:DF 1 "easy_fp_constant" ""))]
5138 "reload_completed && REGNO (operands[0]) <= 31"
5139 [(set (match_dup 2) (match_dup 3))
5140 (set (match_dup 4) (match_dup 5))]
5142 { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
5143 operands[3] = operand_subword (operands[1], 0, 0, DFmode);
5144 operands[4] = operand_subword (operands[0], 1, 0, DFmode);
5145 operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
5147 ;; Don't have reload use general registers to load a constant. First,
5148 ;; it might not work if the output operand has is the equivalent of
5149 ;; a non-offsettable memref, but also it is less efficient than loading
5150 ;; the constant into an FP register, since it will probably be used there.
5151 ;; The "??" is a kludge until we can figure out a more reasonable way
5152 ;; of handling these non-offsettable values.
5154 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,f,f,m")
5155 (match_operand:DF 1 "input_operand" "r,o,r,G,f,m,f"))]
5156 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
5157 && (register_operand (operands[0], DFmode)
5158 || register_operand (operands[1], DFmode))"
5161 switch (which_alternative)
5164 /* We normally copy the low-numbered register first. However, if
5165 the first register operand 0 is the same as the second register of
5166 operand 1, we must copy in the opposite order. */
5167 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5168 return \"mr %L0,%L1\;mr %0,%1\";
5170 return \"mr %0,%1\;mr %L0,%L1\";
5172 /* If the low-address word is used in the address, we must load it
5173 last. Otherwise, load it first. Note that we cannot have
5174 auto-increment in that case since the address register is known to be
5176 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5178 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5180 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5182 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5186 return \"fmr %0,%1\";
5188 return \"lfd%U1%X1 %0,%1\";
5190 return \"stfd%U0%X0 %1,%0\";
5193 [(set_attr "type" "*,load,*,*,fp,fpload,*")
5194 (set_attr "length" "8,8,8,8,*,*,*")])
5197 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r")
5198 (match_operand:DF 1 "input_operand" "r,o,r,G"))]
5199 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5200 && (register_operand (operands[0], DFmode)
5201 || register_operand (operands[1], DFmode))"
5204 switch (which_alternative)
5207 /* We normally copy the low-numbered register first. However, if
5208 the first register operand 0 is the same as the second register of
5209 operand 1, we must copy in the opposite order. */
5210 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5211 return \"mr %L0,%L1\;mr %0,%1\";
5213 return \"mr %0,%1\;mr %L0,%L1\";
5215 /* If the low-address word is used in the address, we must load it
5216 last. Otherwise, load it first. Note that we cannot have
5217 auto-increment in that case since the address register is known to be
5219 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5221 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5223 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5225 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5230 [(set_attr "type" "*,load,*,*")
5231 (set_attr "length" "8,8,8,8")])
5234 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,f,f,m")
5235 (match_operand:DF 1 "input_operand" "r,o,r,G,f,m,f"))]
5236 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
5237 && (register_operand (operands[0], DFmode)
5238 || register_operand (operands[1], DFmode))"
5247 [(set_attr "type" "*,load,*,*,fp,fpload,*")])
5250 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r")
5251 (match_operand:DF 1 "input_operand" "r,o,r,G"))]
5252 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5253 && (register_operand (operands[0], DFmode)
5254 || register_operand (operands[1], DFmode))"
5260 [(set_attr "type" "*,load,*,*")])
5262 ;; Next come the multi-word integer load and store and the load and store
5264 (define_expand "movdi"
5265 [(set (match_operand:DI 0 "general_operand" "")
5266 (match_operand:DI 1 "general_operand" ""))]
5270 if (GET_CODE (operands[0]) == MEM)
5271 operands[1] = force_reg (DImode, operands[1]);
5273 if (GET_CODE (operands[1]) == CONST_DOUBLE
5274 || GET_CODE (operands[1]) == CONST_INT)
5279 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5281 low = CONST_DOUBLE_LOW (operands[1]);
5282 high = CONST_DOUBLE_HIGH (operands[1]);
5286 low = INTVAL (operands[1]);
5287 high = (low < 0) ? ~0 : 0;
5290 emit_move_insn (gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN),
5293 emit_move_insn (gen_rtx (SUBREG, SImode, operands[0], !WORDS_BIG_ENDIAN),
5298 /* Stores between FPR and any non-FPR registers must go through a
5299 temporary stack slot. */
5301 if (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
5302 && ((FP_REGNO_P (REGNO (operands[0]))
5303 && ! FP_REGNO_P (REGNO (operands[1])))
5304 || (FP_REGNO_P (REGNO (operands[1]))
5305 && ! FP_REGNO_P (REGNO (operands[0])))))
5307 rtx stack_slot = assign_stack_temp (DImode, 8, 0);
5309 emit_move_insn (stack_slot, operands[1]);
5310 emit_move_insn (operands[0], stack_slot);
5316 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m")
5317 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f"))]
5318 "! TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode)
5319 || gpc_reg_operand (operands[1], DImode))"
5322 switch (which_alternative)
5325 /* We normally copy the low-numbered register first. However, if
5326 the first register operand 0 is the same as the second register of
5327 operand 1, we must copy in the opposite order. */
5328 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5329 return \"mr %L0,%L1\;mr %0,%1\";
5331 return \"mr %0,%1\;mr %L0,%L1\";
5333 /* If the low-address word is used in the address, we must load it
5334 last. Otherwise, load it first. Note that we cannot have
5335 auto-increment in that case since the address register is known to be
5337 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5339 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5341 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5343 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5345 return \"fmr %0,%1\";
5347 return \"lfd%U1%X1 %0,%1\";
5349 return \"stfd%U0%X0 %1,%0\";
5352 [(set_attr "type" "*,load,*,fp,fpload,*")
5353 (set_attr "length" "8,8,8,*,*,*")])
5356 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,f,f,m,r,*h")
5357 (match_operand:DI 1 "input_operand" "r,m,r,I,J,R,f,m,f,*h,r"))]
5358 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode)
5359 || gpc_reg_operand (operands[1], DImode))"
5372 [(set_attr "type" "*,load,*,*,*,*,fp,fpload,*,*,mtjmpr")])
5374 ;; TImode is similar, except that we usually want to compute the address into
5375 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
5376 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
5377 (define_expand "movti"
5378 [(parallel [(set (match_operand:TI 0 "general_operand" "")
5379 (match_operand:TI 1 "general_operand" ""))
5380 (clobber (scratch:SI))])]
5381 "TARGET_STRING || TARGET_POWERPC64"
5384 if (GET_CODE (operands[0]) == MEM)
5385 operands[1] = force_reg (TImode, operands[1]);
5387 if (GET_CODE (operands[0]) == MEM
5388 && GET_CODE (XEXP (operands[0], 0)) != REG
5389 && ! reload_in_progress)
5390 operands[0] = change_address (operands[0], TImode,
5391 copy_addr_to_reg (XEXP (operands[0], 0)));
5393 if (GET_CODE (operands[1]) == MEM
5394 && GET_CODE (XEXP (operands[1], 0)) != REG
5395 && ! reload_in_progress)
5396 operands[1] = change_address (operands[1], TImode,
5397 copy_addr_to_reg (XEXP (operands[1], 0)));
5400 ;; We say that MQ is clobbered in the last alternative because the first
5401 ;; alternative would never get used otherwise since it would need a reload
5402 ;; while the 2nd alternative would not. We put memory cases first so they
5403 ;; are preferred. Otherwise, we'd try to reload the output instead of
5404 ;; giving the SCRATCH mq.
5406 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
5407 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
5408 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
5409 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
5410 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
5413 switch (which_alternative)
5419 return \"{stsi|stswi} %1,%P0,16\";
5422 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
5425 /* Normally copy registers with lowest numbered register copied first.
5426 But copy in the other order if the first register of the output
5427 is the second, third, or fourth register in the input. */
5428 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
5429 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
5430 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
5432 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
5434 /* If the address is not used in the output, we can use lsi. Otherwise,
5435 fall through to generating four loads. */
5436 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
5437 return \"{lsi|lswi} %0,%P1,16\";
5438 /* ... fall through ... */
5440 /* If the address register is the same as the register for the lowest-
5441 addressed word, load it last. Similarly for the next two words.
5442 Otherwise load lowest address to highest. */
5443 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5445 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
5446 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
5447 REGNO (operands[0]) + 2, operands[1], 0))
5448 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
5449 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
5450 REGNO (operands[0]) + 3, operands[1], 0))
5451 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
5453 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
5456 [(set_attr "type" "*,load,load,*,*")
5457 (set_attr "length" "*,16,16,*,16")])
5460 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
5461 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
5462 (clobber (match_scratch:SI 2 "=X,X,X"))]
5463 "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
5464 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
5467 switch (which_alternative)
5473 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
5476 /* Normally copy registers with lowest numbered register copied first.
5477 But copy in the other order if the first register of the output
5478 is the second, third, or fourth register in the input. */
5479 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
5480 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
5481 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
5483 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
5485 /* If the address register is the same as the register for the lowest-
5486 addressed word, load it last. Similarly for the next two words.
5487 Otherwise load lowest address to highest. */
5488 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5490 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
5491 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
5492 REGNO (operands[0]) + 2, operands[1], 0))
5493 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
5494 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
5495 REGNO (operands[0]) + 3, operands[1], 0))
5496 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
5498 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
5501 [(set_attr "type" "load,*,*")
5502 (set_attr "length" "16,16,16")])
5505 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
5506 (match_operand:TI 1 "input_operand" "r,m,r"))]
5507 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
5508 || gpc_reg_operand (operands[1], TImode))"
5511 switch (which_alternative)
5514 /* We normally copy the low-numbered register first. However, if
5515 the first register operand 0 is the same as the second register of
5516 operand 1, we must copy in the opposite order. */
5517 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5518 return \"mr %L0,%L1\;mr %0,%1\";
5520 return \"mr %0,%1\;mr %L0,%L1\";
5522 /* If the low-address word is used in the address, we must load it
5523 last. Otherwise, load it first. Note that we cannot have
5524 auto-increment in that case since the address register is known to be
5526 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5528 return \"ld %L0,%L1\;ld %0,%1\";
5530 return \"ld%U1 %0,%1\;ld %L0,%L1\";
5532 return \"std%U0 %1,%0\;std %L1,%L0\";
5535 [(set_attr "type" "*,load,*")
5536 (set_attr "length" "8,8,8")])
5538 (define_expand "load_multiple"
5539 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
5540 (match_operand:SI 1 "" ""))
5541 (use (match_operand:SI 2 "" ""))])]
5550 /* Support only loading a constant number of fixed-point registers from
5551 memory and only bother with this if more than two; the machine
5552 doesn't support more than eight. */
5553 if (GET_CODE (operands[2]) != CONST_INT
5554 || INTVAL (operands[2]) <= 2
5555 || INTVAL (operands[2]) > 8
5556 || GET_CODE (operands[1]) != MEM
5557 || GET_CODE (operands[0]) != REG
5558 || REGNO (operands[0]) >= 32)
5561 count = INTVAL (operands[2]);
5562 regno = REGNO (operands[0]);
5564 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
5565 from = force_reg (SImode, XEXP (operands[1], 0));
5567 for (i = 0; i < count; i++)
5568 XVECEXP (operands[3], 0, i)
5569 = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
5570 gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
5574 [(match_parallel 0 "load_multiple_operation"
5575 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
5576 (mem:SI (match_operand:SI 2 "register_operand" "b")))])]
5580 /* We have to handle the case where the pseudo used to contain the address
5581 is assigned to one of the output registers. */
5583 int words = XVECLEN (operands[0], 0);
5586 if (XVECLEN (operands[0], 0) == 1)
5587 return \"{l|lwz} %1,0(%2)\";
5589 for (i = 0; i < words; i++)
5590 if (refers_to_regno_p (REGNO (operands[1]) + i,
5591 REGNO (operands[1]) + i + 1, operands[2], 0))
5595 xop[0] = operands[1];
5596 xop[1] = operands[2];
5597 xop[2] = GEN_INT (4 * (words-1));
5598 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
5603 xop[0] = operands[1];
5604 xop[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
5605 xop[2] = GEN_INT (4 * (words-1));
5606 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
5611 for (j = 0; j < words; j++)
5614 xop[0] = gen_rtx (REG, SImode, REGNO (operands[1]) + j);
5615 xop[1] = operands[2];
5616 xop[2] = GEN_INT (j * 4);
5617 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
5619 xop[0] = operands[2];
5620 xop[1] = GEN_INT (i * 4);
5621 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
5626 return \"{lsi|lswi} %1,%2,%N0\";
5628 [(set_attr "type" "load")
5629 (set_attr "length" "32")])
5632 (define_expand "store_multiple"
5633 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
5634 (match_operand:SI 1 "" ""))
5635 (clobber (scratch:SI))
5636 (use (match_operand:SI 2 "" ""))])]
5645 /* Support only storing a constant number of fixed-point registers to
5646 memory and only bother with this if more than two; the machine
5647 doesn't support more than eight. */
5648 if (GET_CODE (operands[2]) != CONST_INT
5649 || INTVAL (operands[2]) <= 2
5650 || INTVAL (operands[2]) > 8
5651 || GET_CODE (operands[0]) != MEM
5652 || GET_CODE (operands[1]) != REG
5653 || REGNO (operands[1]) >= 32)
5656 count = INTVAL (operands[2]);
5657 regno = REGNO (operands[1]);
5659 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
5660 to = force_reg (SImode, XEXP (operands[0], 0));
5662 XVECEXP (operands[3], 0, 0)
5663 = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]);
5664 XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
5665 gen_rtx (SCRATCH, SImode));
5667 for (i = 1; i < count; i++)
5668 XVECEXP (operands[3], 0, i + 1)
5669 = gen_rtx (SET, VOIDmode,
5670 gen_rtx (MEM, SImode, plus_constant (to, i * 4)),
5671 gen_rtx (REG, SImode, regno + i));
5675 [(match_parallel 0 "store_multiple_operation"
5676 [(set (match_operand:SI 1 "indirect_operand" "=Q")
5677 (match_operand:SI 2 "gpc_reg_operand" "r"))
5678 (clobber (match_scratch:SI 3 "=q"))])]
5679 "TARGET_STRING && TARGET_POWER"
5680 "{stsi|stswi} %2,%P1,%O0")
5683 [(match_parallel 0 "store_multiple_operation"
5684 [(set (mem:SI (match_operand:SI 1 "register_operand" "b"))
5685 (match_operand:SI 2 "gpc_reg_operand" "r"))
5686 (clobber (match_scratch:SI 3 "X"))])]
5687 "TARGET_STRING && !TARGET_POWER"
5688 "{stsi|stswi} %2,%1,%O0")
5691 ;; String/block move insn.
5692 ;; Argument 0 is the destination
5693 ;; Argument 1 is the source
5694 ;; Argument 2 is the length
5695 ;; Argument 3 is the alignment
5697 (define_expand "movstrsi"
5698 [(parallel [(set (match_operand:BLK 0 "" "")
5699 (match_operand:BLK 1 "" ""))
5700 (use (match_operand:SI 2 "" ""))
5701 (use (match_operand:SI 3 "" ""))])]
5705 if (expand_block_move (operands))
5711 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
5712 ;; register allocator doesn't have a clue about allocating 8 word registers
5713 (define_expand "movstrsi_8reg"
5714 [(parallel [(set (match_operand 0 "" "")
5715 (match_operand 1 "" ""))
5716 (use (match_operand 2 "" ""))
5717 (use (match_operand 3 "" ""))
5718 (clobber (reg:SI 5))
5719 (clobber (reg:SI 6))
5720 (clobber (reg:SI 7))
5721 (clobber (reg:SI 8))
5722 (clobber (reg:SI 9))
5723 (clobber (reg:SI 10))
5724 (clobber (reg:SI 11))
5725 (clobber (reg:SI 12))
5726 (clobber (match_scratch:SI 4 ""))])]
5731 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5732 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5733 (use (match_operand:SI 2 "immediate_operand" "i"))
5734 (use (match_operand:SI 3 "immediate_operand" "i"))
5735 (clobber (match_operand:SI 4 "register_operand" "=r"))
5736 (clobber (reg:SI 6))
5737 (clobber (reg:SI 7))
5738 (clobber (reg:SI 8))
5739 (clobber (reg:SI 9))
5740 (clobber (reg:SI 10))
5741 (clobber (reg:SI 11))
5742 (clobber (reg:SI 12))
5743 (clobber (match_scratch:SI 5 "=q"))]
5744 "TARGET_STRING && TARGET_POWER
5745 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
5746 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
5747 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
5748 && REGNO (operands[4]) == 5"
5749 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5750 [(set_attr "length" "8")])
5753 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5754 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5755 (use (match_operand:SI 2 "immediate_operand" "i"))
5756 (use (match_operand:SI 3 "immediate_operand" "i"))
5757 (clobber (match_operand:SI 4 "register_operand" "=r"))
5758 (clobber (reg:SI 6))
5759 (clobber (reg:SI 7))
5760 (clobber (reg:SI 8))
5761 (clobber (reg:SI 9))
5762 (clobber (reg:SI 10))
5763 (clobber (reg:SI 11))
5764 (clobber (reg:SI 12))
5765 (clobber (match_scratch:SI 5 "X"))]
5766 "TARGET_STRING && !TARGET_POWER
5767 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
5768 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
5769 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
5770 && REGNO (operands[4]) == 5"
5771 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5772 [(set_attr "length" "8")])
5774 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
5775 ;; register allocator doesn't have a clue about allocating 6 word registers
5776 (define_expand "movstrsi_6reg"
5777 [(parallel [(set (match_operand 0 "" "")
5778 (match_operand 1 "" ""))
5779 (use (match_operand 2 "" ""))
5780 (use (match_operand 3 "" ""))
5781 (clobber (reg:SI 7))
5782 (clobber (reg:SI 8))
5783 (clobber (reg:SI 9))
5784 (clobber (reg:SI 10))
5785 (clobber (reg:SI 11))
5786 (clobber (reg:SI 12))
5787 (clobber (match_scratch:SI 4 ""))])]
5792 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5793 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5794 (use (match_operand:SI 2 "immediate_operand" "i"))
5795 (use (match_operand:SI 3 "immediate_operand" "i"))
5796 (clobber (match_operand:SI 4 "register_operand" "=r"))
5797 (clobber (reg:SI 8))
5798 (clobber (reg:SI 9))
5799 (clobber (reg:SI 10))
5800 (clobber (reg:SI 11))
5801 (clobber (reg:SI 12))
5802 (clobber (match_scratch:SI 5 "=q"))]
5803 "TARGET_STRING && TARGET_POWER
5804 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
5805 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
5806 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
5807 && REGNO (operands[4]) == 7"
5808 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5809 [(set_attr "length" "8")])
5812 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5813 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5814 (use (match_operand:SI 2 "immediate_operand" "i"))
5815 (use (match_operand:SI 3 "immediate_operand" "i"))
5816 (clobber (match_operand:SI 4 "register_operand" "=r"))
5817 (clobber (reg:SI 8))
5818 (clobber (reg:SI 9))
5819 (clobber (reg:SI 10))
5820 (clobber (reg:SI 11))
5821 (clobber (reg:SI 12))
5822 (clobber (match_scratch:SI 5 "X"))]
5823 "TARGET_STRING && !TARGET_POWER
5824 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
5825 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
5826 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
5827 && REGNO (operands[4]) == 7"
5828 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5829 [(set_attr "length" "8")])
5831 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
5833 (define_expand "movstrsi_4reg"
5834 [(parallel [(set (match_operand 0 "" "")
5835 (match_operand 1 "" ""))
5836 (use (match_operand 2 "" ""))
5837 (use (match_operand 3 "" ""))
5838 (clobber (reg:SI 9))
5839 (clobber (reg:SI 10))
5840 (clobber (reg:SI 11))
5841 (clobber (reg:SI 12))
5842 (clobber (match_scratch:SI 4 ""))])]
5847 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5848 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5849 (use (match_operand:SI 2 "immediate_operand" "i"))
5850 (use (match_operand:SI 3 "immediate_operand" "i"))
5851 (clobber (match_operand:SI 4 "register_operand" "=r"))
5852 (clobber (reg:SI 10))
5853 (clobber (reg:SI 11))
5854 (clobber (reg:SI 12))
5855 (clobber (match_scratch:SI 5 "=q"))]
5856 "TARGET_STRING && TARGET_POWER
5857 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
5858 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
5859 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
5860 && REGNO (operands[4]) == 9"
5861 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5862 [(set_attr "length" "8")])
5865 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5866 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5867 (use (match_operand:SI 2 "immediate_operand" "i"))
5868 (use (match_operand:SI 3 "immediate_operand" "i"))
5869 (clobber (match_operand:SI 4 "register_operand" "=r"))
5870 (clobber (reg:SI 10))
5871 (clobber (reg:SI 11))
5872 (clobber (reg:SI 12))
5873 (clobber (match_scratch:SI 5 "X"))]
5874 "TARGET_STRING && !TARGET_POWER
5875 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
5876 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
5877 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
5878 && REGNO (operands[4]) == 9"
5879 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5880 [(set_attr "length" "8")])
5882 ;; Move up to 8 bytes at a time.
5883 (define_expand "movstrsi_2reg"
5884 [(parallel [(set (match_operand 0 "" "")
5885 (match_operand 1 "" ""))
5886 (use (match_operand 2 "" ""))
5887 (use (match_operand 3 "" ""))
5888 (clobber (match_scratch:DI 4 ""))
5889 (clobber (match_scratch:SI 5 ""))])]
5890 "TARGET_STRING && !TARGET_64BIT"
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_scratch:DI 4 "=&r"))
5899 (clobber (match_scratch:SI 5 "=q"))]
5900 "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
5901 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
5902 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5903 [(set_attr "length" "8")])
5906 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5907 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5908 (use (match_operand:SI 2 "immediate_operand" "i"))
5909 (use (match_operand:SI 3 "immediate_operand" "i"))
5910 (clobber (match_scratch:DI 4 "=&r"))
5911 (clobber (match_scratch:SI 5 "X"))]
5912 "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
5913 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
5914 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5915 [(set_attr "length" "8")])
5917 ;; Move up to 4 bytes at a time.
5918 (define_expand "movstrsi_1reg"
5919 [(parallel [(set (match_operand 0 "" "")
5920 (match_operand 1 "" ""))
5921 (use (match_operand 2 "" ""))
5922 (use (match_operand 3 "" ""))
5923 (clobber (match_scratch:SI 4 ""))
5924 (clobber (match_scratch:SI 5 ""))])]
5929 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5930 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5931 (use (match_operand:SI 2 "immediate_operand" "i"))
5932 (use (match_operand:SI 3 "immediate_operand" "i"))
5933 (clobber (match_scratch:SI 4 "=&r"))
5934 (clobber (match_scratch:SI 5 "=q"))]
5935 "TARGET_STRING && TARGET_POWER
5936 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
5937 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5938 [(set_attr "length" "8")])
5941 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
5942 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
5943 (use (match_operand:SI 2 "immediate_operand" "i"))
5944 (use (match_operand:SI 3 "immediate_operand" "i"))
5945 (clobber (match_scratch:SI 4 "=&r"))
5946 (clobber (match_scratch:SI 5 "X"))]
5947 "TARGET_STRING && !TARGET_POWER
5948 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
5949 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
5950 [(set_attr "length" "8")])
5953 ;; Define insns that do load or store with update. Some of these we can
5954 ;; get by using pre-decrement or pre-increment, but the hardware can also
5955 ;; do cases where the increment is not the size of the object.
5957 ;; In all these cases, we use operands 0 and 1 for the register being
5958 ;; incremented because those are the operands that local-alloc will
5959 ;; tie and these are the pair most likely to be tieable (and the ones
5960 ;; that will benefit the most).
5963 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
5964 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
5965 (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
5966 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
5967 (plus:DI (match_dup 1) (match_dup 2)))]
5972 [(set_attr "type" "load")])
5975 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
5977 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
5978 (match_operand:DI 2 "gpc_reg_operand" "r")))))
5979 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
5980 (plus:DI (match_dup 1) (match_dup 2)))]
5983 [(set_attr "type" "load")])
5985 (define_insn "movdi_update"
5986 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
5987 (match_operand:DI 2 "reg_or_short_operand" "r,I")))
5988 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
5989 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
5990 (plus:DI (match_dup 1) (match_dup 2)))]
5997 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
5998 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5999 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6000 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6001 (plus:SI (match_dup 1) (match_dup 2)))]
6004 {lux|lwzux} %3,%0,%2
6005 {lu|lwzu} %3,%2(%0)"
6006 [(set_attr "type" "load")])
6008 (define_insn "movsi_update"
6009 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6010 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6011 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6012 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6013 (plus:SI (match_dup 1) (match_dup 2)))]
6016 {stux|stwux} %3,%0,%2
6017 {stu|stwu} %3,%2(%0)")
6020 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
6021 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6022 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6023 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6024 (plus:SI (match_dup 1) (match_dup 2)))]
6029 [(set_attr "type" "load")])
6032 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6034 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6035 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6036 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6037 (plus:SI (match_dup 1) (match_dup 2)))]
6042 [(set_attr "type" "load")])
6045 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6047 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6048 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6049 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6050 (plus:SI (match_dup 1) (match_dup 2)))]
6055 [(set_attr "type" "load")])
6058 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6059 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6060 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
6061 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6062 (plus:SI (match_dup 1) (match_dup 2)))]
6069 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
6070 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6071 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6072 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6073 (plus:SI (match_dup 1) (match_dup 2)))]
6078 [(set_attr "type" "load")])
6081 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6083 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6084 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6085 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6086 (plus:SI (match_dup 1) (match_dup 2)))]
6091 [(set_attr "type" "load")])
6094 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6095 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6096 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
6097 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6098 (plus:SI (match_dup 1) (match_dup 2)))]
6105 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
6106 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6107 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6108 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6109 (plus:SI (match_dup 1) (match_dup 2)))]
6114 [(set_attr "type" "fpload")])
6117 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6118 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6119 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
6120 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6121 (plus:SI (match_dup 1) (match_dup 2)))]
6128 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
6129 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6130 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6131 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6132 (plus:SI (match_dup 1) (match_dup 2)))]
6137 [(set_attr "type" "fpload")])
6140 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6141 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6142 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
6143 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6144 (plus:SI (match_dup 1) (match_dup 2)))]
6150 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
6153 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6154 (match_operand:DF 1 "memory_operand" ""))
6155 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
6156 (match_operand:DF 3 "memory_operand" ""))]
6158 && TARGET_HARD_FLOAT
6159 && registers_ok_for_quad_peep (operands[0], operands[2])
6160 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
6161 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
6165 [(set (match_operand:DF 0 "memory_operand" "")
6166 (match_operand:DF 1 "gpc_reg_operand" "f"))
6167 (set (match_operand:DF 2 "memory_operand" "")
6168 (match_operand:DF 3 "gpc_reg_operand" "f"))]
6170 && TARGET_HARD_FLOAT
6171 && registers_ok_for_quad_peep (operands[1], operands[3])
6172 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
6173 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
6176 ;; Next come insns related to the calling sequence.
6178 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
6179 ;; We move the back-chain and decrement the stack pointer.
6181 (define_expand "allocate_stack"
6183 (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
6186 { rtx chain = gen_reg_rtx (Pmode);
6187 rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
6190 emit_move_insn (chain, stack_bot);
6192 if (GET_CODE (operands[0]) != CONST_INT
6193 || INTVAL (operands[0]) < -32767
6194 || INTVAL (operands[0]) > 32768)
6196 neg_op0 = gen_reg_rtx (Pmode);
6197 if (TARGET_POWERPC64)
6198 emit_insn (gen_negdi2 (neg_op0, operands[0]));
6200 emit_insn (gen_negsi2 (neg_op0, operands[0]));
6203 neg_op0 = GEN_INT (- INTVAL (operands[0]));
6205 if (TARGET_POWERPC64)
6206 emit_insn (gen_movdi_update (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
6208 emit_insn (gen_movsi_update (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
6213 ;; These patterns say how to save and restore the stack pointer. We need not
6214 ;; save the stack pointer at function level since we are careful to
6215 ;; preserve the backchain. At block level, we have to restore the backchain
6216 ;; when we restore the stack pointer.
6218 ;; For nonlocal gotos, we must save both the stack pointer and its
6219 ;; backchain and restore both. Note that in the nonlocal case, the
6220 ;; save area is a memory location.
6222 (define_expand "save_stack_function"
6223 [(use (const_int 0))]
6227 (define_expand "restore_stack_function"
6228 [(use (const_int 0))]
6232 (define_expand "restore_stack_block"
6233 [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
6234 (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
6235 (set (mem:SI (match_dup 0)) (match_dup 2))]
6238 { operands[2] = gen_reg_rtx (SImode); }")
6240 (define_expand "save_stack_nonlocal"
6241 [(match_operand:DI 0 "memory_operand" "")
6242 (match_operand:SI 1 "register_operand" "")]
6246 rtx temp = gen_reg_rtx (SImode);
6248 /* Copy the backchain to the first word, sp to the second. */
6249 emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
6250 emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
6251 emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
6255 (define_expand "restore_stack_nonlocal"
6256 [(match_operand:SI 0 "register_operand" "")
6257 (match_operand:DI 1 "memory_operand" "")]
6261 rtx temp = gen_reg_rtx (SImode);
6263 /* Restore the backchain from the first word, sp from the second. */
6264 emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
6265 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
6266 emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
6271 ;; A function pointer under AIX is a pointer to a data area whose first word
6272 ;; contains the actual address of the function, whose second word contains a
6273 ;; pointer to its TOC, and whose third word contains a value to place in the
6274 ;; static chain register (r11). Note that if we load the static chain, our
6275 ;; "trampoline" need not have any executable code.
6277 ;; operands[0] is a register pointing to the 3 word descriptor (aka, the function address)
6278 ;; operands[1] is the stack size to clean up
6279 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for AIX)
6280 ;; operands[3] is location to store the TOC
6281 ;; operands[4] is the TOC register
6282 ;; operands[5] is the static chain register
6284 ;; We do not break this into separate insns, so that the scheduler will not try
6285 ;; to move the load of the new TOC before any loads from the TOC.
6287 (define_insn "call_indirect_aix"
6288 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
6289 (match_operand 1 "const_int_operand" "n"))
6290 (use (match_operand 2 "const_int_operand" "O"))
6291 (use (match_operand 3 "offsettable_addr_operand" "p"))
6292 (use (match_operand 4 "register_operand" "r"))
6293 (clobber (match_operand 5 "register_operand" "=r"))
6294 (clobber (match_scratch:SI 6 "=&r"))
6295 (clobber (match_scratch:SI 7 "=l"))]
6296 "DEFAULT_ABI == ABI_AIX"
6297 "{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"
6298 [(set_attr "length" "28")])
6300 (define_insn "call_value_indirect_aix"
6301 [(set (match_operand 0 "register_operand" "fg")
6302 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
6303 (match_operand 2 "const_int_operand" "n")))
6304 (use (match_operand 3 "const_int_operand" "O"))
6305 (use (match_operand 4 "offsettable_addr_operand" "p"))
6306 (use (match_operand 5 "register_operand" "r"))
6307 (clobber (match_operand 6 "register_operand" "=r"))
6308 (clobber (match_scratch:SI 7 "=&r"))
6309 (clobber (match_scratch:SI 8 "=l"))]
6310 "DEFAULT_ABI == ABI_AIX"
6311 "{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"
6312 [(set_attr "length" "28")])
6314 ;; A function pointer undef NT is a pointer to a data area whose first word
6315 ;; contains the actual address of the function, whose second word contains a
6316 ;; pointer to its TOC. The static chain is not stored under NT, which means
6317 ;; that we need a trampoline.
6319 ;; operands[0] is an SImode pseudo in which we place the address of the function.
6320 ;; operands[1] is the stack size to clean up
6321 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for NT)
6322 ;; operands[3] is location to store the TOC
6323 ;; operands[4] is the TOC register
6325 ;; We do not break this into separate insns, so that the scheduler will not try
6326 ;; to move the load of the new TOC before any loads from the TOC.
6328 (define_insn "call_indirect_nt"
6329 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
6330 (match_operand 1 "const_int_operand" "n"))
6331 (use (match_operand 2 "const_int_operand" "O"))
6332 (use (match_operand 3 "offsettable_addr_operand" "p"))
6333 (use (match_operand 4 "register_operand" "r"))
6334 (clobber (match_scratch:SI 5 "=&r"))
6335 (clobber (match_scratch:SI 6 "=l"))]
6336 "DEFAULT_ABI == ABI_NT"
6337 "{st|stw} %4,%a3\;{l|lwz} %5,0(%0)\;{l|lwz} %4,4(%0)\;mt%6 %5\;{brl|blrl}\;{l|lwz} %4,%a3"
6338 [(set_attr "length" "24")])
6340 (define_insn "call_value_indirect_nt"
6341 [(set (match_operand 0 "register_operand" "fg")
6342 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
6343 (match_operand 2 "const_int_operand" "n")))
6344 (use (match_operand 3 "const_int_operand" "O"))
6345 (use (match_operand 4 "offsettable_addr_operand" "p"))
6346 (use (match_operand 5 "register_operand" "r"))
6347 (clobber (match_scratch:SI 6 "=&r"))
6348 (clobber (match_scratch:SI 7 "=l"))]
6349 "DEFAULT_ABI == ABI_NT"
6350 "{st|stw} %5,%a4\;{l|lwz} %6,0(%1)\;{l|lwz} %5,4(%1)\;mt%7 %6\;{brl|blrl}\;{l|lwz} %5,%a4"
6351 [(set_attr "length" "24")])
6353 ;; A function pointer under System V is just a normal pointer
6354 ;; operands[0] is the function pointer
6355 ;; operands[1] is the stack size to clean up
6356 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument which indicates how to set cr1
6358 (define_insn "call_indirect_sysv"
6359 [(call (mem:SI (match_operand:SI 0 "register_operand" "l,l"))
6360 (match_operand 1 "const_int_operand" "n,n"))
6361 (use (match_operand 2 "const_int_operand" "O,n"))
6362 (clobber (match_scratch:SI 3 "=l,l"))]
6363 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC"
6366 if (INTVAL (operands[2]) > 0)
6367 return \"creqv 6,6,6\;{brl|blrl}\";
6369 else if (INTVAL (operands[2]) < 0)
6370 return \"crxor 6,6,6\;{brl|blrl}\";
6372 return \"{brl|blrl}\";
6374 [(set_attr "length" "4,8")])
6376 (define_insn "call_value_indirect_sysv"
6377 [(set (match_operand 0 "register_operand" "=fg,fg")
6378 (call (mem:SI (match_operand:SI 1 "register_operand" "l,l"))
6379 (match_operand 2 "const_int_operand" "n,n")))
6380 (use (match_operand 3 "const_int_operand" "O,n"))
6381 (clobber (match_scratch:SI 4 "=l,l"))]
6382 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC"
6385 if (INTVAL (operands[3]) > 0)
6386 return \"creqv 6,6,6\;{brl|blrl}\";
6388 else if (INTVAL (operands[3]) < 0)
6389 return \"crxor 6,6,6\;{brl|blrl}\";
6391 return \"{brl|blrl}\";
6393 [(set_attr "length" "4,8")])
6395 ;; Now the definitions for the call and call_value insns
6396 (define_expand "call"
6397 [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
6398 (match_operand 1 "" ""))
6399 (use (match_operand 2 "" ""))
6400 (clobber (scratch:SI))])]
6404 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
6407 operands[0] = XEXP (operands[0], 0);
6409 /* Convert NT DLL imports into an indirect call. */
6410 if (GET_CODE (operands[0]) == SYMBOL_REF
6411 && INTVAL (operands[2]) == (int)CALL_NT_DLLIMPORT)
6413 operands[0] = rs6000_dll_import_ref (operands[0]);
6414 operands[2] = GEN_INT ((int)CALL_NORMAL);
6417 if (GET_CODE (operands[0]) != SYMBOL_REF)
6419 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC)
6420 emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
6421 operands[1], operands[2]));
6424 rtx toc_reg = gen_rtx (REG, Pmode, 2);
6425 rtx toc_addr = RS6000_SAVE_TOC;
6427 if (DEFAULT_ABI == ABI_AIX)
6429 /* AIX function pointers are really pointers to a three word area */
6430 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
6431 emit_call_insn (gen_call_indirect_aix (force_reg (Pmode, operands[0]),
6432 operands[1], operands[2],
6433 toc_addr, toc_reg, static_chain));
6435 else if (DEFAULT_ABI == ABI_NT)
6437 /* NT function pointers are really pointers to a two word area */
6438 rs6000_save_toc_p = 1;
6439 emit_call_insn (gen_call_indirect_nt (force_reg (Pmode, operands[0]),
6440 operands[1], operands[2],
6441 toc_addr, toc_reg));
6450 (define_expand "call_value"
6451 [(parallel [(set (match_operand 0 "" "")
6452 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
6453 (match_operand 2 "" "")))
6454 (use (match_operand 3 "" ""))
6455 (clobber (scratch:SI))])]
6459 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
6462 operands[1] = XEXP (operands[1], 0);
6464 /* Convert NT DLL imports into an indirect call. */
6465 if (GET_CODE (operands[1]) == SYMBOL_REF
6466 && INTVAL (operands[3]) == (int)CALL_NT_DLLIMPORT)
6468 operands[1] = rs6000_dll_import_ref (operands[1]);
6469 operands[3] = GEN_INT ((int)CALL_NORMAL);
6472 if (GET_CODE (operands[1]) != SYMBOL_REF)
6474 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC)
6475 emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
6476 operands[2], operands[3]));
6479 rtx toc_reg = gen_rtx (REG, Pmode, 2);
6480 rtx toc_addr = RS6000_SAVE_TOC;
6482 if (DEFAULT_ABI == ABI_AIX)
6484 /* AIX function pointers are really pointers to a three word area */
6485 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
6486 emit_call_insn (gen_call_value_indirect_aix (operands[0],
6487 force_reg (Pmode, operands[1]),
6488 operands[2], operands[3],
6489 toc_addr, toc_reg, static_chain));
6491 else if (DEFAULT_ABI == ABI_NT)
6493 /* NT function pointers are really pointers to a two word area */
6494 rs6000_save_toc_p = 1;
6495 emit_call_insn (gen_call_value_indirect_nt (operands[0],
6496 force_reg (Pmode, operands[1]),
6497 operands[2], operands[3],
6498 toc_addr, toc_reg));
6507 ;; Call to function in current module. No TOC pointer reload needed.
6508 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
6509 ;; either the function was not prototyped, or it was prototyped as a
6510 ;; variable argument function. It is > 0 if FP registers were passed
6511 ;; and < 0 if they were not.
6514 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
6515 (match_operand 1 "" "g,g"))
6516 (use (match_operand:SI 2 "immediate_operand" "O,n"))
6517 (clobber (match_scratch:SI 3 "=l,l"))]
6521 switch ((enum rs6000_call_cookie)INTVAL (operands[2]))
6523 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6524 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6529 [(set_attr "length" "4,8")])
6531 ;; Call to function which may be in another module. Restore the TOC
6532 ;; pointer (r2) after the call unless this is System V.
6533 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
6534 ;; either the function was not prototyped, or it was prototyped as a
6535 ;; variable argument function. It is > 0 if FP registers were passed
6536 ;; and < 0 if they were not.
6539 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
6540 (match_operand 1 "" "fg,fg"))
6541 (use (match_operand:SI 2 "immediate_operand" "O,n"))
6542 (clobber (match_scratch:SI 3 "=l,l"))]
6543 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT"
6546 /* Indirect calls should go through call_indirect */
6547 if (GET_CODE (operands[0]) == REG)
6550 switch ((enum rs6000_call_cookie)INTVAL (operands[2]))
6552 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6553 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6556 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
6558 [(set_attr "length" "8,12")])
6561 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
6562 (match_operand 1 "" "fg,fg"))
6563 (use (match_operand:SI 2 "immediate_operand" "O,n"))
6564 (clobber (match_scratch:SI 3 "=l,l"))]
6565 "DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4"
6568 /* Indirect calls should go through call_indirect */
6569 if (GET_CODE (operands[0]) == REG)
6572 switch ((enum rs6000_call_cookie)INTVAL (operands[2]))
6574 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6575 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6580 [(set_attr "length" "4,8")])
6583 [(set (match_operand 0 "" "=fg,fg")
6584 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
6585 (match_operand 2 "" "g,g")))
6586 (use (match_operand:SI 3 "immediate_operand" "O,n"))
6587 (clobber (match_scratch:SI 4 "=l,l"))]
6591 switch ((enum rs6000_call_cookie)INTVAL (operands[3]))
6593 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6594 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6599 [(set_attr "length" "4,8")])
6602 [(set (match_operand 0 "" "=fg,fg")
6603 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
6604 (match_operand 2 "" "fg,fg")))
6605 (use (match_operand:SI 3 "immediate_operand" "O,n"))
6606 (clobber (match_scratch:SI 4 "=l,l"))]
6607 "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT"
6610 /* This should be handled by call_value_indirect */
6611 if (GET_CODE (operands[1]) == REG)
6614 switch ((enum rs6000_call_cookie)INTVAL (operands[3]))
6616 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6617 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6620 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
6622 [(set_attr "length" "8,12")])
6625 [(set (match_operand 0 "" "=fg,fg")
6626 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
6627 (match_operand 2 "" "fg,fg")))
6628 (use (match_operand:SI 3 "immediate_operand" "O,n"))
6629 (clobber (match_scratch:SI 4 "=l,l"))]
6630 "DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4"
6633 /* This should be handled by call_value_indirect */
6634 if (GET_CODE (operands[1]) == REG)
6637 switch ((enum rs6000_call_cookie)INTVAL (operands[3]))
6639 case CALL_V4_SET_FP_ARGS: output_asm_insn (\"crxor 6,6,6\", operands); break;
6640 case CALL_V4_CLEAR_FP_ARGS: output_asm_insn (\"creqv 6,6,6\", operands); break;
6645 [(set_attr "length" "4,8")])
6648 ;; Call subroutine returning any type.
6650 (define_expand "untyped_call"
6651 [(parallel [(call (match_operand 0 "" "")
6653 (match_operand 1 "" "")
6654 (match_operand 2 "" "")])]
6660 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
6662 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6664 rtx set = XVECEXP (operands[2], 0, i);
6665 emit_move_insn (SET_DEST (set), SET_SRC (set));
6668 /* The optimizer does not know that the call sets the function value
6669 registers we stored in the result block. We avoid problems by
6670 claiming that all hard registers are used and clobbered at this
6672 emit_insn (gen_blockage ());
6677 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6678 ;; all of memory. This blocks insns from being moved across this point.
6680 (define_insn "blockage"
6681 [(unspec_volatile [(const_int 0)] 0)]
6685 ;; Synchronize instructions/data caches for V.4 trampolines
6686 ;; The extra memory_operand is to prevent the optimizer from
6687 ;; deleting insns with "no" effect.
6689 [(unspec [(match_operand 0 "memory_operand" "=m")
6690 (match_operand 1 "register_operand" "b")
6691 (match_operand 2 "register_operand" "r")] 3)]
6695 (define_insn "dcbst"
6696 [(unspec [(match_operand 0 "memory_operand" "=m")
6697 (match_operand 1 "register_operand" "b")
6698 (match_operand 2 "register_operand" "r")] 4)]
6703 [(unspec [(match_operand 0 "memory_operand" "=m")] 5)]
6707 (define_insn "isync"
6708 [(unspec [(match_operand 0 "memory_operand" "=m")] 6)]
6713 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
6714 ;; signed & unsigned, and one type of branch.
6716 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
6717 ;; insns, and branches. We store the operands of compares until we see
6719 (define_expand "cmpsi"
6721 (compare (match_operand:SI 0 "gpc_reg_operand" "")
6722 (match_operand:SI 1 "reg_or_short_operand" "")))]
6726 /* Take care of the possibility that operands[1] might be negative but
6727 this might be a logical operation. That insn doesn't exist. */
6728 if (GET_CODE (operands[1]) == CONST_INT
6729 && INTVAL (operands[1]) < 0)
6730 operands[1] = force_reg (SImode, operands[1]);
6732 rs6000_compare_op0 = operands[0];
6733 rs6000_compare_op1 = operands[1];
6734 rs6000_compare_fp_p = 0;
6738 (define_expand "cmpdi"
6740 (compare (match_operand:DI 0 "gpc_reg_operand" "")
6741 (match_operand:DI 1 "reg_or_short_operand" "")))]
6745 /* Take care of the possibility that operands[1] might be negative but
6746 this might be a logical operation. That insn doesn't exist. */
6747 if (GET_CODE (operands[1]) == CONST_INT
6748 && INTVAL (operands[1]) < 0)
6749 operands[1] = force_reg (DImode, operands[1]);
6751 rs6000_compare_op0 = operands[0];
6752 rs6000_compare_op1 = operands[1];
6753 rs6000_compare_fp_p = 0;
6757 (define_expand "cmpsf"
6758 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
6759 (match_operand:SF 1 "gpc_reg_operand" "")))]
6763 rs6000_compare_op0 = operands[0];
6764 rs6000_compare_op1 = operands[1];
6765 rs6000_compare_fp_p = 1;
6769 (define_expand "cmpdf"
6770 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
6771 (match_operand:DF 1 "gpc_reg_operand" "")))]
6775 rs6000_compare_op0 = operands[0];
6776 rs6000_compare_op1 = operands[1];
6777 rs6000_compare_fp_p = 1;
6781 (define_expand "beq"
6782 [(set (match_dup 2) (match_dup 1))
6784 (if_then_else (eq (match_dup 2)
6786 (label_ref (match_operand 0 "" ""))
6790 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6791 operands[1] = gen_rtx (COMPARE, mode,
6792 rs6000_compare_op0, rs6000_compare_op1);
6793 operands[2] = gen_reg_rtx (mode);
6796 (define_expand "bne"
6797 [(set (match_dup 2) (match_dup 1))
6799 (if_then_else (ne (match_dup 2)
6801 (label_ref (match_operand 0 "" ""))
6805 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6806 operands[1] = gen_rtx (COMPARE, mode,
6807 rs6000_compare_op0, rs6000_compare_op1);
6808 operands[2] = gen_reg_rtx (mode);
6811 (define_expand "blt"
6812 [(set (match_dup 2) (match_dup 1))
6814 (if_then_else (lt (match_dup 2)
6816 (label_ref (match_operand 0 "" ""))
6820 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6821 operands[1] = gen_rtx (COMPARE, mode,
6822 rs6000_compare_op0, rs6000_compare_op1);
6823 operands[2] = gen_reg_rtx (mode);
6826 (define_expand "bgt"
6827 [(set (match_dup 2) (match_dup 1))
6829 (if_then_else (gt (match_dup 2)
6831 (label_ref (match_operand 0 "" ""))
6835 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6836 operands[1] = gen_rtx (COMPARE, mode,
6837 rs6000_compare_op0, rs6000_compare_op1);
6838 operands[2] = gen_reg_rtx (mode);
6841 (define_expand "ble"
6842 [(set (match_dup 2) (match_dup 1))
6844 (if_then_else (le (match_dup 2)
6846 (label_ref (match_operand 0 "" ""))
6850 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6851 operands[1] = gen_rtx (COMPARE, mode,
6852 rs6000_compare_op0, rs6000_compare_op1);
6853 operands[2] = gen_reg_rtx (mode);
6856 (define_expand "bge"
6857 [(set (match_dup 2) (match_dup 1))
6859 (if_then_else (ge (match_dup 2)
6861 (label_ref (match_operand 0 "" ""))
6865 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6866 operands[1] = gen_rtx (COMPARE, mode,
6867 rs6000_compare_op0, rs6000_compare_op1);
6868 operands[2] = gen_reg_rtx (mode);
6871 (define_expand "bgtu"
6872 [(set (match_dup 2) (match_dup 1))
6874 (if_then_else (gtu (match_dup 2)
6876 (label_ref (match_operand 0 "" ""))
6880 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
6881 rs6000_compare_op0, rs6000_compare_op1);
6882 operands[2] = gen_reg_rtx (CCUNSmode);
6885 (define_expand "bltu"
6886 [(set (match_dup 2) (match_dup 1))
6888 (if_then_else (ltu (match_dup 2)
6890 (label_ref (match_operand 0 "" ""))
6894 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
6895 rs6000_compare_op0, rs6000_compare_op1);
6896 operands[2] = gen_reg_rtx (CCUNSmode);
6899 (define_expand "bgeu"
6900 [(set (match_dup 2) (match_dup 1))
6902 (if_then_else (geu (match_dup 2)
6904 (label_ref (match_operand 0 "" ""))
6908 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
6909 rs6000_compare_op0, rs6000_compare_op1);
6910 operands[2] = gen_reg_rtx (CCUNSmode);
6913 (define_expand "bleu"
6914 [(set (match_dup 2) (match_dup 1))
6916 (if_then_else (leu (match_dup 2)
6918 (label_ref (match_operand 0 "" ""))
6922 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
6923 rs6000_compare_op0, rs6000_compare_op1);
6924 operands[2] = gen_reg_rtx (CCUNSmode);
6927 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
6928 ;; For SEQ, likewise, except that comparisons with zero should be done
6929 ;; with an scc insns. However, due to the order that combine see the
6930 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
6931 ;; the cases we don't want to handle.
6932 (define_expand "seq"
6933 [(set (match_dup 2) (match_dup 1))
6934 (set (match_operand:SI 0 "gpc_reg_operand" "")
6935 (eq:SI (match_dup 2) (const_int 0)))]
6938 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6939 operands[1] = gen_rtx (COMPARE, mode,
6940 rs6000_compare_op0, rs6000_compare_op1);
6941 operands[2] = gen_reg_rtx (mode);
6944 (define_expand "sne"
6945 [(set (match_dup 2) (match_dup 1))
6946 (set (match_operand:SI 0 "gpc_reg_operand" "")
6947 (ne:SI (match_dup 2) (const_int 0)))]
6950 { if (! rs6000_compare_fp_p)
6953 operands[1] = gen_rtx (COMPARE, CCFPmode,
6954 rs6000_compare_op0, rs6000_compare_op1);
6955 operands[2] = gen_reg_rtx (CCFPmode);
6958 ;; A > 0 is best done using the portable sequence, so fail in that case.
6959 (define_expand "sgt"
6960 [(set (match_dup 2) (match_dup 1))
6961 (set (match_operand:SI 0 "gpc_reg_operand" "")
6962 (gt:SI (match_dup 2) (const_int 0)))]
6965 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6967 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
6970 operands[1] = gen_rtx (COMPARE, mode,
6971 rs6000_compare_op0, rs6000_compare_op1);
6972 operands[2] = gen_reg_rtx (mode);
6975 ;; A < 0 is best done in the portable way for A an integer.
6976 (define_expand "slt"
6977 [(set (match_dup 2) (match_dup 1))
6978 (set (match_operand:SI 0 "gpc_reg_operand" "")
6979 (lt:SI (match_dup 2) (const_int 0)))]
6982 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6984 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
6987 operands[1] = gen_rtx (COMPARE, mode,
6988 rs6000_compare_op0, rs6000_compare_op1);
6989 operands[2] = gen_reg_rtx (mode);
6992 (define_expand "sge"
6993 [(set (match_dup 2) (match_dup 1))
6994 (set (match_operand:SI 0 "gpc_reg_operand" "")
6995 (ge:SI (match_dup 2) (const_int 0)))]
6998 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
6999 operands[1] = gen_rtx (COMPARE, mode,
7000 rs6000_compare_op0, rs6000_compare_op1);
7001 operands[2] = gen_reg_rtx (mode);
7004 ;; A <= 0 is best done the portable way for A an integer.
7005 (define_expand "sle"
7006 [(set (match_dup 2) (match_dup 1))
7007 (set (match_operand:SI 0 "gpc_reg_operand" "")
7008 (le:SI (match_dup 2) (const_int 0)))]
7011 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7013 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7016 operands[1] = gen_rtx (COMPARE, mode,
7017 rs6000_compare_op0, rs6000_compare_op1);
7018 operands[2] = gen_reg_rtx (mode);
7021 (define_expand "sgtu"
7022 [(set (match_dup 2) (match_dup 1))
7023 (set (match_operand:SI 0 "gpc_reg_operand" "")
7024 (gtu:SI (match_dup 2) (const_int 0)))]
7027 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7028 rs6000_compare_op0, rs6000_compare_op1);
7029 operands[2] = gen_reg_rtx (CCUNSmode);
7032 (define_expand "sltu"
7033 [(set (match_dup 2) (match_dup 1))
7034 (set (match_operand:SI 0 "gpc_reg_operand" "")
7035 (ltu:SI (match_dup 2) (const_int 0)))]
7038 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7039 rs6000_compare_op0, rs6000_compare_op1);
7040 operands[2] = gen_reg_rtx (CCUNSmode);
7043 (define_expand "sgeu"
7044 [(set (match_dup 2) (match_dup 1))
7045 (set (match_operand:SI 0 "gpc_reg_operand" "")
7046 (geu:SI (match_dup 2) (const_int 0)))]
7049 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7050 rs6000_compare_op0, rs6000_compare_op1);
7051 operands[2] = gen_reg_rtx (CCUNSmode);
7054 (define_expand "sleu"
7055 [(set (match_dup 2) (match_dup 1))
7056 (set (match_operand:SI 0 "gpc_reg_operand" "")
7057 (leu:SI (match_dup 2) (const_int 0)))]
7060 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7061 rs6000_compare_op0, rs6000_compare_op1);
7062 operands[2] = gen_reg_rtx (CCUNSmode);
7065 ;; Here are the actual compare insns.
7067 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
7068 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
7069 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
7071 "{cmp%I2|cmpw%I2} %0,%1,%2"
7072 [(set_attr "type" "compare")])
7075 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
7076 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
7077 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
7080 [(set_attr "type" "compare")])
7082 ;; If we are comparing a register for equality with a large constant,
7083 ;; we can do this with an XOR followed by a compare. But we need a scratch
7084 ;; register for the result of the XOR.
7087 [(set (match_operand:CC 0 "cc_reg_operand" "")
7088 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7089 (match_operand:SI 2 "non_short_cint_operand" "")))
7090 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
7091 "find_single_use (operands[0], insn, 0)
7092 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
7093 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
7094 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
7095 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
7098 /* Get the constant we are comparing against, C, and see what it looks like
7099 sign-extended to 16 bits. Then see what constant could be XOR'ed
7100 with C to get the sign-extended value. */
7102 int c = INTVAL (operands[2]);
7103 int sextc = (c << 16) >> 16;
7104 int xorv = c ^ sextc;
7106 operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
7107 operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
7111 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
7112 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
7113 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
7115 "{cmpl%I2|cmplw%I2} %0,%1,%W2"
7116 [(set_attr "type" "compare")])
7119 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
7120 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
7121 (match_operand:DI 2 "reg_or_u_short_operand" "rI")))]
7123 "cmpld%I2 %0,%1,%W2"
7124 [(set_attr "type" "compare")])
7126 ;; The following two insns don't exist as single insns, but if we provide
7127 ;; them, we can swap an add and compare, which will enable us to overlap more
7128 ;; of the required delay between a compare and branch. We generate code for
7129 ;; them by splitting.
7132 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
7133 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
7134 (match_operand:SI 2 "short_cint_operand" "i")))
7135 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7136 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
7139 [(set_attr "length" "8")])
7142 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
7143 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
7144 (match_operand:SI 2 "u_short_cint_operand" "i")))
7145 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7146 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
7149 [(set_attr "length" "8")])
7152 [(set (match_operand:CC 3 "cc_reg_operand" "")
7153 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7154 (match_operand:SI 2 "short_cint_operand" "")))
7155 (set (match_operand:SI 0 "gpc_reg_operand" "")
7156 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
7158 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
7159 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
7162 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
7163 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
7164 (match_operand:SI 2 "u_short_cint_operand" "")))
7165 (set (match_operand:SI 0 "gpc_reg_operand" "")
7166 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
7168 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
7169 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
7172 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
7173 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
7174 (match_operand:SF 2 "gpc_reg_operand" "f")))]
7177 [(set_attr "type" "fpcompare")])
7180 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
7181 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
7182 (match_operand:DF 2 "gpc_reg_operand" "f")))]
7185 [(set_attr "type" "fpcompare")])
7187 ;; Now we have the scc insns. We can do some combinations because of the
7188 ;; way the machine works.
7190 ;; Note that this is probably faster if we can put an insn between the
7191 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
7192 ;; cases the insns below which don't use an intermediate CR field will
7195 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7196 (match_operator:SI 1 "scc_comparison_operator"
7197 [(match_operand 2 "cc_reg_operand" "y")
7200 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
7201 [(set_attr "length" "12")])
7204 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7205 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
7206 [(match_operand 2 "cc_reg_operand" "y")
7209 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
7210 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
7212 "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
7213 [(set_attr "type" "delayed_compare")
7214 (set_attr "length" "12")])
7217 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7218 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
7219 [(match_operand 2 "cc_reg_operand" "y")
7221 (match_operand:SI 3 "const_int_operand" "n")))]
7225 int is_bit = ccr_bit (operands[1], 1);
7226 int put_bit = 31 - (INTVAL (operands[3]) & 31);
7229 if (is_bit >= put_bit)
7230 count = is_bit - put_bit;
7232 count = 32 - (put_bit - is_bit);
7234 operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
7235 operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
7237 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
7239 [(set_attr "length" "12")])
7242 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7244 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
7245 [(match_operand 2 "cc_reg_operand" "y")
7247 (match_operand:SI 3 "const_int_operand" "n"))
7249 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
7250 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
7255 int is_bit = ccr_bit (operands[1], 1);
7256 int put_bit = 31 - (INTVAL (operands[3]) & 31);
7259 if (is_bit >= put_bit)
7260 count = is_bit - put_bit;
7262 count = 32 - (put_bit - is_bit);
7264 operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
7265 operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
7267 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
7269 [(set_attr "type" "delayed_compare")
7270 (set_attr "length" "12")])
7272 ;; If we are comparing the result of two comparisons, this can be done
7273 ;; using creqv or crxor.
7276 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
7277 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
7278 [(match_operand 2 "cc_reg_operand" "y")
7280 (match_operator 3 "scc_comparison_operator"
7281 [(match_operand 4 "cc_reg_operand" "y")
7283 "REGNO (operands[2]) != REGNO (operands[4])"
7286 enum rtx_code code1, code2;
7288 code1 = GET_CODE (operands[1]);
7289 code2 = GET_CODE (operands[3]);
7291 if ((code1 == EQ || code1 == LT || code1 == GT
7292 || code1 == LTU || code1 == GTU
7293 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
7295 (code2 == EQ || code2 == LT || code2 == GT
7296 || code2 == LTU || code2 == GTU
7297 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
7298 return \"%C1%C3crxor %E0,%j1,%j3\";
7300 return \"%C1%C3creqv %E0,%j1,%j3\";
7302 [(set_attr "length" "12")])
7304 ;; There is a 3 cycle delay between consecutive mfcr instructions
7305 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
7308 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7309 (match_operator:SI 1 "scc_comparison_operator"
7310 [(match_operand 2 "cc_reg_operand" "y")
7312 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
7313 (match_operator:SI 4 "scc_comparison_operator"
7314 [(match_operand 5 "cc_reg_operand" "y")
7316 "REGNO (operands[2]) != REGNO (operands[5])"
7317 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
7318 [(set_attr "length" "20")])
7320 ;; There are some scc insns that can be done directly, without a compare.
7321 ;; These are faster because they don't involve the communications between
7322 ;; the FXU and branch units. In fact, we will be replacing all of the
7323 ;; integer scc insns here or in the portable methods in emit_store_flag.
7325 ;; Also support (neg (scc ..)) since that construct is used to replace
7326 ;; branches, (plus (scc ..) ..) since that construct is common and
7327 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
7328 ;; cases where it is no more expensive than (neg (scc ..)).
7330 ;; Have reload force a constant into a register for the simple insns that
7331 ;; otherwise won't accept constants. We do this because it is faster than
7332 ;; the cmp/mfcr sequence we would otherwise generate.
7335 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7336 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7337 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
7338 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
7341 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
7342 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
7343 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
7344 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
7345 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
7346 [(set_attr "length" "12,8,12,12,12")])
7349 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
7351 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7352 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7354 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7355 (eq:SI (match_dup 1) (match_dup 2)))
7356 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
7359 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
7360 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
7361 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
7362 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
7363 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
7364 [(set_attr "type" "compare")
7365 (set_attr "length" "12,8,12,12,12")])
7367 ;; We have insns of the form shown by the first define_insn below. If
7368 ;; there is something inside the comparison operation, we must split it.
7370 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7371 (plus:SI (match_operator 1 "comparison_operator"
7372 [(match_operand:SI 2 "" "")
7374 "reg_or_cint_operand" "")])
7375 (match_operand:SI 4 "gpc_reg_operand" "")))
7376 (clobber (match_operand:SI 5 "register_operand" ""))]
7377 "! gpc_reg_operand (operands[2], SImode)"
7378 [(set (match_dup 5) (match_dup 2))
7379 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
7383 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7384 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7385 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7386 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
7387 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
7390 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7391 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
7392 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7393 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7394 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
7395 [(set_attr "length" "12,8,12,12,12")])
7398 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
7401 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7402 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7403 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
7405 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
7408 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7409 {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
7410 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7411 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7412 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
7413 [(set_attr "type" "compare")
7414 (set_attr "length" "12,8,12,12,12")])
7417 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
7420 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7421 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
7422 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
7424 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7425 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7426 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
7429 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7430 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
7431 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7432 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7433 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
7434 [(set_attr "type" "compare")
7435 (set_attr "length" "12,8,12,12,12")])
7438 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
7439 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
7440 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
7443 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7444 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
7445 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7446 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7447 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
7448 [(set_attr "length" "12,8,12,12,12")])
7450 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
7451 ;; since it nabs/sr is just as fast.
7453 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7454 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7456 (clobber (match_scratch:SI 2 "=&r"))]
7458 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
7459 [(set_attr "length" "8")])
7461 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
7463 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7464 (plus:SI (lshiftrt:SI
7465 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7467 (match_operand:SI 2 "gpc_reg_operand" "r")))
7468 (clobber (match_scratch:SI 3 "=&r"))]
7470 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
7471 [(set_attr "length" "8")])
7474 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7476 (plus:SI (lshiftrt:SI
7477 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7479 (match_operand:SI 2 "gpc_reg_operand" "r"))
7481 (clobber (match_scratch:SI 3 "=&r"))]
7483 "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
7484 [(set_attr "type" "compare")
7485 (set_attr "length" "8")])
7488 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
7490 (plus:SI (lshiftrt:SI
7491 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
7493 (match_operand:SI 2 "gpc_reg_operand" "r"))
7495 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7496 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
7498 (clobber (match_scratch:SI 3 "=&r"))]
7500 "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
7501 [(set_attr "type" "compare")
7502 (set_attr "length" "8")])
7505 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7506 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7507 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
7508 (clobber (match_scratch:SI 3 "=r,X"))]
7511 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
7512 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
7513 [(set_attr "length" "12")])
7516 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
7518 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7519 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7521 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7522 (le:SI (match_dup 1) (match_dup 2)))
7523 (clobber (match_scratch:SI 3 "=r,X"))]
7526 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
7527 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
7528 [(set_attr "type" "compare,delayed_compare")
7529 (set_attr "length" "12")])
7532 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7533 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7534 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7535 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
7536 (clobber (match_scratch:SI 4 "=&r,&r"))]
7539 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
7540 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
7541 [(set_attr "length" "12")])
7544 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
7546 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7547 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7548 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7550 (clobber (match_scratch:SI 4 "=&r,&r"))]
7553 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
7554 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
7555 [(set_attr "type" "compare")
7556 (set_attr "length" "12")])
7559 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
7561 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7562 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
7563 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7565 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7566 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7567 (clobber (match_scratch:SI 4 "=&r,&r"))]
7570 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
7571 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
7572 [(set_attr "type" "compare")
7573 (set_attr "length" "12")])
7576 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7577 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7578 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
7581 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
7582 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
7583 [(set_attr "length" "12")])
7586 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7587 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7588 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
7590 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
7591 [(set_attr "length" "12")])
7594 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
7596 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7597 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7599 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7600 (leu:SI (match_dup 1) (match_dup 2)))]
7602 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
7603 [(set_attr "type" "compare")
7604 (set_attr "length" "12")])
7607 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7608 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7609 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7610 (match_operand:SI 3 "gpc_reg_operand" "r")))
7611 (clobber (match_scratch:SI 4 "=&r"))]
7613 "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
7614 [(set_attr "length" "8")])
7617 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7619 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7620 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7621 (match_operand:SI 3 "gpc_reg_operand" "r"))
7623 (clobber (match_scratch:SI 4 "=&r"))]
7625 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
7626 [(set_attr "type" "compare")
7627 (set_attr "length" "8")])
7630 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
7632 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7633 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7634 (match_operand:SI 3 "gpc_reg_operand" "r"))
7636 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7637 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7638 (clobber (match_scratch:SI 4 "=&r"))]
7640 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
7641 [(set_attr "type" "compare")
7642 (set_attr "length" "8")])
7645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7646 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7647 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
7649 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
7650 [(set_attr "length" "12")])
7653 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7655 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7656 (match_operand:SI 2 "reg_or_short_operand" "rI")))
7657 (match_operand:SI 3 "gpc_reg_operand" "r")))
7658 (clobber (match_scratch:SI 4 "=&r"))]
7660 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
7661 [(set_attr "length" "12")])
7664 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7667 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7668 (match_operand:SI 2 "reg_or_short_operand" "rI")))
7669 (match_operand:SI 3 "gpc_reg_operand" "r"))
7671 (clobber (match_scratch:SI 4 "=&r"))]
7673 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
7674 [(set_attr "type" "compare")
7675 (set_attr "length" "12")])
7678 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
7681 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7682 (match_operand:SI 2 "reg_or_short_operand" "rI")))
7683 (match_operand:SI 3 "gpc_reg_operand" "r"))
7685 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7686 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
7687 (clobber (match_scratch:SI 4 "=&r"))]
7689 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
7690 [(set_attr "type" "compare")
7691 (set_attr "length" "12")])
7694 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7695 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7696 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
7698 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
7699 [(set_attr "length" "12")])
7702 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
7704 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7705 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7707 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7708 (lt:SI (match_dup 1) (match_dup 2)))]
7710 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
7711 [(set_attr "type" "delayed_compare")
7712 (set_attr "length" "12")])
7715 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7716 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7717 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7718 (match_operand:SI 3 "gpc_reg_operand" "r")))
7719 (clobber (match_scratch:SI 4 "=&r"))]
7721 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
7722 [(set_attr "length" "12")])
7725 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7727 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7728 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7729 (match_operand:SI 3 "gpc_reg_operand" "r"))
7731 (clobber (match_scratch:SI 4 "=&r"))]
7733 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
7734 [(set_attr "type" "compare")
7735 (set_attr "length" "12")])
7738 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
7740 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7741 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7742 (match_operand:SI 3 "gpc_reg_operand" "r"))
7744 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7745 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7746 (clobber (match_scratch:SI 4 "=&r"))]
7748 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
7749 [(set_attr "type" "compare")
7750 (set_attr "length" "12")])
7753 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7754 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7755 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
7757 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
7758 [(set_attr "length" "12")])
7761 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7762 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7763 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
7766 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
7767 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
7768 [(set_attr "length" "12")])
7771 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
7773 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7774 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7776 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7777 (ltu:SI (match_dup 1) (match_dup 2)))]
7780 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
7781 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
7782 [(set_attr "type" "compare")
7783 (set_attr "length" "12")])
7786 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
7787 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
7788 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
7789 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
7790 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
7793 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
7794 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
7795 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
7796 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
7797 [(set_attr "length" "12")])
7800 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
7802 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7803 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7804 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7806 (clobber (match_scratch:SI 4 "=&r,&r"))]
7809 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
7810 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
7811 [(set_attr "type" "compare")
7812 (set_attr "length" "12")])
7815 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
7817 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7818 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7819 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
7821 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7822 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7823 (clobber (match_scratch:SI 4 "=&r,&r"))]
7826 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
7827 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
7828 [(set_attr "type" "compare")
7829 (set_attr "length" "12")])
7832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7833 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7834 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
7837 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
7838 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
7839 [(set_attr "length" "8")])
7842 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7843 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7844 (match_operand:SI 2 "reg_or_short_operand" "rI")))
7845 (clobber (match_scratch:SI 3 "=r"))]
7847 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
7848 [(set_attr "length" "12")])
7851 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
7853 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7854 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7856 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7857 (ge:SI (match_dup 1) (match_dup 2)))
7858 (clobber (match_scratch:SI 3 "=r"))]
7860 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
7861 [(set_attr "type" "compare")
7862 (set_attr "length" "12")])
7865 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7866 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7867 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7868 (match_operand:SI 3 "gpc_reg_operand" "r")))
7869 (clobber (match_scratch:SI 4 "=&r"))]
7871 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
7872 [(set_attr "length" "12")])
7875 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7877 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7878 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7879 (match_operand:SI 3 "gpc_reg_operand" "r"))
7881 (clobber (match_scratch:SI 4 "=&r"))]
7883 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
7884 [(set_attr "type" "compare")
7885 (set_attr "length" "12")])
7888 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
7890 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7891 (match_operand:SI 2 "reg_or_short_operand" "rI"))
7892 (match_operand:SI 3 "gpc_reg_operand" "r"))
7894 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7895 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
7896 (clobber (match_scratch:SI 4 "=&r"))]
7898 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
7899 [(set_attr "type" "compare")
7900 (set_attr "length" "12")])
7903 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7904 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
7905 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
7907 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
7908 [(set_attr "length" "12")])
7910 ;; This is (and (neg (ge X (const_int 0))) Y).
7912 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7915 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
7917 (match_operand:SI 2 "gpc_reg_operand" "r")))
7918 (clobber (match_scratch:SI 3 "=&r"))]
7920 "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
7921 [(set_attr "length" "8")])
7924 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
7928 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
7930 (match_operand:SI 2 "gpc_reg_operand" "r"))
7932 (clobber (match_scratch:SI 3 "=&r"))]
7934 "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
7935 [(set_attr "type" "compare")
7936 (set_attr "length" "8")])
7939 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
7943 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
7945 (match_operand:SI 2 "gpc_reg_operand" "r"))
7947 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7948 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
7951 (clobber (match_scratch:SI 3 "=&r"))]
7953 "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
7954 [(set_attr "type" "compare")
7955 (set_attr "length" "8")])
7958 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7959 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7960 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
7963 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
7964 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
7965 [(set_attr "length" "12")])
7968 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
7970 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7971 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7973 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7974 (geu:SI (match_dup 1) (match_dup 2)))]
7977 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
7978 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
7979 [(set_attr "type" "compare")
7980 (set_attr "length" "12")])
7983 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7984 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7985 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7986 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
7987 (clobber (match_scratch:SI 4 "=&r,&r"))]
7990 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
7991 {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
7992 [(set_attr "length" "8")])
7995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
7997 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
7998 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
7999 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8001 (clobber (match_scratch:SI 4 "=&r,&r"))]
8004 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
8005 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
8006 [(set_attr "type" "compare")
8007 (set_attr "length" "8")])
8010 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8012 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8013 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8014 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8016 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8017 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8018 (clobber (match_scratch:SI 4 "=&r,&r"))]
8021 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
8022 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
8023 [(set_attr "type" "compare")
8024 (set_attr "length" "8")])
8027 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8028 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8029 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
8032 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
8033 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
8034 [(set_attr "length" "12")])
8037 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8039 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8040 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8041 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8042 (clobber (match_scratch:SI 4 "=&r,&r"))]
8045 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
8046 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
8047 [(set_attr "length" "12")])
8050 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8053 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8054 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8055 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8057 (clobber (match_scratch:SI 4 "=&r,&r"))]
8060 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
8061 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
8062 [(set_attr "type" "compare")
8063 (set_attr "length" "12")])
8066 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8069 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8070 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8071 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8073 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8074 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
8075 (clobber (match_scratch:SI 4 "=&r,&r"))]
8078 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
8079 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
8080 [(set_attr "type" "compare")
8081 (set_attr "length" "12")])
8084 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8085 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8088 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
8089 [(set_attr "length" "12")])
8092 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
8094 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8097 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8098 (gt:SI (match_dup 1) (const_int 0)))]
8100 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
8101 [(set_attr "type" "delayed_compare")
8102 (set_attr "length" "12")])
8105 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8106 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8107 (match_operand:SI 2 "reg_or_short_operand" "r")))]
8109 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
8110 [(set_attr "length" "12")])
8113 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8115 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8116 (match_operand:SI 2 "reg_or_short_operand" "r"))
8118 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8119 (gt:SI (match_dup 1) (match_dup 2)))]
8121 "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
8122 [(set_attr "type" "delayed_compare")
8123 (set_attr "length" "12")])
8126 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8127 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8129 (match_operand:SI 2 "gpc_reg_operand" "r")))
8130 (clobber (match_scratch:SI 3 "=&r"))]
8132 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
8133 [(set_attr "length" "12")])
8136 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8138 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8140 (match_operand:SI 2 "gpc_reg_operand" "r"))
8142 (clobber (match_scratch:SI 3 "=&r"))]
8144 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
8145 [(set_attr "type" "compare")
8146 (set_attr "length" "12")])
8149 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8151 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8153 (match_operand:SI 2 "gpc_reg_operand" "r"))
8155 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8156 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
8157 (clobber (match_scratch:SI 3 "=&r"))]
8159 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
8160 [(set_attr "type" "compare")
8161 (set_attr "length" "12")])
8164 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8165 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8166 (match_operand:SI 2 "reg_or_short_operand" "r"))
8167 (match_operand:SI 3 "gpc_reg_operand" "r")))
8168 (clobber (match_scratch:SI 4 "=&r"))]
8170 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
8171 [(set_attr "length" "12")])
8174 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8176 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8177 (match_operand:SI 2 "reg_or_short_operand" "r"))
8178 (match_operand:SI 3 "gpc_reg_operand" "r"))
8180 (clobber (match_scratch:SI 4 "=&r"))]
8182 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
8183 [(set_attr "type" "compare")
8184 (set_attr "length" "12")])
8187 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8189 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8190 (match_operand:SI 2 "reg_or_short_operand" "r"))
8191 (match_operand:SI 3 "gpc_reg_operand" "r"))
8193 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8194 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8195 (clobber (match_scratch:SI 4 "=&r"))]
8197 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
8198 [(set_attr "type" "compare")
8199 (set_attr "length" "12")])
8202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8203 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8206 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
8207 [(set_attr "length" "12")])
8210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8211 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8212 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
8214 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
8215 [(set_attr "length" "12")])
8218 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8219 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8220 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8222 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
8223 [(set_attr "length" "12")])
8226 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8228 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8229 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8231 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8232 (gtu:SI (match_dup 1) (match_dup 2)))]
8234 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
8235 [(set_attr "type" "compare")
8236 (set_attr "length" "12")])
8239 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
8240 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
8241 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
8242 (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
8243 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
8246 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
8247 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8248 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
8249 [(set_attr "length" "8,12,12")])
8252 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8254 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8255 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
8256 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8258 (clobber (match_scratch:SI 4 "=&r,&r"))]
8261 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
8262 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
8263 [(set_attr "type" "compare")
8264 (set_attr "length" "8,12")])
8267 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8269 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8270 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
8271 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8273 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8274 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8275 (clobber (match_scratch:SI 4 "=&r,&r"))]
8278 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
8279 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
8280 [(set_attr "type" "compare")
8281 (set_attr "length" "8,12")])
8284 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8285 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8286 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8288 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
8289 [(set_attr "length" "8")])
8291 ;; Define both directions of branch and return. If we need a reload
8292 ;; register, we'd rather use CR0 since it is much easier to copy a
8293 ;; register CC value to there.
8297 (if_then_else (match_operator 1 "branch_comparison_operator"
8299 "cc_reg_operand" "x,?y")
8301 (label_ref (match_operand 0 "" ""))
8306 if (get_attr_length (insn) == 8)
8307 return \"%C1bc %t1,%j1,%l0\";
8309 return \"%C1bc %T1,%j1,$+8\;b %l0\";
8311 [(set_attr "type" "branch")])
8315 (if_then_else (match_operator 0 "branch_comparison_operator"
8317 "cc_reg_operand" "x,?y")
8322 "{%C0bcr|%C0bclr} %t0,%j0"
8323 [(set_attr "length" "8")])
8327 (if_then_else (match_operator 1 "branch_comparison_operator"
8329 "cc_reg_operand" "x,?y")
8332 (label_ref (match_operand 0 "" ""))))]
8336 if (get_attr_length (insn) == 8)
8337 return \"%C1bc %T1,%j1,%l0\";
8339 return \"%C1bc %t1,%j1,$+8\;b %l0\";
8341 [(set_attr "type" "branch")])
8345 (if_then_else (match_operator 0 "branch_comparison_operator"
8347 "cc_reg_operand" "x,?y")
8352 "{%C0bcr|%C0bclr} %T0,%j0"
8353 [(set_attr "length" "8")])
8355 ;; Unconditional branch and return.
8359 (label_ref (match_operand 0 "" "")))]
8363 (define_insn "return"
8367 [(set_attr "type" "jmpreg")])
8369 (define_insn "indirect_jump"
8370 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
8375 [(set_attr "type" "jmpreg")])
8378 [(set (pc) (match_operand:DI 0 "register_operand" "c,l"))]
8383 [(set_attr "type" "jmpreg")])
8385 ;; Table jump for switch statements:
8386 (define_expand "tablejump"
8388 (plus:SI (match_operand:SI 0 "" "")
8390 (parallel [(set (pc) (match_dup 3))
8391 (use (label_ref (match_operand 1 "" "")))])]
8394 { operands[0] = force_reg (SImode, operands[0]);
8395 operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
8396 operands[3] = gen_reg_rtx (SImode);
8401 (match_operand:SI 0 "register_operand" "c,l"))
8402 (use (label_ref (match_operand 1 "" "")))]
8407 [(set_attr "type" "jmpreg")])
8411 (match_operand:DI 0 "register_operand" "c,l"))
8412 (use (label_ref (match_operand 1 "" "")))]
8417 [(set_attr "type" "jmpreg")])
8424 ;; Define the subtract-one-and-jump insns, starting with the template
8425 ;; so loop.c knows what to generate.
8427 (define_expand "decrement_and_branch_on_count"
8428 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "")
8430 (label_ref (match_operand 1 "" ""))
8433 (plus:SI (match_dup 0)
8435 (clobber (match_scratch:CC 2 ""))
8436 (clobber (match_scratch:SI 3 ""))])]
8440 ;; We need to be able to do this for any operand, including MEM, or we
8441 ;; will cause reload to blow up since we don't allow output reloads on
8443 ;; In order that the length attribute is calculated correctly, the
8444 ;; label MUST be operand 0.
8448 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
8450 (label_ref (match_operand 0 "" ""))
8452 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8453 (plus:SI (match_dup 1)
8455 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8456 (clobber (match_scratch:SI 4 "=X,X,r"))]
8460 if (which_alternative != 0)
8462 else if (get_attr_length (insn) == 8)
8463 return \"{bdn|bdnz} %l0\";
8465 return \"bdz $+8\;b %l0\";
8467 [(set_attr "type" "branch")
8468 (set_attr "length" "*,12,16")])
8472 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
8475 (label_ref (match_operand 0 "" ""))))
8476 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8477 (plus:SI (match_dup 1)
8479 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8480 (clobber (match_scratch:SI 4 "=X,X,r"))]
8484 if (which_alternative != 0)
8486 else if (get_attr_length (insn) == 8)
8489 return \"{bdn|bdnz} $+8\;b %l0\";
8491 [(set_attr "type" "branch")
8492 (set_attr "length" "*,12,16")])
8494 ;; Similar, but we can use GE since we have a REG_NONNEG.
8497 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
8499 (label_ref (match_operand 0 "" ""))
8501 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8502 (plus:SI (match_dup 1)
8504 (clobber (match_scratch:CC 3 "=X,&x,&X"))
8505 (clobber (match_scratch:SI 4 "=X,X,r"))]
8506 "find_reg_note (insn, REG_NONNEG, 0)"
8509 if (which_alternative != 0)
8511 else if (get_attr_length (insn) == 8)
8512 return \"{bdn|bdnz} %l0\";
8514 return \"bdz $+8\;b %l0\";
8516 [(set_attr "type" "branch")
8517 (set_attr "length" "*,12,16")])
8521 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
8524 (label_ref (match_operand 0 "" ""))))
8525 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8526 (plus:SI (match_dup 1)
8528 (clobber (match_scratch:CC 3 "=X,&x,&X"))
8529 (clobber (match_scratch:SI 4 "=X,X,r"))]
8530 "find_reg_note (insn, REG_NONNEG, 0)"
8533 if (which_alternative != 0)
8535 else if (get_attr_length (insn) == 8)
8538 return \"{bdn|bdnz} $+8\;b %l0\";
8540 [(set_attr "type" "branch")
8541 (set_attr "length" "*,12,16")])
8545 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
8547 (label_ref (match_operand 0 "" ""))
8549 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8550 (plus:SI (match_dup 1)
8552 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8553 (clobber (match_scratch:SI 4 "=X,X,r"))]
8557 if (which_alternative != 0)
8559 else if (get_attr_length (insn) == 8)
8562 return \"{bdn|bdnz} $+8\;b %l0\";
8564 [(set_attr "type" "branch")
8565 (set_attr "length" "*,12,16")])
8569 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
8572 (label_ref (match_operand 0 "" ""))))
8573 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
8574 (plus:SI (match_dup 1)
8576 (clobber (match_scratch:CC 3 "=X,&x,&x"))
8577 (clobber (match_scratch:SI 4 "=X,X,r"))]
8581 if (which_alternative != 0)
8583 else if (get_attr_length (insn) == 8)
8584 return \"{bdn|bdnz} %l0\";
8586 return \"bdz $+8\;b %l0\";
8588 [(set_attr "type" "branch")
8589 (set_attr "length" "*,12,16")])
8593 (if_then_else (match_operator 2 "comparison_operator"
8594 [(match_operand:SI 1 "gpc_reg_operand" "")
8596 (match_operand 5 "" "")
8597 (match_operand 6 "" "")))
8598 (set (match_operand:SI 0 "gpc_reg_operand" "")
8599 (plus:SI (match_dup 1)
8601 (clobber (match_scratch:CC 3 ""))
8602 (clobber (match_scratch:SI 4 ""))]
8604 [(parallel [(set (match_dup 3)
8605 (compare:CC (plus:SI (match_dup 1)
8609 (plus:SI (match_dup 1)
8611 (set (pc) (if_then_else (match_dup 7)
8615 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
8620 (if_then_else (match_operator 2 "comparison_operator"
8621 [(match_operand:SI 1 "gpc_reg_operand" "")
8623 (match_operand 5 "" "")
8624 (match_operand 6 "" "")))
8625 (set (match_operand:SI 0 "general_operand" "")
8626 (plus:SI (match_dup 1) (const_int -1)))
8627 (clobber (match_scratch:CC 3 ""))
8628 (clobber (match_scratch:SI 4 ""))]
8629 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
8630 [(parallel [(set (match_dup 3)
8631 (compare:CC (plus:SI (match_dup 1)
8635 (plus:SI (match_dup 1)
8639 (set (pc) (if_then_else (match_dup 7)
8643 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],