1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 91-96, 1997 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GNU CC.
7 ;; GNU CC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU CC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU CC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; Define an insn type attribute. This is used in function unit delay
26 (define_attr "type" "integer,load,store,fpload,fpstore,imul,idiv,branch,compare,delayed_compare,fpcompare,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg"
27 (const_string "integer"))
30 (define_attr "length" ""
31 (if_then_else (eq_attr "type" "branch")
32 (if_then_else (and (ge (minus (pc) (match_dup 0))
34 (lt (minus (pc) (match_dup 0))
40 ;; Processor type -- this attribute must exactly match the processor_type
41 ;; enumeration in rs6000.h.
43 (define_attr "cpu" "rios1,rios2,mpccore,ppc403,ppc601,ppc603,ppc604,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 -- pure PowerPC only
50 ; (POWER and 601 use Integer Unit)
51 (define_function_unit "lsu" 1 0
52 (and (eq_attr "type" "load")
53 (eq_attr "cpu" "mpccore,ppc603,ppc604,ppc620"))
56 (define_function_unit "lsu" 1 0
57 (and (eq_attr "type" "store,fpstore")
58 (eq_attr "cpu" "mpccore,ppc603,ppc604,ppc620"))
61 (define_function_unit "lsu" 1 0
62 (and (eq_attr "type" "fpload")
63 (eq_attr "cpu" "mpccore,ppc603"))
66 (define_function_unit "lsu" 1 0
67 (and (eq_attr "type" "fpload")
68 (eq_attr "cpu" "ppc604,ppc620"))
71 (define_function_unit "iu" 1 0
72 (and (eq_attr "type" "load")
73 (eq_attr "cpu" "rios1,ppc403,ppc601"))
76 (define_function_unit "iu" 1 0
77 (and (eq_attr "type" "store,fpstore")
78 (eq_attr "cpu" "rios1,ppc403,ppc601"))
81 (define_function_unit "fpu" 1 0
82 (and (eq_attr "type" "fpstore")
83 (eq_attr "cpu" "rios1,ppc601"))
86 (define_function_unit "iu" 1 0
87 (and (eq_attr "type" "fpload")
88 (eq_attr "cpu" "rios1"))
91 (define_function_unit "iu" 1 0
92 (and (eq_attr "type" "fpload")
93 (eq_attr "cpu" "ppc601"))
96 (define_function_unit "iu2" 2 0
97 (and (eq_attr "type" "load,fpload")
98 (eq_attr "cpu" "rios2"))
101 (define_function_unit "iu2" 2 0
102 (and (eq_attr "type" "store,fpstore")
103 (eq_attr "cpu" "rios2"))
106 ; Integer Unit (RIOS1, PPC601, PPC603)
107 (define_function_unit "iu" 1 0
108 (and (eq_attr "type" "integer")
109 (eq_attr "cpu" "rios1,mpccore,ppc403,ppc601,ppc603"))
112 (define_function_unit "iu" 1 0
113 (and (eq_attr "type" "imul")
114 (eq_attr "cpu" "ppc403"))
117 (define_function_unit "iu" 1 0
118 (and (eq_attr "type" "imul")
119 (eq_attr "cpu" "rios1,ppc601,ppc603"))
122 (define_function_unit "iu" 1 0
123 (and (eq_attr "type" "idiv")
124 (eq_attr "cpu" "rios1"))
127 (define_function_unit "iu" 1 0
128 (and (eq_attr "type" "idiv")
129 (eq_attr "cpu" "ppc403"))
132 (define_function_unit "iu" 1 0
133 (and (eq_attr "type" "idiv")
134 (eq_attr "cpu" "ppc601"))
137 (define_function_unit "iu" 1 0
138 (and (eq_attr "type" "idiv")
139 (eq_attr "cpu" "ppc603"))
142 ; RIOS2 has two integer units: a primary one which can perform all
143 ; operations and a secondary one which is fed in lock step with the first
144 ; and can perform "simple" integer operations.
145 ; To catch this we define a 'dummy' imuldiv-unit that is also needed
146 ; for the complex insns.
147 (define_function_unit "iu2" 2 0
148 (and (eq_attr "type" "integer")
149 (eq_attr "cpu" "rios2"))
152 (define_function_unit "iu2" 2 0
153 (and (eq_attr "type" "imul")
154 (eq_attr "cpu" "rios2"))
157 (define_function_unit "iu2" 2 0
158 (and (eq_attr "type" "idiv")
159 (eq_attr "cpu" "rios2"))
162 (define_function_unit "imuldiv" 1 0
163 (and (eq_attr "type" "imul")
164 (eq_attr "cpu" "rios2"))
167 (define_function_unit "imuldiv" 1 0
168 (and (eq_attr "type" "idiv")
169 (eq_attr "cpu" "rios2"))
172 ; MPCCORE has separate IMUL/IDIV unit for multicycle instructions
173 ; Divide latency varies greatly from 2-11, use 6 as average
174 (define_function_unit "imuldiv" 1 0
175 (and (eq_attr "type" "imul")
176 (eq_attr "cpu" "mpccore"))
179 (define_function_unit "imuldiv" 1 0
180 (and (eq_attr "type" "idiv")
181 (eq_attr "cpu" "mpccore"))
184 ; PPC604 has two units that perform integer operations
185 ; and one unit for divide/multiply operations (and move
187 (define_function_unit "iu2" 2 0
188 (and (eq_attr "type" "integer")
189 (eq_attr "cpu" "ppc604,ppc620"))
192 (define_function_unit "imuldiv" 1 0
193 (and (eq_attr "type" "imul")
194 (eq_attr "cpu" "ppc604,ppc620"))
197 (define_function_unit "imuldiv" 1 0
198 (and (eq_attr "type" "idiv")
199 (eq_attr "cpu" "ppc604,ppc620"))
202 ; compare is done on integer unit, but feeds insns which
203 ; execute on the branch unit.
204 (define_function_unit "iu" 1 0
205 (and (eq_attr "type" "compare")
206 (eq_attr "cpu" "rios1"))
209 (define_function_unit "iu" 1 0
210 (and (eq_attr "type" "delayed_compare")
211 (eq_attr "cpu" "rios1"))
214 (define_function_unit "iu" 1 0
215 (and (eq_attr "type" "compare,delayed_compare")
216 (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc620"))
219 (define_function_unit "iu2" 2 0
220 (and (eq_attr "type" "compare,delayed_compare")
221 (eq_attr "cpu" "rios2"))
224 (define_function_unit "iu2" 2 0
225 (and (eq_attr "type" "compare,delayed_compare")
226 (eq_attr "cpu" "ppc604,ppc620"))
229 ; fp compare uses fp unit
230 (define_function_unit "fpu" 1 0
231 (and (eq_attr "type" "fpcompare")
232 (eq_attr "cpu" "rios1"))
235 ; rios1 and rios2 have different fpcompare delays
236 (define_function_unit "fpu2" 2 0
237 (and (eq_attr "type" "fpcompare")
238 (eq_attr "cpu" "rios2"))
241 ; on ppc601 and ppc603, fpcompare takes also 2 cycles from
243 ; here we do not define delays, just occupy the unit. The dependencies
244 ; will be assigned by the fpcompare definition in the fpu.
245 (define_function_unit "iu" 1 0
246 (and (eq_attr "type" "fpcompare")
247 (eq_attr "cpu" "ppc601,ppc603"))
250 ; fp compare uses fp unit
251 (define_function_unit "fpu" 1 0
252 (and (eq_attr "type" "fpcompare")
253 (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
256 (define_function_unit "fpu" 1 0
257 (and (eq_attr "type" "fpcompare")
258 (eq_attr "cpu" "mpccore"))
261 (define_function_unit "bpu" 1 0
262 (and (eq_attr "type" "mtjmpr")
263 (eq_attr "cpu" "rios1,rios2"))
266 (define_function_unit "bpu" 1 0
267 (and (eq_attr "type" "mtjmpr")
268 (eq_attr "cpu" "mpccore,ppc403,ppc601,ppc603,ppc604,ppc620"))
271 ; all jumps/branches are executing on the bpu, in 1 cycle, for all machines.
272 (define_function_unit "bpu" 1 0
273 (eq_attr "type" "jmpreg")
276 (define_function_unit "bpu" 1 0
277 (eq_attr "type" "branch")
280 ; Floating Point Unit
281 (define_function_unit "fpu" 1 0
282 (and (eq_attr "type" "fp,dmul")
283 (eq_attr "cpu" "rios1"))
286 (define_function_unit "fpu" 1 0
287 (and (eq_attr "type" "fp")
288 (eq_attr "cpu" "mpccore"))
291 (define_function_unit "fpu" 1 0
292 (and (eq_attr "type" "fp")
293 (eq_attr "cpu" "ppc601"))
296 (define_function_unit "fpu" 1 0
297 (and (eq_attr "type" "fp")
298 (eq_attr "cpu" "ppc603,ppc604,ppc620"))
301 (define_function_unit "fpu" 1 0
302 (and (eq_attr "type" "dmul")
303 (eq_attr "cpu" "mpccore"))
306 (define_function_unit "fpu" 1 0
307 (and (eq_attr "type" "dmul")
308 (eq_attr "cpu" "ppc601"))
312 (define_function_unit "fpu" 1 0
313 (and (eq_attr "type" "dmul")
314 (eq_attr "cpu" "ppc603"))
317 (define_function_unit "fpu" 1 0
318 (and (eq_attr "type" "dmul")
319 (eq_attr "cpu" "ppc604,ppc620"))
322 (define_function_unit "fpu" 1 0
323 (and (eq_attr "type" "sdiv,ddiv")
324 (eq_attr "cpu" "rios1"))
327 (define_function_unit "fpu" 1 0
328 (and (eq_attr "type" "sdiv")
329 (eq_attr "cpu" "ppc601"))
332 (define_function_unit "fpu" 1 0
333 (and (eq_attr "type" "sdiv")
334 (eq_attr "cpu" "mpccore"))
337 (define_function_unit "fpu" 1 0
338 (and (eq_attr "type" "sdiv")
339 (eq_attr "cpu" "ppc603,ppc604,ppc620"))
342 (define_function_unit "fpu" 1 0
343 (and (eq_attr "type" "ddiv")
344 (eq_attr "cpu" "mpccore"))
347 (define_function_unit "fpu" 1 0
348 (and (eq_attr "type" "ddiv")
349 (eq_attr "cpu" "ppc601,ppc604,ppc620"))
352 (define_function_unit "fpu" 1 0
353 (and (eq_attr "type" "ddiv")
354 (eq_attr "cpu" "ppc603"))
357 (define_function_unit "fpu" 1 0
358 (and (eq_attr "type" "ssqrt")
359 (eq_attr "cpu" "ppc620"))
362 (define_function_unit "fpu" 1 0
363 (and (eq_attr "type" "dsqrt")
364 (eq_attr "cpu" "ppc620"))
367 ; RIOS2 has two symmetric FPUs.
368 (define_function_unit "fpu2" 2 0
369 (and (eq_attr "type" "fp")
370 (eq_attr "cpu" "rios2"))
373 (define_function_unit "fpu2" 2 0
374 (and (eq_attr "type" "dmul")
375 (eq_attr "cpu" "rios2"))
378 (define_function_unit "fpu2" 2 0
379 (and (eq_attr "type" "sdiv,ddiv")
380 (eq_attr "cpu" "rios2"))
383 (define_function_unit "fpu2" 2 0
384 (and (eq_attr "type" "ssqrt,dsqrt")
385 (eq_attr "cpu" "rios2"))
389 ;; Start with fixed-point load and store insns. Here we put only the more
390 ;; complex forms. Basic data transfer is done later.
392 (define_expand "zero_extendqidi2"
393 [(set (match_operand:DI 0 "gpc_reg_operand" "")
394 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
399 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
400 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
405 [(set_attr "type" "load,*")])
408 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
409 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
411 (clobber (match_scratch:DI 2 "=r"))]
414 [(set_attr "type" "compare")])
417 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
418 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
420 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
421 (zero_extend:DI (match_dup 1)))]
424 [(set_attr "type" "compare")])
426 (define_insn "extendqidi2"
427 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
428 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
433 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
434 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
436 (clobber (match_scratch:DI 2 "=r"))]
439 [(set_attr "type" "compare")])
442 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
443 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
445 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
446 (sign_extend:DI (match_dup 1)))]
449 [(set_attr "type" "compare")])
451 (define_expand "zero_extendhidi2"
452 [(set (match_operand:DI 0 "gpc_reg_operand" "")
453 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
458 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
459 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
464 [(set_attr "type" "load,*")])
467 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
468 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
470 (clobber (match_scratch:DI 2 "=r"))]
473 [(set_attr "type" "compare")])
476 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
477 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
479 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
480 (zero_extend:DI (match_dup 1)))]
483 [(set_attr "type" "compare")])
485 (define_expand "extendhidi2"
486 [(set (match_operand:DI 0 "gpc_reg_operand" "")
487 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
492 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
493 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
498 [(set_attr "type" "load,*")])
501 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
502 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
504 (clobber (match_scratch:DI 2 "=r"))]
507 [(set_attr "type" "compare")])
510 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
511 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
513 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
514 (sign_extend:DI (match_dup 1)))]
517 [(set_attr "type" "compare")])
519 (define_expand "zero_extendsidi2"
520 [(set (match_operand:DI 0 "gpc_reg_operand" "")
521 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
526 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
527 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
532 [(set_attr "type" "load,*")])
535 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
536 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
538 (clobber (match_scratch:DI 2 "=r"))]
541 [(set_attr "type" "compare")])
544 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
545 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
547 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
548 (zero_extend:DI (match_dup 1)))]
551 [(set_attr "type" "compare")])
553 (define_expand "extendsidi2"
554 [(set (match_operand:DI 0 "gpc_reg_operand" "")
555 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
560 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
561 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
566 [(set_attr "type" "load,*")])
569 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
570 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
572 (clobber (match_scratch:DI 2 "=r"))]
575 [(set_attr "type" "compare")])
578 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
579 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
581 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
582 (sign_extend:DI (match_dup 1)))]
585 [(set_attr "type" "compare")])
587 (define_expand "zero_extendqisi2"
588 [(set (match_operand:SI 0 "gpc_reg_operand" "")
589 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
594 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
595 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
599 {rlinm|rlwinm} %0,%1,0,0xff"
600 [(set_attr "type" "load,*")])
603 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
604 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
606 (clobber (match_scratch:SI 2 "=r"))]
608 "{andil.|andi.} %2,%1,0xff"
609 [(set_attr "type" "compare")])
612 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
613 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
615 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
616 (zero_extend:SI (match_dup 1)))]
618 "{andil.|andi.} %0,%1,0xff"
619 [(set_attr "type" "compare")])
621 (define_expand "extendqisi2"
622 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
623 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
628 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
629 else if (TARGET_POWER)
630 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
632 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
636 (define_insn "extendqisi2_ppc"
637 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
638 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
643 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
644 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
646 (clobber (match_scratch:SI 2 "=r"))]
649 [(set_attr "type" "compare")])
652 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
653 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
655 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
656 (sign_extend:SI (match_dup 1)))]
659 [(set_attr "type" "compare")])
661 (define_expand "extendqisi2_power"
662 [(parallel [(set (match_dup 2)
663 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
665 (clobber (scratch:SI))])
666 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
667 (ashiftrt:SI (match_dup 2)
669 (clobber (scratch:SI))])]
672 { operands[1] = gen_lowpart (SImode, operands[1]);
673 operands[2] = gen_reg_rtx (SImode); }")
675 (define_expand "extendqisi2_no_power"
677 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
679 (set (match_operand:SI 0 "gpc_reg_operand" "")
680 (ashiftrt:SI (match_dup 2)
682 "! TARGET_POWER && ! TARGET_POWERPC"
684 { operands[1] = gen_lowpart (SImode, operands[1]);
685 operands[2] = gen_reg_rtx (SImode); }")
687 (define_expand "zero_extendqihi2"
688 [(set (match_operand:HI 0 "gpc_reg_operand" "")
689 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
694 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
695 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
699 {rlinm|rlwinm} %0,%1,0,0xff"
700 [(set_attr "type" "load,*")])
703 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
704 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
706 (clobber (match_scratch:HI 2 "=r"))]
708 "{andil.|andi.} %2,%1,0xff"
709 [(set_attr "type" "compare")])
712 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
713 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
715 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
716 (zero_extend:HI (match_dup 1)))]
718 "{andil.|andi.} %0,%1,0xff"
719 [(set_attr "type" "compare")])
721 (define_expand "extendqihi2"
722 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
723 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
728 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
729 else if (TARGET_POWER)
730 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
732 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
736 (define_insn "extendqihi2_ppc"
737 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
738 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
743 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
744 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
746 (clobber (match_scratch:HI 2 "=r"))]
749 [(set_attr "type" "compare")])
752 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
753 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
755 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
756 (sign_extend:HI (match_dup 1)))]
759 [(set_attr "type" "compare")])
761 (define_expand "extendqihi2_power"
762 [(parallel [(set (match_dup 2)
763 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
765 (clobber (scratch:SI))])
766 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
767 (ashiftrt:SI (match_dup 2)
769 (clobber (scratch:SI))])]
772 { operands[0] = gen_lowpart (SImode, operands[0]);
773 operands[1] = gen_lowpart (SImode, operands[1]);
774 operands[2] = gen_reg_rtx (SImode); }")
776 (define_expand "extendqihi2_no_power"
778 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
780 (set (match_operand:HI 0 "gpc_reg_operand" "")
781 (ashiftrt:SI (match_dup 2)
783 "! TARGET_POWER && ! TARGET_POWERPC"
785 { operands[0] = gen_lowpart (SImode, operands[0]);
786 operands[1] = gen_lowpart (SImode, operands[1]);
787 operands[2] = gen_reg_rtx (SImode); }")
789 (define_expand "zero_extendhisi2"
790 [(set (match_operand:SI 0 "gpc_reg_operand" "")
791 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
796 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
797 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
801 {rlinm|rlwinm} %0,%1,0,0xffff"
802 [(set_attr "type" "load,*")])
805 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
806 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
808 (clobber (match_scratch:SI 2 "=r"))]
810 "{andil.|andi.} %2,%1,0xffff"
811 [(set_attr "type" "compare")])
814 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
815 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
817 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
818 (zero_extend:SI (match_dup 1)))]
820 "{andil.|andi.} %0,%1,0xffff"
821 [(set_attr "type" "compare")])
823 (define_expand "extendhisi2"
824 [(set (match_operand:SI 0 "gpc_reg_operand" "")
825 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
830 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
831 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
836 [(set_attr "type" "load,*")])
839 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
840 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
842 (clobber (match_scratch:SI 2 "=r"))]
844 "{exts.|extsh.} %2,%1"
845 [(set_attr "type" "compare")])
848 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
849 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
851 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
852 (sign_extend:SI (match_dup 1)))]
854 "{exts.|extsh.} %0,%1"
855 [(set_attr "type" "compare")])
857 ;; Fixed-point arithmetic insns.
859 ;; Discourage ai/addic because of carry but provide it in an alternative
860 ;; allowing register zero as source.
861 (define_expand "addsi3"
862 [(set (match_operand:SI 0 "gpc_reg_operand" "")
863 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
864 (match_operand:SI 2 "reg_or_cint_operand" "")))]
868 if (GET_CODE (operands[2]) == CONST_INT && !add_operand (operands[2], SImode))
870 rtx tmp = ((reload_in_progress || reload_completed
871 || rtx_equal_p (operands[0], operands[1]))
872 ? operands[0] : gen_reg_rtx (SImode));
874 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
875 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
878 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
880 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (high)));
881 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
886 (define_insn "*addsi3_internal1"
887 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
888 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
889 (match_operand:SI 2 "add_operand" "r,I,I,J")))]
893 {cal %0,%2(%1)|addi %0,%1,%2}
895 {cau|addis} %0,%1,%v2"
896 [(set_attr "length" "4,4,4,4")])
898 (define_insn "*addsi3_internal2"
899 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
900 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
901 (match_operand:SI 2 "reg_or_short_operand" "r,I"))
903 (clobber (match_scratch:SI 3 "=r,r"))]
907 {ai.|addic.} %3,%1,%2"
908 [(set_attr "type" "compare")])
910 (define_insn "*addsi3_internal3"
911 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
912 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
913 (match_operand:SI 2 "reg_or_short_operand" "r,I"))
915 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
916 (plus:SI (match_dup 1) (match_dup 2)))]
920 {ai.|addic.} %0,%1,%2"
921 [(set_attr "type" "compare")])
923 ;; Split an add that we can't do in one insn into two insns, each of which
924 ;; does one 16-bit part. This is used by combine. Note that the low-order
925 ;; add should be last in case the result gets used in an address.
928 [(set (match_operand:SI 0 "gpc_reg_operand" "")
929 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
930 (match_operand:SI 2 "non_add_cint_operand" "")))]
932 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
933 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
936 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
937 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
940 high += 0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
942 operands[3] = GEN_INT (high);
943 operands[4] = GEN_INT (low);
946 (define_insn "one_cmplsi2"
947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
948 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
953 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
954 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
956 (clobber (match_scratch:SI 2 "=r"))]
959 [(set_attr "type" "compare")])
962 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
963 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
965 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
966 (not:SI (match_dup 1)))]
969 [(set_attr "type" "compare")])
972 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
973 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
974 (match_operand:SI 2 "gpc_reg_operand" "r")))]
976 "{sf%I1|subf%I1c} %0,%2,%1")
979 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
980 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
981 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
988 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
989 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
990 (match_operand:SI 2 "gpc_reg_operand" "r"))
992 (clobber (match_scratch:SI 3 "=r"))]
994 "{sf.|subfc.} %3,%2,%1"
995 [(set_attr "type" "compare")])
998 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
999 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1000 (match_operand:SI 2 "gpc_reg_operand" "r"))
1002 (clobber (match_scratch:SI 3 "=r"))]
1005 [(set_attr "type" "compare")])
1008 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1009 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1010 (match_operand:SI 2 "gpc_reg_operand" "r"))
1012 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1013 (minus:SI (match_dup 1) (match_dup 2)))]
1015 "{sf.|subfc.} %0,%2,%1"
1016 [(set_attr "type" "compare")])
1019 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1020 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1021 (match_operand:SI 2 "gpc_reg_operand" "r"))
1023 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1024 (minus:SI (match_dup 1) (match_dup 2)))]
1027 [(set_attr "type" "compare")])
1029 (define_expand "subsi3"
1030 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1031 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1032 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1036 if (GET_CODE (operands[2]) == CONST_INT)
1038 emit_insn (gen_addsi3 (operands[0], operands[1],
1039 negate_rtx (SImode, operands[2])));
1044 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1045 ;; instruction and some auxiliary computations. Then we just have a single
1046 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1049 (define_expand "sminsi3"
1051 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1052 (match_operand:SI 2 "reg_or_short_operand" ""))
1054 (minus:SI (match_dup 2) (match_dup 1))))
1055 (set (match_operand:SI 0 "gpc_reg_operand" "")
1056 (minus:SI (match_dup 2) (match_dup 3)))]
1059 { operands[3] = gen_reg_rtx (SImode); }")
1062 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1063 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1064 (match_operand:SI 2 "reg_or_short_operand" "")))
1065 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1068 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1070 (minus:SI (match_dup 2) (match_dup 1))))
1071 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1074 (define_expand "smaxsi3"
1076 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1077 (match_operand:SI 2 "reg_or_short_operand" ""))
1079 (minus:SI (match_dup 2) (match_dup 1))))
1080 (set (match_operand:SI 0 "gpc_reg_operand" "")
1081 (plus:SI (match_dup 3) (match_dup 1)))]
1084 { operands[3] = gen_reg_rtx (SImode); }")
1087 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1088 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1089 (match_operand:SI 2 "reg_or_short_operand" "")))
1090 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1093 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1095 (minus:SI (match_dup 2) (match_dup 1))))
1096 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1099 (define_expand "uminsi3"
1100 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1102 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1104 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1106 (minus:SI (match_dup 4) (match_dup 3))))
1107 (set (match_operand:SI 0 "gpc_reg_operand" "")
1108 (minus:SI (match_dup 2) (match_dup 3)))]
1112 operands[3] = gen_reg_rtx (SImode);
1113 operands[4] = gen_reg_rtx (SImode);
1114 operands[5] = GEN_INT (-2147483647 - 1);
1117 (define_expand "umaxsi3"
1118 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1120 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1122 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1124 (minus:SI (match_dup 4) (match_dup 3))))
1125 (set (match_operand:SI 0 "gpc_reg_operand" "")
1126 (plus:SI (match_dup 3) (match_dup 1)))]
1130 operands[3] = gen_reg_rtx (SImode);
1131 operands[4] = gen_reg_rtx (SImode);
1132 operands[5] = GEN_INT (-2147483647 - 1);
1136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1137 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1138 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1140 (minus:SI (match_dup 2) (match_dup 1))))]
1145 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1147 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1148 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1150 (minus:SI (match_dup 2) (match_dup 1)))
1152 (clobber (match_scratch:SI 3 "=r"))]
1155 [(set_attr "type" "delayed_compare")])
1158 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1160 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1161 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1163 (minus:SI (match_dup 2) (match_dup 1)))
1165 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1166 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1168 (minus:SI (match_dup 2) (match_dup 1))))]
1171 [(set_attr "type" "delayed_compare")])
1173 ;; We don't need abs with condition code because such comparisons should
1175 (define_expand "abssi2"
1176 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1177 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1183 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1188 (define_insn "abssi2_power"
1189 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1190 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1194 (define_insn "abssi2_nopower"
1195 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1196 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1197 (clobber (match_scratch:SI 2 "=&r,&r"))]
1201 return (TARGET_POWERPC)
1202 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0\"
1203 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%2,%0\";
1205 [(set_attr "length" "12")])
1208 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1209 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1210 (clobber (match_scratch:SI 2 "=&r,&r"))]
1211 "!TARGET_POWER && reload_completed"
1212 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1213 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1214 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1218 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1219 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1224 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1225 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1226 (clobber (match_scratch:SI 2 "=&r,&r"))]
1230 return (TARGET_POWERPC)
1231 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2\"
1232 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%0,%2\";
1234 [(set_attr "length" "12")])
1237 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1238 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1239 (clobber (match_scratch:SI 2 "=&r,&r"))]
1240 "!TARGET_POWER && reload_completed"
1241 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1242 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1243 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1246 (define_insn "negsi2"
1247 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1248 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1253 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1254 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1256 (clobber (match_scratch:SI 2 "=r"))]
1259 [(set_attr "type" "compare")])
1262 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
1263 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1265 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1266 (neg:SI (match_dup 1)))]
1269 [(set_attr "type" "compare")])
1271 (define_insn "ffssi2"
1272 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
1273 (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1275 "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
1276 [(set_attr "length" "16")])
1278 (define_expand "mulsi3"
1279 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1280 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1281 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1286 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1288 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1292 (define_insn "mulsi3_mq"
1293 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1294 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1295 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1296 (clobber (match_scratch:SI 3 "=q,q"))]
1299 {muls|mullw} %0,%1,%2
1300 {muli|mulli} %0,%1,%2"
1301 [(set_attr "type" "imul")])
1303 (define_insn "mulsi3_no_mq"
1304 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1305 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1306 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1309 {muls|mullw} %0,%1,%2
1310 {muli|mulli} %0,%1,%2"
1311 [(set_attr "type" "imul")])
1314 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1315 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1316 (match_operand:SI 2 "gpc_reg_operand" "r"))
1318 (clobber (match_scratch:SI 3 "=r"))
1319 (clobber (match_scratch:SI 4 "=q"))]
1321 "{muls.|mullw.} %3,%1,%2"
1322 [(set_attr "type" "delayed_compare")])
1325 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1326 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1327 (match_operand:SI 2 "gpc_reg_operand" "r"))
1329 (clobber (match_scratch:SI 3 "=r"))]
1331 "{muls.|mullw.} %3,%1,%2"
1332 [(set_attr "type" "delayed_compare")])
1335 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1336 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1337 (match_operand:SI 2 "gpc_reg_operand" "r"))
1339 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1340 (mult:SI (match_dup 1) (match_dup 2)))
1341 (clobber (match_scratch:SI 4 "=q"))]
1343 "{muls.|mullw.} %0,%1,%2"
1344 [(set_attr "type" "delayed_compare")])
1347 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1348 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1349 (match_operand:SI 2 "gpc_reg_operand" "r"))
1351 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1352 (mult:SI (match_dup 1) (match_dup 2)))]
1354 "{muls.|mullw.} %0,%1,%2"
1355 [(set_attr "type" "delayed_compare")])
1357 ;; Operand 1 is divided by operand 2; quotient goes to operand
1358 ;; 0 and remainder to operand 3.
1359 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1361 (define_expand "divmodsi4"
1362 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1363 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1364 (match_operand:SI 2 "gpc_reg_operand" "")))
1365 (set (match_operand:SI 3 "gpc_reg_operand" "")
1366 (mod:SI (match_dup 1) (match_dup 2)))])]
1367 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1370 if (! TARGET_POWER && ! TARGET_POWERPC)
1372 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1373 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1374 emit_insn (gen_divss_call ());
1375 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1376 emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
1382 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1383 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1384 (match_operand:SI 2 "gpc_reg_operand" "r")))
1385 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
1386 (mod:SI (match_dup 1) (match_dup 2)))]
1389 [(set_attr "type" "idiv")])
1392 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1393 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1394 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1397 [(set_attr "type" "idiv")])
1399 (define_expand "udivsi3"
1400 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1401 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1402 (match_operand:SI 2 "gpc_reg_operand" "")))]
1403 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1406 if (! TARGET_POWER && ! TARGET_POWERPC)
1408 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1409 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1410 emit_insn (gen_quous_call ());
1411 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1417 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1418 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1419 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1422 [(set_attr "type" "idiv")])
1424 ;; For powers of two we can do srai/aze for divide and then adjust for
1425 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1426 ;; used; for PowerPC, force operands into register and do a normal divide;
1427 ;; for AIX common-mode, use quoss call on register operands.
1428 (define_expand "divsi3"
1429 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1430 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1431 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1435 if (GET_CODE (operands[2]) == CONST_INT
1436 && exact_log2 (INTVAL (operands[2])) >= 0)
1438 else if (TARGET_POWERPC)
1439 operands[2] = force_reg (SImode, operands[2]);
1440 else if (TARGET_POWER)
1444 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1445 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1446 emit_insn (gen_quoss_call ());
1447 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1452 (define_expand "modsi3"
1453 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1454 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1455 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1459 int i = exact_log2 (INTVAL (operands[2]));
1463 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
1466 temp1 = gen_reg_rtx (SImode);
1467 temp2 = gen_reg_rtx (SImode);
1469 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1470 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1471 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1477 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1478 (match_operand:SI 2 "const_int_operand" "N")))]
1479 "exact_log2 (INTVAL (operands[2])) >= 0"
1480 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1481 [(set_attr "length" "8")])
1484 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1485 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1486 (match_operand:SI 2 "const_int_operand" "N"))
1488 (clobber (match_scratch:SI 3 "=r"))]
1489 "exact_log2 (INTVAL (operands[2])) >= 0"
1490 "{srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3"
1491 [(set_attr "type" "compare")
1492 (set_attr "length" "8")])
1495 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1496 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1497 (match_operand:SI 2 "const_int_operand" "N"))
1499 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1500 (div:SI (match_dup 1) (match_dup 2)))]
1501 "exact_log2 (INTVAL (operands[2])) >= 0"
1502 "{srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0"
1503 [(set_attr "type" "compare")
1504 (set_attr "length" "8")])
1507 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1510 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
1512 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
1513 (match_operand:SI 3 "gpc_reg_operand" "r")))
1514 (set (match_operand:SI 2 "register_operand" "=*q")
1517 (zero_extend:DI (match_dup 1)) (const_int 32))
1518 (zero_extend:DI (match_dup 4)))
1522 [(set_attr "type" "idiv")])
1524 ;; To do unsigned divide we handle the cases of the divisor looking like a
1525 ;; negative number. If it is a constant that is less than 2**31, we don't
1526 ;; have to worry about the branches. So make a few subroutines here.
1528 ;; First comes the normal case.
1529 (define_expand "udivmodsi4_normal"
1530 [(set (match_dup 4) (const_int 0))
1531 (parallel [(set (match_operand:SI 0 "" "")
1532 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1534 (zero_extend:DI (match_operand:SI 1 "" "")))
1535 (match_operand:SI 2 "" "")))
1536 (set (match_operand:SI 3 "" "")
1537 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1539 (zero_extend:DI (match_dup 1)))
1543 { operands[4] = gen_reg_rtx (SImode); }")
1545 ;; This handles the branches.
1546 (define_expand "udivmodsi4_tests"
1547 [(set (match_operand:SI 0 "" "") (const_int 0))
1548 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
1549 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
1550 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
1551 (label_ref (match_operand:SI 4 "" "")) (pc)))
1552 (set (match_dup 0) (const_int 1))
1553 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
1554 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
1555 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
1556 (label_ref (match_dup 4)) (pc)))]
1559 { operands[5] = gen_reg_rtx (CCUNSmode);
1560 operands[6] = gen_reg_rtx (CCmode);
1563 (define_expand "udivmodsi4"
1564 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1565 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1566 (match_operand:SI 2 "reg_or_cint_operand" "")))
1567 (set (match_operand:SI 3 "gpc_reg_operand" "")
1568 (umod:SI (match_dup 1) (match_dup 2)))])]
1575 if (! TARGET_POWERPC)
1577 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1578 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1579 emit_insn (gen_divus_call ());
1580 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1581 emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
1587 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
1589 operands[2] = force_reg (SImode, operands[2]);
1590 label = gen_label_rtx ();
1591 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
1592 operands[3], label));
1595 operands[2] = force_reg (SImode, operands[2]);
1597 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
1605 ;; AIX architecture-independent common-mode multiply (DImode),
1606 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
1607 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
1608 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
1609 ;; assumed unused if generating common-mode, so ignore.
1610 (define_insn "mulh_call"
1613 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
1614 (sign_extend:DI (reg:SI 4)))
1616 (clobber (match_scratch:SI 0 "=l"))]
1617 "! TARGET_POWER && ! TARGET_POWERPC"
1619 [(set_attr "type" "imul")])
1621 (define_insn "mull_call"
1623 (mult:DI (sign_extend:DI (reg:SI 3))
1624 (sign_extend:DI (reg:SI 4))))
1625 (clobber (match_scratch:SI 0 "=l"))
1626 (clobber (reg:SI 0))]
1627 "! TARGET_POWER && ! TARGET_POWERPC"
1629 [(set_attr "type" "imul")])
1631 (define_insn "divss_call"
1633 (div:SI (reg:SI 3) (reg:SI 4)))
1635 (mod:SI (reg:SI 3) (reg:SI 4)))
1636 (clobber (match_scratch:SI 0 "=l"))
1637 (clobber (reg:SI 0))]
1638 "! TARGET_POWER && ! TARGET_POWERPC"
1640 [(set_attr "type" "idiv")])
1642 (define_insn "divus_call"
1644 (udiv:SI (reg:SI 3) (reg:SI 4)))
1646 (umod:SI (reg:SI 3) (reg:SI 4)))
1647 (clobber (match_scratch:SI 0 "=l"))
1648 (clobber (reg:SI 0))
1649 (clobber (match_scratch:CC 1 "=x"))
1650 (clobber (reg:CC 69))]
1651 "! TARGET_POWER && ! TARGET_POWERPC"
1653 [(set_attr "type" "idiv")])
1655 (define_insn "quoss_call"
1657 (div:SI (reg:SI 3) (reg:SI 4)))
1658 (clobber (match_scratch:SI 0 "=l"))]
1659 "! TARGET_POWER && ! TARGET_POWERPC"
1661 [(set_attr "type" "idiv")])
1663 (define_insn "quous_call"
1665 (udiv:SI (reg:SI 3) (reg:SI 4)))
1666 (clobber (match_scratch:SI 0 "=l"))
1667 (clobber (reg:SI 0))
1668 (clobber (match_scratch:CC 1 "=x"))
1669 (clobber (reg:CC 69))]
1670 "! TARGET_POWER && ! TARGET_POWERPC"
1672 [(set_attr "type" "idiv")])
1674 ;; Logical instructions
1675 (define_insn "andsi3"
1676 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1677 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1678 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
1679 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
1683 {rlinm|rlwinm} %0,%1,0,%m2,%M2
1684 {andil.|andi.} %0,%1,%b2
1685 {andiu.|andis.} %0,%1,%u2"
1686 [(set_attr "length" "4,4,4,4")])
1688 (define_insn "*andsi3_internal2"
1689 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
1690 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1691 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1693 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1697 {andil.|andi.} %3,%1,%b2
1698 {andiu.|andis.} %3,%1,%u2
1699 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2"
1700 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1702 (define_insn "*andsi3_internal3"
1703 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
1704 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1705 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1707 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1708 (and:SI (match_dup 1) (match_dup 2)))]
1712 {andil.|andi.} %0,%1,%b2
1713 {andiu.|andis.} %0,%1,%u2
1714 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2"
1715 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1717 (define_expand "iorsi3"
1718 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1719 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
1720 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1724 if (GET_CODE (operands[2]) == CONST_INT
1725 && !logical_operand (operands[2], SImode))
1727 HOST_WIDE_INT value = INTVAL (operands[2]);
1728 rtx tmp = ((reload_in_progress || reload_completed
1729 || rtx_equal_p (operands[0], operands[1]))
1730 ? operands[0] : gen_reg_rtx (SImode));
1732 emit_insn (gen_iorsi3 (tmp, operands[1], GEN_INT (value & 0xffff0000)));
1733 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0x0000ffff)));
1738 (define_insn "*iorsi3_internal1"
1739 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1740 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1741 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1745 {oril|ori} %0,%1,%b2
1746 {oriu|oris} %0,%1,%u2"
1747 [(set_attr "length" "4,4,4")])
1749 (define_insn "*iorsi3_internal2"
1750 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1751 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1752 (match_operand:SI 2 "gpc_reg_operand" "r"))
1754 (clobber (match_scratch:SI 3 "=r"))]
1757 [(set_attr "type" "compare")])
1759 (define_insn "*iorsi3_internal3"
1760 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1761 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1762 (match_operand:SI 2 "gpc_reg_operand" "r"))
1764 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1765 (ior:SI (match_dup 1) (match_dup 2)))]
1768 [(set_attr "type" "compare")])
1770 (define_expand "xorsi3"
1771 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1772 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1773 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1777 if (GET_CODE (operands[2]) == CONST_INT
1778 && !logical_operand (operands[2], SImode))
1780 HOST_WIDE_INT value = INTVAL (operands[2]);
1781 rtx tmp = ((reload_in_progress || reload_completed
1782 || rtx_equal_p (operands[0], operands[1]))
1783 ? operands[0] : gen_reg_rtx (SImode));
1785 emit_insn (gen_xorsi3 (tmp, operands[1], GEN_INT (value & 0xffff0000)));
1786 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0x0000ffff)));
1791 (define_insn "*xorsi3_internal1"
1792 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1793 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1794 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1798 {xoril|xori} %0,%1,%b2
1799 {xoriu|xoris} %0,%1,%u2"
1800 [(set_attr "length" "4,4,4")])
1802 (define_insn "*xorsi3_internal2"
1803 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1804 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1805 (match_operand:SI 2 "gpc_reg_operand" "r"))
1807 (clobber (match_scratch:SI 3 "=r"))]
1810 [(set_attr "type" "compare")])
1812 (define_insn "*xorsi3_internal3"
1813 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1814 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1815 (match_operand:SI 2 "gpc_reg_operand" "r"))
1817 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1818 (xor:SI (match_dup 1) (match_dup 2)))]
1821 [(set_attr "type" "compare")])
1823 (define_insn "*eqv_internal1"
1824 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1825 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1826 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1830 (define_insn "*eqv_internal2"
1831 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1832 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1833 (match_operand:SI 2 "gpc_reg_operand" "r")))
1835 (clobber (match_scratch:SI 3 "=r"))]
1838 [(set_attr "type" "compare")])
1840 (define_insn "*eqv_internal3"
1841 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1842 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1843 (match_operand:SI 2 "gpc_reg_operand" "r")))
1845 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1846 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
1849 [(set_attr "type" "compare")])
1851 (define_insn "*andc_internal1"
1852 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1853 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1854 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1858 (define_insn "*andc_internal2"
1859 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1860 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1861 (match_operand:SI 2 "gpc_reg_operand" "r"))
1863 (clobber (match_scratch:SI 3 "=r"))]
1866 [(set_attr "type" "compare")])
1868 (define_insn "*andc_internal3"
1869 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1870 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1871 (match_operand:SI 2 "gpc_reg_operand" "r"))
1873 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1874 (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
1877 [(set_attr "type" "compare")])
1879 (define_insn "*iorc_internal1"
1880 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1881 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1882 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1886 (define_insn "*iorc_internal2"
1887 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1888 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1889 (match_operand:SI 2 "gpc_reg_operand" "r"))
1891 (clobber (match_scratch:SI 3 "=r"))]
1894 [(set_attr "type" "compare")])
1896 (define_insn "*iorc_internal3"
1897 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1898 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1899 (match_operand:SI 2 "gpc_reg_operand" "r"))
1901 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1902 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
1905 [(set_attr "type" "compare")])
1907 (define_insn "*nand_internal1"
1908 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1909 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1910 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1914 (define_insn "*nand_internal2"
1915 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1916 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1917 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1919 (clobber (match_scratch:SI 3 "=r"))]
1922 [(set_attr "type" "compare")])
1924 (define_insn "*nand_internal3"
1925 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1926 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1927 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1929 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1930 (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1933 [(set_attr "type" "compare")])
1935 (define_insn "*nor_internal1"
1936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1937 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1938 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1942 (define_insn "*nor_internal2"
1943 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1944 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1945 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1947 (clobber (match_scratch:SI 3 "=r"))]
1950 [(set_attr "type" "compare")])
1952 (define_insn "*nor_internal3"
1953 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1954 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1955 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1957 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1958 (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1961 [(set_attr "type" "compare")])
1963 ;; maskir insn. We need four forms because things might be in arbitrary
1964 ;; orders. Don't define forms that only set CR fields because these
1965 ;; would modify an input register.
1967 (define_insn "*maskir_internal1"
1968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1969 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1970 (match_operand:SI 1 "gpc_reg_operand" "0"))
1971 (and:SI (match_dup 2)
1972 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
1976 (define_insn "*maskir_internal2"
1977 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1978 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1979 (match_operand:SI 1 "gpc_reg_operand" "0"))
1980 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1985 (define_insn "*maskir_internal3"
1986 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1987 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1988 (match_operand:SI 3 "gpc_reg_operand" "r"))
1989 (and:SI (not:SI (match_dup 2))
1990 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
1994 (define_insn "*maskir_internal4"
1995 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1996 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1997 (match_operand:SI 2 "gpc_reg_operand" "r"))
1998 (and:SI (not:SI (match_dup 2))
1999 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2003 (define_insn "*maskir_internal5"
2004 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2006 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2007 (match_operand:SI 1 "gpc_reg_operand" "0"))
2008 (and:SI (match_dup 2)
2009 (match_operand:SI 3 "gpc_reg_operand" "r")))
2011 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2012 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2013 (and:SI (match_dup 2) (match_dup 3))))]
2016 [(set_attr "type" "compare")])
2018 (define_insn "*maskir_internal6"
2019 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2021 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2022 (match_operand:SI 1 "gpc_reg_operand" "0"))
2023 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2026 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2027 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2028 (and:SI (match_dup 3) (match_dup 2))))]
2031 [(set_attr "type" "compare")])
2033 (define_insn "*maskir_internal7"
2034 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2036 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2037 (match_operand:SI 3 "gpc_reg_operand" "r"))
2038 (and:SI (not:SI (match_dup 2))
2039 (match_operand:SI 1 "gpc_reg_operand" "0")))
2041 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2042 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2043 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2046 [(set_attr "type" "compare")])
2048 (define_insn "*maskir_internal8"
2049 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2051 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2052 (match_operand:SI 2 "gpc_reg_operand" "r"))
2053 (and:SI (not:SI (match_dup 2))
2054 (match_operand:SI 1 "gpc_reg_operand" "0")))
2056 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2057 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2058 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2061 [(set_attr "type" "compare")])
2063 ;; Rotate and shift insns, in all their variants. These support shifts,
2064 ;; field inserts and extracts, and various combinations thereof.
2065 (define_expand "insv"
2066 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2067 (match_operand:SI 1 "const_int_operand" "i")
2068 (match_operand:SI 2 "const_int_operand" "i"))
2069 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2073 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2074 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2075 compiler if the address of the structure is taken later. */
2076 if (GET_CODE (operands[0]) == SUBREG
2077 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2082 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2083 (match_operand:SI 1 "const_int_operand" "i")
2084 (match_operand:SI 2 "const_int_operand" "i"))
2085 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2089 int start = INTVAL (operands[2]) & 31;
2090 int size = INTVAL (operands[1]) & 31;
2092 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
2093 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2094 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2098 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2099 (match_operand:SI 1 "const_int_operand" "i")
2100 (match_operand:SI 2 "const_int_operand" "i"))
2101 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2102 (match_operand:SI 4 "const_int_operand" "i")))]
2103 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2106 int shift = INTVAL (operands[4]) & 31;
2107 int start = INTVAL (operands[2]) & 31;
2108 int size = INTVAL (operands[1]) & 31;
2110 operands[4] = gen_rtx (CONST_INT, VOIDmode, shift - start - size);
2111 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2112 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2116 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2117 (match_operand:SI 1 "const_int_operand" "i")
2118 (match_operand:SI 2 "const_int_operand" "i"))
2119 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2120 (match_operand:SI 4 "const_int_operand" "i")))]
2121 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2124 int shift = INTVAL (operands[4]) & 31;
2125 int start = INTVAL (operands[2]) & 31;
2126 int size = INTVAL (operands[1]) & 31;
2128 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - shift - start - size);
2129 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2130 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2134 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2135 (match_operand:SI 1 "const_int_operand" "i")
2136 (match_operand:SI 2 "const_int_operand" "i"))
2137 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2138 (match_operand:SI 4 "const_int_operand" "i")))]
2139 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2142 int shift = INTVAL (operands[4]) & 31;
2143 int start = INTVAL (operands[2]) & 31;
2144 int size = INTVAL (operands[1]) & 31;
2146 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - shift - start - size);
2147 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2148 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2152 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2153 (match_operand:SI 1 "const_int_operand" "i")
2154 (match_operand:SI 2 "const_int_operand" "i"))
2155 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2156 (match_operand:SI 4 "const_int_operand" "i")
2157 (match_operand:SI 5 "const_int_operand" "i")))]
2158 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2161 int extract_start = INTVAL (operands[5]) & 31;
2162 int extract_size = INTVAL (operands[4]) & 31;
2163 int insert_start = INTVAL (operands[2]) & 31;
2164 int insert_size = INTVAL (operands[1]) & 31;
2166 /* Align extract field with insert field */
2167 operands[5] = gen_rtx (CONST_INT, VOIDmode,
2168 extract_start + extract_size - insert_start - insert_size);
2169 operands[1] = gen_rtx (CONST_INT, VOIDmode, insert_start + insert_size - 1);
2170 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
2174 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
2175 (match_operand:DI 1 "const_int_operand" "i")
2176 (match_operand:DI 2 "const_int_operand" "i"))
2177 (match_operand:DI 3 "gpc_reg_operand" "r"))]
2181 int start = INTVAL (operands[2]) & 63;
2182 int size = INTVAL (operands[1]) & 63;
2184 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - start - size);
2185 return \"rldimi %0,%3,%H2,%H1\";
2188 (define_expand "extzv"
2189 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2190 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2191 (match_operand:SI 2 "const_int_operand" "i")
2192 (match_operand:SI 3 "const_int_operand" "i")))]
2196 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2197 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2198 compiler if the address of the structure is taken later. */
2199 if (GET_CODE (operands[0]) == SUBREG
2200 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2205 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2206 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2207 (match_operand:SI 2 "const_int_operand" "i")
2208 (match_operand:SI 3 "const_int_operand" "i")))]
2212 int start = INTVAL (operands[3]) & 31;
2213 int size = INTVAL (operands[2]) & 31;
2215 if (start + size >= 32)
2216 operands[3] = const0_rtx;
2218 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2219 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
2223 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 4 "=r"))]
2232 int start = INTVAL (operands[3]) & 31;
2233 int size = INTVAL (operands[2]) & 31;
2235 /* If the bitfield being tested fits in the upper or lower half of a
2236 word, it is possible to use andiu. or andil. to test it. This is
2237 useful because the condition register set-use delay is smaller for
2238 andi[ul]. than for rlinm. This doesn't work when the starting bit
2239 position is 0 because the LT and GT bits may be set wrong. */
2241 if ((start > 0 && start + size <= 16) || start >= 16)
2243 operands[3] = gen_rtx (CONST_INT, VOIDmode,
2244 ((1 << (16 - (start & 15)))
2245 - (1 << (16 - (start & 15) - size))));
2247 return \"{andiu.|andis.} %4,%1,%3\";
2249 return \"{andil.|andi.} %4,%1,%3\";
2252 if (start + size >= 32)
2253 operands[3] = const0_rtx;
2255 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2256 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
2258 [(set_attr "type" "compare")])
2261 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2262 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2263 (match_operand:SI 2 "const_int_operand" "i")
2264 (match_operand:SI 3 "const_int_operand" "i"))
2266 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2267 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
2271 int start = INTVAL (operands[3]) & 31;
2272 int size = INTVAL (operands[2]) & 31;
2274 if (start >= 16 && start + size == 32)
2276 operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
2277 return \"{andil.|andi.} %0,%1,%3\";
2280 if (start + size >= 32)
2281 operands[3] = const0_rtx;
2283 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2284 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
2286 [(set_attr "type" "delayed_compare")])
2289 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2290 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2291 (match_operand:DI 2 "const_int_operand" "i")
2292 (match_operand:DI 3 "const_int_operand" "i")))]
2296 int start = INTVAL (operands[3]) & 63;
2297 int size = INTVAL (operands[2]) & 63;
2299 if (start + size >= 64)
2300 operands[3] = const0_rtx;
2302 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2303 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
2304 return \"rldicl %0,%1,%3,%2\";
2308 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
2309 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2310 (match_operand:DI 2 "const_int_operand" "i")
2311 (match_operand:DI 3 "const_int_operand" "i"))
2313 (clobber (match_scratch:DI 4 "=r"))]
2317 int start = INTVAL (operands[3]) & 63;
2318 int size = INTVAL (operands[2]) & 63;
2320 if (start + size >= 64)
2321 operands[3] = const0_rtx;
2323 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2324 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
2325 return \"rldicl. %4,%1,%3,%2\";
2329 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
2330 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2331 (match_operand:DI 2 "const_int_operand" "i")
2332 (match_operand:DI 3 "const_int_operand" "i"))
2334 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
2335 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
2339 int start = INTVAL (operands[3]) & 63;
2340 int size = INTVAL (operands[2]) & 63;
2342 if (start + size >= 64)
2343 operands[3] = const0_rtx;
2345 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2346 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
2347 return \"rldicl. %0,%1,%3,%2\";
2350 (define_insn "rotlsi3"
2351 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2352 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2353 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2355 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
2358 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2359 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2360 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2362 (clobber (match_scratch:SI 3 "=r"))]
2364 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff"
2365 [(set_attr "type" "delayed_compare")])
2368 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2369 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2370 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2372 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2373 (rotate:SI (match_dup 1) (match_dup 2)))]
2375 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff"
2376 [(set_attr "type" "delayed_compare")])
2379 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2380 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2381 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2382 (match_operand:SI 3 "mask_operand" "L")))]
2384 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
2387 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2389 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2390 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2391 (match_operand:SI 3 "mask_operand" "L"))
2393 (clobber (match_scratch:SI 4 "=r"))]
2395 "{rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3"
2396 [(set_attr "type" "delayed_compare")])
2399 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2401 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2402 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2403 (match_operand:SI 3 "mask_operand" "L"))
2405 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2406 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2408 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3"
2409 [(set_attr "type" "delayed_compare")])
2412 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2415 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2416 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2418 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
2421 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2422 (compare:CC (zero_extend:SI
2424 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2425 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2427 (clobber (match_scratch:SI 3 "=r"))]
2429 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff"
2430 [(set_attr "type" "delayed_compare")])
2433 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2434 (compare:CC (zero_extend:SI
2436 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2437 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2439 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2440 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2442 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff"
2443 [(set_attr "type" "delayed_compare")])
2446 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2449 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2450 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2452 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
2455 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2456 (compare:CC (zero_extend:SI
2458 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2459 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2461 (clobber (match_scratch:SI 3 "=r"))]
2463 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff"
2464 [(set_attr "type" "delayed_compare")])
2467 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2468 (compare:CC (zero_extend:SI
2470 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2471 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2473 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2474 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2476 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff"
2477 [(set_attr "type" "delayed_compare")])
2479 ;; Note that we use "sle." instead of "sl." so that we can set
2480 ;; SHIFT_COUNT_TRUNCATED.
2482 (define_expand "ashlsi3"
2483 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2484 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2485 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2490 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
2492 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
2496 (define_insn "ashlsi3_power"
2497 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2498 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2499 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2500 (clobber (match_scratch:SI 3 "=q,X"))]
2504 {sli|slwi} %0,%1,%h2"
2505 [(set_attr "length" "8")])
2507 (define_insn "ashlsi3_no_power"
2508 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2509 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2510 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2512 "{sl|slw}%I2 %0,%1,%h2"
2513 [(set_attr "length" "8")])
2516 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2517 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2518 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2520 (clobber (match_scratch:SI 3 "=r,r"))
2521 (clobber (match_scratch:SI 4 "=q,X"))]
2525 {sli.|slwi.} %3,%1,%h2"
2526 [(set_attr "type" "delayed_compare")])
2529 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2530 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2531 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2533 (clobber (match_scratch:SI 3 "=r"))]
2535 "{sl|slw}%I2. %3,%1,%h2"
2536 [(set_attr "type" "delayed_compare")])
2539 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2540 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2541 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2543 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2544 (ashift:SI (match_dup 1) (match_dup 2)))
2545 (clobber (match_scratch:SI 4 "=q,X"))]
2549 {sli.|slwi.} %0,%1,%h2"
2550 [(set_attr "type" "delayed_compare")])
2553 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2554 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2555 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2557 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2558 (ashift:SI (match_dup 1) (match_dup 2)))]
2560 "{sl|slw}%I2. %0,%1,%h2"
2561 [(set_attr "type" "delayed_compare")])
2564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2565 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2566 (match_operand:SI 2 "const_int_operand" "i"))
2567 (match_operand:SI 3 "mask_operand" "L")))]
2568 "includes_lshift_p (operands[2], operands[3])"
2569 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
2572 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2574 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2575 (match_operand:SI 2 "const_int_operand" "i"))
2576 (match_operand:SI 3 "mask_operand" "L"))
2578 (clobber (match_scratch:SI 4 "=r"))]
2579 "includes_lshift_p (operands[2], operands[3])"
2580 "{rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3"
2581 [(set_attr "type" "delayed_compare")])
2584 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2586 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2587 (match_operand:SI 2 "const_int_operand" "i"))
2588 (match_operand:SI 3 "mask_operand" "L"))
2590 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2591 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2592 "includes_lshift_p (operands[2], operands[3])"
2593 "{rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3"
2594 [(set_attr "type" "delayed_compare")])
2596 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
2598 (define_expand "lshrsi3"
2599 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2600 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2601 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2606 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
2608 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
2612 (define_insn "lshrsi3_power"
2613 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2614 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
2615 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
2616 (clobber (match_scratch:SI 3 "=q,X,X"))]
2621 {s%A2i|s%A2wi} %0,%1,%h2")
2623 (define_insn "lshrsi3_no_power"
2624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2625 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2626 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
2630 {sr|srw}%I2 %0,%1,%h2")
2633 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
2634 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
2635 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
2637 (clobber (match_scratch:SI 3 "=r,X,r"))
2638 (clobber (match_scratch:SI 4 "=q,X,X"))]
2643 {s%A2i.|s%A2wi.} %3,%1,%h2"
2644 [(set_attr "type" "delayed_compare")])
2647 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2648 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2649 (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
2651 (clobber (match_scratch:SI 3 "=X,r"))]
2655 {sr|srw}%I2. %3,%1,%h2"
2656 [(set_attr "type" "delayed_compare")])
2659 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
2660 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
2661 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
2663 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2664 (lshiftrt:SI (match_dup 1) (match_dup 2)))
2665 (clobber (match_scratch:SI 4 "=q,X,X"))]
2670 {s%A2i.|s%A2wi.} %0,%1,%h2"
2671 [(set_attr "type" "delayed_compare")])
2674 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2675 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2676 (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
2678 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2679 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
2683 {sr|srw}%I2. %0,%1,%h2"
2684 [(set_attr "type" "delayed_compare")])
2687 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2688 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2689 (match_operand:SI 2 "const_int_operand" "i"))
2690 (match_operand:SI 3 "mask_operand" "L")))]
2691 "includes_rshift_p (operands[2], operands[3])"
2692 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
2695 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2697 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2698 (match_operand:SI 2 "const_int_operand" "i"))
2699 (match_operand:SI 3 "mask_operand" "L"))
2701 (clobber (match_scratch:SI 4 "=r"))]
2702 "includes_rshift_p (operands[2], operands[3])"
2703 "{rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3"
2704 [(set_attr "type" "delayed_compare")])
2707 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2709 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2710 (match_operand:SI 2 "const_int_operand" "i"))
2711 (match_operand:SI 3 "mask_operand" "L"))
2713 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2714 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2715 "includes_rshift_p (operands[2], operands[3])"
2716 "{rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3"
2717 [(set_attr "type" "delayed_compare")])
2720 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2723 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2724 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2725 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2726 "{rlinm|rlwinm} %0,%1,%s2,0xff")
2729 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2733 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2734 (match_operand:SI 2 "const_int_operand" "i")) 0))
2736 (clobber (match_scratch:SI 3 "=r"))]
2737 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2738 "{rlinm.|rlwinm.} %3,%1,%s2,0xff"
2739 [(set_attr "type" "delayed_compare")])
2742 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2746 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2747 (match_operand:SI 2 "const_int_operand" "i")) 0))
2749 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2750 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2751 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2752 "{rlinm.|rlwinm.} %0,%1,%s2,0xff"
2753 [(set_attr "type" "delayed_compare")])
2756 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2759 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2760 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2761 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2762 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
2765 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2769 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2770 (match_operand:SI 2 "const_int_operand" "i")) 0))
2772 (clobber (match_scratch:SI 3 "=r"))]
2773 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2774 "{rlinm.|rlwinm.} %3,%1,%s2,0xffff"
2775 [(set_attr "type" "delayed_compare")])
2778 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2782 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2783 (match_operand:SI 2 "const_int_operand" "i")) 0))
2785 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2786 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2787 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2788 "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
2789 [(set_attr "type" "delayed_compare")])
2792 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2794 (match_operand:SI 1 "gpc_reg_operand" "r"))
2795 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2801 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2803 (match_operand:SI 1 "gpc_reg_operand" "r"))
2804 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2810 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2812 (match_operand:SI 1 "gpc_reg_operand" "r"))
2813 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2819 (define_expand "ashrsi3"
2820 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2821 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2822 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2827 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
2829 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
2833 (define_insn "ashrsi3_power"
2834 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2835 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2836 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2837 (clobber (match_scratch:SI 3 "=q,X"))]
2841 {srai|srawi} %0,%1,%h2")
2843 (define_insn "ashrsi3_no_power"
2844 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2845 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2846 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2848 "{sra|sraw}%I2 %0,%1,%h2")
2851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2852 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2853 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2855 (clobber (match_scratch:SI 3 "=r,r"))
2856 (clobber (match_scratch:SI 4 "=q,X"))]
2860 {srai.|srawi.} %3,%1,%h2"
2861 [(set_attr "type" "delayed_compare")])
2864 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2865 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2866 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2868 (clobber (match_scratch:SI 3 "=r"))]
2870 "{sra|sraw}%I2. %3,%1,%h2"
2871 [(set_attr "type" "delayed_compare")])
2874 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2875 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2876 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2878 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2879 (ashiftrt:SI (match_dup 1) (match_dup 2)))
2880 (clobber (match_scratch:SI 4 "=q,X"))]
2884 {srai.|srawi.} %0,%1,%h2"
2885 [(set_attr "type" "delayed_compare")])
2888 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2889 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2890 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2892 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2893 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
2895 "{sra|sraw}%I2. %0,%1,%h2"
2896 [(set_attr "type" "delayed_compare")])
2898 ;; Floating-point insns, excluding normal data motion.
2900 ;; PowerPC has a full set of single-precision floating point instructions.
2902 ;; For the POWER architecture, we pretend that we have both SFmode and
2903 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
2904 ;; The only conversions we will do will be when storing to memory. In that
2905 ;; case, we will use the "frsp" instruction before storing.
2907 ;; Note that when we store into a single-precision memory location, we need to
2908 ;; use the frsp insn first. If the register being stored isn't dead, we
2909 ;; need a scratch register for the frsp. But this is difficult when the store
2910 ;; is done by reload. It is not incorrect to do the frsp on the register in
2911 ;; this case, we just lose precision that we would have otherwise gotten but
2912 ;; is not guaranteed. Perhaps this should be tightened up at some point.
2914 (define_insn "extendsfdf2"
2915 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
2916 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2920 if (REGNO (operands[0]) == REGNO (operands[1]))
2923 return \"fmr %0,%1\";
2925 [(set_attr "type" "fp")])
2927 (define_insn "truncdfsf2"
2928 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2929 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
2932 [(set_attr "type" "fp")])
2934 (define_insn "aux_truncdfsf2"
2935 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2936 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
2937 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2939 [(set_attr "type" "fp")])
2941 (define_insn "negsf2"
2942 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2943 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2946 [(set_attr "type" "fp")])
2948 (define_insn "abssf2"
2949 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2950 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2953 [(set_attr "type" "fp")])
2956 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2957 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
2960 [(set_attr "type" "fp")])
2962 (define_expand "addsf3"
2963 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2964 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2965 (match_operand:SF 2 "gpc_reg_operand" "")))]
2970 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2971 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2972 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2973 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2975 [(set_attr "type" "fp")])
2978 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2979 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2980 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2981 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2982 "{fa|fadd} %0,%1,%2"
2983 [(set_attr "type" "fp")])
2985 (define_expand "subsf3"
2986 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2987 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2988 (match_operand:SF 2 "gpc_reg_operand" "")))]
2993 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2994 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2995 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2996 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2998 [(set_attr "type" "fp")])
3001 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3002 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3003 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3004 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3005 "{fs|fsub} %0,%1,%2"
3006 [(set_attr "type" "fp")])
3008 (define_expand "mulsf3"
3009 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3010 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
3011 (match_operand:SF 2 "gpc_reg_operand" "")))]
3016 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3017 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3018 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3019 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3021 [(set_attr "type" "fp")])
3024 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3025 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3026 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3027 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3028 "{fm|fmul} %0,%1,%2"
3029 [(set_attr "type" "dmul")])
3031 (define_expand "divsf3"
3032 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3033 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
3034 (match_operand:SF 2 "gpc_reg_operand" "")))]
3039 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3040 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3041 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3042 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3044 [(set_attr "type" "sdiv")])
3047 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3048 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3049 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3050 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3051 "{fd|fdiv} %0,%1,%2"
3052 [(set_attr "type" "ddiv")])
3055 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3056 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3057 (match_operand:SF 2 "gpc_reg_operand" "f"))
3058 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3059 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3060 "fmadds %0,%1,%2,%3"
3061 [(set_attr "type" "fp")])
3064 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3065 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3066 (match_operand:SF 2 "gpc_reg_operand" "f"))
3067 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3068 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3069 "{fma|fmadd} %0,%1,%2,%3"
3070 [(set_attr "type" "dmul")])
3073 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3074 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3075 (match_operand:SF 2 "gpc_reg_operand" "f"))
3076 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3077 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3078 "fmsubs %0,%1,%2,%3"
3079 [(set_attr "type" "fp")])
3082 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3083 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3084 (match_operand:SF 2 "gpc_reg_operand" "f"))
3085 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3086 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3087 "{fms|fmsub} %0,%1,%2,%3"
3088 [(set_attr "type" "dmul")])
3091 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3092 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3093 (match_operand:SF 2 "gpc_reg_operand" "f"))
3094 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3095 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3096 "fnmadds %0,%1,%2,%3"
3097 [(set_attr "type" "fp")])
3100 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3101 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3102 (match_operand:SF 2 "gpc_reg_operand" "f"))
3103 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3104 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3105 "{fnma|fnmadd} %0,%1,%2,%3"
3106 [(set_attr "type" "dmul")])
3109 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3110 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3111 (match_operand:SF 2 "gpc_reg_operand" "f"))
3112 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3113 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3114 "fnmsubs %0,%1,%2,%3"
3115 [(set_attr "type" "fp")])
3118 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3119 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3120 (match_operand:SF 2 "gpc_reg_operand" "f"))
3121 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3122 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3123 "{fnms|fnmsub} %0,%1,%2,%3"
3124 [(set_attr "type" "dmul")])
3126 (define_expand "sqrtsf2"
3127 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3128 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
3129 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3133 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3134 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3135 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
3137 [(set_attr "type" "ssqrt")])
3140 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3141 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3142 "TARGET_POWER2 && TARGET_HARD_FLOAT"
3144 [(set_attr "type" "dsqrt")])
3146 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3147 ;; fsel instruction and some auxiliary computations. Then we just have a
3148 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3150 (define_expand "maxsf3"
3152 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
3153 (match_operand:SF 2 "gpc_reg_operand" "")))
3154 (set (match_operand:SF 0 "gpc_reg_operand" "")
3155 (if_then_else:SF (ge (match_dup 3)
3159 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3161 { operands[3] = gen_reg_rtx (SFmode); }")
3164 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3165 (smax:SF (match_operand:SF 1 "gpc_reg_operand" "")
3166 (match_operand:SF 2 "gpc_reg_operand" "")))
3167 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3168 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3170 (minus:SF (match_dup 1) (match_dup 2)))
3172 (if_then_else:SF (ge (match_dup 3)
3178 (define_expand "minsf3"
3180 (minus:SF (match_operand:SF 2 "gpc_reg_operand" "")
3181 (match_operand:SF 1 "gpc_reg_operand" "")))
3182 (set (match_operand:SF 0 "gpc_reg_operand" "")
3183 (if_then_else:SF (ge (match_dup 3)
3187 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3189 { operands[3] = gen_reg_rtx (SFmode); }")
3192 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3193 (smin:SF (match_operand:SF 1 "gpc_reg_operand" "")
3194 (match_operand:SF 2 "gpc_reg_operand" "")))
3195 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3196 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3198 (minus:SF (match_dup 2) (match_dup 1)))
3200 (if_then_else:SF (ge (match_dup 3)
3206 (define_expand "movsfcc"
3207 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3208 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3209 (match_operand:SF 2 "gpc_reg_operand" "f")
3210 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3211 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3215 enum rtx_code code = GET_CODE (operands[1]);
3216 if (! rs6000_compare_fp_p)
3220 case GE: case EQ: case NE:
3221 op0 = rs6000_compare_op0;
3222 op1 = rs6000_compare_op1;
3225 op0 = rs6000_compare_op1;
3226 op1 = rs6000_compare_op0;
3227 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3230 op0 = rs6000_compare_op1;
3231 op1 = rs6000_compare_op0;
3234 op0 = rs6000_compare_op0;
3235 op1 = rs6000_compare_op1;
3236 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3241 if (GET_MODE (rs6000_compare_op0) == DFmode)
3243 temp = gen_reg_rtx (DFmode);
3244 emit_insn (gen_subdf3 (temp, op0, op1));
3245 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[2], operands[3]));
3248 emit_insn (gen_negdf2 (temp, temp));
3249 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[0], operands[3]));
3253 emit_insn (gen_negdf2 (temp, temp));
3254 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[3], operands[0]));
3259 temp = gen_reg_rtx (SFmode);
3260 emit_insn (gen_subsf3 (temp, op0, op1));
3261 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[2], operands[3]));
3264 emit_insn (gen_negsf2 (temp, temp));
3265 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[0], operands[3]));
3269 emit_insn (gen_negsf2 (temp, temp));
3270 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[3], operands[0]));
3276 (define_insn "fselsfsf4"
3277 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3278 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3280 (match_operand:SF 2 "gpc_reg_operand" "f")
3281 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3282 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3284 [(set_attr "type" "fp")])
3286 (define_insn "fseldfsf4"
3287 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3288 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3290 (match_operand:SF 2 "gpc_reg_operand" "f")
3291 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3292 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3294 [(set_attr "type" "fp")])
3296 (define_insn "negdf2"
3297 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3298 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3301 [(set_attr "type" "fp")])
3303 (define_insn "absdf2"
3304 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3305 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3308 [(set_attr "type" "fp")])
3311 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3312 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3315 [(set_attr "type" "fp")])
3317 (define_insn "adddf3"
3318 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3319 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3320 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3322 "{fa|fadd} %0,%1,%2"
3323 [(set_attr "type" "fp")])
3325 (define_insn "subdf3"
3326 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3327 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3328 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3330 "{fs|fsub} %0,%1,%2"
3331 [(set_attr "type" "fp")])
3333 (define_insn "muldf3"
3334 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3335 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3336 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3338 "{fm|fmul} %0,%1,%2"
3339 [(set_attr "type" "dmul")])
3341 (define_insn "divdf3"
3342 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3343 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3344 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3346 "{fd|fdiv} %0,%1,%2"
3347 [(set_attr "type" "ddiv")])
3350 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3351 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3352 (match_operand:DF 2 "gpc_reg_operand" "f"))
3353 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3354 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3355 "{fma|fmadd} %0,%1,%2,%3"
3356 [(set_attr "type" "dmul")])
3359 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3360 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3361 (match_operand:DF 2 "gpc_reg_operand" "f"))
3362 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3363 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3364 "{fms|fmsub} %0,%1,%2,%3"
3365 [(set_attr "type" "dmul")])
3368 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3369 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3370 (match_operand:DF 2 "gpc_reg_operand" "f"))
3371 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3372 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3373 "{fnma|fnmadd} %0,%1,%2,%3"
3374 [(set_attr "type" "dmul")])
3377 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3378 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3379 (match_operand:DF 2 "gpc_reg_operand" "f"))
3380 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3381 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3382 "{fnms|fnmsub} %0,%1,%2,%3"
3383 [(set_attr "type" "dmul")])
3385 (define_insn "sqrtdf2"
3386 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3387 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3388 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3390 [(set_attr "type" "dsqrt")])
3392 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3393 ;; fsel instruction and some auxiliary computations. Then we just have a
3394 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3397 (define_expand "maxdf3"
3399 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
3400 (match_operand:DF 2 "gpc_reg_operand" "")))
3401 (set (match_operand:DF 0 "gpc_reg_operand" "")
3402 (if_then_else:DF (ge (match_dup 3)
3406 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3408 { operands[3] = gen_reg_rtx (DFmode); }")
3411 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3412 (smax:DF (match_operand:DF 1 "gpc_reg_operand" "")
3413 (match_operand:DF 2 "gpc_reg_operand" "")))
3414 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3415 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3417 (minus:DF (match_dup 1) (match_dup 2)))
3419 (if_then_else:DF (ge (match_dup 3)
3425 (define_expand "mindf3"
3427 (minus:DF (match_operand:DF 2 "gpc_reg_operand" "")
3428 (match_operand:DF 1 "gpc_reg_operand" "")))
3429 (set (match_operand:DF 0 "gpc_reg_operand" "")
3430 (if_then_else:DF (ge (match_dup 3)
3434 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3436 { operands[3] = gen_reg_rtx (DFmode); }")
3439 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3440 (smin:DF (match_operand:DF 1 "gpc_reg_operand" "")
3441 (match_operand:DF 2 "gpc_reg_operand" "")))
3442 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3443 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3445 (minus:DF (match_dup 2) (match_dup 1)))
3447 (if_then_else:DF (ge (match_dup 3)
3453 (define_expand "movdfcc"
3454 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3455 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3456 (match_operand:DF 2 "gpc_reg_operand" "f")
3457 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3458 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3462 enum rtx_code code = GET_CODE (operands[1]);
3463 if (! rs6000_compare_fp_p)
3467 case GE: case EQ: case NE:
3468 op0 = rs6000_compare_op0;
3469 op1 = rs6000_compare_op1;
3472 op0 = rs6000_compare_op1;
3473 op1 = rs6000_compare_op0;
3474 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3477 op0 = rs6000_compare_op1;
3478 op1 = rs6000_compare_op0;
3481 op0 = rs6000_compare_op0;
3482 op1 = rs6000_compare_op1;
3483 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3488 if (GET_MODE (rs6000_compare_op0) == DFmode)
3490 temp = gen_reg_rtx (DFmode);
3491 emit_insn (gen_subdf3 (temp, op0, op1));
3492 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[2], operands[3]));
3495 emit_insn (gen_negdf2 (temp, temp));
3496 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[0], operands[3]));
3500 emit_insn (gen_negdf2 (temp, temp));
3501 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[3], operands[0]));
3506 temp = gen_reg_rtx (SFmode);
3507 emit_insn (gen_subsf3 (temp, op0, op1));
3508 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[2], operands[3]));
3511 emit_insn (gen_negsf2 (temp, temp));
3512 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[0], operands[3]));
3516 emit_insn (gen_negsf2 (temp, temp));
3517 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[3], operands[0]));
3523 (define_insn "fseldfdf4"
3524 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3525 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3527 (match_operand:DF 2 "gpc_reg_operand" "f")
3528 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3529 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3531 [(set_attr "type" "fp")])
3533 (define_insn "fselsfdf4"
3534 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3535 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3537 (match_operand:DF 2 "gpc_reg_operand" "f")
3538 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3541 [(set_attr "type" "fp")])
3543 ;; Conversions to and from floating-point.
3545 (define_expand "floatsidf2"
3546 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
3547 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3550 (clobber (match_dup 4))
3551 (clobber (match_dup 5))
3552 (clobber (reg:DF 76))])]
3553 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3556 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
3557 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503601774854144\", DFmode));
3558 operands[4] = gen_reg_rtx (SImode);
3559 operands[5] = gen_reg_rtx (Pmode);
3562 (define_insn "*floatsidf2_internal"
3563 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
3564 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
3565 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
3566 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
3567 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
3568 (clobber (match_operand:SI 5 "gpc_reg_operand" "=b"))
3569 (clobber (reg:DF 76))]
3570 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3572 [(set_attr "length" "24")])
3575 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3576 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3577 (use (match_operand:SI 2 "gpc_reg_operand" ""))
3578 (use (match_operand:DF 3 "gpc_reg_operand" ""))
3579 (clobber (match_operand:SI 4 "gpc_reg_operand" ""))
3580 (clobber (match_operand:SI 5 "gpc_reg_operand" ""))
3581 (clobber (reg:DF 76))]
3582 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3584 (xor:SI (match_dup 1)
3587 (unspec [(const_int 0)] 11))
3589 (unspec [(match_dup 4)
3590 (match_dup 5)] 12)) ;; low word
3592 (unspec [(match_dup 2)
3594 (match_dup 7)] 13)) ;; high word
3596 (unspec [(match_dup 7)
3599 (minus:DF (match_dup 0)
3603 operands[6] = GEN_INT (0x80000000);
3604 operands[7] = gen_rtx (REG, DFmode, FPMEM_REGNUM);
3607 (define_expand "floatunssidf2"
3608 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
3609 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3612 (clobber (match_dup 4))
3613 (clobber (reg:DF 76))])]
3614 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3617 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
3618 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503599627370496\", DFmode));
3619 operands[4] = gen_reg_rtx (Pmode);
3622 (define_insn "*floatunssidf2_internal"
3623 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
3624 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
3625 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
3626 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
3627 (clobber (match_operand:SI 4 "gpc_reg_operand" "=b"))
3628 (clobber (reg:DF 76))]
3629 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3631 [(set_attr "length" "20")])
3634 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3635 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3636 (use (match_operand:SI 2 "gpc_reg_operand" ""))
3637 (use (match_operand:DF 3 "gpc_reg_operand" ""))
3638 (clobber (match_operand:SI 4 "gpc_reg_operand" "=b"))
3639 (clobber (reg:DF 76))]
3640 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3642 (unspec [(const_int 0)] 11))
3644 (unspec [(match_dup 1)
3645 (match_dup 4)] 12)) ;; low word
3647 (unspec [(match_dup 2)
3649 (match_dup 5)] 13)) ;; high word
3651 (unspec [(match_dup 5)
3654 (minus:DF (match_dup 0)
3656 "operands[5] = gen_rtx (REG, DFmode, FPMEM_REGNUM);")
3658 ;; Load up scratch register with base address + offset if needed
3659 (define_insn "*floatsidf2_loadaddr"
3660 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
3661 (unspec [(const_int 0)] 11))]
3665 if (rs6000_fpmem_offset > 32760)
3669 xop[0] = operands[0];
3670 xop[1] = (frame_pointer_needed) ? frame_pointer_rtx : stack_pointer_rtx;
3671 xop[2] = GEN_INT ((rs6000_fpmem_offset >> 16) + ((rs6000_fpmem_offset & 0x8000) >> 15));
3672 output_asm_insn (\"{cau|addis} %0,%1,%2\", xop);
3674 else if (rs6000_fpmem_offset < 0)
3679 [(set_attr "length" "4")])
3681 (define_insn "*floatsidf2_store1"
3683 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
3684 (match_operand:SI 1 "gpc_reg_operand" "r")] 12))]
3685 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3690 if (rs6000_fpmem_offset > 32760)
3692 else if (frame_pointer_needed)
3693 indx = frame_pointer_rtx;
3695 indx = stack_pointer_rtx;
3697 operands[2] = gen_rtx (MEM, SImode,
3698 gen_rtx (PLUS, Pmode,
3700 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
3701 + ((WORDS_BIG_ENDIAN != 0) * 4))));
3703 return \"{st|stw} %0,%2\";
3705 [(set_attr "type" "store")])
3707 (define_insn "*floatsidf2_store2"
3709 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
3710 (match_operand:SI 1 "gpc_reg_operand" "r")
3712 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3717 if (rs6000_fpmem_offset > 32760)
3719 else if (frame_pointer_needed)
3720 indx = frame_pointer_rtx;
3722 indx = stack_pointer_rtx;
3724 operands[2] = gen_rtx (MEM, SImode,
3725 gen_rtx (PLUS, Pmode,
3727 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
3728 + ((WORDS_BIG_ENDIAN == 0) * 4))));
3730 return \"{st|stw} %0,%2\";
3732 [(set_attr "type" "store")])
3734 (define_insn "*floatsidf2_load"
3735 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3736 (unspec [(reg:DF 76)
3737 (match_operand:SI 1 "gpc_reg_operand" "b")] 14))]
3738 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3742 HOST_WIDE_INT offset = rs6000_fpmem_offset;
3744 if (rs6000_fpmem_offset > 32760)
3747 offset = (((offset & 0xffff) ^ 0x8000) - 0x8000);
3749 else if (frame_pointer_needed)
3750 indx = frame_pointer_rtx;
3752 indx = stack_pointer_rtx;
3754 operands[2] = gen_rtx (MEM, SImode,
3755 gen_rtx (PLUS, Pmode, indx, GEN_INT (offset)));
3757 return \"lfd %0,%2\";
3759 [(set_attr "type" "fpload")])
3761 (define_expand "fix_truncdfsi2"
3762 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3763 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
3764 (clobber (match_dup 2))
3765 (clobber (match_dup 3))
3766 (clobber (match_dup 4))])]
3770 if (!TARGET_POWER2 && !TARGET_POWERPC)
3772 emit_insn (gen_trunc_call (operands[0], operands[1],
3773 gen_rtx (SYMBOL_REF, Pmode, RS6000_ITRUNC)));
3777 operands[2] = gen_reg_rtx (DImode);
3778 operands[3] = gen_reg_rtx (Pmode);
3779 operands[4] = gen_rtx (REG, DImode, FPMEM_REGNUM);
3782 (define_insn "*fix_truncdfsi2_internal"
3783 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3784 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
3785 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
3786 (clobber (match_operand:SI 3 "gpc_reg_operand" "=b"))
3787 (clobber (reg:DI 76))]
3790 [(set_attr "length" "12")])
3793 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3794 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
3795 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
3796 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))
3797 (clobber (reg:DI 76))]
3800 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" ""))))
3802 (unspec [(const_int 0)] 11))
3804 (unspec [(match_dup 2)
3806 (set (match_operand:SI 0 "gpc_reg_operand" "")
3807 (unspec [(match_dup 4)
3808 (match_dup 3)] 16))]
3809 "operands[4] = gen_rtx (REG, DImode, FPMEM_REGNUM);")
3811 (define_insn "*fctiwz"
3812 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3813 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3814 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3815 "{fcirz|fctiwz} %0,%1"
3816 [(set_attr "type" "fp")])
3818 (define_insn "*fix_truncdfsi2_store"
3820 (unspec [(match_operand:DI 0 "gpc_reg_operand" "f")
3821 (match_operand:SI 1 "gpc_reg_operand" "b")] 15))]
3822 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3827 if (rs6000_fpmem_offset > 32760)
3829 else if (frame_pointer_needed)
3830 indx = frame_pointer_rtx;
3832 indx = stack_pointer_rtx;
3834 operands[2] = gen_rtx (MEM, DFmode,
3835 gen_rtx (PLUS, Pmode,
3837 GEN_INT ((((rs6000_fpmem_offset & 0xffff)
3838 ^ 0x8000) - 0x8000))));
3840 return \"stfd %0,%w2\";
3842 [(set_attr "type" "fpstore")])
3844 (define_insn "*fix_truncdfsi2_load"
3845 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3846 (unspec [(reg:DI 76)
3847 (match_operand:SI 1 "gpc_reg_operand" "b")] 16))]
3848 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3853 if (rs6000_fpmem_offset > 32760)
3855 else if (frame_pointer_needed)
3856 indx = frame_pointer_rtx;
3858 indx = stack_pointer_rtx;
3860 operands[2] = gen_rtx (MEM, DFmode,
3861 gen_rtx (PLUS, Pmode,
3863 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
3864 + ((WORDS_BIG_ENDIAN) ? 4 : 0))));
3866 return \"{l|lwz} %0,%2\";
3868 [(set_attr "type" "load")])
3870 (define_expand "fixuns_truncdfsi2"
3871 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3872 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
3873 "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
3876 emit_insn (gen_trunc_call (operands[0], operands[1],
3877 gen_rtx (SYMBOL_REF, Pmode, RS6000_UITRUNC)));
3881 (define_expand "trunc_call"
3882 [(parallel [(set (match_operand:SI 0 "" "")
3883 (fix:SI (match_operand:DF 1 "" "")))
3884 (use (match_operand:SI 2 "" ""))])]
3888 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
3889 rtx first = XVECEXP (insns, 0, 0);
3890 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
3892 REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
3894 REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
3900 (define_expand "trunc_call_rtl"
3901 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
3903 (parallel [(set (reg:SI 3)
3904 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
3906 (clobber (scratch:SI))])
3907 (set (match_operand:SI 0 "gpc_reg_operand" "")
3912 rs6000_trunc_used = 1;
3915 (define_insn "floatdidf2"
3916 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3917 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
3918 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3920 [(set_attr "type" "fp")])
3922 (define_insn "fix_truncdfdi2"
3923 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3924 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
3925 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3927 [(set_attr "type" "fp")])
3929 ;; Define the DImode operations that can be done in a small number
3930 ;; of instructions. The & constraints are to prevent the register
3931 ;; allocator from allocating registers that overlap with the inputs
3932 ;; (for example, having an input in 7,8 and an output in 6,7). We
3933 ;; also allow for the the output being the same as one of the inputs.
3935 (define_insn "*adddi3_noppc64"
3936 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
3937 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
3938 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
3939 "! TARGET_POWERPC64"
3942 if (WORDS_BIG_ENDIAN)
3943 return (GET_CODE (operands[2])) != CONST_INT
3944 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
3945 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
3947 return (GET_CODE (operands[2])) != CONST_INT
3948 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
3949 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
3951 [(set_attr "length" "8")])
3953 (define_insn "*subdi3_noppc64"
3954 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
3955 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
3956 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
3957 "! TARGET_POWERPC64"
3960 if (WORDS_BIG_ENDIAN)
3961 return (GET_CODE (operands[1]) != CONST_INT)
3962 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
3963 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
3965 return (GET_CODE (operands[1]) != CONST_INT)
3966 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
3967 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
3969 [(set_attr "length" "8")])
3971 (define_insn "*negdi2_noppc64"
3972 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
3973 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
3974 "! TARGET_POWERPC64"
3977 return (WORDS_BIG_ENDIAN)
3978 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
3979 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
3981 [(set_attr "length" "8")])
3983 (define_expand "mulsidi3"
3984 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3985 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3986 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3990 if (! TARGET_POWER && ! TARGET_POWERPC)
3992 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
3993 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
3994 emit_insn (gen_mull_call ());
3995 if (WORDS_BIG_ENDIAN)
3996 emit_move_insn (operands[0], gen_rtx (REG, DImode, 3));
3999 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
4000 gen_rtx (REG, SImode, 3));
4001 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
4002 gen_rtx (REG, SImode, 4));
4006 else if (TARGET_POWER)
4008 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
4013 (define_insn "mulsidi3_mq"
4014 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4015 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4016 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
4017 (clobber (match_scratch:SI 3 "=q"))]
4019 "mul %0,%1,%2\;mfmq %L0"
4020 [(set_attr "type" "imul")
4021 (set_attr "length" "8")])
4023 (define_insn "*mulsidi3_powerpc"
4024 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4025 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4026 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
4027 "TARGET_POWERPC && ! TARGET_POWERPC64"
4030 return (WORDS_BIG_ENDIAN)
4031 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
4032 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
4034 [(set_attr "type" "imul")
4035 (set_attr "length" "8")])
4038 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4039 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4040 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4041 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
4044 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
4045 (sign_extend:DI (match_dup 2)))
4048 (mult:SI (match_dup 1)
4052 int endian = (WORDS_BIG_ENDIAN == 0);
4053 operands[3] = operand_subword (operands[0], endian, 0, DImode);
4054 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
4057 (define_insn "umulsidi3"
4058 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4059 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4060 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
4061 "TARGET_POWERPC && ! TARGET_POWERPC64"
4064 return (WORDS_BIG_ENDIAN)
4065 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
4066 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
4068 [(set_attr "type" "imul")
4069 (set_attr "length" "8")])
4072 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4073 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4074 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4075 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
4078 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
4079 (zero_extend:DI (match_dup 2)))
4082 (mult:SI (match_dup 1)
4086 int endian = (WORDS_BIG_ENDIAN == 0);
4087 operands[3] = operand_subword (operands[0], endian, 0, DImode);
4088 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
4091 (define_expand "smulsi3_highpart"
4092 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4094 (lshiftrt:DI (mult:DI (sign_extend:DI
4095 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4097 (match_operand:SI 2 "gpc_reg_operand" "r")))
4102 if (! TARGET_POWER && ! TARGET_POWERPC)
4104 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
4105 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
4106 emit_insn (gen_mulh_call ());
4107 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
4110 else if (TARGET_POWER)
4112 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
4117 (define_insn "smulsi3_highpart_mq"
4118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4120 (lshiftrt:DI (mult:DI (sign_extend:DI
4121 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4123 (match_operand:SI 2 "gpc_reg_operand" "r")))
4125 (clobber (match_scratch:SI 3 "=q"))]
4128 [(set_attr "type" "imul")])
4131 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4133 (lshiftrt:DI (mult:DI (sign_extend:DI
4134 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4136 (match_operand:SI 2 "gpc_reg_operand" "r")))
4140 [(set_attr "type" "imul")])
4142 (define_insn "umulsi3_highpart"
4143 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4145 (lshiftrt:DI (mult:DI (zero_extend:DI
4146 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4148 (match_operand:SI 2 "gpc_reg_operand" "r")))
4152 [(set_attr "type" "imul")])
4154 ;; If operands 0 and 2 are in the same register, we have a problem. But
4155 ;; operands 0 and 1 (the usual case) can be in the same register. That's
4156 ;; why we have the strange constraints below.
4157 (define_insn "ashldi3_power"
4158 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
4159 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
4160 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
4161 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
4164 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
4165 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
4166 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
4167 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
4168 [(set_attr "length" "8")])
4170 (define_insn "lshrdi3_power"
4171 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
4172 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
4173 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
4174 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
4177 {cal %0,0(0)|li %0,0}\;{s%A2i|s%A2wi} %L0,%1,%h2
4178 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
4179 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
4180 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
4181 [(set_attr "length" "8")])
4183 ;; Shift by a variable amount is too complex to be worth open-coding. We
4184 ;; just handle shifts by constants.
4185 (define_insn "ashrdi3_power"
4186 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4187 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
4188 (match_operand:SI 2 "const_int_operand" "M,i")))
4189 (clobber (match_scratch:SI 3 "=X,q"))]
4192 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
4193 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
4194 [(set_attr "length" "8")])
4196 ;; PowerPC64 DImode operations.
4198 (define_expand "adddi3"
4199 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4200 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
4201 (match_operand:DI 2 "add_operand" "")))]
4205 if (! TARGET_POWERPC64 && non_short_cint_operand (operands[2], DImode))
4209 ;; Discourage ai/addic because of carry but provide it in an alternative
4210 ;; allowing register zero as source.
4213 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
4214 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
4215 (match_operand:DI 2 "add_operand" "r,I,I,J")))]
4224 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4225 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
4226 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
4228 (clobber (match_scratch:DI 3 "=r,r"))]
4233 [(set_attr "type" "compare")])
4236 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
4237 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
4238 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
4240 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4241 (plus:DI (match_dup 1) (match_dup 2)))]
4246 [(set_attr "type" "compare")])
4248 ;; Split an add that we can't do in one insn into two insns, each of which
4249 ;; does one 16-bit part. This is used by combine. Note that the low-order
4250 ;; add should be last in case the result gets used in an address.
4253 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4254 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
4255 (match_operand:DI 2 "non_add_cint_operand" "")))]
4257 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
4258 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4261 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
4262 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
4265 high+=0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
4267 operands[3] = GEN_INT (high);
4268 operands[4] = GEN_INT (low);
4271 (define_insn "one_cmpldi2"
4272 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4273 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4278 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4279 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4281 (clobber (match_scratch:DI 2 "=r"))]
4284 [(set_attr "type" "compare")])
4287 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4288 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4290 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4291 (not:DI (match_dup 1)))]
4294 [(set_attr "type" "compare")])
4297 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4298 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
4299 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
4306 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4307 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4308 (match_operand:DI 2 "gpc_reg_operand" "r"))
4310 (clobber (match_scratch:DI 3 "=r"))]
4313 [(set_attr "type" "compare")])
4316 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4317 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4318 (match_operand:DI 2 "gpc_reg_operand" "r"))
4320 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4321 (minus:DI (match_dup 1) (match_dup 2)))]
4324 [(set_attr "type" "compare")])
4326 (define_expand "subdi3"
4327 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4328 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
4329 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4333 if (GET_CODE (operands[2]) == CONST_INT)
4335 emit_insn (gen_adddi3 (operands[0], operands[1],
4336 negate_rtx (DImode, operands[2])));
4341 (define_insn "absdi2"
4342 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4343 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4344 (clobber (match_scratch:DI 2 "=&r,&r"))]
4346 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0"
4347 [(set_attr "length" "12")])
4350 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4351 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4352 (clobber (match_scratch:DI 2 "=&r,&r"))]
4353 "TARGET_POWERPC64 && reload_completed"
4354 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4355 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4356 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
4360 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4361 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4362 (clobber (match_scratch:DI 2 "=&r,&r"))]
4364 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2"
4365 [(set_attr "length" "12")])
4368 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4369 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4370 (clobber (match_scratch:DI 2 "=&r,&r"))]
4371 "TARGET_POWERPC64 && reload_completed"
4372 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4373 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4374 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
4377 (define_expand "negdi2"
4378 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4379 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
4384 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4385 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4390 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4391 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4393 (clobber (match_scratch:DI 2 "=r"))]
4396 [(set_attr "type" "compare")])
4399 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4400 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4402 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4403 (neg:DI (match_dup 1)))]
4406 [(set_attr "type" "compare")])
4408 (define_insn "ffsdi2"
4409 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4410 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4412 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
4413 [(set_attr "length" "16")])
4415 (define_insn "muldi3"
4416 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4417 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4418 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4421 [(set_attr "type" "imul")])
4423 (define_insn "smuldi3_highpart"
4424 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4426 (lshiftrt:TI (mult:TI (sign_extend:TI
4427 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4429 (match_operand:DI 2 "gpc_reg_operand" "r")))
4433 [(set_attr "type" "imul")])
4435 (define_insn "umuldi3_highpart"
4436 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4438 (lshiftrt:TI (mult:TI (zero_extend:TI
4439 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4441 (match_operand:DI 2 "gpc_reg_operand" "r")))
4445 [(set_attr "type" "imul")])
4447 (define_expand "divdi3"
4448 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4449 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
4450 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4454 if (GET_CODE (operands[2]) == CONST_INT
4455 && exact_log2 (INTVAL (operands[2])) >= 0)
4458 operands[2] = force_reg (DImode, operands[2]);
4461 (define_expand "moddi3"
4462 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
4463 (use (match_operand:DI 1 "gpc_reg_operand" ""))
4464 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
4468 int i = exact_log2 (INTVAL (operands[2]));
4472 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
4475 temp1 = gen_reg_rtx (DImode);
4476 temp2 = gen_reg_rtx (DImode);
4478 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
4479 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
4480 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
4485 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4486 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4487 (match_operand:DI 2 "const_int_operand" "N")))]
4488 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4489 "sradi %0,%1,%p2\;addze %0,%0"
4490 [(set_attr "length" "8")])
4493 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4494 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4495 (match_operand:DI 2 "const_int_operand" "N"))
4497 (clobber (match_scratch:DI 3 "=r"))]
4498 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4499 "sradi %3,%1,%p2\;addze. %3,%3"
4500 [(set_attr "type" "compare")
4501 (set_attr "length" "8")])
4504 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4505 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4506 (match_operand:DI 2 "const_int_operand" "N"))
4508 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4509 (div:DI (match_dup 1) (match_dup 2)))]
4510 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4511 "sradi %0,%1,%p2\;addze. %0,%0"
4512 [(set_attr "type" "compare")
4513 (set_attr "length" "8")])
4516 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4517 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4518 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4521 [(set_attr "type" "idiv")])
4523 (define_insn "udivdi3"
4524 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4525 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4526 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4529 [(set_attr "type" "idiv")])
4531 (define_insn "rotldi3"
4532 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4533 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4534 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
4536 "rld%I2cl %0,%1,%H2,0")
4539 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4540 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4541 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4543 (clobber (match_scratch:DI 3 "=r"))]
4545 "rld%I2cl. %3,%1,%H2,0"
4546 [(set_attr "type" "delayed_compare")])
4549 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4550 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4551 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4553 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4554 (rotate:DI (match_dup 1) (match_dup 2)))]
4556 "rld%I2cl. %0,%1,%H2,0"
4557 [(set_attr "type" "delayed_compare")])
4559 (define_expand "ashldi3"
4560 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4561 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
4562 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4563 "TARGET_POWERPC64 || TARGET_POWER"
4566 if (TARGET_POWERPC64)
4568 else if (TARGET_POWER)
4570 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
4578 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4579 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4580 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4583 [(set_attr "length" "8")])
4586 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4587 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4588 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4590 (clobber (match_scratch:DI 3 "=r"))]
4593 [(set_attr "type" "delayed_compare")])
4596 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4597 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4598 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4600 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4601 (ashift:DI (match_dup 1) (match_dup 2)))]
4604 [(set_attr "type" "delayed_compare")])
4606 (define_expand "lshrdi3"
4607 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4608 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4609 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4610 "TARGET_POWERPC64 || TARGET_POWER"
4613 if (TARGET_POWERPC64)
4615 else if (TARGET_POWER)
4617 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
4625 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4626 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4627 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4632 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4633 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4634 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4636 (clobber (match_scratch:DI 3 "=r"))]
4639 [(set_attr "type" "delayed_compare")])
4642 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4643 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4644 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4646 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4647 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
4650 [(set_attr "type" "delayed_compare")])
4652 (define_expand "ashrdi3"
4653 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4654 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4655 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4656 "TARGET_POWERPC64 || TARGET_POWER"
4659 if (TARGET_POWERPC64)
4661 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
4663 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
4671 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4672 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4673 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4675 "srad%I2 %0,%1,%H2")
4678 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4679 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4680 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4682 (clobber (match_scratch:DI 3 "=r"))]
4684 "srad%I2. %3,%1,%H2"
4685 [(set_attr "type" "delayed_compare")])
4688 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4689 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4690 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4692 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4693 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
4695 "srad%I2. %0,%1,%H2"
4696 [(set_attr "type" "delayed_compare")])
4698 (define_insn "anddi3"
4699 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4700 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4701 (match_operand:DI 2 "and_operand" "?r,K,J")))
4702 (clobber (match_scratch:CC 3 "=X,x,x"))]
4710 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
4711 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4712 (match_operand:DI 2 "and_operand" "r,K,J"))
4714 (clobber (match_scratch:DI 3 "=r,r,r"))]
4720 [(set_attr "type" "compare,compare,compare")])
4723 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
4724 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4725 (match_operand:DI 2 "and_operand" "r,K,J"))
4727 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4728 (and:DI (match_dup 1) (match_dup 2)))]
4734 [(set_attr "type" "compare,compare,compare")])
4736 ;; Take a AND with a constant that cannot be done in a single insn and try to
4737 ;; split it into two insns. This does not verify that the insns are valid
4738 ;; since this need not be done as combine will do it.
4741 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4742 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
4743 (match_operand:DI 2 "non_and_cint_operand" "")))]
4745 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
4746 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
4749 int maskval = INTVAL (operands[2]);
4750 int i, transitions, last_bit_value;
4751 int orig = maskval, first_c = maskval, second_c;
4753 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
4754 the low-order bit and count for the third transition. When we get there,
4755 make a first mask that has everything to the left of that position
4756 a one. Then make the second mask to turn off whatever else is needed. */
4758 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
4760 if (((maskval >>= 1) & 1) != last_bit_value)
4761 last_bit_value ^= 1, transitions++;
4763 if (transitions > 2)
4765 first_c |= (~0) << i;
4770 second_c = orig | ~ first_c;
4772 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
4773 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
4776 (define_insn "iordi3"
4777 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4778 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4779 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4787 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4788 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4789 (match_operand:DI 2 "gpc_reg_operand" "r"))
4791 (clobber (match_scratch:DI 3 "=r"))]
4794 [(set_attr "type" "compare")])
4797 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4798 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4799 (match_operand:DI 2 "gpc_reg_operand" "r"))
4801 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4802 (ior:DI (match_dup 1) (match_dup 2)))]
4805 [(set_attr "type" "compare")])
4807 ;; Split an IOR that we can't do in one insn into two insns, each of which
4808 ;; does one 16-bit part. This is used by combine.
4811 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4812 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
4813 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4815 [(set (match_dup 0) (ior:DI (match_dup 1) (match_dup 3)))
4816 (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 4)))]
4819 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4820 INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
4821 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4824 (define_insn "xordi3"
4825 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4826 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4827 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4835 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4836 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4837 (match_operand:DI 2 "gpc_reg_operand" "r"))
4839 (clobber (match_scratch:DI 3 "=r"))]
4842 [(set_attr "type" "compare")])
4845 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4846 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4847 (match_operand:DI 2 "gpc_reg_operand" "r"))
4849 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4850 (xor:DI (match_dup 1) (match_dup 2)))]
4853 [(set_attr "type" "compare")])
4855 ;; Split an XOR that we can't do in one insn into two insns, each of which
4856 ;; does one 16-bit part. This is used by combine.
4859 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4860 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
4861 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4863 [(set (match_dup 0) (xor:DI (match_dup 1) (match_dup 3)))
4864 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 4)))]
4867 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4868 INTVAL (operands[2]) & 0xffff0000);
4869 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4873 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4874 (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4875 (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4880 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4881 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4882 (match_operand:DI 2 "gpc_reg_operand" "r")))
4884 (clobber (match_scratch:DI 3 "=r"))]
4887 [(set_attr "type" "compare")])
4890 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4891 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4892 (match_operand:DI 2 "gpc_reg_operand" "r")))
4894 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4895 (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
4898 [(set_attr "type" "compare")])
4901 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4902 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4903 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4908 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4909 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4910 (match_operand:DI 2 "gpc_reg_operand" "r"))
4912 (clobber (match_scratch:DI 3 "=r"))]
4915 [(set_attr "type" "compare")])
4918 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4919 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4920 (match_operand:DI 2 "gpc_reg_operand" "r"))
4922 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4923 (and:DI (not:DI (match_dup 1)) (match_dup 2)))]
4926 [(set_attr "type" "compare")])
4929 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4930 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4931 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4936 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4937 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4938 (match_operand:DI 2 "gpc_reg_operand" "r"))
4940 (clobber (match_scratch:DI 3 "=r"))]
4943 [(set_attr "type" "compare")])
4946 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4947 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4948 (match_operand:DI 2 "gpc_reg_operand" "r"))
4950 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4951 (ior:DI (not:DI (match_dup 1)) (match_dup 2)))]
4954 [(set_attr "type" "compare")])
4957 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4958 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4959 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4964 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4965 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4966 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4968 (clobber (match_scratch:DI 3 "=r"))]
4971 [(set_attr "type" "compare")])
4974 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4975 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4976 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4978 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4979 (ior:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
4982 [(set_attr "type" "compare")])
4985 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4986 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4987 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4992 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4993 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
4994 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
4996 (clobber (match_scratch:DI 3 "=r"))]
4999 [(set_attr "type" "compare")])
5002 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5003 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5004 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5006 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5007 (and:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
5010 [(set_attr "type" "compare")])
5012 ;; Now define ways of moving data around.
5014 ;; Elf specific ways of loading addresses for non-PIC code.
5015 ;; The output of this could be r0, but we limit it to base
5016 ;; registers, since almost all uses of this will need it
5017 ;; in a base register shortly.
5018 (define_insn "elf_high"
5019 [(set (match_operand:SI 0 "register_operand" "=b")
5020 (high:SI (match_operand 1 "" "")))]
5021 "TARGET_ELF && !TARGET_64BIT"
5022 "{cau|addis} %0,0,%1@ha")
5024 (define_insn "elf_low"
5025 [(set (match_operand:SI 0 "register_operand" "=r")
5026 (lo_sum:SI (match_operand:SI 1 "register_operand" "b")
5027 (match_operand 2 "" "")))]
5028 "TARGET_ELF && !TARGET_64BIT"
5029 "{cal %0,%a2@l(%1)|addi %0,%1,%2@l}")
5031 ;; Set up a register with a value from the GOT table
5033 (define_expand "movsi_got"
5034 [(set (match_operand:SI 0 "register_operand" "")
5035 (unspec [(match_operand:SI 1 "got_operand" "")
5037 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
5040 if (GET_CODE (operands[1]) == CONST)
5042 rtx offset = const0_rtx;
5043 HOST_WIDE_INT value;
5045 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
5046 value = INTVAL (offset);
5049 rtx tmp = ((reload_in_progress || reload_completed)
5051 : gen_reg_rtx (Pmode));
5052 emit_insn (gen_movsi_got (tmp, operands[1]));
5053 emit_insn (gen_addsi3 (operands[0], tmp, offset));
5058 operands[2] = rs6000_got_register (operands[1]);
5061 (define_insn "*movsi_got_internal"
5062 [(set (match_operand:SI 0 "register_operand" "=r")
5063 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
5064 (match_operand:SI 2 "register_operand" "b")] 8))]
5065 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
5066 "{l|lwz} %0,%a1@got(%2)"
5067 [(set_attr "type" "load")])
5069 ;; For SI, we special-case integers that can't be loaded in one insn. We
5070 ;; do the load 16-bits at a time. We could do this by loading from memory,
5071 ;; and this is even supposed to be faster, but it is simpler not to get
5072 ;; integers in the TOC.
5073 (define_expand "movsi"
5074 [(set (match_operand:SI 0 "general_operand" "")
5075 (match_operand:SI 1 "any_operand" ""))]
5079 if (GET_CODE (operands[0]) != REG)
5080 operands[1] = force_reg (SImode, operands[1]);
5082 /* Convert a move of a CONST_DOUBLE into a CONST_INT */
5083 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5084 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
5086 /* Use default pattern for address of ELF small data */
5088 && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5089 && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
5090 && small_data_operand (operands[1], SImode))
5092 emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
5096 if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5097 && flag_pic == 1 && got_operand (operands[1], SImode))
5099 emit_insn (gen_movsi_got (operands[0], operands[1]));
5103 if (TARGET_ELF && TARGET_NO_TOC && !TARGET_64BIT
5105 && CONSTANT_P (operands[1])
5106 && GET_CODE (operands[1]) != HIGH
5107 && GET_CODE (operands[1]) != CONST_INT)
5109 rtx target = (reload_completed || reload_in_progress)
5110 ? operands[0] : gen_reg_rtx (SImode);
5112 /* If this is a function address on -mcall-aixdesc or -mcall-nt,
5113 convert it to the address of the descriptor. */
5114 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
5115 && GET_CODE (operands[1]) == SYMBOL_REF
5116 && XSTR (operands[1], 0)[0] == '.')
5118 char *name = XSTR (operands[1], 0);
5120 while (*name == '.')
5122 new_ref = gen_rtx (SYMBOL_REF, Pmode, name);
5123 CONSTANT_POOL_ADDRESS_P (new_ref) = CONSTANT_POOL_ADDRESS_P (operands[1]);
5124 SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
5125 SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
5126 operands[1] = new_ref;
5129 emit_insn (gen_elf_high (target, operands[1]));
5130 emit_insn (gen_elf_low (operands[0], target, operands[1]));
5134 if (GET_CODE (operands[1]) == CONST
5135 && DEFAULT_ABI == ABI_NT
5136 && !side_effects_p (operands[0]))
5138 rtx const_term = const0_rtx;
5139 rtx sym = eliminate_constant_term (XEXP (operands[1], 0), &const_term);
5140 if (sym && GET_CODE (const_term) == CONST_INT
5141 && (GET_CODE (sym) == SYMBOL_REF || GET_CODE (sym) == LABEL_REF))
5143 unsigned HOST_WIDE_INT value = INTVAL (const_term);
5144 int new_reg_p = (flag_expensive_optimizations
5145 && !reload_completed
5146 && !reload_in_progress);
5147 rtx tmp1 = (new_reg_p && value != 0) ? gen_reg_rtx (SImode) : operands[0];
5149 emit_insn (gen_movsi (tmp1, sym));
5150 if (INTVAL (const_term) != 0)
5151 emit_insn (gen_addsi3 (operands[0], tmp1, GEN_INT (value)));
5155 fatal_insn (\"bad address\", operands[1]);
5158 if ((!TARGET_WINDOWS_NT || DEFAULT_ABI != ABI_NT)
5159 && CONSTANT_P (operands[1])
5160 && GET_CODE (operands[1]) != CONST_INT
5161 && GET_CODE (operands[1]) != HIGH
5162 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
5164 /* Emit a USE operation so that the constant isn't deleted if
5165 expensive optimizations are turned on because nobody
5166 references it. This should only be done for operands that
5167 contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
5168 This should not be done for operands that contain LABEL_REFs.
5169 For now, we just handle the obvious case. */
5170 if (GET_CODE (operands[1]) != LABEL_REF)
5171 emit_insn (gen_rtx (USE, VOIDmode, operands[1]));
5173 /* If we are to limit the number of things we put in the TOC and
5174 this is a symbol plus a constant we can add in one insn,
5175 just put the symbol in the TOC and add the constant. Don't do
5176 this if reload is in progress. */
5177 if (GET_CODE (operands[1]) == CONST
5178 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
5179 && GET_CODE (XEXP (operands[1], 0)) == PLUS
5180 && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
5181 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
5182 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
5183 && ! side_effects_p (operands[0]))
5185 rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
5186 rtx other = XEXP (XEXP (operands[1], 0), 1);
5188 emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
5192 operands[1] = force_const_mem (SImode, operands[1]);
5193 if (! memory_address_p (SImode, XEXP (operands[1], 0))
5194 && ! reload_in_progress)
5195 operands[1] = change_address (operands[1], SImode,
5196 XEXP (operands[1], 0));
5201 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,r,r,r,r,r,*q,*c*l,*h")
5202 (match_operand:SI 1 "input_operand" "r,S,T,U,m,r,I,J,n,R,*h,r,r,0"))]
5203 "gpc_reg_operand (operands[0], SImode)
5204 || gpc_reg_operand (operands[1], SImode)"
5207 {l|lwz} %0,[toc]%1(2)
5208 {l|lwz} %0,[toc]%l1(2)
5210 {l%U1%X1|lwz%U1%X1} %0,%1
5211 {st%U0%X0|stw%U0%X0} %1,%0
5220 [(set_attr "type" "*,load,load,*,load,store,*,*,*,*,*,*,mtjmpr,*")
5221 (set_attr "length" "4,4,4,4,4,4,4,4,8,4,4,4,4,4")])
5223 ;; Split a load of a large constant into the appropriate two-insn
5227 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5228 (match_operand:SI 1 "const_int_operand" ""))]
5229 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
5230 && (INTVAL (operands[1]) & 0xffff) != 0"
5234 (ior:SI (match_dup 0)
5238 operands[2] = gen_rtx (CONST_INT, VOIDmode,
5239 INTVAL (operands[1]) & 0xffff0000);
5240 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
5244 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
5245 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
5247 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
5250 [(set_attr "type" "compare")])
5252 (define_expand "movhi"
5253 [(set (match_operand:HI 0 "general_operand" "")
5254 (match_operand:HI 1 "any_operand" ""))]
5258 if (GET_CODE (operands[0]) != REG)
5259 operands[1] = force_reg (HImode, operands[1]);
5261 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
5263 operands[1] = force_const_mem (HImode, operands[1]);
5264 if (! memory_address_p (HImode, XEXP (operands[1], 0))
5265 && ! reload_in_progress)
5266 operands[1] = change_address (operands[1], HImode,
5267 XEXP (operands[1], 0));
5272 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
5273 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
5274 "gpc_reg_operand (operands[0], HImode)
5275 || gpc_reg_operand (operands[1], HImode)"
5285 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
5287 (define_expand "movqi"
5288 [(set (match_operand:QI 0 "general_operand" "")
5289 (match_operand:QI 1 "any_operand" ""))]
5293 if (GET_CODE (operands[0]) != REG)
5294 operands[1] = force_reg (QImode, operands[1]);
5296 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
5298 operands[1] = force_const_mem (QImode, operands[1]);
5299 if (! memory_address_p (QImode, XEXP (operands[1], 0))
5300 && ! reload_in_progress)
5301 operands[1] = change_address (operands[1], QImode,
5302 XEXP (operands[1], 0));
5307 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
5308 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
5309 "gpc_reg_operand (operands[0], QImode)
5310 || gpc_reg_operand (operands[1], QImode)"
5320 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
5322 ;; Here is how to move condition codes around. When we store CC data in
5323 ;; an integer register or memory, we store just the high-order 4 bits.
5324 ;; This lets us not shift in the most common case of CR0.
5325 (define_expand "movcc"
5326 [(set (match_operand:CC 0 "nonimmediate_operand" "")
5327 (match_operand:CC 1 "nonimmediate_operand" ""))]
5332 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
5333 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
5334 "register_operand (operands[0], CCmode)
5335 || register_operand (operands[1], CCmode)"
5339 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
5341 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
5343 {l%U1%X1|lwz%U1%X1} %0,%1
5344 {st%U0%U1|stw%U0%U1} %1,%0"
5345 [(set_attr "type" "*,*,*,compare,*,*,load,store")
5346 (set_attr "length" "*,*,12,*,8,*,*,*")])
5348 ;; For floating-point, we normally deal with the floating-point registers
5349 ;; unless -msoft-float is used. The sole exception is that parameter passing
5350 ;; can produce floating-point values in fixed-point registers. Unless the
5351 ;; value is a simple constant or already in memory, we deal with this by
5352 ;; allocating memory and copying the value explicitly via that memory location.
5353 (define_expand "movsf"
5354 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5355 (match_operand:SF 1 "any_operand" ""))]
5359 /* If we are called from reload, we might be getting a SUBREG of a hard
5360 reg. So expand it. */
5361 if (GET_CODE (operands[0]) == SUBREG
5362 && GET_CODE (SUBREG_REG (operands[0])) == REG
5363 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
5364 operands[0] = alter_subreg (operands[0]);
5365 if (GET_CODE (operands[1]) == SUBREG
5366 && GET_CODE (SUBREG_REG (operands[1])) == REG
5367 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
5368 operands[1] = alter_subreg (operands[1]);
5370 if (TARGET_SOFT_FLOAT && GET_CODE (operands[0]) == MEM)
5371 operands[1] = force_reg (SFmode, operands[1]);
5373 else if (TARGET_HARD_FLOAT)
5375 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
5377 /* If this is a store to memory or another integer register do the
5378 move directly. Otherwise store to a temporary stack slot and
5379 load from there into a floating point register. */
5381 if (GET_CODE (operands[0]) == MEM
5382 || (GET_CODE (operands[0]) == REG
5383 && (REGNO (operands[0]) < 32
5384 || (reload_in_progress
5385 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
5387 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5388 operand_subword (operands[1], 0, 0, SFmode));
5393 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5395 emit_move_insn (stack_slot, operands[1]);
5396 emit_move_insn (operands[0], stack_slot);
5401 if (GET_CODE (operands[0]) == MEM)
5403 /* If operands[1] is a register, it may have double-precision data
5404 in it, so truncate it to single precision. We need not do
5405 this for POWERPC. */
5406 if (! TARGET_POWERPC && TARGET_HARD_FLOAT
5407 && GET_CODE (operands[1]) == REG)
5410 = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
5411 emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
5412 operands[1] = newreg;
5415 operands[1] = force_reg (SFmode, operands[1]);
5418 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
5420 if (GET_CODE (operands[1]) == MEM
5421 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
5422 || GET_CODE (operands[1]) == CONST_DOUBLE
5424 || (GET_CODE (operands[1]) == REG
5425 && (REGNO (operands[1]) < 32
5426 || (reload_in_progress
5427 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))))
5429 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5430 operand_subword (operands[1], 0, 0, SFmode));
5435 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5437 emit_move_insn (stack_slot, operands[1]);
5438 emit_move_insn (operands[0], stack_slot);
5444 if (CONSTANT_P (operands[1]) && TARGET_HARD_FLOAT)
5446 operands[1] = force_const_mem (SFmode, operands[1]);
5447 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
5448 && ! reload_in_progress)
5449 operands[1] = change_address (operands[1], SFmode,
5450 XEXP (operands[1], 0));
5455 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5456 (match_operand:SF 1 "const_double_operand" ""))]
5457 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], SFmode) <= 1
5458 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5459 || (GET_CODE (operands[0]) == SUBREG
5460 && GET_CODE (SUBREG_REG (operands[0])) == REG
5461 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5462 [(set (match_dup 2) (match_dup 3))]
5468 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
5469 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
5471 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
5472 operands[3] = GEN_INT(l);
5476 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5477 (match_operand:SF 1 "const_double_operand" ""))]
5478 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], SFmode) == 2
5479 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5480 || (GET_CODE (operands[0]) == SUBREG
5481 && GET_CODE (SUBREG_REG (operands[0])) == REG
5482 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5483 [(set (match_dup 2) (match_dup 3))
5484 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 4)))]
5490 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
5491 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
5493 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
5494 operands[3] = GEN_INT(l & 0xffff0000);
5495 operands[4] = GEN_INT(l & 0x0000ffff);
5498 (define_insn "*movsf_hardfloat"
5499 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,m,!r,!r")
5500 (match_operand:SF 1 "input_operand" "f,m,f,G,Fn"))]
5501 "(gpc_reg_operand (operands[0], SFmode)
5502 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
5509 [(set_attr "type" "fp,fpload,fpstore,*,*")
5510 (set_attr "length" "4,4,4,4,8")])
5512 (define_insn "*movsf_softfloat"
5513 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
5514 (match_operand:SF 1 "input_operand" "r,m,r,I,J,R,G,Fn"))]
5515 "(gpc_reg_operand (operands[0], SFmode)
5516 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
5519 {l%U1%X1|lwz%U1%X1} %0,%1
5520 {st%U0%X0|stw%U0%X0} %1,%0
5526 [(set_attr "type" "*,load,store,*,*,*,*,*")
5527 (set_attr "length" "4,4,4,4,4,4,4,8")])
5530 (define_expand "movdf"
5531 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5532 (match_operand:DF 1 "any_operand" ""))]
5536 if (GET_CODE (operands[0]) != REG)
5537 operands[1] = force_reg (DFmode, operands[1]);
5539 /* Stores between FPR and any non-FPR registers must go through a
5540 temporary stack slot. */
5542 if (TARGET_POWERPC64
5543 && GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
5544 && ((FP_REGNO_P (REGNO (operands[0]))
5545 && ! FP_REGNO_P (REGNO (operands[1])))
5546 || (FP_REGNO_P (REGNO (operands[1]))
5547 && ! FP_REGNO_P (REGNO (operands[0])))))
5549 rtx stack_slot = assign_stack_temp (DFmode, 8, 0);
5551 emit_move_insn (stack_slot, operands[1]);
5552 emit_move_insn (operands[0], stack_slot);
5556 if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
5558 operands[1] = force_const_mem (DFmode, operands[1]);
5559 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
5560 && ! reload_in_progress)
5561 operands[1] = change_address (operands[1], DFmode,
5562 XEXP (operands[1], 0));
5567 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5568 (match_operand:DF 1 "const_int_operand" ""))]
5569 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) <= 1
5570 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5571 || (GET_CODE (operands[0]) == SUBREG
5572 && GET_CODE (SUBREG_REG (operands[0])) == REG
5573 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5574 [(set (match_dup 2) (match_dup 4))
5575 (set (match_dup 3) (match_dup 1))]
5578 int endian = (WORDS_BIG_ENDIAN == 0);
5579 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5580 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5581 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
5585 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5586 (match_operand:DF 1 "const_int_operand" ""))]
5587 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) >= 2
5588 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5589 || (GET_CODE (operands[0]) == SUBREG
5590 && GET_CODE (SUBREG_REG (operands[0])) == REG
5591 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5592 [(set (match_dup 3) (match_dup 5))
5593 (set (match_dup 2) (match_dup 4))
5594 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 6)))]
5597 HOST_WIDE_INT value = INTVAL (operands[1]);
5598 int endian = (WORDS_BIG_ENDIAN == 0);
5599 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5600 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5601 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
5602 operands[5] = GEN_INT (value & 0xffff0000);
5603 operands[6] = GEN_INT (value & 0x0000ffff);
5607 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5608 (match_operand:DF 1 "const_double_operand" ""))]
5609 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) <= 2
5610 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5611 || (GET_CODE (operands[0]) == SUBREG
5612 && GET_CODE (SUBREG_REG (operands[0])) == REG
5613 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5614 [(set (match_dup 2) (match_dup 4))
5615 (set (match_dup 3) (match_dup 5))]
5618 int endian = (WORDS_BIG_ENDIAN == 0);
5619 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5620 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5622 #ifdef HOST_WORDS_BIG_ENDIAN
5623 operands[4] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
5624 operands[5] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
5626 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
5627 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
5632 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5633 (match_operand:DF 1 "const_double_operand" ""))]
5634 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) == 3
5635 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5636 || (GET_CODE (operands[0]) == SUBREG
5637 && GET_CODE (SUBREG_REG (operands[0])) == REG
5638 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5639 [(set (match_dup 2) (match_dup 4))
5640 (set (match_dup 3) (match_dup 5))
5641 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))]
5646 int endian = (WORDS_BIG_ENDIAN == 0);
5647 rtx high_reg = operand_subword (operands[0], endian, 0, DFmode);
5648 rtx low_reg = operand_subword (operands[0], 1 - endian, 0, DFmode);
5650 #ifdef HOST_WORDS_BIG_ENDIAN
5651 high = CONST_DOUBLE_LOW (operands[1]);
5652 low = CONST_DOUBLE_HIGH (operands[1]);
5654 high = CONST_DOUBLE_HIGH (operands[1]);
5655 low = CONST_DOUBLE_LOW (operands[1]);
5658 if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
5659 || (low & 0xffff) == 0)
5661 operands[2] = high_reg;
5662 operands[3] = low_reg;
5663 operands[4] = GEN_INT (high & 0xffff0000);
5664 operands[5] = GEN_INT (low);
5665 operands[6] = GEN_INT (high & 0x0000ffff);
5669 operands[2] = low_reg;
5670 operands[3] = high_reg;
5671 operands[4] = GEN_INT (low & 0xffff0000);
5672 operands[5] = GEN_INT (high);
5673 operands[6] = GEN_INT (low & 0x0000ffff);
5678 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5679 (match_operand:DF 1 "const_double_operand" ""))]
5680 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) >= 4
5681 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5682 || (GET_CODE (operands[0]) == SUBREG
5683 && GET_CODE (SUBREG_REG (operands[0])) == REG
5684 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5685 [(set (match_dup 2) (match_dup 4))
5686 (set (match_dup 3) (match_dup 5))
5687 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))
5688 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
5691 HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
5692 HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
5693 int endian = (WORDS_BIG_ENDIAN == 0);
5695 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5696 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5697 operands[4] = GEN_INT (high & 0xffff0000);
5698 operands[5] = GEN_INT (low & 0xffff0000);
5699 operands[6] = GEN_INT (high & 0x0000ffff);
5700 operands[7] = GEN_INT (low & 0x0000ffff);
5704 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5705 (match_operand:DF 1 "easy_fp_constant" ""))]
5706 "TARGET_64BIT && reload_completed
5707 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5708 || (GET_CODE (operands[0]) == SUBREG
5709 && GET_CODE (SUBREG_REG (operands[0])) == REG
5710 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5711 [(set (match_dup 2) (subreg:DI (match_dup 1) 0))]
5713 { operands[2] = gen_lowpart (DImode, operands[0]); }")
5715 ;; Don't have reload use general registers to load a constant. First,
5716 ;; it might not work if the output operand has is the equivalent of
5717 ;; a non-offsettable memref, but also it is less efficient than loading
5718 ;; the constant into an FP register, since it will probably be used there.
5719 ;; The "??" is a kludge until we can figure out a more reasonable way
5720 ;; of handling these non-offsettable values.
5721 (define_insn "*movdf_hardfloat32"
5722 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
5723 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
5724 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
5725 && (register_operand (operands[0], DFmode)
5726 || register_operand (operands[1], DFmode))"
5729 switch (which_alternative)
5732 /* We normally copy the low-numbered register first. However, if
5733 the first register operand 0 is the same as the second register of
5734 operand 1, we must copy in the opposite order. */
5735 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5736 return \"mr %L0,%L1\;mr %0,%1\";
5738 return \"mr %0,%1\;mr %L0,%L1\";
5740 /* If the low-address word is used in the address, we must load it
5741 last. Otherwise, load it first. Note that we cannot have
5742 auto-increment in that case since the address register is known to be
5744 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5746 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5748 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5750 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5756 return \"fmr %0,%1\";
5758 return \"lfd%U1%X1 %0,%1\";
5760 return \"stfd%U0%X0 %1,%0\";
5763 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
5764 (set_attr "length" "8,8,8,8,12,16,*,*,*")])
5766 (define_insn "*movdf_softfloat32"
5767 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r,r,r")
5768 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F"))]
5769 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5770 && (register_operand (operands[0], DFmode)
5771 || register_operand (operands[1], DFmode))"
5774 switch (which_alternative)
5777 /* We normally copy the low-numbered register first. However, if
5778 the first register operand 0 is the same as the second register of
5779 operand 1, we must copy in the opposite order. */
5780 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5781 return \"mr %L0,%L1\;mr %0,%1\";
5783 return \"mr %0,%1\;mr %L0,%L1\";
5785 /* If the low-address word is used in the address, we must load it
5786 last. Otherwise, load it first. Note that we cannot have
5787 auto-increment in that case since the address register is known to be
5789 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5791 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5793 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5795 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5802 [(set_attr "type" "*,load,store,*,*,*")
5803 (set_attr "length" "8,8,8,8,12,16")])
5805 (define_insn "*movdf_hardfloat64"
5806 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
5807 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
5808 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
5809 && (register_operand (operands[0], DFmode)
5810 || register_operand (operands[1], DFmode))"
5821 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
5822 (set_attr "length" "4,4,4,8,12,16,4,4,4")])
5824 (define_insn "*movdf_softfloat64"
5825 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r,r,r")
5826 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F"))]
5827 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5828 && (register_operand (operands[0], DFmode)
5829 || register_operand (operands[1], DFmode))"
5837 [(set_attr "type" "*,load,store,*,*,*")
5838 (set_attr "length" "*,*,*,8,12,16")])
5840 ;; Next come the multi-word integer load and store and the load and store
5842 (define_expand "movdi"
5843 [(set (match_operand:DI 0 "general_operand" "")
5844 (match_operand:DI 1 "any_operand" ""))]
5848 if (GET_CODE (operands[0]) != REG)
5849 operands[1] = force_reg (DImode, operands[1]);
5852 && (GET_CODE (operands[1]) == CONST_DOUBLE
5853 || GET_CODE (operands[1]) == CONST_INT))
5858 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5860 low = CONST_DOUBLE_LOW (operands[1]);
5861 high = CONST_DOUBLE_HIGH (operands[1]);
5864 #if HOST_BITS_PER_WIDE_INT == 32
5866 low = INTVAL (operands[1]);
5867 high = (low < 0) ? ~0 : 0;
5871 low = INTVAL (operands[1]) & 0xffffffff;
5872 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
5878 emit_move_insn (operands[0], GEN_INT (high));
5879 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT(32)));
5882 HOST_WIDE_INT low_low = low & 0xffff;
5883 HOST_WIDE_INT low_high = low & (~ (HOST_WIDE_INT) 0xffff);
5885 emit_insn (gen_iordi3 (operands[0], operands[0],
5886 GEN_INT (low_high)));
5888 emit_insn (gen_iordi3 (operands[0], operands[0],
5889 GEN_INT (low_low)));
5895 /* Stores between FPR and any non-FPR registers must go through a
5896 temporary stack slot. */
5898 if (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
5899 && ((FP_REGNO_P (REGNO (operands[0]))
5900 && ! FP_REGNO_P (REGNO (operands[1])))
5901 || (FP_REGNO_P (REGNO (operands[1]))
5902 && ! FP_REGNO_P (REGNO (operands[0])))))
5904 rtx stack_slot = assign_stack_temp (DImode, 8, 0);
5906 emit_move_insn (stack_slot, operands[1]);
5907 emit_move_insn (operands[0], stack_slot);
5912 (define_insn "*movdi_32"
5913 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
5914 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
5916 && (gpc_reg_operand (operands[0], DImode)
5917 || gpc_reg_operand (operands[1], DImode))"
5920 switch (which_alternative)
5923 /* We normally copy the low-numbered register first. However, if
5924 the first register operand 0 is the same as the second register of
5925 operand 1, we must copy in the opposite order. */
5926 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5927 return \"mr %L0,%L1\;mr %0,%1\";
5929 return \"mr %0,%1\;mr %L0,%L1\";
5931 /* If the low-address word is used in the address, we must load it
5932 last. Otherwise, load it first. Note that we cannot have
5933 auto-increment in that case since the address register is known to be
5935 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5937 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5939 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5941 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5943 return \"fmr %0,%1\";
5945 return \"lfd%U1%X1 %0,%1\";
5947 return \"stfd%U0%X0 %1,%0\";
5956 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
5957 (set_attr "length" "8,8,8,*,*,*,8,12,8,12,16")])
5960 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5961 (match_operand:DI 1 "const_int_operand" ""))]
5962 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) <= 1"
5963 [(set (match_dup 2) (match_dup 4))
5964 (set (match_dup 3) (match_dup 1))]
5967 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
5968 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
5969 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
5973 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5974 (match_operand:DI 1 "const_int_operand" ""))]
5975 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) >= 2"
5976 [(set (match_dup 3) (match_dup 5))
5977 (set (match_dup 2) (match_dup 4))
5978 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 6)))]
5981 HOST_WIDE_INT value = INTVAL (operands[1]);
5982 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
5983 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
5984 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
5985 operands[5] = GEN_INT (value & 0xffff0000);
5986 operands[6] = GEN_INT (value & 0x0000ffff);
5990 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5991 (match_operand:DI 1 "const_double_operand" ""))]
5992 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) <= 2"
5993 [(set (match_dup 2) (match_dup 4))
5994 (set (match_dup 3) (match_dup 5))]
5997 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
5998 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
5999 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
6000 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
6004 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6005 (match_operand:DI 1 "const_double_operand" ""))]
6006 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) == 3"
6007 [(set (match_dup 2) (match_dup 4))
6008 (set (match_dup 3) (match_dup 5))
6009 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))]
6012 HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
6013 HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
6014 rtx high_reg = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6015 rtx low_reg = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6017 if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
6018 || (low & 0xffff) == 0)
6020 operands[2] = high_reg;
6021 operands[3] = low_reg;
6022 operands[4] = GEN_INT (high & 0xffff0000);
6023 operands[5] = GEN_INT (low);
6024 operands[6] = GEN_INT (high & 0x0000ffff);
6028 operands[2] = low_reg;
6029 operands[3] = high_reg;
6030 operands[4] = GEN_INT (low & 0xffff0000);
6031 operands[5] = GEN_INT (high);
6032 operands[6] = GEN_INT (low & 0x0000ffff);
6037 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6038 (match_operand:DI 1 "const_double_operand" ""))]
6039 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) >= 4"
6040 [(set (match_dup 2) (match_dup 4))
6041 (set (match_dup 3) (match_dup 5))
6042 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))
6043 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
6046 HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
6047 HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
6049 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6050 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6051 operands[4] = GEN_INT (high & 0xffff0000);
6052 operands[5] = GEN_INT (low & 0xffff0000);
6053 operands[6] = GEN_INT (high & 0x0000ffff);
6054 operands[7] = GEN_INT (low & 0x0000ffff);
6057 (define_insn "*movdi_64"
6058 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
6059 (match_operand:DI 1 "input_operand" "r,m,r,I,J,nF,R,f,m,f,*h,r,0"))]
6061 && (gpc_reg_operand (operands[0], DImode)
6062 || gpc_reg_operand (operands[1], DImode))"
6077 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
6078 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
6080 ;; Split a load of a large constant into the appropriate five-instruction
6081 ;; sequence. The expansion in movdi tries to perform the minimum number of
6082 ;; steps, but here we have to handle anything in a constant number of insns.
6085 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6086 (match_operand:DI 1 "const_double_operand" ""))]
6087 "TARGET_64BIT && num_insns_constant (operands[1], DImode) > 1"
6091 (ior:DI (match_dup 0)
6094 (ashift:DI (match_dup 0)
6097 (ior:DI (match_dup 0)
6100 (ior:DI (match_dup 0)
6107 if (GET_CODE (operands[1]) == CONST_DOUBLE)
6109 low = CONST_DOUBLE_LOW (operands[1]);
6110 high = CONST_DOUBLE_HIGH (operands[1]);
6113 #if HOST_BITS_PER_WIDE_INT == 32
6115 low = INTVAL (operands[1]);
6116 high = (low < 0) ? ~0 : 0;
6120 low = INTVAL (operands[1]) & 0xffffffff;
6121 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
6125 if ((high + 0x8000) < 0x10000
6126 && ((low & 0xffff) == 0 || (low & (~ (HOST_WIDE_INT) 0xffff)) == 0))
6129 operands[2] = GEN_INT (high & (~ (HOST_WIDE_INT) 0xffff));
6130 operands[3] = GEN_INT (high & 0xffff);
6131 operands[4] = GEN_INT (low & (~ (HOST_WIDE_INT) 0xffff));
6132 operands[5] = GEN_INT (low & 0xffff);
6136 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
6137 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
6139 (set (match_operand:DI 0 "gpc_reg_operand" "=r") (match_dup 1))]
6142 [(set_attr "type" "compare")])
6144 ;; TImode is similar, except that we usually want to compute the address into
6145 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
6146 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
6147 (define_expand "movti"
6148 [(parallel [(set (match_operand:TI 0 "general_operand" "")
6149 (match_operand:TI 1 "general_operand" ""))
6150 (clobber (scratch:SI))])]
6151 "TARGET_STRING || TARGET_POWERPC64"
6154 if (GET_CODE (operands[0]) == MEM)
6155 operands[1] = force_reg (TImode, operands[1]);
6157 if (GET_CODE (operands[0]) == MEM
6158 && GET_CODE (XEXP (operands[0], 0)) != REG
6159 && ! reload_in_progress)
6160 operands[0] = change_address (operands[0], TImode,
6161 copy_addr_to_reg (XEXP (operands[0], 0)));
6163 if (GET_CODE (operands[1]) == MEM
6164 && GET_CODE (XEXP (operands[1], 0)) != REG
6165 && ! reload_in_progress)
6166 operands[1] = change_address (operands[1], TImode,
6167 copy_addr_to_reg (XEXP (operands[1], 0)));
6170 ;; We say that MQ is clobbered in the last alternative because the first
6171 ;; alternative would never get used otherwise since it would need a reload
6172 ;; while the 2nd alternative would not. We put memory cases first so they
6173 ;; are preferred. Otherwise, we'd try to reload the output instead of
6174 ;; giving the SCRATCH mq.
6176 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
6177 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
6178 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
6179 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
6180 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
6183 switch (which_alternative)
6189 return \"{stsi|stswi} %1,%P0,16\";
6192 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
6195 /* Normally copy registers with lowest numbered register copied first.
6196 But copy in the other order if the first register of the output
6197 is the second, third, or fourth register in the input. */
6198 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
6199 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
6200 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
6202 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
6204 /* If the address is not used in the output, we can use lsi. Otherwise,
6205 fall through to generating four loads. */
6206 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
6207 return \"{lsi|lswi} %0,%P1,16\";
6208 /* ... fall through ... */
6210 /* If the address register is the same as the register for the lowest-
6211 addressed word, load it last. Similarly for the next two words.
6212 Otherwise load lowest address to highest. */
6213 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6215 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
6216 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
6217 REGNO (operands[0]) + 2, operands[1], 0))
6218 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
6219 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
6220 REGNO (operands[0]) + 3, operands[1], 0))
6221 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
6223 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
6226 [(set_attr "type" "store,store,*,load,load")
6227 (set_attr "length" "*,16,16,*,16")])
6230 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
6231 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
6232 (clobber (match_scratch:SI 2 "=X,X,X"))]
6233 "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
6234 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
6237 switch (which_alternative)
6243 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
6246 /* Normally copy registers with lowest numbered register copied first.
6247 But copy in the other order if the first register of the output
6248 is the second, third, or fourth register in the input. */
6249 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
6250 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
6251 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
6253 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
6255 /* If the address register is the same as the register for the lowest-
6256 addressed word, load it last. Similarly for the next two words.
6257 Otherwise load lowest address to highest. */
6258 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6260 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
6261 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
6262 REGNO (operands[0]) + 2, operands[1], 0))
6263 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
6264 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
6265 REGNO (operands[0]) + 3, operands[1], 0))
6266 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
6268 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
6271 [(set_attr "type" "store,*,load")
6272 (set_attr "length" "16,16,16")])
6275 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
6276 (match_operand:TI 1 "input_operand" "r,m,r"))]
6277 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
6278 || gpc_reg_operand (operands[1], TImode))"
6281 switch (which_alternative)
6284 /* We normally copy the low-numbered register first. However, if
6285 the first register operand 0 is the same as the second register of
6286 operand 1, we must copy in the opposite order. */
6287 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
6288 return \"mr %L0,%L1\;mr %0,%1\";
6290 return \"mr %0,%1\;mr %L0,%L1\";
6292 /* If the low-address word is used in the address, we must load it
6293 last. Otherwise, load it first. Note that we cannot have
6294 auto-increment in that case since the address register is known to be
6296 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6298 return \"ld %L0,%L1\;ld %0,%1\";
6300 return \"ld%U1 %0,%1\;ld %L0,%L1\";
6302 return \"std%U0 %1,%0\;std %L1,%L0\";
6305 [(set_attr "type" "*,load,store")
6306 (set_attr "length" "8,8,8")])
6308 (define_expand "load_multiple"
6309 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
6310 (match_operand:SI 1 "" ""))
6311 (use (match_operand:SI 2 "" ""))])]
6320 /* Support only loading a constant number of fixed-point registers from
6321 memory and only bother with this if more than two; the machine
6322 doesn't support more than eight. */
6323 if (GET_CODE (operands[2]) != CONST_INT
6324 || INTVAL (operands[2]) <= 2
6325 || INTVAL (operands[2]) > 8
6326 || GET_CODE (operands[1]) != MEM
6327 || GET_CODE (operands[0]) != REG
6328 || REGNO (operands[0]) >= 32)
6331 count = INTVAL (operands[2]);
6332 regno = REGNO (operands[0]);
6334 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
6335 from = force_reg (SImode, XEXP (operands[1], 0));
6337 for (i = 0; i < count; i++)
6338 XVECEXP (operands[3], 0, i)
6339 = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
6340 change_address (operands[1], SImode,
6341 plus_constant (from, i * 4)));
6345 [(match_parallel 0 "load_multiple_operation"
6346 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
6347 (mem:SI (match_operand:SI 2 "register_operand" "b")))])]
6351 /* We have to handle the case where the pseudo used to contain the address
6352 is assigned to one of the output registers. */
6354 int words = XVECLEN (operands[0], 0);
6357 if (XVECLEN (operands[0], 0) == 1)
6358 return \"{l|lwz} %1,0(%2)\";
6360 for (i = 0; i < words; i++)
6361 if (refers_to_regno_p (REGNO (operands[1]) + i,
6362 REGNO (operands[1]) + i + 1, operands[2], 0))
6366 xop[0] = operands[1];
6367 xop[1] = operands[2];
6368 xop[2] = GEN_INT (4 * (words-1));
6369 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
6374 xop[0] = operands[1];
6375 xop[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
6376 xop[2] = GEN_INT (4 * (words-1));
6377 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
6382 for (j = 0; j < words; j++)
6385 xop[0] = gen_rtx (REG, SImode, REGNO (operands[1]) + j);
6386 xop[1] = operands[2];
6387 xop[2] = GEN_INT (j * 4);
6388 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
6390 xop[0] = operands[2];
6391 xop[1] = GEN_INT (i * 4);
6392 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
6397 return \"{lsi|lswi} %1,%2,%N0\";
6399 [(set_attr "type" "load")
6400 (set_attr "length" "32")])
6403 (define_expand "store_multiple"
6404 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
6405 (match_operand:SI 1 "" ""))
6406 (clobber (scratch:SI))
6407 (use (match_operand:SI 2 "" ""))])]
6416 /* Support only storing a constant number of fixed-point registers to
6417 memory and only bother with this if more than two; the machine
6418 doesn't support more than eight. */
6419 if (GET_CODE (operands[2]) != CONST_INT
6420 || INTVAL (operands[2]) <= 2
6421 || INTVAL (operands[2]) > 8
6422 || GET_CODE (operands[0]) != MEM
6423 || GET_CODE (operands[1]) != REG
6424 || REGNO (operands[1]) >= 32)
6427 count = INTVAL (operands[2]);
6428 regno = REGNO (operands[1]);
6430 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
6431 to = force_reg (SImode, XEXP (operands[0], 0));
6433 XVECEXP (operands[3], 0, 0)
6434 = gen_rtx (SET, VOIDmode, change_address (operands[0], SImode, to),
6436 XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
6437 gen_rtx (SCRATCH, SImode));
6439 for (i = 1; i < count; i++)
6440 XVECEXP (operands[3], 0, i + 1)
6441 = gen_rtx (SET, VOIDmode,
6442 change_address (operands[0], SImode,
6443 plus_constant (to, i * 4)),
6444 gen_rtx (REG, SImode, regno + i));
6448 [(match_parallel 0 "store_multiple_operation"
6449 [(set (match_operand:SI 1 "indirect_operand" "=Q")
6450 (match_operand:SI 2 "gpc_reg_operand" "r"))
6451 (clobber (match_scratch:SI 3 "=q"))])]
6452 "TARGET_STRING && TARGET_POWER"
6453 "{stsi|stswi} %2,%P1,%O0"
6454 [(set_attr "type" "store")])
6457 [(match_parallel 0 "store_multiple_operation"
6458 [(set (mem:SI (match_operand:SI 1 "register_operand" "b"))
6459 (match_operand:SI 2 "gpc_reg_operand" "r"))
6460 (clobber (match_scratch:SI 3 "X"))])]
6461 "TARGET_STRING && !TARGET_POWER"
6462 "{stsi|stswi} %2,%1,%O0"
6463 [(set_attr "type" "store")])
6466 ;; String/block move insn.
6467 ;; Argument 0 is the destination
6468 ;; Argument 1 is the source
6469 ;; Argument 2 is the length
6470 ;; Argument 3 is the alignment
6472 (define_expand "movstrsi"
6473 [(parallel [(set (match_operand:BLK 0 "" "")
6474 (match_operand:BLK 1 "" ""))
6475 (use (match_operand:SI 2 "" ""))
6476 (use (match_operand:SI 3 "" ""))])]
6480 if (expand_block_move (operands))
6486 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
6487 ;; register allocator doesn't have a clue about allocating 8 word registers
6488 (define_expand "movstrsi_8reg"
6489 [(parallel [(set (match_operand 0 "" "")
6490 (match_operand 1 "" ""))
6491 (use (match_operand 2 "" ""))
6492 (use (match_operand 3 "" ""))
6493 (clobber (reg:SI 5))
6494 (clobber (reg:SI 6))
6495 (clobber (reg:SI 7))
6496 (clobber (reg:SI 8))
6497 (clobber (reg:SI 9))
6498 (clobber (reg:SI 10))
6499 (clobber (reg:SI 11))
6500 (clobber (reg:SI 12))
6501 (clobber (match_scratch:SI 4 ""))])]
6506 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6507 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6508 (use (match_operand:SI 2 "immediate_operand" "i"))
6509 (use (match_operand:SI 3 "immediate_operand" "i"))
6510 (clobber (match_operand:SI 4 "register_operand" "=r"))
6511 (clobber (reg:SI 6))
6512 (clobber (reg:SI 7))
6513 (clobber (reg:SI 8))
6514 (clobber (reg:SI 9))
6515 (clobber (reg:SI 10))
6516 (clobber (reg:SI 11))
6517 (clobber (reg:SI 12))
6518 (clobber (match_scratch:SI 5 "=q"))]
6519 "TARGET_STRING && TARGET_POWER
6520 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
6521 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
6522 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
6523 && REGNO (operands[4]) == 5"
6524 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6525 [(set_attr "type" "load")
6526 (set_attr "length" "8")])
6529 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6530 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6531 (use (match_operand:SI 2 "immediate_operand" "i"))
6532 (use (match_operand:SI 3 "immediate_operand" "i"))
6533 (clobber (match_operand:SI 4 "register_operand" "=r"))
6534 (clobber (reg:SI 6))
6535 (clobber (reg:SI 7))
6536 (clobber (reg:SI 8))
6537 (clobber (reg:SI 9))
6538 (clobber (reg:SI 10))
6539 (clobber (reg:SI 11))
6540 (clobber (reg:SI 12))
6541 (clobber (match_scratch:SI 5 "X"))]
6542 "TARGET_STRING && !TARGET_POWER
6543 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
6544 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
6545 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
6546 && REGNO (operands[4]) == 5"
6547 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6548 [(set_attr "type" "load")
6549 (set_attr "length" "8")])
6551 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
6552 ;; register allocator doesn't have a clue about allocating 6 word registers
6553 (define_expand "movstrsi_6reg"
6554 [(parallel [(set (match_operand 0 "" "")
6555 (match_operand 1 "" ""))
6556 (use (match_operand 2 "" ""))
6557 (use (match_operand 3 "" ""))
6558 (clobber (reg:SI 7))
6559 (clobber (reg:SI 8))
6560 (clobber (reg:SI 9))
6561 (clobber (reg:SI 10))
6562 (clobber (reg:SI 11))
6563 (clobber (reg:SI 12))
6564 (clobber (match_scratch:SI 4 ""))])]
6569 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6570 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6571 (use (match_operand:SI 2 "immediate_operand" "i"))
6572 (use (match_operand:SI 3 "immediate_operand" "i"))
6573 (clobber (match_operand:SI 4 "register_operand" "=r"))
6574 (clobber (reg:SI 8))
6575 (clobber (reg:SI 9))
6576 (clobber (reg:SI 10))
6577 (clobber (reg:SI 11))
6578 (clobber (reg:SI 12))
6579 (clobber (match_scratch:SI 5 "=q"))]
6580 "TARGET_STRING && TARGET_POWER
6581 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
6582 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
6583 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
6584 && REGNO (operands[4]) == 7"
6585 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6586 [(set_attr "type" "load")
6587 (set_attr "length" "8")])
6590 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6591 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6592 (use (match_operand:SI 2 "immediate_operand" "i"))
6593 (use (match_operand:SI 3 "immediate_operand" "i"))
6594 (clobber (match_operand:SI 4 "register_operand" "=r"))
6595 (clobber (reg:SI 8))
6596 (clobber (reg:SI 9))
6597 (clobber (reg:SI 10))
6598 (clobber (reg:SI 11))
6599 (clobber (reg:SI 12))
6600 (clobber (match_scratch:SI 5 "X"))]
6601 "TARGET_STRING && !TARGET_POWER
6602 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
6603 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
6604 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
6605 && REGNO (operands[4]) == 7"
6606 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6607 [(set_attr "type" "load")
6608 (set_attr "length" "8")])
6610 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
6612 (define_expand "movstrsi_4reg"
6613 [(parallel [(set (match_operand 0 "" "")
6614 (match_operand 1 "" ""))
6615 (use (match_operand 2 "" ""))
6616 (use (match_operand 3 "" ""))
6617 (clobber (reg:SI 9))
6618 (clobber (reg:SI 10))
6619 (clobber (reg:SI 11))
6620 (clobber (reg:SI 12))
6621 (clobber (match_scratch:SI 4 ""))])]
6626 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6627 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6628 (use (match_operand:SI 2 "immediate_operand" "i"))
6629 (use (match_operand:SI 3 "immediate_operand" "i"))
6630 (clobber (match_operand:SI 4 "register_operand" "=r"))
6631 (clobber (reg:SI 10))
6632 (clobber (reg:SI 11))
6633 (clobber (reg:SI 12))
6634 (clobber (match_scratch:SI 5 "=q"))]
6635 "TARGET_STRING && TARGET_POWER
6636 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
6637 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
6638 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
6639 && REGNO (operands[4]) == 9"
6640 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6641 [(set_attr "type" "load")
6642 (set_attr "length" "8")])
6645 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6646 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6647 (use (match_operand:SI 2 "immediate_operand" "i"))
6648 (use (match_operand:SI 3 "immediate_operand" "i"))
6649 (clobber (match_operand:SI 4 "register_operand" "=r"))
6650 (clobber (reg:SI 10))
6651 (clobber (reg:SI 11))
6652 (clobber (reg:SI 12))
6653 (clobber (match_scratch:SI 5 "X"))]
6654 "TARGET_STRING && !TARGET_POWER
6655 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
6656 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
6657 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
6658 && REGNO (operands[4]) == 9"
6659 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6660 [(set_attr "type" "load")
6661 (set_attr "length" "8")])
6663 ;; Move up to 8 bytes at a time.
6664 (define_expand "movstrsi_2reg"
6665 [(parallel [(set (match_operand 0 "" "")
6666 (match_operand 1 "" ""))
6667 (use (match_operand 2 "" ""))
6668 (use (match_operand 3 "" ""))
6669 (clobber (match_scratch:DI 4 ""))
6670 (clobber (match_scratch:SI 5 ""))])]
6671 "TARGET_STRING && !TARGET_64BIT"
6675 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6676 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6677 (use (match_operand:SI 2 "immediate_operand" "i"))
6678 (use (match_operand:SI 3 "immediate_operand" "i"))
6679 (clobber (match_scratch:DI 4 "=&r"))
6680 (clobber (match_scratch:SI 5 "=q"))]
6681 "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
6682 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
6683 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6684 [(set_attr "type" "load")
6685 (set_attr "length" "8")])
6688 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6689 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6690 (use (match_operand:SI 2 "immediate_operand" "i"))
6691 (use (match_operand:SI 3 "immediate_operand" "i"))
6692 (clobber (match_scratch:DI 4 "=&r"))
6693 (clobber (match_scratch:SI 5 "X"))]
6694 "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
6695 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
6696 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6697 [(set_attr "type" "load")
6698 (set_attr "length" "8")])
6700 ;; Move up to 4 bytes at a time.
6701 (define_expand "movstrsi_1reg"
6702 [(parallel [(set (match_operand 0 "" "")
6703 (match_operand 1 "" ""))
6704 (use (match_operand 2 "" ""))
6705 (use (match_operand 3 "" ""))
6706 (clobber (match_scratch:SI 4 ""))
6707 (clobber (match_scratch:SI 5 ""))])]
6712 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6713 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6714 (use (match_operand:SI 2 "immediate_operand" "i"))
6715 (use (match_operand:SI 3 "immediate_operand" "i"))
6716 (clobber (match_scratch:SI 4 "=&r"))
6717 (clobber (match_scratch:SI 5 "=q"))]
6718 "TARGET_STRING && TARGET_POWER
6719 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
6720 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6721 [(set_attr "type" "load")
6722 (set_attr "length" "8")])
6725 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6726 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6727 (use (match_operand:SI 2 "immediate_operand" "i"))
6728 (use (match_operand:SI 3 "immediate_operand" "i"))
6729 (clobber (match_scratch:SI 4 "=&r"))
6730 (clobber (match_scratch:SI 5 "X"))]
6731 "TARGET_STRING && !TARGET_POWER
6732 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
6733 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6734 [(set_attr "type" "load")
6735 (set_attr "length" "8")])
6738 ;; Define insns that do load or store with update. Some of these we can
6739 ;; get by using pre-decrement or pre-increment, but the hardware can also
6740 ;; do cases where the increment is not the size of the object.
6742 ;; In all these cases, we use operands 0 and 1 for the register being
6743 ;; incremented because those are the operands that local-alloc will
6744 ;; tie and these are the pair most likely to be tieable (and the ones
6745 ;; that will benefit the most).
6747 (define_insn "*movdi_update1"
6748 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
6749 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
6750 (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
6751 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
6752 (plus:DI (match_dup 1) (match_dup 2)))]
6753 "TARGET_POWERPC64 && TARGET_UPDATE"
6757 [(set_attr "type" "load")])
6759 (define_insn "*movdi_update2"
6760 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
6762 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
6763 (match_operand:DI 2 "gpc_reg_operand" "r")))))
6764 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
6765 (plus:DI (match_dup 1) (match_dup 2)))]
6768 [(set_attr "type" "load")])
6770 (define_insn "movdi_update"
6771 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
6772 (match_operand:DI 2 "reg_or_short_operand" "r,I")))
6773 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
6774 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
6775 (plus:DI (match_dup 1) (match_dup 2)))]
6776 "TARGET_POWERPC64 && TARGET_UPDATE"
6780 [(set_attr "type" "store")])
6782 (define_insn "*movsi_update1"
6783 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6784 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6785 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6786 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6787 (plus:SI (match_dup 1) (match_dup 2)))]
6790 {lux|lwzux} %3,%0,%2
6791 {lu|lwzu} %3,%2(%0)"
6792 [(set_attr "type" "load")])
6794 (define_insn "movsi_update"
6795 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6796 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6797 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6798 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6799 (plus:SI (match_dup 1) (match_dup 2)))]
6802 {stux|stwux} %3,%0,%2
6803 {stu|stwu} %3,%2(%0)"
6804 [(set_attr "type" "store")])
6806 (define_insn "*movhi_update"
6807 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
6808 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6809 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6810 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6811 (plus:SI (match_dup 1) (match_dup 2)))]
6816 [(set_attr "type" "load")])
6818 (define_insn "*movhi_update2"
6819 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6821 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6822 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6823 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6824 (plus:SI (match_dup 1) (match_dup 2)))]
6829 [(set_attr "type" "load")])
6831 (define_insn "*movhi_update3"
6832 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6834 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6835 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6836 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6837 (plus:SI (match_dup 1) (match_dup 2)))]
6842 [(set_attr "type" "load")])
6844 (define_insn "*movhi_update4"
6845 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6846 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6847 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
6848 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6849 (plus:SI (match_dup 1) (match_dup 2)))]
6854 [(set_attr "type" "store")])
6856 (define_insn "*movqi_update1"
6857 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
6858 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6859 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6860 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6861 (plus:SI (match_dup 1) (match_dup 2)))]
6866 [(set_attr "type" "load")])
6868 (define_insn "*movqi_update2"
6869 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6871 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6872 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6873 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6874 (plus:SI (match_dup 1) (match_dup 2)))]
6879 [(set_attr "type" "load")])
6881 (define_insn "*movqi_update3"
6882 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6883 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6884 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
6885 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6886 (plus:SI (match_dup 1) (match_dup 2)))]
6891 [(set_attr "type" "store")])
6893 (define_insn "*movsf_update1"
6894 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
6895 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6896 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6897 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6898 (plus:SI (match_dup 1) (match_dup 2)))]
6899 "TARGET_HARD_FLOAT && TARGET_UPDATE"
6903 [(set_attr "type" "fpload")])
6905 (define_insn "*movsf_update2"
6906 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6907 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6908 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
6909 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6910 (plus:SI (match_dup 1) (match_dup 2)))]
6911 "TARGET_HARD_FLOAT && TARGET_UPDATE"
6915 [(set_attr "type" "fpstore")])
6917 (define_insn "*movsf_update3"
6918 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
6919 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6920 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6921 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6922 (plus:SI (match_dup 1) (match_dup 2)))]
6923 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
6925 {lux|lwzux} %3,%0,%2
6926 {lu|lwzu} %3,%2(%0)"
6927 [(set_attr "type" "load")])
6929 (define_insn "*movsf_update4"
6930 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6931 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6932 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
6933 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6934 (plus:SI (match_dup 1) (match_dup 2)))]
6935 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
6937 {stux|stwux} %3,%0,%2
6938 {stu|stwu} %3,%2(%0)"
6939 [(set_attr "type" "store")])
6941 (define_insn "*movdf_update1"
6942 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
6943 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6944 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6945 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6946 (plus:SI (match_dup 1) (match_dup 2)))]
6947 "TARGET_HARD_FLOAT && TARGET_UPDATE"
6951 [(set_attr "type" "fpload")])
6953 (define_insn "*movdf_update2"
6954 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6955 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6956 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
6957 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6958 (plus:SI (match_dup 1) (match_dup 2)))]
6959 "TARGET_HARD_FLOAT && TARGET_UPDATE"
6963 [(set_attr "type" "fpstore")])
6965 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
6968 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
6969 (match_operand:DF 1 "memory_operand" ""))
6970 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
6971 (match_operand:DF 3 "memory_operand" ""))]
6973 && TARGET_HARD_FLOAT
6974 && registers_ok_for_quad_peep (operands[0], operands[2])
6975 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
6976 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
6980 [(set (match_operand:DF 0 "memory_operand" "")
6981 (match_operand:DF 1 "gpc_reg_operand" "f"))
6982 (set (match_operand:DF 2 "memory_operand" "")
6983 (match_operand:DF 3 "gpc_reg_operand" "f"))]
6985 && TARGET_HARD_FLOAT
6986 && registers_ok_for_quad_peep (operands[1], operands[3])
6987 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
6988 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
6991 ;; Next come insns related to the calling sequence.
6993 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
6994 ;; We move the back-chain and decrement the stack pointer.
6996 (define_expand "allocate_stack"
6998 (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
7001 { rtx chain = gen_reg_rtx (Pmode);
7002 rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
7005 emit_move_insn (chain, stack_bot);
7007 /* Under Windows NT, we need to add stack probes for large/variable allocations,
7008 so do it via a call to the external function alloca, instead of doing it
7010 if (DEFAULT_ABI == ABI_NT
7011 && (GET_CODE (operands[0]) != CONST_INT || INTVAL (operands[0]) > 4096))
7013 rtx tmp = gen_reg_rtx (SImode);
7014 emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"__allocate_stack\"),
7015 tmp, 0, SImode, 1, operands[0], Pmode);
7016 emit_insn (gen_set_sp (tmp));
7020 if (GET_CODE (operands[0]) != CONST_INT
7021 || INTVAL (operands[0]) < -32767
7022 || INTVAL (operands[0]) > 32768)
7024 neg_op0 = gen_reg_rtx (Pmode);
7026 emit_insn (gen_negsi2 (neg_op0, operands[0]));
7028 emit_insn (gen_negdi2 (neg_op0, operands[0]));
7031 neg_op0 = GEN_INT (- INTVAL (operands[0]));
7034 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
7035 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
7039 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
7040 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
7041 emit_move_insn (gen_rtx (MEM, (TARGET_32BIT) ? SImode : DImode,
7048 ;; Marker to indicate that the stack pointer was changed under NT in
7049 ;; ways not known to the compiler
7051 (define_insn "set_sp"
7053 (unspec [(match_operand:SI 0 "register_operand" "r")] 7))]
7056 [(set_attr "length" "0")])
7058 ;; These patterns say how to save and restore the stack pointer. We need not
7059 ;; save the stack pointer at function level since we are careful to
7060 ;; preserve the backchain. At block level, we have to restore the backchain
7061 ;; when we restore the stack pointer.
7063 ;; For nonlocal gotos, we must save both the stack pointer and its
7064 ;; backchain and restore both. Note that in the nonlocal case, the
7065 ;; save area is a memory location.
7067 (define_expand "save_stack_function"
7068 [(use (const_int 0))]
7072 (define_expand "restore_stack_function"
7073 [(use (const_int 0))]
7077 (define_expand "restore_stack_block"
7078 [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
7079 (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
7080 (set (mem:SI (match_dup 0)) (match_dup 2))]
7083 { operands[2] = gen_reg_rtx (SImode); }")
7085 (define_expand "save_stack_nonlocal"
7086 [(match_operand:DI 0 "memory_operand" "")
7087 (match_operand:SI 1 "register_operand" "")]
7091 rtx temp = gen_reg_rtx (SImode);
7093 /* Copy the backchain to the first word, sp to the second. */
7094 emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
7095 emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
7096 emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
7100 (define_expand "restore_stack_nonlocal"
7101 [(match_operand:SI 0 "register_operand" "")
7102 (match_operand:DI 1 "memory_operand" "")]
7106 rtx temp = gen_reg_rtx (SImode);
7108 /* Restore the backchain from the first word, sp from the second. */
7109 emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
7110 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
7111 emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
7115 ;; If we have -mmiminal-toc, we need to reload r30 after a nonlocal goto.
7117 (define_insn "nonlocal_goto_receiver"
7118 [(unspec_volatile [(const_int 0)] 1)]
7119 "TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0"
7122 rs6000_output_load_toc_table (asm_out_file, 30);
7125 [(set_attr "type" "load")])
7127 ;; A function pointer under AIX is a pointer to a data area whose first word
7128 ;; contains the actual address of the function, whose second word contains a
7129 ;; pointer to its TOC, and whose third word contains a value to place in the
7130 ;; static chain register (r11). Note that if we load the static chain, our
7131 ;; "trampoline" need not have any executable code.
7133 ;; operands[0] is a register pointing to the 3 word descriptor (aka, the function address)
7134 ;; operands[1] is the stack size to clean up
7135 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for AIX)
7136 ;; operands[3] is location to store the TOC
7137 ;; operands[4] is the TOC register
7138 ;; operands[5] is the static chain register
7140 ;; We do not break this into separate insns, so that the scheduler will not try
7141 ;; to move the load of the new TOC before any loads from the TOC.
7143 (define_insn "call_indirect_aix"
7144 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
7145 (match_operand 1 "const_int_operand" "n"))
7146 (use (match_operand 2 "const_int_operand" "n"))
7147 (use (match_operand 3 "offsettable_addr_operand" "p"))
7148 (use (match_operand 4 "register_operand" "r"))
7149 (clobber (match_operand 5 "register_operand" "=r"))
7150 (clobber (match_scratch:SI 6 "=&r"))
7151 (clobber (match_scratch:SI 7 "=l"))]
7152 "DEFAULT_ABI == ABI_AIX
7153 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
7154 "{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"
7155 [(set_attr "type" "load")
7156 (set_attr "length" "28")])
7158 (define_insn "call_value_indirect_aix"
7159 [(set (match_operand 0 "register_operand" "fg")
7160 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
7161 (match_operand 2 "const_int_operand" "n")))
7162 (use (match_operand 3 "const_int_operand" "n"))
7163 (use (match_operand 4 "offsettable_addr_operand" "p"))
7164 (use (match_operand 5 "register_operand" "r"))
7165 (clobber (match_operand 6 "register_operand" "=r"))
7166 (clobber (match_scratch:SI 7 "=&r"))
7167 (clobber (match_scratch:SI 8 "=l"))]
7168 "DEFAULT_ABI == ABI_AIX
7169 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
7170 "{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"
7171 [(set_attr "type" "load")
7172 (set_attr "length" "28")])
7174 ;; A function pointer undef NT is a pointer to a data area whose first word
7175 ;; contains the actual address of the function, whose second word contains a
7176 ;; pointer to its TOC. The static chain is not stored under NT, which means
7177 ;; that we need a trampoline.
7179 ;; operands[0] is an SImode pseudo in which we place the address of the function.
7180 ;; operands[1] is the stack size to clean up
7181 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for NT)
7182 ;; operands[3] is location to store the TOC
7183 ;; operands[4] is the TOC register
7185 ;; We do not break this into separate insns, so that the scheduler will not try
7186 ;; to move the load of the new TOC before any loads from the TOC.
7188 (define_insn "call_indirect_nt"
7189 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
7190 (match_operand 1 "const_int_operand" "n"))
7191 (use (match_operand 2 "const_int_operand" "n"))
7192 (use (match_operand 3 "offsettable_addr_operand" "p"))
7193 (use (match_operand 4 "register_operand" "r"))
7194 (clobber (match_scratch:SI 5 "=&r"))
7195 (clobber (match_scratch:SI 6 "=l"))]
7196 "DEFAULT_ABI == ABI_NT
7197 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
7198 "{st|stw} %4,%a3\;{l|lwz} %5,0(%0)\;{l|lwz} %4,4(%0)\;mt%6 %5\;{brl|blrl}\;{l|lwz} %4,%a3"
7199 [(set_attr "type" "load")
7200 (set_attr "length" "24")])
7202 (define_insn "call_value_indirect_nt"
7203 [(set (match_operand 0 "register_operand" "fg")
7204 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
7205 (match_operand 2 "const_int_operand" "n")))
7206 (use (match_operand 3 "const_int_operand" "n"))
7207 (use (match_operand 4 "offsettable_addr_operand" "p"))
7208 (use (match_operand 5 "register_operand" "r"))
7209 (clobber (match_scratch:SI 6 "=&r"))
7210 (clobber (match_scratch:SI 7 "=l"))]
7211 "DEFAULT_ABI == ABI_NT
7212 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
7213 "{st|stw} %5,%a4\;{l|lwz} %6,0(%1)\;{l|lwz} %5,4(%1)\;mt%7 %6\;{brl|blrl}\;{l|lwz} %5,%a4"
7214 [(set_attr "type" "load")
7215 (set_attr "length" "24")])
7217 ;; A function pointer under System V is just a normal pointer
7218 ;; operands[0] is the function pointer
7219 ;; operands[1] is the stack size to clean up
7220 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument which indicates how to set cr1
7222 (define_insn "call_indirect_sysv"
7223 [(call (mem:SI (match_operand:SI 0 "register_operand" "l,l"))
7224 (match_operand 1 "const_int_operand" "n,n"))
7225 (use (match_operand 2 "const_int_operand" "O,n"))
7226 (clobber (match_scratch:SI 3 "=l,l"))]
7227 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
7230 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7231 output_asm_insn (\"crxor 6,6,6\", operands);
7233 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7234 output_asm_insn (\"creqv 6,6,6\", operands);
7236 return \"{brl|blrl}\";
7238 [(set_attr "type" "jmpreg")
7239 (set_attr "length" "4,8")])
7241 (define_insn "call_value_indirect_sysv"
7242 [(set (match_operand 0 "register_operand" "=fg,fg")
7243 (call (mem:SI (match_operand:SI 1 "register_operand" "l,l"))
7244 (match_operand 2 "const_int_operand" "n,n")))
7245 (use (match_operand 3 "const_int_operand" "O,n"))
7246 (clobber (match_scratch:SI 4 "=l,l"))]
7247 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
7250 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7251 output_asm_insn (\"crxor 6,6,6\", operands);
7253 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7254 output_asm_insn (\"creqv 6,6,6\", operands);
7256 return \"{brl|blrl}\";
7258 [(set_attr "type" "jmpreg")
7259 (set_attr "length" "4,8")])
7261 ;; Now the definitions for the call and call_value insns
7262 (define_expand "call"
7263 [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
7264 (match_operand 1 "" ""))
7265 (use (match_operand 2 "" ""))
7266 (clobber (scratch:SI))])]
7270 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
7273 operands[0] = XEXP (operands[0], 0);
7275 /* Convert NT DLL imports into an indirect call. */
7276 if (GET_CODE (operands[0]) == SYMBOL_REF
7277 && (INTVAL (operands[2]) & CALL_NT_DLLIMPORT) != 0)
7279 operands[0] = rs6000_dll_import_ref (operands[0]);
7280 operands[2] = GEN_INT ((int)CALL_NORMAL);
7283 if (GET_CODE (operands[0]) != SYMBOL_REF
7284 || (INTVAL (operands[2]) & CALL_LONG) != 0)
7286 if (INTVAL (operands[2]) & CALL_LONG)
7287 operands[0] = rs6000_longcall_ref (operands[0]);
7289 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
7290 emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
7291 operands[1], operands[2]));
7294 rtx toc_reg = gen_rtx (REG, Pmode, 2);
7295 rtx toc_addr = RS6000_SAVE_TOC;
7297 if (DEFAULT_ABI == ABI_AIX)
7299 /* AIX function pointers are really pointers to a three word area */
7300 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
7301 emit_call_insn (gen_call_indirect_aix (force_reg (Pmode, operands[0]),
7302 operands[1], operands[2],
7303 toc_addr, toc_reg, static_chain));
7305 else if (DEFAULT_ABI == ABI_NT)
7307 /* NT function pointers are really pointers to a two word area */
7308 emit_call_insn (gen_call_indirect_nt (force_reg (Pmode, operands[0]),
7309 operands[1], operands[2],
7310 toc_addr, toc_reg));
7319 (define_expand "call_value"
7320 [(parallel [(set (match_operand 0 "" "")
7321 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
7322 (match_operand 2 "" "")))
7323 (use (match_operand 3 "" ""))
7324 (clobber (scratch:SI))])]
7328 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
7331 operands[1] = XEXP (operands[1], 0);
7333 /* Convert NT DLL imports into an indirect call. */
7334 if (GET_CODE (operands[1]) == SYMBOL_REF
7335 && (INTVAL (operands[3]) & CALL_NT_DLLIMPORT) != 0)
7337 operands[1] = rs6000_dll_import_ref (operands[1]);
7338 operands[3] = GEN_INT ((int)CALL_NORMAL);
7341 if (GET_CODE (operands[1]) != SYMBOL_REF
7342 || (INTVAL (operands[3]) & CALL_LONG) != 0)
7344 if (INTVAL (operands[2]) & CALL_LONG)
7345 operands[1] = rs6000_longcall_ref (operands[1]);
7347 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
7348 emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
7349 operands[2], operands[3]));
7352 rtx toc_reg = gen_rtx (REG, Pmode, 2);
7353 rtx toc_addr = RS6000_SAVE_TOC;
7355 if (DEFAULT_ABI == ABI_AIX)
7357 /* AIX function pointers are really pointers to a three word area */
7358 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
7359 emit_call_insn (gen_call_value_indirect_aix (operands[0],
7360 force_reg (Pmode, operands[1]),
7361 operands[2], operands[3],
7362 toc_addr, toc_reg, static_chain));
7364 else if (DEFAULT_ABI == ABI_NT)
7366 /* NT function pointers are really pointers to a two word area */
7367 emit_call_insn (gen_call_value_indirect_nt (operands[0],
7368 force_reg (Pmode, operands[1]),
7369 operands[2], operands[3],
7370 toc_addr, toc_reg));
7379 ;; Call to function in current module. No TOC pointer reload needed.
7380 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
7381 ;; either the function was not prototyped, or it was prototyped as a
7382 ;; variable argument function. It is > 0 if FP registers were passed
7383 ;; and < 0 if they were not.
7386 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
7387 (match_operand 1 "" "g,g"))
7388 (use (match_operand:SI 2 "immediate_operand" "O,n"))
7389 (clobber (match_scratch:SI 3 "=l,l"))]
7390 "(INTVAL (operands[2]) & CALL_LONG) == 0"
7393 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7394 output_asm_insn (\"crxor 6,6,6\", operands);
7396 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7397 output_asm_insn (\"creqv 6,6,6\", operands);
7401 [(set_attr "type" "branch")
7402 (set_attr "length" "4,8")])
7404 ;; Call to function which may be in another module. Restore the TOC
7405 ;; pointer (r2) after the call unless this is System V.
7406 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
7407 ;; either the function was not prototyped, or it was prototyped as a
7408 ;; variable argument function. It is > 0 if FP registers were passed
7409 ;; and < 0 if they were not.
7412 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
7413 (match_operand 1 "" "fg,fg"))
7414 (use (match_operand:SI 2 "immediate_operand" "O,n"))
7415 (clobber (match_scratch:SI 3 "=l,l"))]
7416 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
7417 && (INTVAL (operands[2]) & CALL_LONG) == 0"
7420 /* Indirect calls should go through call_indirect */
7421 if (GET_CODE (operands[0]) == REG)
7424 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7425 output_asm_insn (\"crxor 6,6,6\", operands);
7427 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7428 output_asm_insn (\"creqv 6,6,6\", operands);
7430 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
7432 [(set_attr "type" "branch")
7433 (set_attr "length" "8,12")])
7436 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
7437 (match_operand 1 "" "fg,fg"))
7438 (use (match_operand:SI 2 "immediate_operand" "O,n"))
7439 (clobber (match_scratch:SI 3 "=l,l"))]
7440 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
7441 && (INTVAL (operands[2]) & CALL_LONG) == 0"
7444 /* Indirect calls should go through call_indirect */
7445 if (GET_CODE (operands[0]) == REG)
7448 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7449 output_asm_insn (\"crxor 6,6,6\", operands);
7451 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7452 output_asm_insn (\"creqv 6,6,6\", operands);
7454 return (flag_pic == 1) ? \"bl %z0@plt\" : \"bl %z0\";
7456 [(set_attr "type" "branch")
7457 (set_attr "length" "4,8")])
7460 [(set (match_operand 0 "" "=fg,fg")
7461 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
7462 (match_operand 2 "" "g,g")))
7463 (use (match_operand:SI 3 "immediate_operand" "O,n"))
7464 (clobber (match_scratch:SI 4 "=l,l"))]
7465 "(INTVAL (operands[3]) & CALL_LONG) == 0"
7468 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7469 output_asm_insn (\"crxor 6,6,6\", operands);
7471 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7472 output_asm_insn (\"creqv 6,6,6\", operands);
7476 [(set_attr "type" "branch")
7477 (set_attr "length" "4,8")])
7480 [(set (match_operand 0 "" "=fg,fg")
7481 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
7482 (match_operand 2 "" "fg,fg")))
7483 (use (match_operand:SI 3 "immediate_operand" "O,n"))
7484 (clobber (match_scratch:SI 4 "=l,l"))]
7485 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
7486 && (INTVAL (operands[3]) & CALL_LONG) == 0"
7489 /* This should be handled by call_value_indirect */
7490 if (GET_CODE (operands[1]) == REG)
7493 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7494 output_asm_insn (\"crxor 6,6,6\", operands);
7496 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7497 output_asm_insn (\"creqv 6,6,6\", operands);
7499 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
7501 [(set_attr "type" "branch")
7502 (set_attr "length" "8,12")])
7505 [(set (match_operand 0 "" "=fg,fg")
7506 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
7507 (match_operand 2 "" "fg,fg")))
7508 (use (match_operand:SI 3 "immediate_operand" "O,n"))
7509 (clobber (match_scratch:SI 4 "=l,l"))]
7510 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
7511 && (INTVAL (operands[3]) & CALL_LONG) == 0"
7514 /* This should be handled by call_value_indirect */
7515 if (GET_CODE (operands[1]) == REG)
7518 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7519 output_asm_insn (\"crxor 6,6,6\", operands);
7521 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7522 output_asm_insn (\"creqv 6,6,6\", operands);
7524 return (flag_pic == 1) ? \"bl %z1@plt\" : \"bl %z1\";
7526 [(set_attr "type" "branch")
7527 (set_attr "length" "4,8")])
7529 ;; Call subroutine returning any type.
7530 (define_expand "untyped_call"
7531 [(parallel [(call (match_operand 0 "" "")
7533 (match_operand 1 "" "")
7534 (match_operand 2 "" "")])]
7540 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
7542 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7544 rtx set = XVECEXP (operands[2], 0, i);
7545 emit_move_insn (SET_DEST (set), SET_SRC (set));
7548 /* The optimizer does not know that the call sets the function value
7549 registers we stored in the result block. We avoid problems by
7550 claiming that all hard registers are used and clobbered at this
7552 emit_insn (gen_blockage ());
7557 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7558 ;; all of memory. This blocks insns from being moved across this point.
7560 (define_insn "blockage"
7561 [(unspec_volatile [(const_int 0)] 0)]
7565 ;; V.4 specific code to initialize the PIC register
7567 (define_insn "init_v4_pic"
7568 [(set (match_operand:SI 0 "register_operand" "=l")
7569 (unspec [(const_int 0)] 7))]
7570 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS"
7571 "bl _GLOBAL_OFFSET_TABLE_@local-4"
7572 [(set_attr "type" "branch")
7573 (set_attr "length" "4")])
7576 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
7577 ;; signed & unsigned, and one type of branch.
7579 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
7580 ;; insns, and branches. We store the operands of compares until we see
7582 (define_expand "cmpsi"
7584 (compare (match_operand:SI 0 "gpc_reg_operand" "")
7585 (match_operand:SI 1 "reg_or_short_operand" "")))]
7589 /* Take care of the possibility that operands[1] might be negative but
7590 this might be a logical operation. That insn doesn't exist. */
7591 if (GET_CODE (operands[1]) == CONST_INT
7592 && INTVAL (operands[1]) < 0)
7593 operands[1] = force_reg (SImode, operands[1]);
7595 rs6000_compare_op0 = operands[0];
7596 rs6000_compare_op1 = operands[1];
7597 rs6000_compare_fp_p = 0;
7601 (define_expand "cmpdi"
7603 (compare (match_operand:DI 0 "gpc_reg_operand" "")
7604 (match_operand:DI 1 "reg_or_short_operand" "")))]
7608 /* Take care of the possibility that operands[1] might be negative but
7609 this might be a logical operation. That insn doesn't exist. */
7610 if (GET_CODE (operands[1]) == CONST_INT
7611 && INTVAL (operands[1]) < 0)
7612 operands[1] = force_reg (DImode, operands[1]);
7614 rs6000_compare_op0 = operands[0];
7615 rs6000_compare_op1 = operands[1];
7616 rs6000_compare_fp_p = 0;
7620 (define_expand "cmpsf"
7621 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
7622 (match_operand:SF 1 "gpc_reg_operand" "")))]
7626 rs6000_compare_op0 = operands[0];
7627 rs6000_compare_op1 = operands[1];
7628 rs6000_compare_fp_p = 1;
7632 (define_expand "cmpdf"
7633 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
7634 (match_operand:DF 1 "gpc_reg_operand" "")))]
7638 rs6000_compare_op0 = operands[0];
7639 rs6000_compare_op1 = operands[1];
7640 rs6000_compare_fp_p = 1;
7644 (define_expand "beq"
7645 [(set (match_dup 2) (match_dup 1))
7647 (if_then_else (eq (match_dup 2)
7649 (label_ref (match_operand 0 "" ""))
7653 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7654 operands[1] = gen_rtx (COMPARE, mode,
7655 rs6000_compare_op0, rs6000_compare_op1);
7656 operands[2] = gen_reg_rtx (mode);
7659 (define_expand "bne"
7660 [(set (match_dup 2) (match_dup 1))
7662 (if_then_else (ne (match_dup 2)
7664 (label_ref (match_operand 0 "" ""))
7668 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7669 operands[1] = gen_rtx (COMPARE, mode,
7670 rs6000_compare_op0, rs6000_compare_op1);
7671 operands[2] = gen_reg_rtx (mode);
7674 (define_expand "blt"
7675 [(set (match_dup 2) (match_dup 1))
7677 (if_then_else (lt (match_dup 2)
7679 (label_ref (match_operand 0 "" ""))
7683 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7684 operands[1] = gen_rtx (COMPARE, mode,
7685 rs6000_compare_op0, rs6000_compare_op1);
7686 operands[2] = gen_reg_rtx (mode);
7689 (define_expand "bgt"
7690 [(set (match_dup 2) (match_dup 1))
7692 (if_then_else (gt (match_dup 2)
7694 (label_ref (match_operand 0 "" ""))
7698 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7699 operands[1] = gen_rtx (COMPARE, mode,
7700 rs6000_compare_op0, rs6000_compare_op1);
7701 operands[2] = gen_reg_rtx (mode);
7704 (define_expand "ble"
7705 [(set (match_dup 2) (match_dup 1))
7707 (if_then_else (le (match_dup 2)
7709 (label_ref (match_operand 0 "" ""))
7713 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7714 operands[1] = gen_rtx (COMPARE, mode,
7715 rs6000_compare_op0, rs6000_compare_op1);
7716 operands[2] = gen_reg_rtx (mode);
7719 (define_expand "bge"
7720 [(set (match_dup 2) (match_dup 1))
7722 (if_then_else (ge (match_dup 2)
7724 (label_ref (match_operand 0 "" ""))
7728 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7729 operands[1] = gen_rtx (COMPARE, mode,
7730 rs6000_compare_op0, rs6000_compare_op1);
7731 operands[2] = gen_reg_rtx (mode);
7734 (define_expand "bgtu"
7735 [(set (match_dup 2) (match_dup 1))
7737 (if_then_else (gtu (match_dup 2)
7739 (label_ref (match_operand 0 "" ""))
7743 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7744 rs6000_compare_op0, rs6000_compare_op1);
7745 operands[2] = gen_reg_rtx (CCUNSmode);
7748 (define_expand "bltu"
7749 [(set (match_dup 2) (match_dup 1))
7751 (if_then_else (ltu (match_dup 2)
7753 (label_ref (match_operand 0 "" ""))
7757 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7758 rs6000_compare_op0, rs6000_compare_op1);
7759 operands[2] = gen_reg_rtx (CCUNSmode);
7762 (define_expand "bgeu"
7763 [(set (match_dup 2) (match_dup 1))
7765 (if_then_else (geu (match_dup 2)
7767 (label_ref (match_operand 0 "" ""))
7771 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7772 rs6000_compare_op0, rs6000_compare_op1);
7773 operands[2] = gen_reg_rtx (CCUNSmode);
7776 (define_expand "bleu"
7777 [(set (match_dup 2) (match_dup 1))
7779 (if_then_else (leu (match_dup 2)
7781 (label_ref (match_operand 0 "" ""))
7785 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7786 rs6000_compare_op0, rs6000_compare_op1);
7787 operands[2] = gen_reg_rtx (CCUNSmode);
7790 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
7791 ;; For SEQ, likewise, except that comparisons with zero should be done
7792 ;; with an scc insns. However, due to the order that combine see the
7793 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
7794 ;; the cases we don't want to handle.
7795 (define_expand "seq"
7796 [(set (match_dup 2) (match_dup 1))
7797 (set (match_operand:SI 0 "gpc_reg_operand" "")
7798 (eq:SI (match_dup 2) (const_int 0)))]
7801 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7802 operands[1] = gen_rtx (COMPARE, mode,
7803 rs6000_compare_op0, rs6000_compare_op1);
7804 operands[2] = gen_reg_rtx (mode);
7807 (define_expand "sne"
7808 [(set (match_dup 2) (match_dup 1))
7809 (set (match_operand:SI 0 "gpc_reg_operand" "")
7810 (ne:SI (match_dup 2) (const_int 0)))]
7813 { if (! rs6000_compare_fp_p)
7816 operands[1] = gen_rtx (COMPARE, CCFPmode,
7817 rs6000_compare_op0, rs6000_compare_op1);
7818 operands[2] = gen_reg_rtx (CCFPmode);
7821 ;; A > 0 is best done using the portable sequence, so fail in that case.
7822 (define_expand "sgt"
7823 [(set (match_dup 2) (match_dup 1))
7824 (set (match_operand:SI 0 "gpc_reg_operand" "")
7825 (gt:SI (match_dup 2) (const_int 0)))]
7828 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7830 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7833 operands[1] = gen_rtx (COMPARE, mode,
7834 rs6000_compare_op0, rs6000_compare_op1);
7835 operands[2] = gen_reg_rtx (mode);
7838 ;; A < 0 is best done in the portable way for A an integer.
7839 (define_expand "slt"
7840 [(set (match_dup 2) (match_dup 1))
7841 (set (match_operand:SI 0 "gpc_reg_operand" "")
7842 (lt:SI (match_dup 2) (const_int 0)))]
7845 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7847 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7850 operands[1] = gen_rtx (COMPARE, mode,
7851 rs6000_compare_op0, rs6000_compare_op1);
7852 operands[2] = gen_reg_rtx (mode);
7855 (define_expand "sge"
7856 [(set (match_dup 2) (match_dup 1))
7857 (set (match_operand:SI 0 "gpc_reg_operand" "")
7858 (ge:SI (match_dup 2) (const_int 0)))]
7861 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7862 operands[1] = gen_rtx (COMPARE, mode,
7863 rs6000_compare_op0, rs6000_compare_op1);
7864 operands[2] = gen_reg_rtx (mode);
7867 ;; A <= 0 is best done the portable way for A an integer.
7868 (define_expand "sle"
7869 [(set (match_dup 2) (match_dup 1))
7870 (set (match_operand:SI 0 "gpc_reg_operand" "")
7871 (le:SI (match_dup 2) (const_int 0)))]
7874 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7876 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7879 operands[1] = gen_rtx (COMPARE, mode,
7880 rs6000_compare_op0, rs6000_compare_op1);
7881 operands[2] = gen_reg_rtx (mode);
7884 (define_expand "sgtu"
7885 [(set (match_dup 2) (match_dup 1))
7886 (set (match_operand:SI 0 "gpc_reg_operand" "")
7887 (gtu:SI (match_dup 2) (const_int 0)))]
7890 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7891 rs6000_compare_op0, rs6000_compare_op1);
7892 operands[2] = gen_reg_rtx (CCUNSmode);
7895 (define_expand "sltu"
7896 [(set (match_dup 2) (match_dup 1))
7897 (set (match_operand:SI 0 "gpc_reg_operand" "")
7898 (ltu:SI (match_dup 2) (const_int 0)))]
7901 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7902 rs6000_compare_op0, rs6000_compare_op1);
7903 operands[2] = gen_reg_rtx (CCUNSmode);
7906 (define_expand "sgeu"
7907 [(set (match_dup 2) (match_dup 1))
7908 (set (match_operand:SI 0 "gpc_reg_operand" "")
7909 (geu:SI (match_dup 2) (const_int 0)))]
7912 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7913 rs6000_compare_op0, rs6000_compare_op1);
7914 operands[2] = gen_reg_rtx (CCUNSmode);
7917 (define_expand "sleu"
7918 [(set (match_dup 2) (match_dup 1))
7919 (set (match_operand:SI 0 "gpc_reg_operand" "")
7920 (leu:SI (match_dup 2) (const_int 0)))]
7923 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7924 rs6000_compare_op0, rs6000_compare_op1);
7925 operands[2] = gen_reg_rtx (CCUNSmode);
7928 ;; Here are the actual compare insns.
7930 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
7931 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
7932 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
7934 "{cmp%I2|cmpw%I2} %0,%1,%2"
7935 [(set_attr "type" "compare")])
7938 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
7939 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
7940 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
7943 [(set_attr "type" "compare")])
7945 ;; If we are comparing a register for equality with a large constant,
7946 ;; we can do this with an XOR followed by a compare. But we need a scratch
7947 ;; register for the result of the XOR.
7950 [(set (match_operand:CC 0 "cc_reg_operand" "")
7951 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7952 (match_operand:SI 2 "non_short_cint_operand" "")))
7953 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
7954 "find_single_use (operands[0], insn, 0)
7955 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
7956 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
7957 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
7958 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
7961 /* Get the constant we are comparing against, C, and see what it looks like
7962 sign-extended to 16 bits. Then see what constant could be XOR'ed
7963 with C to get the sign-extended value. */
7965 int c = INTVAL (operands[2]);
7966 int sextc = (c << 16) >> 16;
7967 int xorv = c ^ sextc;
7969 operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
7970 operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
7974 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
7975 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
7976 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
7978 "{cmpl%I2|cmplw%I2} %0,%1,%W2"
7979 [(set_attr "type" "compare")])
7982 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
7983 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
7984 (match_operand:DI 2 "reg_or_u_short_operand" "rI")))]
7986 "cmpld%I2 %0,%1,%W2"
7987 [(set_attr "type" "compare")])
7989 ;; The following two insns don't exist as single insns, but if we provide
7990 ;; them, we can swap an add and compare, which will enable us to overlap more
7991 ;; of the required delay between a compare and branch. We generate code for
7992 ;; them by splitting.
7995 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
7996 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
7997 (match_operand:SI 2 "short_cint_operand" "i")))
7998 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
7999 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
8002 [(set_attr "length" "8")])
8005 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
8006 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
8007 (match_operand:SI 2 "u_short_cint_operand" "i")))
8008 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8009 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
8012 [(set_attr "length" "8")])
8015 [(set (match_operand:CC 3 "cc_reg_operand" "")
8016 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8017 (match_operand:SI 2 "short_cint_operand" "")))
8018 (set (match_operand:SI 0 "gpc_reg_operand" "")
8019 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
8021 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
8022 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
8025 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
8026 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
8027 (match_operand:SI 2 "u_short_cint_operand" "")))
8028 (set (match_operand:SI 0 "gpc_reg_operand" "")
8029 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
8031 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
8032 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
8035 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
8036 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
8037 (match_operand:SF 2 "gpc_reg_operand" "f")))]
8040 [(set_attr "type" "fpcompare")])
8043 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
8044 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
8045 (match_operand:DF 2 "gpc_reg_operand" "f")))]
8048 [(set_attr "type" "fpcompare")])
8050 ;; Now we have the scc insns. We can do some combinations because of the
8051 ;; way the machine works.
8053 ;; Note that this is probably faster if we can put an insn between the
8054 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
8055 ;; cases the insns below which don't use an intermediate CR field will
8058 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8059 (match_operator:SI 1 "scc_comparison_operator"
8060 [(match_operand 2 "cc_reg_operand" "y")
8063 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
8064 [(set_attr "length" "12")])
8067 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8068 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
8069 [(match_operand 2 "cc_reg_operand" "y")
8072 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
8073 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
8075 "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
8076 [(set_attr "type" "delayed_compare")
8077 (set_attr "length" "12")])
8080 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8081 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
8082 [(match_operand 2 "cc_reg_operand" "y")
8084 (match_operand:SI 3 "const_int_operand" "n")))]
8088 int is_bit = ccr_bit (operands[1], 1);
8089 int put_bit = 31 - (INTVAL (operands[3]) & 31);
8092 if (is_bit >= put_bit)
8093 count = is_bit - put_bit;
8095 count = 32 - (put_bit - is_bit);
8097 operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
8098 operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
8100 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
8102 [(set_attr "length" "12")])
8105 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8107 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
8108 [(match_operand 2 "cc_reg_operand" "y")
8110 (match_operand:SI 3 "const_int_operand" "n"))
8112 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
8113 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
8118 int is_bit = ccr_bit (operands[1], 1);
8119 int put_bit = 31 - (INTVAL (operands[3]) & 31);
8122 if (is_bit >= put_bit)
8123 count = is_bit - put_bit;
8125 count = 32 - (put_bit - is_bit);
8127 operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
8128 operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
8130 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
8132 [(set_attr "type" "delayed_compare")
8133 (set_attr "length" "12")])
8135 ;; If we are comparing the result of two comparisons, this can be done
8136 ;; using creqv or crxor.
8139 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
8140 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
8141 [(match_operand 2 "cc_reg_operand" "y")
8143 (match_operator 3 "scc_comparison_operator"
8144 [(match_operand 4 "cc_reg_operand" "y")
8146 "REGNO (operands[2]) != REGNO (operands[4])"
8149 enum rtx_code code1, code2;
8151 code1 = GET_CODE (operands[1]);
8152 code2 = GET_CODE (operands[3]);
8154 if ((code1 == EQ || code1 == LT || code1 == GT
8155 || code1 == LTU || code1 == GTU
8156 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
8158 (code2 == EQ || code2 == LT || code2 == GT
8159 || code2 == LTU || code2 == GTU
8160 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
8161 return \"%C1%C3crxor %E0,%j1,%j3\";
8163 return \"%C1%C3creqv %E0,%j1,%j3\";
8165 [(set_attr "length" "12")])
8167 ;; There is a 3 cycle delay between consecutive mfcr instructions
8168 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
8171 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8172 (match_operator:SI 1 "scc_comparison_operator"
8173 [(match_operand 2 "cc_reg_operand" "y")
8175 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
8176 (match_operator:SI 4 "scc_comparison_operator"
8177 [(match_operand 5 "cc_reg_operand" "y")
8179 "REGNO (operands[2]) != REGNO (operands[5])"
8180 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
8181 [(set_attr "length" "20")])
8183 ;; There are some scc insns that can be done directly, without a compare.
8184 ;; These are faster because they don't involve the communications between
8185 ;; the FXU and branch units. In fact, we will be replacing all of the
8186 ;; integer scc insns here or in the portable methods in emit_store_flag.
8188 ;; Also support (neg (scc ..)) since that construct is used to replace
8189 ;; branches, (plus (scc ..) ..) since that construct is common and
8190 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
8191 ;; cases where it is no more expensive than (neg (scc ..)).
8193 ;; Have reload force a constant into a register for the simple insns that
8194 ;; otherwise won't accept constants. We do this because it is faster than
8195 ;; the cmp/mfcr sequence we would otherwise generate.
8198 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8199 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8200 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
8201 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
8204 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8205 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
8206 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8207 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8208 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
8209 [(set_attr "length" "12,8,12,12,12")])
8212 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
8214 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8215 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8217 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8218 (eq:SI (match_dup 1) (match_dup 2)))
8219 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
8222 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
8223 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
8224 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
8225 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
8226 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
8227 [(set_attr "type" "compare")
8228 (set_attr "length" "12,8,12,12,12")])
8230 ;; We have insns of the form shown by the first define_insn below. If
8231 ;; there is something inside the comparison operation, we must split it.
8233 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8234 (plus:SI (match_operator 1 "comparison_operator"
8235 [(match_operand:SI 2 "" "")
8237 "reg_or_cint_operand" "")])
8238 (match_operand:SI 4 "gpc_reg_operand" "")))
8239 (clobber (match_operand:SI 5 "register_operand" ""))]
8240 "! gpc_reg_operand (operands[2], SImode)"
8241 [(set (match_dup 5) (match_dup 2))
8242 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
8246 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8247 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8248 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8249 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
8250 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
8253 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8254 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
8255 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8256 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8257 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
8258 [(set_attr "length" "12,8,12,12,12")])
8261 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
8264 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8265 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8266 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
8268 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
8271 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8272 {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
8273 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8274 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8275 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
8276 [(set_attr "type" "compare")
8277 (set_attr "length" "12,8,12,12,12")])
8280 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
8283 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8284 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8285 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
8287 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8288 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8289 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
8292 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8293 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
8294 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8295 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8296 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
8297 [(set_attr "type" "compare")
8298 (set_attr "length" "12,8,12,12,12")])
8301 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8302 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8303 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
8306 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8307 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
8308 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8309 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8310 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
8311 [(set_attr "length" "12,8,12,12,12")])
8313 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
8314 ;; since it nabs/sr is just as fast.
8316 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8317 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8319 (clobber (match_scratch:SI 2 "=&r"))]
8321 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
8322 [(set_attr "length" "8")])
8324 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
8326 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8327 (plus:SI (lshiftrt:SI
8328 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8330 (match_operand:SI 2 "gpc_reg_operand" "r")))
8331 (clobber (match_scratch:SI 3 "=&r"))]
8333 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
8334 [(set_attr "length" "8")])
8337 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8339 (plus:SI (lshiftrt:SI
8340 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8342 (match_operand:SI 2 "gpc_reg_operand" "r"))
8344 (clobber (match_scratch:SI 3 "=&r"))]
8346 "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
8347 [(set_attr "type" "compare")
8348 (set_attr "length" "8")])
8351 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8353 (plus:SI (lshiftrt:SI
8354 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8356 (match_operand:SI 2 "gpc_reg_operand" "r"))
8358 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8359 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
8361 (clobber (match_scratch:SI 3 "=&r"))]
8363 "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
8364 [(set_attr "type" "compare")
8365 (set_attr "length" "8")])
8368 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8369 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8370 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
8371 (clobber (match_scratch:SI 3 "=r,X"))]
8374 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
8375 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
8376 [(set_attr "length" "12")])
8379 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
8381 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8382 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8384 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8385 (le:SI (match_dup 1) (match_dup 2)))
8386 (clobber (match_scratch:SI 3 "=r,X"))]
8389 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
8390 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
8391 [(set_attr "type" "compare,delayed_compare")
8392 (set_attr "length" "12")])
8395 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8396 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8397 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8398 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8399 (clobber (match_scratch:SI 4 "=&r,&r"))]
8402 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8403 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
8404 [(set_attr "length" "12")])
8407 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8409 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8410 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8411 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8413 (clobber (match_scratch:SI 4 "=&r,&r"))]
8416 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8417 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
8418 [(set_attr "type" "compare")
8419 (set_attr "length" "12")])
8422 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8424 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8425 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8426 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8428 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8429 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8430 (clobber (match_scratch:SI 4 "=&r,&r"))]
8433 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8434 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
8435 [(set_attr "type" "compare")
8436 (set_attr "length" "12")])
8439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8440 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8441 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
8444 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8445 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
8446 [(set_attr "length" "12")])
8449 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8450 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8451 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8453 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
8454 [(set_attr "length" "12")])
8457 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8459 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8460 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8462 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8463 (leu:SI (match_dup 1) (match_dup 2)))]
8465 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
8466 [(set_attr "type" "compare")
8467 (set_attr "length" "12")])
8470 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8471 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8472 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8473 (match_operand:SI 3 "gpc_reg_operand" "r")))
8474 (clobber (match_scratch:SI 4 "=&r"))]
8476 "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
8477 [(set_attr "length" "8")])
8480 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8482 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8483 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8484 (match_operand:SI 3 "gpc_reg_operand" "r"))
8486 (clobber (match_scratch:SI 4 "=&r"))]
8488 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
8489 [(set_attr "type" "compare")
8490 (set_attr "length" "8")])
8493 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8495 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8496 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8497 (match_operand:SI 3 "gpc_reg_operand" "r"))
8499 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8500 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8501 (clobber (match_scratch:SI 4 "=&r"))]
8503 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
8504 [(set_attr "type" "compare")
8505 (set_attr "length" "8")])
8508 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8509 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8510 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8512 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
8513 [(set_attr "length" "12")])
8516 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8518 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8519 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8520 (match_operand:SI 3 "gpc_reg_operand" "r")))
8521 (clobber (match_scratch:SI 4 "=&r"))]
8523 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
8524 [(set_attr "length" "12")])
8527 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8530 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8531 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8532 (match_operand:SI 3 "gpc_reg_operand" "r"))
8534 (clobber (match_scratch:SI 4 "=&r"))]
8536 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
8537 [(set_attr "type" "compare")
8538 (set_attr "length" "12")])
8541 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8544 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8545 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8546 (match_operand:SI 3 "gpc_reg_operand" "r"))
8548 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8549 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
8550 (clobber (match_scratch:SI 4 "=&r"))]
8552 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
8553 [(set_attr "type" "compare")
8554 (set_attr "length" "12")])
8557 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8558 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8559 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8561 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
8562 [(set_attr "length" "12")])
8565 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8567 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8568 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8570 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8571 (lt:SI (match_dup 1) (match_dup 2)))]
8573 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
8574 [(set_attr "type" "delayed_compare")
8575 (set_attr "length" "12")])
8578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8579 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8580 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8581 (match_operand:SI 3 "gpc_reg_operand" "r")))
8582 (clobber (match_scratch:SI 4 "=&r"))]
8584 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
8585 [(set_attr "length" "12")])
8588 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8590 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8591 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8592 (match_operand:SI 3 "gpc_reg_operand" "r"))
8594 (clobber (match_scratch:SI 4 "=&r"))]
8596 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
8597 [(set_attr "type" "compare")
8598 (set_attr "length" "12")])
8601 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8603 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8604 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8605 (match_operand:SI 3 "gpc_reg_operand" "r"))
8607 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8608 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8609 (clobber (match_scratch:SI 4 "=&r"))]
8611 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
8612 [(set_attr "type" "compare")
8613 (set_attr "length" "12")])
8616 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8617 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8618 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8620 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
8621 [(set_attr "length" "12")])
8624 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8625 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8626 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
8629 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
8630 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
8631 [(set_attr "length" "12")])
8634 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
8636 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8637 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8639 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8640 (ltu:SI (match_dup 1) (match_dup 2)))]
8643 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
8644 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
8645 [(set_attr "type" "compare")
8646 (set_attr "length" "12")])
8649 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
8650 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
8651 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
8652 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
8653 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
8656 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8657 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8658 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8659 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
8660 [(set_attr "length" "12")])
8663 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8665 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8666 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8667 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8669 (clobber (match_scratch:SI 4 "=&r,&r"))]
8672 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
8673 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
8674 [(set_attr "type" "compare")
8675 (set_attr "length" "12")])
8678 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8680 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8681 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8682 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8684 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8685 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8686 (clobber (match_scratch:SI 4 "=&r,&r"))]
8689 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
8690 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
8691 [(set_attr "type" "compare")
8692 (set_attr "length" "12")])
8695 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8696 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8697 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
8700 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
8701 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
8702 [(set_attr "length" "8")])
8705 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8706 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8707 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8708 (clobber (match_scratch:SI 3 "=r"))]
8710 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
8711 [(set_attr "length" "12")])
8714 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8716 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8717 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8719 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8720 (ge:SI (match_dup 1) (match_dup 2)))
8721 (clobber (match_scratch:SI 3 "=r"))]
8723 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
8724 [(set_attr "type" "compare")
8725 (set_attr "length" "12")])
8728 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8729 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8730 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8731 (match_operand:SI 3 "gpc_reg_operand" "r")))
8732 (clobber (match_scratch:SI 4 "=&r"))]
8734 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
8735 [(set_attr "length" "12")])
8738 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8740 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8741 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8742 (match_operand:SI 3 "gpc_reg_operand" "r"))
8744 (clobber (match_scratch:SI 4 "=&r"))]
8746 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
8747 [(set_attr "type" "compare")
8748 (set_attr "length" "12")])
8751 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8753 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8754 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8755 (match_operand:SI 3 "gpc_reg_operand" "r"))
8757 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8758 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8759 (clobber (match_scratch:SI 4 "=&r"))]
8761 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
8762 [(set_attr "type" "compare")
8763 (set_attr "length" "12")])
8766 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8767 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8768 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8770 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
8771 [(set_attr "length" "12")])
8773 ;; This is (and (neg (ge X (const_int 0))) Y).
8775 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8778 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8780 (match_operand:SI 2 "gpc_reg_operand" "r")))
8781 (clobber (match_scratch:SI 3 "=&r"))]
8783 "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
8784 [(set_attr "length" "8")])
8787 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8791 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8793 (match_operand:SI 2 "gpc_reg_operand" "r"))
8795 (clobber (match_scratch:SI 3 "=&r"))]
8797 "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
8798 [(set_attr "type" "compare")
8799 (set_attr "length" "8")])
8802 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8806 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8808 (match_operand:SI 2 "gpc_reg_operand" "r"))
8810 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8811 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
8814 (clobber (match_scratch:SI 3 "=&r"))]
8816 "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
8817 [(set_attr "type" "compare")
8818 (set_attr "length" "8")])
8821 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8822 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8823 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
8826 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
8827 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
8828 [(set_attr "length" "12")])
8831 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
8833 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8834 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8836 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8837 (geu:SI (match_dup 1) (match_dup 2)))]
8840 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
8841 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
8842 [(set_attr "type" "compare")
8843 (set_attr "length" "12")])
8846 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8847 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8848 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8849 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8850 (clobber (match_scratch:SI 4 "=&r,&r"))]
8853 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
8854 {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
8855 [(set_attr "length" "8")])
8858 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8860 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8861 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8862 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8864 (clobber (match_scratch:SI 4 "=&r,&r"))]
8867 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
8868 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
8869 [(set_attr "type" "compare")
8870 (set_attr "length" "8")])
8873 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8875 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8876 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8877 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8879 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8880 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8881 (clobber (match_scratch:SI 4 "=&r,&r"))]
8884 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
8885 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
8886 [(set_attr "type" "compare")
8887 (set_attr "length" "8")])
8890 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8891 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8892 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
8895 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
8896 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
8897 [(set_attr "length" "12")])
8900 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8902 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8903 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8904 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8905 (clobber (match_scratch:SI 4 "=&r,&r"))]
8908 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
8909 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
8910 [(set_attr "length" "12")])
8913 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8916 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8917 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8918 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8920 (clobber (match_scratch:SI 4 "=&r,&r"))]
8923 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
8924 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
8925 [(set_attr "type" "compare")
8926 (set_attr "length" "12")])
8929 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8932 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8933 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
8934 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8936 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8937 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
8938 (clobber (match_scratch:SI 4 "=&r,&r"))]
8941 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
8942 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
8943 [(set_attr "type" "compare")
8944 (set_attr "length" "12")])
8947 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8948 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8951 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
8952 [(set_attr "length" "12")])
8955 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
8957 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8960 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8961 (gt:SI (match_dup 1) (const_int 0)))]
8963 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
8964 [(set_attr "type" "delayed_compare")
8965 (set_attr "length" "12")])
8968 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8969 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8970 (match_operand:SI 2 "reg_or_short_operand" "r")))]
8972 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
8973 [(set_attr "length" "12")])
8976 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8978 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8979 (match_operand:SI 2 "reg_or_short_operand" "r"))
8981 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8982 (gt:SI (match_dup 1) (match_dup 2)))]
8984 "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
8985 [(set_attr "type" "delayed_compare")
8986 (set_attr "length" "12")])
8989 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8990 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8992 (match_operand:SI 2 "gpc_reg_operand" "r")))
8993 (clobber (match_scratch:SI 3 "=&r"))]
8995 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
8996 [(set_attr "length" "12")])
8999 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9001 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9003 (match_operand:SI 2 "gpc_reg_operand" "r"))
9005 (clobber (match_scratch:SI 3 "=&r"))]
9007 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
9008 [(set_attr "type" "compare")
9009 (set_attr "length" "12")])
9012 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
9014 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9016 (match_operand:SI 2 "gpc_reg_operand" "r"))
9018 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9019 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
9020 (clobber (match_scratch:SI 3 "=&r"))]
9022 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
9023 [(set_attr "type" "compare")
9024 (set_attr "length" "12")])
9027 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9028 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9029 (match_operand:SI 2 "reg_or_short_operand" "r"))
9030 (match_operand:SI 3 "gpc_reg_operand" "r")))
9031 (clobber (match_scratch:SI 4 "=&r"))]
9033 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
9034 [(set_attr "length" "12")])
9037 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9039 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9040 (match_operand:SI 2 "reg_or_short_operand" "r"))
9041 (match_operand:SI 3 "gpc_reg_operand" "r"))
9043 (clobber (match_scratch:SI 4 "=&r"))]
9045 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
9046 [(set_attr "type" "compare")
9047 (set_attr "length" "12")])
9050 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
9052 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9053 (match_operand:SI 2 "reg_or_short_operand" "r"))
9054 (match_operand:SI 3 "gpc_reg_operand" "r"))
9056 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9057 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9058 (clobber (match_scratch:SI 4 "=&r"))]
9060 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
9061 [(set_attr "type" "compare")
9062 (set_attr "length" "12")])
9065 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9066 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9069 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
9070 [(set_attr "length" "12")])
9073 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9074 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9075 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
9077 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
9078 [(set_attr "length" "12")])
9081 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9082 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9083 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
9085 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
9086 [(set_attr "length" "12")])
9089 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
9091 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9092 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9094 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9095 (gtu:SI (match_dup 1) (match_dup 2)))]
9097 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
9098 [(set_attr "type" "compare")
9099 (set_attr "length" "12")])
9102 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
9103 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
9104 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
9105 (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
9106 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
9109 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
9110 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
9111 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
9112 [(set_attr "length" "8,12,12")])
9115 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9117 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9118 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
9119 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9121 (clobber (match_scratch:SI 4 "=&r,&r"))]
9124 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
9125 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
9126 [(set_attr "type" "compare")
9127 (set_attr "length" "8,12")])
9130 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9132 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9133 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
9134 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9136 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9137 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9138 (clobber (match_scratch:SI 4 "=&r,&r"))]
9141 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
9142 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
9143 [(set_attr "type" "compare")
9144 (set_attr "length" "8,12")])
9147 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9148 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9149 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
9151 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
9152 [(set_attr "length" "8")])
9154 ;; Define both directions of branch and return. If we need a reload
9155 ;; register, we'd rather use CR0 since it is much easier to copy a
9156 ;; register CC value to there.
9160 (if_then_else (match_operator 1 "branch_comparison_operator"
9162 "cc_reg_operand" "x,?y")
9164 (label_ref (match_operand 0 "" ""))
9169 if (get_attr_length (insn) == 8)
9170 return \"%C1bc %t1,%j1,%l0\";
9172 return \"%C1bc %T1,%j1,%$+8\;b %l0\";
9175 [(set_attr "type" "branch")])
9179 (if_then_else (match_operator 0 "branch_comparison_operator"
9181 "cc_reg_operand" "x,?y")
9186 "{%C0bcr|%C0bclr} %t0,%j0"
9187 [(set_attr "type" "branch")
9188 (set_attr "length" "8")])
9192 (if_then_else (match_operator 1 "branch_comparison_operator"
9194 "cc_reg_operand" "x,?y")
9197 (label_ref (match_operand 0 "" ""))))]
9201 if (get_attr_length (insn) == 8)
9202 return \"%C1bc %T1,%j1,%l0\";
9204 return \"%C1bc %t1,%j1,%$+8\;b %l0\";
9206 [(set_attr "type" "branch")])
9210 (if_then_else (match_operator 0 "branch_comparison_operator"
9212 "cc_reg_operand" "x,?y")
9217 "{%C0bcr|%C0bclr} %T0,%j0"
9218 [(set_attr "type" "branch")
9219 (set_attr "length" "8")])
9221 ;; Unconditional branch and return.
9225 (label_ref (match_operand 0 "" "")))]
9228 [(set_attr "type" "branch")])
9230 (define_insn "return"
9234 [(set_attr "type" "jmpreg")])
9236 (define_insn "indirect_jump"
9237 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
9242 [(set_attr "type" "jmpreg")])
9245 [(set (pc) (match_operand:DI 0 "register_operand" "c,l"))]
9250 [(set_attr "type" "jmpreg")])
9252 ;; Table jump for switch statements:
9253 (define_expand "tablejump"
9254 [(use (match_operand 0 "" ""))
9255 (use (label_ref (match_operand 1 "" "")))]
9260 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
9262 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
9266 (define_expand "tablejumpsi"
9268 (plus:SI (match_operand:SI 0 "" "")
9270 (parallel [(set (pc) (match_dup 3))
9271 (use (label_ref (match_operand 1 "" "")))])]
9274 { operands[0] = force_reg (SImode, operands[0]);
9275 operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
9276 operands[3] = gen_reg_rtx (SImode);
9279 (define_expand "tablejumpdi"
9281 (plus:DI (match_operand:DI 0 "" "")
9283 (parallel [(set (pc) (match_dup 3))
9284 (use (label_ref (match_operand 1 "" "")))])]
9287 { operands[0] = force_reg (DImode, operands[0]);
9288 operands[2] = force_reg (DImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
9289 operands[3] = gen_reg_rtx (DImode);
9294 (match_operand:SI 0 "register_operand" "c,l"))
9295 (use (label_ref (match_operand 1 "" "")))]
9300 [(set_attr "type" "jmpreg")])
9304 (match_operand:DI 0 "register_operand" "c,l"))
9305 (use (label_ref (match_operand 1 "" "")))]
9310 [(set_attr "type" "jmpreg")])
9317 ;; Define the subtract-one-and-jump insns, starting with the template
9318 ;; so loop.c knows what to generate.
9320 (define_expand "decrement_and_branch_on_count"
9321 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "")
9323 (label_ref (match_operand 1 "" ""))
9326 (plus:SI (match_dup 0)
9328 (clobber (match_scratch:CC 2 ""))
9329 (clobber (match_scratch:SI 3 ""))])]
9333 ;; We need to be able to do this for any operand, including MEM, or we
9334 ;; will cause reload to blow up since we don't allow output reloads on
9336 ;; In order that the length attribute is calculated correctly, the
9337 ;; label MUST be operand 0.
9341 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
9343 (label_ref (match_operand 0 "" ""))
9345 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9346 (plus:SI (match_dup 1)
9348 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9349 (clobber (match_scratch:SI 4 "=X,X,r"))]
9353 if (which_alternative != 0)
9355 else if (get_attr_length (insn) == 8)
9356 return \"{bdn|bdnz} %l0\";
9358 return \"bdz %$+8\;b %l0\";
9360 [(set_attr "type" "branch")
9361 (set_attr "length" "*,12,16")])
9365 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
9368 (label_ref (match_operand 0 "" ""))))
9369 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9370 (plus:SI (match_dup 1)
9372 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9373 (clobber (match_scratch:SI 4 "=X,X,r"))]
9377 if (which_alternative != 0)
9379 else if (get_attr_length (insn) == 8)
9382 return \"{bdn|bdnz} %$+8\;b %l0\";
9384 [(set_attr "type" "branch")
9385 (set_attr "length" "*,12,16")])
9387 ;; Similar, but we can use GE since we have a REG_NONNEG.
9390 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
9392 (label_ref (match_operand 0 "" ""))
9394 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9395 (plus:SI (match_dup 1)
9397 (clobber (match_scratch:CC 3 "=X,&x,&X"))
9398 (clobber (match_scratch:SI 4 "=X,X,r"))]
9399 "find_reg_note (insn, REG_NONNEG, 0)"
9402 if (which_alternative != 0)
9404 else if (get_attr_length (insn) == 8)
9405 return \"{bdn|bdnz} %l0\";
9407 return \"bdz %$+8\;b %l0\";
9409 [(set_attr "type" "branch")
9410 (set_attr "length" "*,12,16")])
9414 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
9417 (label_ref (match_operand 0 "" ""))))
9418 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9419 (plus:SI (match_dup 1)
9421 (clobber (match_scratch:CC 3 "=X,&x,&X"))
9422 (clobber (match_scratch:SI 4 "=X,X,r"))]
9423 "find_reg_note (insn, REG_NONNEG, 0)"
9426 if (which_alternative != 0)
9428 else if (get_attr_length (insn) == 8)
9431 return \"{bdn|bdnz} %$+8\;b %l0\";
9433 [(set_attr "type" "branch")
9434 (set_attr "length" "*,12,16")])
9438 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
9440 (label_ref (match_operand 0 "" ""))
9442 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9443 (plus:SI (match_dup 1)
9445 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9446 (clobber (match_scratch:SI 4 "=X,X,r"))]
9450 if (which_alternative != 0)
9452 else if (get_attr_length (insn) == 8)
9455 return \"{bdn|bdnz} %$+8\;b %l0\";
9457 [(set_attr "type" "branch")
9458 (set_attr "length" "*,12,16")])
9462 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
9465 (label_ref (match_operand 0 "" ""))))
9466 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9467 (plus:SI (match_dup 1)
9469 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9470 (clobber (match_scratch:SI 4 "=X,X,r"))]
9474 if (which_alternative != 0)
9476 else if (get_attr_length (insn) == 8)
9477 return \"{bdn|bdnz} %l0\";
9479 return \"bdz %$+8\;b %l0\";
9481 [(set_attr "type" "branch")
9482 (set_attr "length" "*,12,16")])
9486 (if_then_else (match_operator 2 "comparison_operator"
9487 [(match_operand:SI 1 "gpc_reg_operand" "")
9489 (match_operand 5 "" "")
9490 (match_operand 6 "" "")))
9491 (set (match_operand:SI 0 "gpc_reg_operand" "")
9492 (plus:SI (match_dup 1)
9494 (clobber (match_scratch:CC 3 ""))
9495 (clobber (match_scratch:SI 4 ""))]
9497 [(parallel [(set (match_dup 3)
9498 (compare:CC (plus:SI (match_dup 1)
9502 (plus:SI (match_dup 1)
9504 (set (pc) (if_then_else (match_dup 7)
9508 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
9513 (if_then_else (match_operator 2 "comparison_operator"
9514 [(match_operand:SI 1 "gpc_reg_operand" "")
9516 (match_operand 5 "" "")
9517 (match_operand 6 "" "")))
9518 (set (match_operand:SI 0 "general_operand" "")
9519 (plus:SI (match_dup 1) (const_int -1)))
9520 (clobber (match_scratch:CC 3 ""))
9521 (clobber (match_scratch:SI 4 ""))]
9522 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
9523 [(parallel [(set (match_dup 3)
9524 (compare:CC (plus:SI (match_dup 1)
9528 (plus:SI (match_dup 1)
9532 (set (pc) (if_then_else (match_dup 7)
9536 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],