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")])
1391 (define_expand "udivsi3"
1392 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1393 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1394 (match_operand:SI 2 "gpc_reg_operand" "")))]
1395 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1398 if (! TARGET_POWER && ! TARGET_POWERPC)
1400 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1401 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1402 emit_insn (gen_quous_call ());
1403 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1406 else if (TARGET_POWER)
1408 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1413 (define_insn "udivsi3_mq"
1414 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1415 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1416 (match_operand:SI 2 "gpc_reg_operand" "r")))
1417 (clobber (match_scratch:SI 3 "=q"))]
1418 "TARGET_POWERPC && TARGET_POWER"
1420 [(set_attr "type" "idiv")])
1422 (define_insn "*udivsi3_no_mq"
1423 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1424 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1425 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1426 "TARGET_POWERPC && ! TARGET_POWER"
1428 [(set_attr "type" "idiv")])
1430 ;; For powers of two we can do srai/aze for divide and then adjust for
1431 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1432 ;; used; for PowerPC, force operands into register and do a normal divide;
1433 ;; for AIX common-mode, use quoss call on register operands.
1434 (define_expand "divsi3"
1435 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1436 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1437 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1441 if (GET_CODE (operands[2]) == CONST_INT
1442 && exact_log2 (INTVAL (operands[2])) >= 0)
1444 else if (TARGET_POWERPC)
1446 operands[2] = force_reg (SImode, operands[2]);
1449 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1453 else if (TARGET_POWER)
1457 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1458 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1459 emit_insn (gen_quoss_call ());
1460 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1465 (define_insn "divsi3_mq"
1466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1467 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1468 (match_operand:SI 2 "gpc_reg_operand" "r")))
1469 (clobber (match_scratch:SI 3 "=q"))]
1470 "TARGET_POWERPC && TARGET_POWER"
1472 [(set_attr "type" "idiv")])
1474 (define_insn "*divsi3_no_mq"
1475 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1476 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1477 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1478 "TARGET_POWERPC && ! TARGET_POWER"
1480 [(set_attr "type" "idiv")])
1482 (define_expand "modsi3"
1483 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1484 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1485 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1489 int i = exact_log2 (INTVAL (operands[2]));
1493 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
1496 temp1 = gen_reg_rtx (SImode);
1497 temp2 = gen_reg_rtx (SImode);
1499 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1500 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1501 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1506 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1507 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1508 (match_operand:SI 2 "const_int_operand" "N")))]
1509 "exact_log2 (INTVAL (operands[2])) >= 0"
1510 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1511 [(set_attr "length" "8")])
1514 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1515 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1516 (match_operand:SI 2 "const_int_operand" "N"))
1518 (clobber (match_scratch:SI 3 "=r"))]
1519 "exact_log2 (INTVAL (operands[2])) >= 0"
1520 "{srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3"
1521 [(set_attr "type" "compare")
1522 (set_attr "length" "8")])
1525 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1526 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1527 (match_operand:SI 2 "const_int_operand" "N"))
1529 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1530 (div:SI (match_dup 1) (match_dup 2)))]
1531 "exact_log2 (INTVAL (operands[2])) >= 0"
1532 "{srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0"
1533 [(set_attr "type" "compare")
1534 (set_attr "length" "8")])
1537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1540 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
1542 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
1543 (match_operand:SI 3 "gpc_reg_operand" "r")))
1544 (set (match_operand:SI 2 "register_operand" "=*q")
1547 (zero_extend:DI (match_dup 1)) (const_int 32))
1548 (zero_extend:DI (match_dup 4)))
1552 [(set_attr "type" "idiv")])
1554 ;; To do unsigned divide we handle the cases of the divisor looking like a
1555 ;; negative number. If it is a constant that is less than 2**31, we don't
1556 ;; have to worry about the branches. So make a few subroutines here.
1558 ;; First comes the normal case.
1559 (define_expand "udivmodsi4_normal"
1560 [(set (match_dup 4) (const_int 0))
1561 (parallel [(set (match_operand:SI 0 "" "")
1562 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1564 (zero_extend:DI (match_operand:SI 1 "" "")))
1565 (match_operand:SI 2 "" "")))
1566 (set (match_operand:SI 3 "" "")
1567 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1569 (zero_extend:DI (match_dup 1)))
1573 { operands[4] = gen_reg_rtx (SImode); }")
1575 ;; This handles the branches.
1576 (define_expand "udivmodsi4_tests"
1577 [(set (match_operand:SI 0 "" "") (const_int 0))
1578 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
1579 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
1580 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
1581 (label_ref (match_operand:SI 4 "" "")) (pc)))
1582 (set (match_dup 0) (const_int 1))
1583 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
1584 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
1585 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
1586 (label_ref (match_dup 4)) (pc)))]
1589 { operands[5] = gen_reg_rtx (CCUNSmode);
1590 operands[6] = gen_reg_rtx (CCmode);
1593 (define_expand "udivmodsi4"
1594 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1595 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1596 (match_operand:SI 2 "reg_or_cint_operand" "")))
1597 (set (match_operand:SI 3 "gpc_reg_operand" "")
1598 (umod:SI (match_dup 1) (match_dup 2)))])]
1605 if (! TARGET_POWERPC)
1607 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1608 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1609 emit_insn (gen_divus_call ());
1610 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1611 emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
1617 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
1619 operands[2] = force_reg (SImode, operands[2]);
1620 label = gen_label_rtx ();
1621 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
1622 operands[3], label));
1625 operands[2] = force_reg (SImode, operands[2]);
1627 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
1635 ;; AIX architecture-independent common-mode multiply (DImode),
1636 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
1637 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
1638 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
1639 ;; assumed unused if generating common-mode, so ignore.
1640 (define_insn "mulh_call"
1643 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
1644 (sign_extend:DI (reg:SI 4)))
1646 (clobber (match_scratch:SI 0 "=l"))]
1647 "! TARGET_POWER && ! TARGET_POWERPC"
1649 [(set_attr "type" "imul")])
1651 (define_insn "mull_call"
1653 (mult:DI (sign_extend:DI (reg:SI 3))
1654 (sign_extend:DI (reg:SI 4))))
1655 (clobber (match_scratch:SI 0 "=l"))
1656 (clobber (reg:SI 0))]
1657 "! TARGET_POWER && ! TARGET_POWERPC"
1659 [(set_attr "type" "imul")])
1661 (define_insn "divss_call"
1663 (div:SI (reg:SI 3) (reg:SI 4)))
1665 (mod:SI (reg:SI 3) (reg:SI 4)))
1666 (clobber (match_scratch:SI 0 "=l"))
1667 (clobber (reg:SI 0))]
1668 "! TARGET_POWER && ! TARGET_POWERPC"
1670 [(set_attr "type" "idiv")])
1672 (define_insn "divus_call"
1674 (udiv:SI (reg:SI 3) (reg:SI 4)))
1676 (umod:SI (reg:SI 3) (reg:SI 4)))
1677 (clobber (match_scratch:SI 0 "=l"))
1678 (clobber (reg:SI 0))
1679 (clobber (match_scratch:CC 1 "=x"))
1680 (clobber (reg:CC 69))]
1681 "! TARGET_POWER && ! TARGET_POWERPC"
1683 [(set_attr "type" "idiv")])
1685 (define_insn "quoss_call"
1687 (div:SI (reg:SI 3) (reg:SI 4)))
1688 (clobber (match_scratch:SI 0 "=l"))]
1689 "! TARGET_POWER && ! TARGET_POWERPC"
1691 [(set_attr "type" "idiv")])
1693 (define_insn "quous_call"
1695 (udiv:SI (reg:SI 3) (reg:SI 4)))
1696 (clobber (match_scratch:SI 0 "=l"))
1697 (clobber (reg:SI 0))
1698 (clobber (match_scratch:CC 1 "=x"))
1699 (clobber (reg:CC 69))]
1700 "! TARGET_POWER && ! TARGET_POWERPC"
1702 [(set_attr "type" "idiv")])
1704 ;; Logical instructions
1705 (define_insn "andsi3"
1706 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1707 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1708 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
1709 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
1713 {rlinm|rlwinm} %0,%1,0,%m2,%M2
1714 {andil.|andi.} %0,%1,%b2
1715 {andiu.|andis.} %0,%1,%u2"
1716 [(set_attr "length" "4,4,4,4")])
1718 (define_insn "*andsi3_internal2"
1719 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
1720 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1721 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1723 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1727 {andil.|andi.} %3,%1,%b2
1728 {andiu.|andis.} %3,%1,%u2
1729 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2"
1730 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1732 (define_insn "*andsi3_internal3"
1733 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
1734 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1735 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1737 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1738 (and:SI (match_dup 1) (match_dup 2)))]
1742 {andil.|andi.} %0,%1,%b2
1743 {andiu.|andis.} %0,%1,%u2
1744 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2"
1745 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1747 (define_expand "iorsi3"
1748 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1749 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
1750 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1754 if (GET_CODE (operands[2]) == CONST_INT
1755 && !logical_operand (operands[2], SImode))
1757 HOST_WIDE_INT value = INTVAL (operands[2]);
1758 rtx tmp = ((reload_in_progress || reload_completed
1759 || rtx_equal_p (operands[0], operands[1]))
1760 ? operands[0] : gen_reg_rtx (SImode));
1762 emit_insn (gen_iorsi3 (tmp, operands[1], GEN_INT (value & 0xffff0000)));
1763 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0x0000ffff)));
1768 (define_insn "*iorsi3_internal1"
1769 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1770 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1771 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1775 {oril|ori} %0,%1,%b2
1776 {oriu|oris} %0,%1,%u2"
1777 [(set_attr "length" "4,4,4")])
1779 (define_insn "*iorsi3_internal2"
1780 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1781 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1782 (match_operand:SI 2 "gpc_reg_operand" "r"))
1784 (clobber (match_scratch:SI 3 "=r"))]
1787 [(set_attr "type" "compare")])
1789 (define_insn "*iorsi3_internal3"
1790 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1791 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1792 (match_operand:SI 2 "gpc_reg_operand" "r"))
1794 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1795 (ior:SI (match_dup 1) (match_dup 2)))]
1798 [(set_attr "type" "compare")])
1800 (define_expand "xorsi3"
1801 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1802 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1803 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1807 if (GET_CODE (operands[2]) == CONST_INT
1808 && !logical_operand (operands[2], SImode))
1810 HOST_WIDE_INT value = INTVAL (operands[2]);
1811 rtx tmp = ((reload_in_progress || reload_completed
1812 || rtx_equal_p (operands[0], operands[1]))
1813 ? operands[0] : gen_reg_rtx (SImode));
1815 emit_insn (gen_xorsi3 (tmp, operands[1], GEN_INT (value & 0xffff0000)));
1816 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0x0000ffff)));
1821 (define_insn "*xorsi3_internal1"
1822 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1823 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1824 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1828 {xoril|xori} %0,%1,%b2
1829 {xoriu|xoris} %0,%1,%u2"
1830 [(set_attr "length" "4,4,4")])
1832 (define_insn "*xorsi3_internal2"
1833 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1834 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1835 (match_operand:SI 2 "gpc_reg_operand" "r"))
1837 (clobber (match_scratch:SI 3 "=r"))]
1840 [(set_attr "type" "compare")])
1842 (define_insn "*xorsi3_internal3"
1843 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1844 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1845 (match_operand:SI 2 "gpc_reg_operand" "r"))
1847 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1848 (xor:SI (match_dup 1) (match_dup 2)))]
1851 [(set_attr "type" "compare")])
1853 (define_insn "*eqv_internal1"
1854 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1855 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1856 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1860 (define_insn "*eqv_internal2"
1861 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1862 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1863 (match_operand:SI 2 "gpc_reg_operand" "r")))
1865 (clobber (match_scratch:SI 3 "=r"))]
1868 [(set_attr "type" "compare")])
1870 (define_insn "*eqv_internal3"
1871 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1872 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1873 (match_operand:SI 2 "gpc_reg_operand" "r")))
1875 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1876 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
1879 [(set_attr "type" "compare")])
1881 (define_insn "*andc_internal1"
1882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1883 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1884 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1888 (define_insn "*andc_internal2"
1889 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1890 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1891 (match_operand:SI 2 "gpc_reg_operand" "r"))
1893 (clobber (match_scratch:SI 3 "=r"))]
1896 [(set_attr "type" "compare")])
1898 (define_insn "*andc_internal3"
1899 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1900 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1901 (match_operand:SI 2 "gpc_reg_operand" "r"))
1903 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1904 (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
1907 [(set_attr "type" "compare")])
1909 (define_insn "*iorc_internal1"
1910 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1911 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1912 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1916 (define_insn "*iorc_internal2"
1917 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1918 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1919 (match_operand:SI 2 "gpc_reg_operand" "r"))
1921 (clobber (match_scratch:SI 3 "=r"))]
1924 [(set_attr "type" "compare")])
1926 (define_insn "*iorc_internal3"
1927 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1928 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1929 (match_operand:SI 2 "gpc_reg_operand" "r"))
1931 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1932 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
1935 [(set_attr "type" "compare")])
1937 (define_insn "*nand_internal1"
1938 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1939 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1940 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1944 (define_insn "*nand_internal2"
1945 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1946 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1947 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1949 (clobber (match_scratch:SI 3 "=r"))]
1952 [(set_attr "type" "compare")])
1954 (define_insn "*nand_internal3"
1955 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1956 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1957 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1959 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1960 (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1963 [(set_attr "type" "compare")])
1965 (define_insn "*nor_internal1"
1966 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1967 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1968 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1972 (define_insn "*nor_internal2"
1973 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1974 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1975 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1977 (clobber (match_scratch:SI 3 "=r"))]
1980 [(set_attr "type" "compare")])
1982 (define_insn "*nor_internal3"
1983 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1984 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1985 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1987 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1988 (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1991 [(set_attr "type" "compare")])
1993 ;; maskir insn. We need four forms because things might be in arbitrary
1994 ;; orders. Don't define forms that only set CR fields because these
1995 ;; would modify an input register.
1997 (define_insn "*maskir_internal1"
1998 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1999 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2000 (match_operand:SI 1 "gpc_reg_operand" "0"))
2001 (and:SI (match_dup 2)
2002 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2006 (define_insn "*maskir_internal2"
2007 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2008 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2009 (match_operand:SI 1 "gpc_reg_operand" "0"))
2010 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2015 (define_insn "*maskir_internal3"
2016 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2017 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2018 (match_operand:SI 3 "gpc_reg_operand" "r"))
2019 (and:SI (not:SI (match_dup 2))
2020 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2024 (define_insn "*maskir_internal4"
2025 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2026 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2027 (match_operand:SI 2 "gpc_reg_operand" "r"))
2028 (and:SI (not:SI (match_dup 2))
2029 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2033 (define_insn "*maskir_internal5"
2034 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2036 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2037 (match_operand:SI 1 "gpc_reg_operand" "0"))
2038 (and:SI (match_dup 2)
2039 (match_operand:SI 3 "gpc_reg_operand" "r")))
2041 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2042 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2043 (and:SI (match_dup 2) (match_dup 3))))]
2046 [(set_attr "type" "compare")])
2048 (define_insn "*maskir_internal6"
2049 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2051 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2052 (match_operand:SI 1 "gpc_reg_operand" "0"))
2053 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2056 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2057 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2058 (and:SI (match_dup 3) (match_dup 2))))]
2061 [(set_attr "type" "compare")])
2063 (define_insn "*maskir_internal7"
2064 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2066 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2067 (match_operand:SI 3 "gpc_reg_operand" "r"))
2068 (and:SI (not:SI (match_dup 2))
2069 (match_operand:SI 1 "gpc_reg_operand" "0")))
2071 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2072 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2073 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2076 [(set_attr "type" "compare")])
2078 (define_insn "*maskir_internal8"
2079 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2081 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2082 (match_operand:SI 2 "gpc_reg_operand" "r"))
2083 (and:SI (not:SI (match_dup 2))
2084 (match_operand:SI 1 "gpc_reg_operand" "0")))
2086 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2087 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2088 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2091 [(set_attr "type" "compare")])
2093 ;; Rotate and shift insns, in all their variants. These support shifts,
2094 ;; field inserts and extracts, and various combinations thereof.
2095 (define_expand "insv"
2096 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2097 (match_operand:SI 1 "const_int_operand" "i")
2098 (match_operand:SI 2 "const_int_operand" "i"))
2099 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2103 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2104 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2105 compiler if the address of the structure is taken later. */
2106 if (GET_CODE (operands[0]) == SUBREG
2107 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2112 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2113 (match_operand:SI 1 "const_int_operand" "i")
2114 (match_operand:SI 2 "const_int_operand" "i"))
2115 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2119 int start = INTVAL (operands[2]) & 31;
2120 int size = INTVAL (operands[1]) & 31;
2122 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
2123 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2124 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2128 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2129 (match_operand:SI 1 "const_int_operand" "i")
2130 (match_operand:SI 2 "const_int_operand" "i"))
2131 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2132 (match_operand:SI 4 "const_int_operand" "i")))]
2133 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2136 int shift = INTVAL (operands[4]) & 31;
2137 int start = INTVAL (operands[2]) & 31;
2138 int size = INTVAL (operands[1]) & 31;
2140 operands[4] = gen_rtx (CONST_INT, VOIDmode, shift - start - size);
2141 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2142 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2146 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2147 (match_operand:SI 1 "const_int_operand" "i")
2148 (match_operand:SI 2 "const_int_operand" "i"))
2149 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2150 (match_operand:SI 4 "const_int_operand" "i")))]
2151 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2154 int shift = INTVAL (operands[4]) & 31;
2155 int start = INTVAL (operands[2]) & 31;
2156 int size = INTVAL (operands[1]) & 31;
2158 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - shift - start - size);
2159 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2160 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2164 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2165 (match_operand:SI 1 "const_int_operand" "i")
2166 (match_operand:SI 2 "const_int_operand" "i"))
2167 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2168 (match_operand:SI 4 "const_int_operand" "i")))]
2169 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2172 int shift = INTVAL (operands[4]) & 31;
2173 int start = INTVAL (operands[2]) & 31;
2174 int size = INTVAL (operands[1]) & 31;
2176 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - shift - start - size);
2177 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2178 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2182 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2183 (match_operand:SI 1 "const_int_operand" "i")
2184 (match_operand:SI 2 "const_int_operand" "i"))
2185 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2186 (match_operand:SI 4 "const_int_operand" "i")
2187 (match_operand:SI 5 "const_int_operand" "i")))]
2188 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2191 int extract_start = INTVAL (operands[5]) & 31;
2192 int extract_size = INTVAL (operands[4]) & 31;
2193 int insert_start = INTVAL (operands[2]) & 31;
2194 int insert_size = INTVAL (operands[1]) & 31;
2196 /* Align extract field with insert field */
2197 operands[5] = gen_rtx (CONST_INT, VOIDmode,
2198 extract_start + extract_size - insert_start - insert_size);
2199 operands[1] = gen_rtx (CONST_INT, VOIDmode, insert_start + insert_size - 1);
2200 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
2204 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
2205 (match_operand:DI 1 "const_int_operand" "i")
2206 (match_operand:DI 2 "const_int_operand" "i"))
2207 (match_operand:DI 3 "gpc_reg_operand" "r"))]
2211 int start = INTVAL (operands[2]) & 63;
2212 int size = INTVAL (operands[1]) & 63;
2214 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - start - size);
2215 return \"rldimi %0,%3,%H2,%H1\";
2218 (define_expand "extzv"
2219 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2220 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2221 (match_operand:SI 2 "const_int_operand" "i")
2222 (match_operand:SI 3 "const_int_operand" "i")))]
2226 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2227 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2228 compiler if the address of the structure is taken later. */
2229 if (GET_CODE (operands[0]) == SUBREG
2230 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2235 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2236 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2237 (match_operand:SI 2 "const_int_operand" "i")
2238 (match_operand:SI 3 "const_int_operand" "i")))]
2242 int start = INTVAL (operands[3]) & 31;
2243 int size = INTVAL (operands[2]) & 31;
2245 if (start + size >= 32)
2246 operands[3] = const0_rtx;
2248 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2249 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
2253 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2254 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2255 (match_operand:SI 2 "const_int_operand" "i")
2256 (match_operand:SI 3 "const_int_operand" "i"))
2258 (clobber (match_scratch:SI 4 "=r"))]
2262 int start = INTVAL (operands[3]) & 31;
2263 int size = INTVAL (operands[2]) & 31;
2265 /* If the bitfield being tested fits in the upper or lower half of a
2266 word, it is possible to use andiu. or andil. to test it. This is
2267 useful because the condition register set-use delay is smaller for
2268 andi[ul]. than for rlinm. This doesn't work when the starting bit
2269 position is 0 because the LT and GT bits may be set wrong. */
2271 if ((start > 0 && start + size <= 16) || start >= 16)
2273 operands[3] = gen_rtx (CONST_INT, VOIDmode,
2274 ((1 << (16 - (start & 15)))
2275 - (1 << (16 - (start & 15) - size))));
2277 return \"{andiu.|andis.} %4,%1,%3\";
2279 return \"{andil.|andi.} %4,%1,%3\";
2282 if (start + size >= 32)
2283 operands[3] = const0_rtx;
2285 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2286 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
2288 [(set_attr "type" "compare")])
2291 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2292 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2293 (match_operand:SI 2 "const_int_operand" "i")
2294 (match_operand:SI 3 "const_int_operand" "i"))
2296 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2297 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
2301 int start = INTVAL (operands[3]) & 31;
2302 int size = INTVAL (operands[2]) & 31;
2304 if (start >= 16 && start + size == 32)
2306 operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
2307 return \"{andil.|andi.} %0,%1,%3\";
2310 if (start + size >= 32)
2311 operands[3] = const0_rtx;
2313 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2314 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
2316 [(set_attr "type" "delayed_compare")])
2319 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2320 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2321 (match_operand:DI 2 "const_int_operand" "i")
2322 (match_operand:DI 3 "const_int_operand" "i")))]
2326 int start = INTVAL (operands[3]) & 63;
2327 int size = INTVAL (operands[2]) & 63;
2329 if (start + size >= 64)
2330 operands[3] = const0_rtx;
2332 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2333 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
2334 return \"rldicl %0,%1,%3,%2\";
2338 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
2339 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2340 (match_operand:DI 2 "const_int_operand" "i")
2341 (match_operand:DI 3 "const_int_operand" "i"))
2343 (clobber (match_scratch:DI 4 "=r"))]
2347 int start = INTVAL (operands[3]) & 63;
2348 int size = INTVAL (operands[2]) & 63;
2350 if (start + size >= 64)
2351 operands[3] = const0_rtx;
2353 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2354 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
2355 return \"rldicl. %4,%1,%3,%2\";
2359 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
2360 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2361 (match_operand:DI 2 "const_int_operand" "i")
2362 (match_operand:DI 3 "const_int_operand" "i"))
2364 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
2365 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
2369 int start = INTVAL (operands[3]) & 63;
2370 int size = INTVAL (operands[2]) & 63;
2372 if (start + size >= 64)
2373 operands[3] = const0_rtx;
2375 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2376 operands[2] = gen_rtx (CONST_INT, VOIDmode, 64 - size);
2377 return \"rldicl. %0,%1,%3,%2\";
2380 (define_insn "rotlsi3"
2381 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2382 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2383 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2385 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
2388 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2389 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2390 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2392 (clobber (match_scratch:SI 3 "=r"))]
2394 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff"
2395 [(set_attr "type" "delayed_compare")])
2398 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2399 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2400 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2402 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2403 (rotate:SI (match_dup 1) (match_dup 2)))]
2405 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff"
2406 [(set_attr "type" "delayed_compare")])
2409 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2410 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2411 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2412 (match_operand:SI 3 "mask_operand" "L")))]
2414 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
2417 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2419 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2420 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2421 (match_operand:SI 3 "mask_operand" "L"))
2423 (clobber (match_scratch:SI 4 "=r"))]
2425 "{rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3"
2426 [(set_attr "type" "delayed_compare")])
2429 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2431 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2432 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2433 (match_operand:SI 3 "mask_operand" "L"))
2435 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2436 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2438 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3"
2439 [(set_attr "type" "delayed_compare")])
2442 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2445 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2446 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2448 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
2451 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2452 (compare:CC (zero_extend:SI
2454 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2455 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2457 (clobber (match_scratch:SI 3 "=r"))]
2459 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff"
2460 [(set_attr "type" "delayed_compare")])
2463 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2464 (compare:CC (zero_extend:SI
2466 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2467 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2469 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2470 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2472 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff"
2473 [(set_attr "type" "delayed_compare")])
2476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2479 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2480 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2482 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
2485 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2486 (compare:CC (zero_extend:SI
2488 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2489 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2491 (clobber (match_scratch:SI 3 "=r"))]
2493 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff"
2494 [(set_attr "type" "delayed_compare")])
2497 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2498 (compare:CC (zero_extend:SI
2500 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2501 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2503 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2504 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2506 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff"
2507 [(set_attr "type" "delayed_compare")])
2509 ;; Note that we use "sle." instead of "sl." so that we can set
2510 ;; SHIFT_COUNT_TRUNCATED.
2512 (define_expand "ashlsi3"
2513 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2514 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2515 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2520 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
2522 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
2526 (define_insn "ashlsi3_power"
2527 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2528 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2529 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2530 (clobber (match_scratch:SI 3 "=q,X"))]
2534 {sli|slwi} %0,%1,%h2"
2535 [(set_attr "length" "8")])
2537 (define_insn "ashlsi3_no_power"
2538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2539 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2540 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2542 "{sl|slw}%I2 %0,%1,%h2"
2543 [(set_attr "length" "8")])
2546 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2547 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2548 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2550 (clobber (match_scratch:SI 3 "=r,r"))
2551 (clobber (match_scratch:SI 4 "=q,X"))]
2555 {sli.|slwi.} %3,%1,%h2"
2556 [(set_attr "type" "delayed_compare")])
2559 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2560 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2561 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2563 (clobber (match_scratch:SI 3 "=r"))]
2565 "{sl|slw}%I2. %3,%1,%h2"
2566 [(set_attr "type" "delayed_compare")])
2569 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2570 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2571 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2573 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2574 (ashift:SI (match_dup 1) (match_dup 2)))
2575 (clobber (match_scratch:SI 4 "=q,X"))]
2579 {sli.|slwi.} %0,%1,%h2"
2580 [(set_attr "type" "delayed_compare")])
2583 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2584 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2585 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2587 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2588 (ashift:SI (match_dup 1) (match_dup 2)))]
2590 "{sl|slw}%I2. %0,%1,%h2"
2591 [(set_attr "type" "delayed_compare")])
2594 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2595 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2596 (match_operand:SI 2 "const_int_operand" "i"))
2597 (match_operand:SI 3 "mask_operand" "L")))]
2598 "includes_lshift_p (operands[2], operands[3])"
2599 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
2602 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2604 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2605 (match_operand:SI 2 "const_int_operand" "i"))
2606 (match_operand:SI 3 "mask_operand" "L"))
2608 (clobber (match_scratch:SI 4 "=r"))]
2609 "includes_lshift_p (operands[2], operands[3])"
2610 "{rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3"
2611 [(set_attr "type" "delayed_compare")])
2614 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2616 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2617 (match_operand:SI 2 "const_int_operand" "i"))
2618 (match_operand:SI 3 "mask_operand" "L"))
2620 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2621 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2622 "includes_lshift_p (operands[2], operands[3])"
2623 "{rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3"
2624 [(set_attr "type" "delayed_compare")])
2626 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
2628 (define_expand "lshrsi3"
2629 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2630 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2631 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2636 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
2638 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
2642 (define_insn "lshrsi3_power"
2643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2644 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
2645 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
2646 (clobber (match_scratch:SI 3 "=q,X,X"))]
2651 {s%A2i|s%A2wi} %0,%1,%h2")
2653 (define_insn "lshrsi3_no_power"
2654 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2655 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2656 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
2660 {sr|srw}%I2 %0,%1,%h2")
2663 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
2664 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
2665 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
2667 (clobber (match_scratch:SI 3 "=r,X,r"))
2668 (clobber (match_scratch:SI 4 "=q,X,X"))]
2673 {s%A2i.|s%A2wi.} %3,%1,%h2"
2674 [(set_attr "type" "delayed_compare")])
2677 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2678 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2679 (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
2681 (clobber (match_scratch:SI 3 "=X,r"))]
2685 {sr|srw}%I2. %3,%1,%h2"
2686 [(set_attr "type" "delayed_compare")])
2689 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
2690 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
2691 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i"))
2693 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2694 (lshiftrt:SI (match_dup 1) (match_dup 2)))
2695 (clobber (match_scratch:SI 4 "=q,X,X"))]
2700 {s%A2i.|s%A2wi.} %0,%1,%h2"
2701 [(set_attr "type" "delayed_compare")])
2704 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2705 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2706 (match_operand:SI 2 "reg_or_cint_operand" "O,ri"))
2708 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2709 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
2713 {sr|srw}%I2. %0,%1,%h2"
2714 [(set_attr "type" "delayed_compare")])
2717 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2718 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2719 (match_operand:SI 2 "const_int_operand" "i"))
2720 (match_operand:SI 3 "mask_operand" "L")))]
2721 "includes_rshift_p (operands[2], operands[3])"
2722 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
2725 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2727 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2728 (match_operand:SI 2 "const_int_operand" "i"))
2729 (match_operand:SI 3 "mask_operand" "L"))
2731 (clobber (match_scratch:SI 4 "=r"))]
2732 "includes_rshift_p (operands[2], operands[3])"
2733 "{rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3"
2734 [(set_attr "type" "delayed_compare")])
2737 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2739 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2740 (match_operand:SI 2 "const_int_operand" "i"))
2741 (match_operand:SI 3 "mask_operand" "L"))
2743 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2744 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2745 "includes_rshift_p (operands[2], operands[3])"
2746 "{rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3"
2747 [(set_attr "type" "delayed_compare")])
2750 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2753 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2754 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2755 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2756 "{rlinm|rlwinm} %0,%1,%s2,0xff")
2759 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2763 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2764 (match_operand:SI 2 "const_int_operand" "i")) 0))
2766 (clobber (match_scratch:SI 3 "=r"))]
2767 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2768 "{rlinm.|rlwinm.} %3,%1,%s2,0xff"
2769 [(set_attr "type" "delayed_compare")])
2772 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2776 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2777 (match_operand:SI 2 "const_int_operand" "i")) 0))
2779 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2780 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2781 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2782 "{rlinm.|rlwinm.} %0,%1,%s2,0xff"
2783 [(set_attr "type" "delayed_compare")])
2786 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2789 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2790 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2791 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2792 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
2795 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2799 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2800 (match_operand:SI 2 "const_int_operand" "i")) 0))
2802 (clobber (match_scratch:SI 3 "=r"))]
2803 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2804 "{rlinm.|rlwinm.} %3,%1,%s2,0xffff"
2805 [(set_attr "type" "delayed_compare")])
2808 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2812 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2813 (match_operand:SI 2 "const_int_operand" "i")) 0))
2815 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2816 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2817 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2818 "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
2819 [(set_attr "type" "delayed_compare")])
2822 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2824 (match_operand:SI 1 "gpc_reg_operand" "r"))
2825 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2831 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2833 (match_operand:SI 1 "gpc_reg_operand" "r"))
2834 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2840 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2842 (match_operand:SI 1 "gpc_reg_operand" "r"))
2843 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2849 (define_expand "ashrsi3"
2850 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2851 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2852 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2857 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
2859 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
2863 (define_insn "ashrsi3_power"
2864 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2865 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2866 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2867 (clobber (match_scratch:SI 3 "=q,X"))]
2871 {srai|srawi} %0,%1,%h2")
2873 (define_insn "ashrsi3_no_power"
2874 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2875 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2876 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2878 "{sra|sraw}%I2 %0,%1,%h2")
2881 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2882 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2883 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2885 (clobber (match_scratch:SI 3 "=r,r"))
2886 (clobber (match_scratch:SI 4 "=q,X"))]
2890 {srai.|srawi.} %3,%1,%h2"
2891 [(set_attr "type" "delayed_compare")])
2894 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2895 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2896 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2898 (clobber (match_scratch:SI 3 "=r"))]
2900 "{sra|sraw}%I2. %3,%1,%h2"
2901 [(set_attr "type" "delayed_compare")])
2904 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2905 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2906 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2908 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2909 (ashiftrt:SI (match_dup 1) (match_dup 2)))
2910 (clobber (match_scratch:SI 4 "=q,X"))]
2914 {srai.|srawi.} %0,%1,%h2"
2915 [(set_attr "type" "delayed_compare")])
2918 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2919 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2920 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2922 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2923 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
2925 "{sra|sraw}%I2. %0,%1,%h2"
2926 [(set_attr "type" "delayed_compare")])
2928 ;; Floating-point insns, excluding normal data motion.
2930 ;; PowerPC has a full set of single-precision floating point instructions.
2932 ;; For the POWER architecture, we pretend that we have both SFmode and
2933 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
2934 ;; The only conversions we will do will be when storing to memory. In that
2935 ;; case, we will use the "frsp" instruction before storing.
2937 ;; Note that when we store into a single-precision memory location, we need to
2938 ;; use the frsp insn first. If the register being stored isn't dead, we
2939 ;; need a scratch register for the frsp. But this is difficult when the store
2940 ;; is done by reload. It is not incorrect to do the frsp on the register in
2941 ;; this case, we just lose precision that we would have otherwise gotten but
2942 ;; is not guaranteed. Perhaps this should be tightened up at some point.
2944 (define_insn "extendsfdf2"
2945 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
2946 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2950 if (REGNO (operands[0]) == REGNO (operands[1]))
2953 return \"fmr %0,%1\";
2955 [(set_attr "type" "fp")])
2957 (define_insn "truncdfsf2"
2958 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2959 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
2962 [(set_attr "type" "fp")])
2964 (define_insn "aux_truncdfsf2"
2965 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2966 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
2967 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2969 [(set_attr "type" "fp")])
2971 (define_insn "negsf2"
2972 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2973 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2976 [(set_attr "type" "fp")])
2978 (define_insn "abssf2"
2979 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2980 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2983 [(set_attr "type" "fp")])
2986 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2987 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
2990 [(set_attr "type" "fp")])
2992 (define_expand "addsf3"
2993 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2994 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2995 (match_operand:SF 2 "gpc_reg_operand" "")))]
3000 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3001 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3002 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3003 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3005 [(set_attr "type" "fp")])
3008 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3009 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3010 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3011 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3012 "{fa|fadd} %0,%1,%2"
3013 [(set_attr "type" "fp")])
3015 (define_expand "subsf3"
3016 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3017 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
3018 (match_operand:SF 2 "gpc_reg_operand" "")))]
3023 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3024 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3025 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3026 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3028 [(set_attr "type" "fp")])
3031 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3032 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3033 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3034 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3035 "{fs|fsub} %0,%1,%2"
3036 [(set_attr "type" "fp")])
3038 (define_expand "mulsf3"
3039 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3040 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
3041 (match_operand:SF 2 "gpc_reg_operand" "")))]
3046 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3047 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3048 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3049 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3051 [(set_attr "type" "fp")])
3054 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3055 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3056 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3057 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3058 "{fm|fmul} %0,%1,%2"
3059 [(set_attr "type" "dmul")])
3061 (define_expand "divsf3"
3062 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3063 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
3064 (match_operand:SF 2 "gpc_reg_operand" "")))]
3069 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3070 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3071 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3072 "TARGET_POWERPC && TARGET_HARD_FLOAT"
3074 [(set_attr "type" "sdiv")])
3077 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3078 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
3079 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3080 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
3081 "{fd|fdiv} %0,%1,%2"
3082 [(set_attr "type" "ddiv")])
3085 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3086 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3087 (match_operand:SF 2 "gpc_reg_operand" "f"))
3088 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3089 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3090 "fmadds %0,%1,%2,%3"
3091 [(set_attr "type" "fp")])
3094 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3095 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3096 (match_operand:SF 2 "gpc_reg_operand" "f"))
3097 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3098 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3099 "{fma|fmadd} %0,%1,%2,%3"
3100 [(set_attr "type" "dmul")])
3103 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3104 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3105 (match_operand:SF 2 "gpc_reg_operand" "f"))
3106 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3107 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3108 "fmsubs %0,%1,%2,%3"
3109 [(set_attr "type" "fp")])
3112 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3113 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3114 (match_operand:SF 2 "gpc_reg_operand" "f"))
3115 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3116 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3117 "{fms|fmsub} %0,%1,%2,%3"
3118 [(set_attr "type" "dmul")])
3121 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3122 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3123 (match_operand:SF 2 "gpc_reg_operand" "f"))
3124 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3125 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3126 "fnmadds %0,%1,%2,%3"
3127 [(set_attr "type" "fp")])
3130 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3131 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3132 (match_operand:SF 2 "gpc_reg_operand" "f"))
3133 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3134 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3135 "{fnma|fnmadd} %0,%1,%2,%3"
3136 [(set_attr "type" "dmul")])
3139 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3140 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3141 (match_operand:SF 2 "gpc_reg_operand" "f"))
3142 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3143 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3144 "fnmsubs %0,%1,%2,%3"
3145 [(set_attr "type" "fp")])
3148 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3149 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
3150 (match_operand:SF 2 "gpc_reg_operand" "f"))
3151 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
3152 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3153 "{fnms|fnmsub} %0,%1,%2,%3"
3154 [(set_attr "type" "dmul")])
3156 (define_expand "sqrtsf2"
3157 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3158 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
3159 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3163 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3164 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3165 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
3167 [(set_attr "type" "ssqrt")])
3170 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3171 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
3172 "TARGET_POWER2 && TARGET_HARD_FLOAT"
3174 [(set_attr "type" "dsqrt")])
3176 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3177 ;; fsel instruction and some auxiliary computations. Then we just have a
3178 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3180 (define_expand "maxsf3"
3182 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
3183 (match_operand:SF 2 "gpc_reg_operand" "")))
3184 (set (match_operand:SF 0 "gpc_reg_operand" "")
3185 (if_then_else:SF (ge (match_dup 3)
3189 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3191 { operands[3] = gen_reg_rtx (SFmode); }")
3194 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3195 (smax:SF (match_operand:SF 1 "gpc_reg_operand" "")
3196 (match_operand:SF 2 "gpc_reg_operand" "")))
3197 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3198 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3200 (minus:SF (match_dup 1) (match_dup 2)))
3202 (if_then_else:SF (ge (match_dup 3)
3208 (define_expand "minsf3"
3210 (minus:SF (match_operand:SF 2 "gpc_reg_operand" "")
3211 (match_operand:SF 1 "gpc_reg_operand" "")))
3212 (set (match_operand:SF 0 "gpc_reg_operand" "")
3213 (if_then_else:SF (ge (match_dup 3)
3217 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3219 { operands[3] = gen_reg_rtx (SFmode); }")
3222 [(set (match_operand:SF 0 "gpc_reg_operand" "")
3223 (smin:SF (match_operand:SF 1 "gpc_reg_operand" "")
3224 (match_operand:SF 2 "gpc_reg_operand" "")))
3225 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
3226 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3228 (minus:SF (match_dup 2) (match_dup 1)))
3230 (if_then_else:SF (ge (match_dup 3)
3236 (define_expand "movsfcc"
3237 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3238 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3239 (match_operand:SF 2 "gpc_reg_operand" "f")
3240 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3241 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3245 enum rtx_code code = GET_CODE (operands[1]);
3246 if (! rs6000_compare_fp_p)
3250 case GE: case EQ: case NE:
3251 op0 = rs6000_compare_op0;
3252 op1 = rs6000_compare_op1;
3255 op0 = rs6000_compare_op1;
3256 op1 = rs6000_compare_op0;
3257 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3260 op0 = rs6000_compare_op1;
3261 op1 = rs6000_compare_op0;
3264 op0 = rs6000_compare_op0;
3265 op1 = rs6000_compare_op1;
3266 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3271 if (GET_MODE (rs6000_compare_op0) == DFmode)
3273 temp = gen_reg_rtx (DFmode);
3274 emit_insn (gen_subdf3 (temp, op0, op1));
3275 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[2], operands[3]));
3278 emit_insn (gen_negdf2 (temp, temp));
3279 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[0], operands[3]));
3283 emit_insn (gen_negdf2 (temp, temp));
3284 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[3], operands[0]));
3289 temp = gen_reg_rtx (SFmode);
3290 emit_insn (gen_subsf3 (temp, op0, op1));
3291 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[2], operands[3]));
3294 emit_insn (gen_negsf2 (temp, temp));
3295 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[0], operands[3]));
3299 emit_insn (gen_negsf2 (temp, temp));
3300 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[3], operands[0]));
3306 (define_insn "fselsfsf4"
3307 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3308 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3310 (match_operand:SF 2 "gpc_reg_operand" "f")
3311 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3312 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3314 [(set_attr "type" "fp")])
3316 (define_insn "fseldfsf4"
3317 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3318 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3320 (match_operand:SF 2 "gpc_reg_operand" "f")
3321 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3322 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3324 [(set_attr "type" "fp")])
3326 (define_insn "negdf2"
3327 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3328 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3331 [(set_attr "type" "fp")])
3333 (define_insn "absdf2"
3334 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3335 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3338 [(set_attr "type" "fp")])
3341 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3342 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3345 [(set_attr "type" "fp")])
3347 (define_insn "adddf3"
3348 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3349 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3350 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3352 "{fa|fadd} %0,%1,%2"
3353 [(set_attr "type" "fp")])
3355 (define_insn "subdf3"
3356 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3357 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3358 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3360 "{fs|fsub} %0,%1,%2"
3361 [(set_attr "type" "fp")])
3363 (define_insn "muldf3"
3364 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3365 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3366 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3368 "{fm|fmul} %0,%1,%2"
3369 [(set_attr "type" "dmul")])
3371 (define_insn "divdf3"
3372 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3373 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3374 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3376 "{fd|fdiv} %0,%1,%2"
3377 [(set_attr "type" "ddiv")])
3380 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3381 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3382 (match_operand:DF 2 "gpc_reg_operand" "f"))
3383 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3384 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3385 "{fma|fmadd} %0,%1,%2,%3"
3386 [(set_attr "type" "dmul")])
3389 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3390 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3391 (match_operand:DF 2 "gpc_reg_operand" "f"))
3392 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3393 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3394 "{fms|fmsub} %0,%1,%2,%3"
3395 [(set_attr "type" "dmul")])
3398 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3399 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3400 (match_operand:DF 2 "gpc_reg_operand" "f"))
3401 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3402 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3403 "{fnma|fnmadd} %0,%1,%2,%3"
3404 [(set_attr "type" "dmul")])
3407 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3408 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3409 (match_operand:DF 2 "gpc_reg_operand" "f"))
3410 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3411 "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
3412 "{fnms|fnmsub} %0,%1,%2,%3"
3413 [(set_attr "type" "dmul")])
3415 (define_insn "sqrtdf2"
3416 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3417 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3418 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3420 [(set_attr "type" "dsqrt")])
3422 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3423 ;; fsel instruction and some auxiliary computations. Then we just have a
3424 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3427 (define_expand "maxdf3"
3429 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
3430 (match_operand:DF 2 "gpc_reg_operand" "")))
3431 (set (match_operand:DF 0 "gpc_reg_operand" "")
3432 (if_then_else:DF (ge (match_dup 3)
3436 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3438 { operands[3] = gen_reg_rtx (DFmode); }")
3441 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3442 (smax:DF (match_operand:DF 1 "gpc_reg_operand" "")
3443 (match_operand:DF 2 "gpc_reg_operand" "")))
3444 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3445 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3447 (minus:DF (match_dup 1) (match_dup 2)))
3449 (if_then_else:DF (ge (match_dup 3)
3455 (define_expand "mindf3"
3457 (minus:DF (match_operand:DF 2 "gpc_reg_operand" "")
3458 (match_operand:DF 1 "gpc_reg_operand" "")))
3459 (set (match_operand:DF 0 "gpc_reg_operand" "")
3460 (if_then_else:DF (ge (match_dup 3)
3464 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3466 { operands[3] = gen_reg_rtx (DFmode); }")
3469 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3470 (smin:DF (match_operand:DF 1 "gpc_reg_operand" "")
3471 (match_operand:DF 2 "gpc_reg_operand" "")))
3472 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3473 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3475 (minus:DF (match_dup 2) (match_dup 1)))
3477 (if_then_else:DF (ge (match_dup 3)
3483 (define_expand "movdfcc"
3484 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3485 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3486 (match_operand:DF 2 "gpc_reg_operand" "f")
3487 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3488 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3492 enum rtx_code code = GET_CODE (operands[1]);
3493 if (! rs6000_compare_fp_p)
3497 case GE: case EQ: case NE:
3498 op0 = rs6000_compare_op0;
3499 op1 = rs6000_compare_op1;
3502 op0 = rs6000_compare_op1;
3503 op1 = rs6000_compare_op0;
3504 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3507 op0 = rs6000_compare_op1;
3508 op1 = rs6000_compare_op0;
3511 op0 = rs6000_compare_op0;
3512 op1 = rs6000_compare_op1;
3513 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3518 if (GET_MODE (rs6000_compare_op0) == DFmode)
3520 temp = gen_reg_rtx (DFmode);
3521 emit_insn (gen_subdf3 (temp, op0, op1));
3522 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[2], operands[3]));
3525 emit_insn (gen_negdf2 (temp, temp));
3526 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[0], operands[3]));
3530 emit_insn (gen_negdf2 (temp, temp));
3531 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[3], operands[0]));
3536 temp = gen_reg_rtx (SFmode);
3537 emit_insn (gen_subsf3 (temp, op0, op1));
3538 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[2], operands[3]));
3541 emit_insn (gen_negsf2 (temp, temp));
3542 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[0], operands[3]));
3546 emit_insn (gen_negsf2 (temp, temp));
3547 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[3], operands[0]));
3553 (define_insn "fseldfdf4"
3554 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3555 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3557 (match_operand:DF 2 "gpc_reg_operand" "f")
3558 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3559 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3561 [(set_attr "type" "fp")])
3563 (define_insn "fselsfdf4"
3564 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3565 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3567 (match_operand:DF 2 "gpc_reg_operand" "f")
3568 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3571 [(set_attr "type" "fp")])
3573 ;; Conversions to and from floating-point.
3575 (define_expand "floatsidf2"
3576 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
3577 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3580 (clobber (match_dup 4))
3581 (clobber (match_dup 5))
3582 (clobber (reg:DF 76))])]
3583 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3586 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
3587 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503601774854144\", DFmode));
3588 operands[4] = gen_reg_rtx (SImode);
3589 operands[5] = gen_reg_rtx (Pmode);
3592 (define_insn "*floatsidf2_internal"
3593 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
3594 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
3595 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
3596 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
3597 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
3598 (clobber (match_operand:SI 5 "gpc_reg_operand" "=b"))
3599 (clobber (reg:DF 76))]
3600 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3602 [(set_attr "length" "24")])
3605 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3606 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3607 (use (match_operand:SI 2 "gpc_reg_operand" ""))
3608 (use (match_operand:DF 3 "gpc_reg_operand" ""))
3609 (clobber (match_operand:SI 4 "gpc_reg_operand" ""))
3610 (clobber (match_operand:SI 5 "gpc_reg_operand" ""))
3611 (clobber (reg:DF 76))]
3612 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3614 (xor:SI (match_dup 1)
3617 (unspec [(const_int 0)] 11))
3619 (unspec [(match_dup 4)
3620 (match_dup 5)] 12)) ;; low word
3622 (unspec [(match_dup 2)
3624 (match_dup 7)] 13)) ;; high word
3626 (unspec [(match_dup 7)
3629 (minus:DF (match_dup 0)
3633 operands[6] = GEN_INT (0x80000000);
3634 operands[7] = gen_rtx (REG, DFmode, FPMEM_REGNUM);
3637 (define_expand "floatunssidf2"
3638 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
3639 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3642 (clobber (match_dup 4))
3643 (clobber (reg:DF 76))])]
3644 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3647 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
3648 operands[3] = force_reg (DFmode, rs6000_float_const (\"4503599627370496\", DFmode));
3649 operands[4] = gen_reg_rtx (Pmode);
3652 (define_insn "*floatunssidf2_internal"
3653 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
3654 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
3655 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
3656 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
3657 (clobber (match_operand:SI 4 "gpc_reg_operand" "=b"))
3658 (clobber (reg:DF 76))]
3659 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3661 [(set_attr "length" "20")])
3664 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3665 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
3666 (use (match_operand:SI 2 "gpc_reg_operand" ""))
3667 (use (match_operand:DF 3 "gpc_reg_operand" ""))
3668 (clobber (match_operand:SI 4 "gpc_reg_operand" "=b"))
3669 (clobber (reg:DF 76))]
3670 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3672 (unspec [(const_int 0)] 11))
3674 (unspec [(match_dup 1)
3675 (match_dup 4)] 12)) ;; low word
3677 (unspec [(match_dup 2)
3679 (match_dup 5)] 13)) ;; high word
3681 (unspec [(match_dup 5)
3684 (minus:DF (match_dup 0)
3686 "operands[5] = gen_rtx (REG, DFmode, FPMEM_REGNUM);")
3688 ;; Load up scratch register with base address + offset if needed
3689 (define_insn "*floatsidf2_loadaddr"
3690 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
3691 (unspec [(const_int 0)] 11))]
3695 if (rs6000_fpmem_offset > 32760)
3699 xop[0] = operands[0];
3700 xop[1] = (frame_pointer_needed) ? frame_pointer_rtx : stack_pointer_rtx;
3701 xop[2] = GEN_INT ((rs6000_fpmem_offset >> 16) + ((rs6000_fpmem_offset & 0x8000) >> 15));
3702 output_asm_insn (\"{cau|addis} %0,%1,%2\", xop);
3704 else if (rs6000_fpmem_offset < 0)
3709 [(set_attr "length" "4")])
3711 (define_insn "*floatsidf2_store1"
3713 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
3714 (match_operand:SI 1 "gpc_reg_operand" "r")] 12))]
3715 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3720 if (rs6000_fpmem_offset > 32760)
3722 else if (frame_pointer_needed)
3723 indx = frame_pointer_rtx;
3725 indx = stack_pointer_rtx;
3727 operands[2] = gen_rtx (MEM, SImode,
3728 gen_rtx (PLUS, Pmode,
3730 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
3731 + ((WORDS_BIG_ENDIAN != 0) * 4))));
3733 return \"{st|stw} %0,%2\";
3735 [(set_attr "type" "store")])
3737 (define_insn "*floatsidf2_store2"
3739 (unspec [(match_operand:SI 0 "gpc_reg_operand" "r")
3740 (match_operand:SI 1 "gpc_reg_operand" "r")
3742 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3747 if (rs6000_fpmem_offset > 32760)
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,
3757 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
3758 + ((WORDS_BIG_ENDIAN == 0) * 4))));
3760 return \"{st|stw} %0,%2\";
3762 [(set_attr "type" "store")])
3764 (define_insn "*floatsidf2_load"
3765 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3766 (unspec [(reg:DF 76)
3767 (match_operand:SI 1 "gpc_reg_operand" "b")] 14))]
3768 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3772 HOST_WIDE_INT offset = rs6000_fpmem_offset;
3774 if (rs6000_fpmem_offset > 32760)
3777 offset = (((offset & 0xffff) ^ 0x8000) - 0x8000);
3779 else if (frame_pointer_needed)
3780 indx = frame_pointer_rtx;
3782 indx = stack_pointer_rtx;
3784 operands[2] = gen_rtx (MEM, SImode,
3785 gen_rtx (PLUS, Pmode, indx, GEN_INT (offset)));
3787 return \"lfd %0,%2\";
3789 [(set_attr "type" "fpload")])
3791 (define_expand "fix_truncdfsi2"
3792 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
3793 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
3794 (clobber (match_dup 2))
3795 (clobber (match_dup 3))
3796 (clobber (match_dup 4))])]
3800 if (!TARGET_POWER2 && !TARGET_POWERPC)
3802 emit_insn (gen_trunc_call (operands[0], operands[1],
3803 gen_rtx (SYMBOL_REF, Pmode, RS6000_ITRUNC)));
3807 operands[2] = gen_reg_rtx (DImode);
3808 operands[3] = gen_reg_rtx (Pmode);
3809 operands[4] = gen_rtx (REG, DImode, FPMEM_REGNUM);
3812 (define_insn "*fix_truncdfsi2_internal"
3813 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3814 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
3815 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
3816 (clobber (match_operand:SI 3 "gpc_reg_operand" "=b"))
3817 (clobber (reg:DI 76))]
3820 [(set_attr "length" "12")])
3823 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3824 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
3825 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
3826 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))
3827 (clobber (reg:DI 76))]
3830 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" ""))))
3832 (unspec [(const_int 0)] 11))
3834 (unspec [(match_dup 2)
3836 (set (match_operand:SI 0 "gpc_reg_operand" "")
3837 (unspec [(match_dup 4)
3838 (match_dup 3)] 16))]
3839 "operands[4] = gen_rtx (REG, DImode, FPMEM_REGNUM);")
3841 (define_insn "*fctiwz"
3842 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3843 (sign_extend:DI (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3844 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3845 "{fcirz|fctiwz} %0,%1"
3846 [(set_attr "type" "fp")])
3848 (define_insn "*fix_truncdfsi2_store"
3850 (unspec [(match_operand:DI 0 "gpc_reg_operand" "f")
3851 (match_operand:SI 1 "gpc_reg_operand" "b")] 15))]
3852 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3857 if (rs6000_fpmem_offset > 32760)
3859 else if (frame_pointer_needed)
3860 indx = frame_pointer_rtx;
3862 indx = stack_pointer_rtx;
3864 operands[2] = gen_rtx (MEM, DFmode,
3865 gen_rtx (PLUS, Pmode,
3867 GEN_INT ((((rs6000_fpmem_offset & 0xffff)
3868 ^ 0x8000) - 0x8000))));
3870 return \"stfd %0,%w2\";
3872 [(set_attr "type" "fpstore")])
3874 (define_insn "*fix_truncdfsi2_load"
3875 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3876 (unspec [(reg:DI 76)
3877 (match_operand:SI 1 "gpc_reg_operand" "b")] 16))]
3878 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3883 if (rs6000_fpmem_offset > 32760)
3885 else if (frame_pointer_needed)
3886 indx = frame_pointer_rtx;
3888 indx = stack_pointer_rtx;
3890 operands[2] = gen_rtx (MEM, DFmode,
3891 gen_rtx (PLUS, Pmode,
3893 GEN_INT ((((rs6000_fpmem_offset & 0xffff) ^ 0x8000) - 0x8000)
3894 + ((WORDS_BIG_ENDIAN) ? 4 : 0))));
3896 return \"{l|lwz} %0,%2\";
3898 [(set_attr "type" "load")])
3900 (define_expand "fixuns_truncdfsi2"
3901 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3902 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
3903 "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
3906 emit_insn (gen_trunc_call (operands[0], operands[1],
3907 gen_rtx (SYMBOL_REF, Pmode, RS6000_UITRUNC)));
3911 (define_expand "trunc_call"
3912 [(parallel [(set (match_operand:SI 0 "" "")
3913 (fix:SI (match_operand:DF 1 "" "")))
3914 (use (match_operand:SI 2 "" ""))])]
3918 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
3919 rtx first = XVECEXP (insns, 0, 0);
3920 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
3922 REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
3924 REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
3930 (define_expand "trunc_call_rtl"
3931 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
3933 (parallel [(set (reg:SI 3)
3934 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
3936 (clobber (scratch:SI))])
3937 (set (match_operand:SI 0 "gpc_reg_operand" "")
3942 rs6000_trunc_used = 1;
3945 (define_insn "floatdidf2"
3946 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3947 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
3948 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3950 [(set_attr "type" "fp")])
3952 (define_insn "fix_truncdfdi2"
3953 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3954 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
3955 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3957 [(set_attr "type" "fp")])
3959 ;; Define the DImode operations that can be done in a small number
3960 ;; of instructions. The & constraints are to prevent the register
3961 ;; allocator from allocating registers that overlap with the inputs
3962 ;; (for example, having an input in 7,8 and an output in 6,7). We
3963 ;; also allow for the the output being the same as one of the inputs.
3965 (define_insn "*adddi3_noppc64"
3966 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
3967 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
3968 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
3969 "! TARGET_POWERPC64"
3972 if (WORDS_BIG_ENDIAN)
3973 return (GET_CODE (operands[2])) != CONST_INT
3974 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
3975 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
3977 return (GET_CODE (operands[2])) != CONST_INT
3978 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
3979 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
3981 [(set_attr "length" "8")])
3983 (define_insn "*subdi3_noppc64"
3984 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
3985 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
3986 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
3987 "! TARGET_POWERPC64"
3990 if (WORDS_BIG_ENDIAN)
3991 return (GET_CODE (operands[1]) != CONST_INT)
3992 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
3993 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
3995 return (GET_CODE (operands[1]) != CONST_INT)
3996 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
3997 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
3999 [(set_attr "length" "8")])
4001 (define_insn "*negdi2_noppc64"
4002 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4003 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
4004 "! TARGET_POWERPC64"
4007 return (WORDS_BIG_ENDIAN)
4008 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
4009 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
4011 [(set_attr "length" "8")])
4013 (define_expand "mulsidi3"
4014 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4015 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4016 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4020 if (! TARGET_POWER && ! TARGET_POWERPC)
4022 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
4023 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
4024 emit_insn (gen_mull_call ());
4025 if (WORDS_BIG_ENDIAN)
4026 emit_move_insn (operands[0], gen_rtx (REG, DImode, 3));
4029 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
4030 gen_rtx (REG, SImode, 3));
4031 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
4032 gen_rtx (REG, SImode, 4));
4036 else if (TARGET_POWER)
4038 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
4043 (define_insn "mulsidi3_mq"
4044 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4045 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4046 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
4047 (clobber (match_scratch:SI 3 "=q"))]
4049 "mul %0,%1,%2\;mfmq %L0"
4050 [(set_attr "type" "imul")
4051 (set_attr "length" "8")])
4053 (define_insn "*mulsidi3_no_mq"
4054 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4055 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4056 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
4057 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
4060 return (WORDS_BIG_ENDIAN)
4061 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
4062 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
4064 [(set_attr "type" "imul")
4065 (set_attr "length" "8")])
4068 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4069 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4070 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4071 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
4074 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
4075 (sign_extend:DI (match_dup 2)))
4078 (mult:SI (match_dup 1)
4082 int endian = (WORDS_BIG_ENDIAN == 0);
4083 operands[3] = operand_subword (operands[0], endian, 0, DImode);
4084 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
4087 (define_expand "umulsidi3"
4088 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4089 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4090 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4091 "TARGET_POWERPC && ! TARGET_POWERPC64"
4096 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
4101 (define_insn "umulsidi3_mq"
4102 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4103 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4104 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
4105 (clobber (match_scratch:SI 3 "=q"))]
4106 "TARGET_POWERPC && TARGET_POWER"
4109 return (WORDS_BIG_ENDIAN)
4110 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
4111 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
4113 [(set_attr "type" "imul")
4114 (set_attr "length" "8")])
4116 (define_insn "*umulsidi3_no_mq"
4117 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4118 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
4119 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
4120 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
4123 return (WORDS_BIG_ENDIAN)
4124 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
4125 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
4127 [(set_attr "type" "imul")
4128 (set_attr "length" "8")])
4131 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4132 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
4133 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
4134 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
4137 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
4138 (zero_extend:DI (match_dup 2)))
4141 (mult:SI (match_dup 1)
4145 int endian = (WORDS_BIG_ENDIAN == 0);
4146 operands[3] = operand_subword (operands[0], endian, 0, DImode);
4147 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
4150 (define_expand "smulsi3_highpart"
4151 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4153 (lshiftrt:DI (mult:DI (sign_extend:DI
4154 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4156 (match_operand:SI 2 "gpc_reg_operand" "r")))
4161 if (! TARGET_POWER && ! TARGET_POWERPC)
4163 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
4164 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
4165 emit_insn (gen_mulh_call ());
4166 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
4169 else if (TARGET_POWER)
4171 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
4176 (define_insn "smulsi3_highpart_mq"
4177 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4179 (lshiftrt:DI (mult:DI (sign_extend:DI
4180 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4182 (match_operand:SI 2 "gpc_reg_operand" "r")))
4184 (clobber (match_scratch:SI 3 "=q"))]
4187 [(set_attr "type" "imul")])
4189 (define_insn "*smulsi3_highpart_no_mq"
4190 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4192 (lshiftrt:DI (mult:DI (sign_extend:DI
4193 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4195 (match_operand:SI 2 "gpc_reg_operand" "r")))
4197 "TARGET_POWERPC && ! TARGET_POWER"
4199 [(set_attr "type" "imul")])
4201 (define_expand "umulsi3_highpart"
4202 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4204 (lshiftrt:DI (mult:DI (zero_extend:DI
4205 (match_operand:SI 1 "gpc_reg_operand" ""))
4207 (match_operand:SI 2 "gpc_reg_operand" "")))
4214 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
4219 (define_insn "umulsi3_highpart_mq"
4220 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4222 (lshiftrt:DI (mult:DI (zero_extend:DI
4223 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4225 (match_operand:SI 2 "gpc_reg_operand" "r")))
4227 (clobber (match_scratch:SI 3 "=q"))]
4228 "TARGET_POWERPC && TARGET_POWER"
4230 [(set_attr "type" "imul")])
4232 (define_insn "*umulsi3_highpart_no_mq"
4233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4235 (lshiftrt:DI (mult:DI (zero_extend:DI
4236 (match_operand:SI 1 "gpc_reg_operand" "%r"))
4238 (match_operand:SI 2 "gpc_reg_operand" "r")))
4240 "TARGET_POWERPC && ! TARGET_POWER"
4242 [(set_attr "type" "imul")])
4244 ;; If operands 0 and 2 are in the same register, we have a problem. But
4245 ;; operands 0 and 1 (the usual case) can be in the same register. That's
4246 ;; why we have the strange constraints below.
4247 (define_insn "ashldi3_power"
4248 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
4249 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
4250 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
4251 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
4254 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
4255 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
4256 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
4257 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
4258 [(set_attr "length" "8")])
4260 (define_insn "lshrdi3_power"
4261 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
4262 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
4263 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
4264 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
4267 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
4268 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
4269 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
4270 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
4271 [(set_attr "length" "8")])
4273 ;; Shift by a variable amount is too complex to be worth open-coding. We
4274 ;; just handle shifts by constants.
4275 (define_insn "ashrdi3_power"
4276 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4277 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
4278 (match_operand:SI 2 "const_int_operand" "M,i")))
4279 (clobber (match_scratch:SI 3 "=X,q"))]
4282 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
4283 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
4284 [(set_attr "length" "8")])
4286 ;; PowerPC64 DImode operations.
4288 (define_expand "adddi3"
4289 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4290 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
4291 (match_operand:DI 2 "add_operand" "")))]
4295 if (! TARGET_POWERPC64 && non_short_cint_operand (operands[2], DImode))
4299 ;; Discourage ai/addic because of carry but provide it in an alternative
4300 ;; allowing register zero as source.
4303 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
4304 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
4305 (match_operand:DI 2 "add_operand" "r,I,I,J")))]
4314 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4315 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
4316 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
4318 (clobber (match_scratch:DI 3 "=r,r"))]
4323 [(set_attr "type" "compare")])
4326 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
4327 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
4328 (match_operand:DI 2 "reg_or_short_operand" "r,I"))
4330 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4331 (plus:DI (match_dup 1) (match_dup 2)))]
4336 [(set_attr "type" "compare")])
4338 ;; Split an add that we can't do in one insn into two insns, each of which
4339 ;; does one 16-bit part. This is used by combine. Note that the low-order
4340 ;; add should be last in case the result gets used in an address.
4343 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4344 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
4345 (match_operand:DI 2 "non_add_cint_operand" "")))]
4347 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
4348 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4351 HOST_WIDE_INT low = INTVAL (operands[2]) & 0xffff;
4352 HOST_WIDE_INT high = INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff);
4355 high+=0x10000, low |= ((HOST_WIDE_INT) -1) << 16;
4357 operands[3] = GEN_INT (high);
4358 operands[4] = GEN_INT (low);
4361 (define_insn "one_cmpldi2"
4362 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4363 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4368 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4369 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4371 (clobber (match_scratch:DI 2 "=r"))]
4374 [(set_attr "type" "compare")])
4377 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4378 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4380 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4381 (not:DI (match_dup 1)))]
4384 [(set_attr "type" "compare")])
4387 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
4388 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
4389 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
4396 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4397 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4398 (match_operand:DI 2 "gpc_reg_operand" "r"))
4400 (clobber (match_scratch:DI 3 "=r"))]
4403 [(set_attr "type" "compare")])
4406 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4407 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4408 (match_operand:DI 2 "gpc_reg_operand" "r"))
4410 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4411 (minus:DI (match_dup 1) (match_dup 2)))]
4414 [(set_attr "type" "compare")])
4416 (define_expand "subdi3"
4417 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4418 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
4419 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4423 if (GET_CODE (operands[2]) == CONST_INT)
4425 emit_insn (gen_adddi3 (operands[0], operands[1],
4426 negate_rtx (DImode, operands[2])));
4431 (define_insn "absdi2"
4432 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4433 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4434 (clobber (match_scratch:DI 2 "=&r,&r"))]
4436 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0"
4437 [(set_attr "length" "12")])
4440 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4441 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
4442 (clobber (match_scratch:DI 2 "=&r,&r"))]
4443 "TARGET_POWERPC64 && reload_completed"
4444 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4445 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4446 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
4450 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4451 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4452 (clobber (match_scratch:DI 2 "=&r,&r"))]
4454 "sradi %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2"
4455 [(set_attr "length" "12")])
4458 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
4459 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
4460 (clobber (match_scratch:DI 2 "=&r,&r"))]
4461 "TARGET_POWERPC64 && reload_completed"
4462 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 31)))
4463 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
4464 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
4467 (define_expand "negdi2"
4468 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4469 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
4474 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4475 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4480 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4481 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4483 (clobber (match_scratch:DI 2 "=r"))]
4486 [(set_attr "type" "compare")])
4489 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4490 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4492 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4493 (neg:DI (match_dup 1)))]
4496 [(set_attr "type" "compare")])
4498 (define_insn "ffsdi2"
4499 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
4500 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
4502 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
4503 [(set_attr "length" "16")])
4505 (define_insn "muldi3"
4506 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4507 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4508 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4511 [(set_attr "type" "imul")])
4513 (define_insn "smuldi3_highpart"
4514 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4516 (lshiftrt:TI (mult:TI (sign_extend:TI
4517 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4519 (match_operand:DI 2 "gpc_reg_operand" "r")))
4523 [(set_attr "type" "imul")])
4525 (define_insn "umuldi3_highpart"
4526 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4528 (lshiftrt:TI (mult:TI (zero_extend:TI
4529 (match_operand:DI 1 "gpc_reg_operand" "%r"))
4531 (match_operand:DI 2 "gpc_reg_operand" "r")))
4535 [(set_attr "type" "imul")])
4537 (define_expand "divdi3"
4538 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4539 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
4540 (match_operand:DI 2 "reg_or_cint_operand" "")))]
4544 if (GET_CODE (operands[2]) == CONST_INT
4545 && exact_log2 (INTVAL (operands[2])) >= 0)
4548 operands[2] = force_reg (DImode, operands[2]);
4551 (define_expand "moddi3"
4552 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
4553 (use (match_operand:DI 1 "gpc_reg_operand" ""))
4554 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
4558 int i = exact_log2 (INTVAL (operands[2]));
4562 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
4565 temp1 = gen_reg_rtx (DImode);
4566 temp2 = gen_reg_rtx (DImode);
4568 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
4569 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
4570 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
4575 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4576 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4577 (match_operand:DI 2 "const_int_operand" "N")))]
4578 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4579 "sradi %0,%1,%p2\;addze %0,%0"
4580 [(set_attr "length" "8")])
4583 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4584 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4585 (match_operand:DI 2 "const_int_operand" "N"))
4587 (clobber (match_scratch:DI 3 "=r"))]
4588 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4589 "sradi %3,%1,%p2\;addze. %3,%3"
4590 [(set_attr "type" "compare")
4591 (set_attr "length" "8")])
4594 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4595 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4596 (match_operand:DI 2 "const_int_operand" "N"))
4598 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4599 (div:DI (match_dup 1) (match_dup 2)))]
4600 "TARGET_POWERPC64 && exact_log2 (INTVAL (operands[2])) >= 0"
4601 "sradi %0,%1,%p2\;addze. %0,%0"
4602 [(set_attr "type" "compare")
4603 (set_attr "length" "8")])
4606 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4607 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4608 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4611 [(set_attr "type" "idiv")])
4613 (define_insn "udivdi3"
4614 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4615 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4616 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4619 [(set_attr "type" "idiv")])
4621 (define_insn "rotldi3"
4622 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4623 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4624 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
4626 "rld%I2cl %0,%1,%H2,0")
4629 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4630 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4631 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4633 (clobber (match_scratch:DI 3 "=r"))]
4635 "rld%I2cl. %3,%1,%H2,0"
4636 [(set_attr "type" "delayed_compare")])
4639 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4640 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4641 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
4643 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4644 (rotate:DI (match_dup 1) (match_dup 2)))]
4646 "rld%I2cl. %0,%1,%H2,0"
4647 [(set_attr "type" "delayed_compare")])
4649 (define_expand "ashldi3"
4650 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4651 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
4652 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4653 "TARGET_POWERPC64 || TARGET_POWER"
4656 if (TARGET_POWERPC64)
4658 else if (TARGET_POWER)
4660 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
4668 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4669 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4670 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4673 [(set_attr "length" "8")])
4676 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4677 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4678 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4680 (clobber (match_scratch:DI 3 "=r"))]
4683 [(set_attr "type" "delayed_compare")])
4686 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4687 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4688 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4690 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4691 (ashift:DI (match_dup 1) (match_dup 2)))]
4694 [(set_attr "type" "delayed_compare")])
4696 (define_expand "lshrdi3"
4697 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4698 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4699 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4700 "TARGET_POWERPC64 || TARGET_POWER"
4703 if (TARGET_POWERPC64)
4705 else if (TARGET_POWER)
4707 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
4715 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4716 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4717 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4722 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4723 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4724 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4726 (clobber (match_scratch:DI 3 "=r"))]
4729 [(set_attr "type" "delayed_compare")])
4732 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4733 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4734 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4736 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4737 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
4740 [(set_attr "type" "delayed_compare")])
4742 (define_expand "ashrdi3"
4743 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4744 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
4745 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4746 "TARGET_POWERPC64 || TARGET_POWER"
4749 if (TARGET_POWERPC64)
4751 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
4753 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
4761 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4762 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4763 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4765 "srad%I2 %0,%1,%H2")
4768 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4769 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4770 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4772 (clobber (match_scratch:DI 3 "=r"))]
4774 "srad%I2. %3,%1,%H2"
4775 [(set_attr "type" "delayed_compare")])
4778 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4779 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
4780 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
4782 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4783 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
4785 "srad%I2. %0,%1,%H2"
4786 [(set_attr "type" "delayed_compare")])
4788 (define_insn "anddi3"
4789 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4790 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4791 (match_operand:DI 2 "and_operand" "?r,K,J")))
4792 (clobber (match_scratch:CC 3 "=X,x,x"))]
4800 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
4801 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4802 (match_operand:DI 2 "and_operand" "r,K,J"))
4804 (clobber (match_scratch:DI 3 "=r,r,r"))]
4810 [(set_attr "type" "compare,compare,compare")])
4813 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x")
4814 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4815 (match_operand:DI 2 "and_operand" "r,K,J"))
4817 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4818 (and:DI (match_dup 1) (match_dup 2)))]
4824 [(set_attr "type" "compare,compare,compare")])
4826 ;; Take a AND with a constant that cannot be done in a single insn and try to
4827 ;; split it into two insns. This does not verify that the insns are valid
4828 ;; since this need not be done as combine will do it.
4831 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4832 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
4833 (match_operand:DI 2 "non_and_cint_operand" "")))]
4835 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
4836 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
4839 int maskval = INTVAL (operands[2]);
4840 int i, transitions, last_bit_value;
4841 int orig = maskval, first_c = maskval, second_c;
4843 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
4844 the low-order bit and count for the third transition. When we get there,
4845 make a first mask that has everything to the left of that position
4846 a one. Then make the second mask to turn off whatever else is needed. */
4848 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
4850 if (((maskval >>= 1) & 1) != last_bit_value)
4851 last_bit_value ^= 1, transitions++;
4853 if (transitions > 2)
4855 first_c |= (~0) << i;
4860 second_c = orig | ~ first_c;
4862 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
4863 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
4866 (define_insn "iordi3"
4867 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4868 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4869 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4877 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4878 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4879 (match_operand:DI 2 "gpc_reg_operand" "r"))
4881 (clobber (match_scratch:DI 3 "=r"))]
4884 [(set_attr "type" "compare")])
4887 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4888 (compare:CC (ior:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4889 (match_operand:DI 2 "gpc_reg_operand" "r"))
4891 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4892 (ior:DI (match_dup 1) (match_dup 2)))]
4895 [(set_attr "type" "compare")])
4897 ;; Split an IOR that we can't do in one insn into two insns, each of which
4898 ;; does one 16-bit part. This is used by combine.
4901 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4902 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
4903 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4905 [(set (match_dup 0) (ior:DI (match_dup 1) (match_dup 3)))
4906 (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 4)))]
4909 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4910 INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
4911 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4914 (define_insn "xordi3"
4915 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
4916 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
4917 (match_operand:DI 2 "logical_operand" "r,K,J")))]
4925 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4926 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4927 (match_operand:DI 2 "gpc_reg_operand" "r"))
4929 (clobber (match_scratch:DI 3 "=r"))]
4932 [(set_attr "type" "compare")])
4935 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4936 (compare:CC (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4937 (match_operand:DI 2 "gpc_reg_operand" "r"))
4939 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4940 (xor:DI (match_dup 1) (match_dup 2)))]
4943 [(set_attr "type" "compare")])
4945 ;; Split an XOR that we can't do in one insn into two insns, each of which
4946 ;; does one 16-bit part. This is used by combine.
4949 [(set (match_operand:DI 0 "gpc_reg_operand" "")
4950 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
4951 (match_operand:DI 2 "non_logical_cint_operand" "")))]
4953 [(set (match_dup 0) (xor:DI (match_dup 1) (match_dup 3)))
4954 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 4)))]
4957 operands[3] = gen_rtx (CONST_INT, VOIDmode,
4958 INTVAL (operands[2]) & 0xffff0000);
4959 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
4963 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4964 (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4965 (match_operand:DI 2 "gpc_reg_operand" "r"))))]
4970 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4971 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4972 (match_operand:DI 2 "gpc_reg_operand" "r")))
4974 (clobber (match_scratch:DI 3 "=r"))]
4977 [(set_attr "type" "compare")])
4980 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4981 (compare:CC (not:DI (xor:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
4982 (match_operand:DI 2 "gpc_reg_operand" "r")))
4984 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
4985 (not:DI (xor:DI (match_dup 1) (match_dup 2))))]
4988 [(set_attr "type" "compare")])
4991 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
4992 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
4993 (match_operand:DI 2 "gpc_reg_operand" "r")))]
4998 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4999 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5000 (match_operand:DI 2 "gpc_reg_operand" "r"))
5002 (clobber (match_scratch:DI 3 "=r"))]
5005 [(set_attr "type" "compare")])
5008 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5009 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5010 (match_operand:DI 2 "gpc_reg_operand" "r"))
5012 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5013 (and:DI (not:DI (match_dup 1)) (match_dup 2)))]
5016 [(set_attr "type" "compare")])
5019 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5020 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5021 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5026 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5027 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5028 (match_operand:DI 2 "gpc_reg_operand" "r"))
5030 (clobber (match_scratch:DI 3 "=r"))]
5033 [(set_attr "type" "compare")])
5036 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5037 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
5038 (match_operand:DI 2 "gpc_reg_operand" "r"))
5040 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5041 (ior:DI (not:DI (match_dup 1)) (match_dup 2)))]
5044 [(set_attr "type" "compare")])
5047 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5048 (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5049 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
5054 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5055 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5056 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5058 (clobber (match_scratch:DI 3 "=r"))]
5061 [(set_attr "type" "compare")])
5064 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5065 (compare:CC (ior:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5066 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5068 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5069 (ior:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
5072 [(set_attr "type" "compare")])
5075 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5076 (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5077 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))))]
5082 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5083 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5084 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5086 (clobber (match_scratch:DI 3 "=r"))]
5089 [(set_attr "type" "compare")])
5092 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
5093 (compare:CC (and:DI (not:DI (match_operand:DI 1 "gpc_reg_operand" "%r"))
5094 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r")))
5096 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5097 (and:DI (not:DI (match_dup 1)) (not:DI (match_dup 2))))]
5100 [(set_attr "type" "compare")])
5102 ;; Now define ways of moving data around.
5104 ;; Elf specific ways of loading addresses for non-PIC code.
5105 ;; The output of this could be r0, but we limit it to base
5106 ;; registers, since almost all uses of this will need it
5107 ;; in a base register shortly.
5108 (define_insn "elf_high"
5109 [(set (match_operand:SI 0 "register_operand" "=b")
5110 (high:SI (match_operand 1 "" "")))]
5111 "TARGET_ELF && !TARGET_64BIT"
5112 "{cau|addis} %0,0,%1@ha")
5114 (define_insn "elf_low"
5115 [(set (match_operand:SI 0 "register_operand" "=r")
5116 (lo_sum:SI (match_operand:SI 1 "register_operand" "b")
5117 (match_operand 2 "" "")))]
5118 "TARGET_ELF && !TARGET_64BIT"
5119 "{cal %0,%a2@l(%1)|addi %0,%1,%2@l}")
5121 ;; Set up a register with a value from the GOT table
5123 (define_expand "movsi_got"
5124 [(set (match_operand:SI 0 "register_operand" "")
5125 (unspec [(match_operand:SI 1 "got_operand" "")
5127 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
5130 if (GET_CODE (operands[1]) == CONST)
5132 rtx offset = const0_rtx;
5133 HOST_WIDE_INT value;
5135 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
5136 value = INTVAL (offset);
5139 rtx tmp = ((reload_in_progress || reload_completed)
5141 : gen_reg_rtx (Pmode));
5142 emit_insn (gen_movsi_got (tmp, operands[1]));
5143 emit_insn (gen_addsi3 (operands[0], tmp, offset));
5148 operands[2] = rs6000_got_register (operands[1]);
5151 (define_insn "*movsi_got_internal"
5152 [(set (match_operand:SI 0 "register_operand" "=r")
5153 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
5154 (match_operand:SI 2 "register_operand" "b")] 8))]
5155 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
5156 "{l|lwz} %0,%a1@got(%2)"
5157 [(set_attr "type" "load")])
5159 ;; Sometimes, though, the GOT `register' will be on the stack. Deal with
5160 ;; this case specially.
5161 ;; Force final to split this insn (if it hasn't been split already) to
5162 ;; avoid having to create a suitable output template.
5163 (define_insn "*movsi_got_internal_mem"
5164 [(set (match_operand:SI 0 "register_operand" "=r")
5165 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
5166 (match_operand:SI 2 "memory_operand" "m")] 8))]
5167 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5169 && (reload_in_progress || reload_completed)"
5171 [(set_attr "type" "load")
5172 (set_attr "length" "8")])
5174 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
5175 ;; didn't get allocated to a hard register.
5177 [(set (match_operand:SI 0 "register_operand" "=r")
5178 (unspec [(match_operand:SI 1 "got_no_const_operand" "")
5179 (match_operand:SI 2 "memory_operand" "m")] 8))]
5180 "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5182 && (reload_in_progress || reload_completed)"
5183 [(set (match_dup 0) (match_dup 2))
5184 (set (match_dup 0) (unspec [(match_dup 1)(match_dup 0)] 8))]
5187 ;; For SI, we special-case integers that can't be loaded in one insn. We
5188 ;; do the load 16-bits at a time. We could do this by loading from memory,
5189 ;; and this is even supposed to be faster, but it is simpler not to get
5190 ;; integers in the TOC.
5191 (define_expand "movsi"
5192 [(set (match_operand:SI 0 "general_operand" "")
5193 (match_operand:SI 1 "any_operand" ""))]
5197 if (GET_CODE (operands[0]) != REG)
5198 operands[1] = force_reg (SImode, operands[1]);
5200 /* Convert a move of a CONST_DOUBLE into a CONST_INT */
5201 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5202 operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
5204 /* Use default pattern for address of ELF small data */
5206 && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5207 && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
5208 && small_data_operand (operands[1], SImode))
5210 emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
5214 if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
5215 && flag_pic == 1 && got_operand (operands[1], SImode))
5217 emit_insn (gen_movsi_got (operands[0], operands[1]));
5221 if (TARGET_ELF && TARGET_NO_TOC && !TARGET_64BIT
5223 && CONSTANT_P (operands[1])
5224 && GET_CODE (operands[1]) != HIGH
5225 && GET_CODE (operands[1]) != CONST_INT)
5227 rtx target = (reload_completed || reload_in_progress)
5228 ? operands[0] : gen_reg_rtx (SImode);
5230 /* If this is a function address on -mcall-aixdesc or -mcall-nt,
5231 convert it to the address of the descriptor. */
5232 if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
5233 && GET_CODE (operands[1]) == SYMBOL_REF
5234 && XSTR (operands[1], 0)[0] == '.')
5236 char *name = XSTR (operands[1], 0);
5238 while (*name == '.')
5240 new_ref = gen_rtx (SYMBOL_REF, Pmode, name);
5241 CONSTANT_POOL_ADDRESS_P (new_ref) = CONSTANT_POOL_ADDRESS_P (operands[1]);
5242 SYMBOL_REF_FLAG (new_ref) = SYMBOL_REF_FLAG (operands[1]);
5243 SYMBOL_REF_USED (new_ref) = SYMBOL_REF_USED (operands[1]);
5244 operands[1] = new_ref;
5247 emit_insn (gen_elf_high (target, operands[1]));
5248 emit_insn (gen_elf_low (operands[0], target, operands[1]));
5252 if (GET_CODE (operands[1]) == CONST
5253 && DEFAULT_ABI == ABI_NT
5254 && !side_effects_p (operands[0]))
5256 rtx const_term = const0_rtx;
5257 rtx sym = eliminate_constant_term (XEXP (operands[1], 0), &const_term);
5258 if (sym && GET_CODE (const_term) == CONST_INT
5259 && (GET_CODE (sym) == SYMBOL_REF || GET_CODE (sym) == LABEL_REF))
5261 unsigned HOST_WIDE_INT value = INTVAL (const_term);
5262 int new_reg_p = (flag_expensive_optimizations
5263 && !reload_completed
5264 && !reload_in_progress);
5265 rtx tmp1 = (new_reg_p && value != 0) ? gen_reg_rtx (SImode) : operands[0];
5267 emit_insn (gen_movsi (tmp1, sym));
5268 if (INTVAL (const_term) != 0)
5269 emit_insn (gen_addsi3 (operands[0], tmp1, GEN_INT (value)));
5273 fatal_insn (\"bad address\", operands[1]);
5276 if ((!TARGET_WINDOWS_NT || DEFAULT_ABI != ABI_NT)
5277 && CONSTANT_P (operands[1])
5278 && GET_CODE (operands[1]) != CONST_INT
5279 && GET_CODE (operands[1]) != HIGH
5280 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
5282 /* Emit a USE operation so that the constant isn't deleted if
5283 expensive optimizations are turned on because nobody
5284 references it. This should only be done for operands that
5285 contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
5286 This should not be done for operands that contain LABEL_REFs.
5287 For now, we just handle the obvious case. */
5288 if (GET_CODE (operands[1]) != LABEL_REF)
5289 emit_insn (gen_rtx (USE, VOIDmode, operands[1]));
5291 /* If we are to limit the number of things we put in the TOC and
5292 this is a symbol plus a constant we can add in one insn,
5293 just put the symbol in the TOC and add the constant. Don't do
5294 this if reload is in progress. */
5295 if (GET_CODE (operands[1]) == CONST
5296 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
5297 && GET_CODE (XEXP (operands[1], 0)) == PLUS
5298 && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
5299 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
5300 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
5301 && ! side_effects_p (operands[0]))
5303 rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
5304 rtx other = XEXP (XEXP (operands[1], 0), 1);
5306 emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
5310 operands[1] = force_const_mem (SImode, operands[1]);
5311 if (! memory_address_p (SImode, XEXP (operands[1], 0))
5312 && ! reload_in_progress)
5313 operands[1] = change_address (operands[1], SImode,
5314 XEXP (operands[1], 0));
5319 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,r,r,r,r,r,*q,*c*l,*h")
5320 (match_operand:SI 1 "input_operand" "r,S,T,U,m,r,I,J,n,R,*h,r,r,0"))]
5321 "gpc_reg_operand (operands[0], SImode)
5322 || gpc_reg_operand (operands[1], SImode)"
5325 {l|lwz} %0,[toc]%1(2)
5326 {l|lwz} %0,[toc]%l1(2)
5328 {l%U1%X1|lwz%U1%X1} %0,%1
5329 {st%U0%X0|stw%U0%X0} %1,%0
5338 [(set_attr "type" "*,load,load,*,load,store,*,*,*,*,*,*,mtjmpr,*")
5339 (set_attr "length" "4,4,4,4,4,4,4,4,8,4,4,4,4,4")])
5341 ;; Split a load of a large constant into the appropriate two-insn
5345 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5346 (match_operand:SI 1 "const_int_operand" ""))]
5347 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
5348 && (INTVAL (operands[1]) & 0xffff) != 0"
5352 (ior:SI (match_dup 0)
5356 operands[2] = gen_rtx (CONST_INT, VOIDmode,
5357 INTVAL (operands[1]) & 0xffff0000);
5358 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
5362 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
5363 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
5365 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
5368 [(set_attr "type" "compare")])
5370 (define_expand "movhi"
5371 [(set (match_operand:HI 0 "general_operand" "")
5372 (match_operand:HI 1 "any_operand" ""))]
5376 if (GET_CODE (operands[0]) != REG)
5377 operands[1] = force_reg (HImode, operands[1]);
5379 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
5381 operands[1] = force_const_mem (HImode, operands[1]);
5382 if (! memory_address_p (HImode, XEXP (operands[1], 0))
5383 && ! reload_in_progress)
5384 operands[1] = change_address (operands[1], HImode,
5385 XEXP (operands[1], 0));
5390 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
5391 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
5392 "gpc_reg_operand (operands[0], HImode)
5393 || gpc_reg_operand (operands[1], HImode)"
5403 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
5405 (define_expand "movqi"
5406 [(set (match_operand:QI 0 "general_operand" "")
5407 (match_operand:QI 1 "any_operand" ""))]
5411 if (GET_CODE (operands[0]) != REG)
5412 operands[1] = force_reg (QImode, operands[1]);
5414 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
5416 operands[1] = force_const_mem (QImode, operands[1]);
5417 if (! memory_address_p (QImode, XEXP (operands[1], 0))
5418 && ! reload_in_progress)
5419 operands[1] = change_address (operands[1], QImode,
5420 XEXP (operands[1], 0));
5425 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
5426 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
5427 "gpc_reg_operand (operands[0], QImode)
5428 || gpc_reg_operand (operands[1], QImode)"
5438 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
5440 ;; Here is how to move condition codes around. When we store CC data in
5441 ;; an integer register or memory, we store just the high-order 4 bits.
5442 ;; This lets us not shift in the most common case of CR0.
5443 (define_expand "movcc"
5444 [(set (match_operand:CC 0 "nonimmediate_operand" "")
5445 (match_operand:CC 1 "nonimmediate_operand" ""))]
5450 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
5451 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
5452 "register_operand (operands[0], CCmode)
5453 || register_operand (operands[1], CCmode)"
5457 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
5459 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
5461 {l%U1%X1|lwz%U1%X1} %0,%1
5462 {st%U0%U1|stw%U0%U1} %1,%0"
5463 [(set_attr "type" "*,*,*,compare,*,*,load,store")
5464 (set_attr "length" "*,*,12,*,8,*,*,*")])
5466 ;; For floating-point, we normally deal with the floating-point registers
5467 ;; unless -msoft-float is used. The sole exception is that parameter passing
5468 ;; can produce floating-point values in fixed-point registers. Unless the
5469 ;; value is a simple constant or already in memory, we deal with this by
5470 ;; allocating memory and copying the value explicitly via that memory location.
5471 (define_expand "movsf"
5472 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5473 (match_operand:SF 1 "any_operand" ""))]
5477 /* If we are called from reload, we might be getting a SUBREG of a hard
5478 reg. So expand it. */
5479 if (GET_CODE (operands[0]) == SUBREG
5480 && GET_CODE (SUBREG_REG (operands[0])) == REG
5481 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
5482 operands[0] = alter_subreg (operands[0]);
5483 if (GET_CODE (operands[1]) == SUBREG
5484 && GET_CODE (SUBREG_REG (operands[1])) == REG
5485 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
5486 operands[1] = alter_subreg (operands[1]);
5488 if (TARGET_SOFT_FLOAT && GET_CODE (operands[0]) == MEM)
5489 operands[1] = force_reg (SFmode, operands[1]);
5491 else if (TARGET_HARD_FLOAT)
5493 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
5495 /* If this is a store to memory or another integer register do the
5496 move directly. Otherwise store to a temporary stack slot and
5497 load from there into a floating point register. */
5499 if (GET_CODE (operands[0]) == MEM
5500 || (GET_CODE (operands[0]) == REG
5501 && (REGNO (operands[0]) < 32
5502 || (reload_in_progress
5503 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
5505 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5506 operand_subword (operands[1], 0, 0, SFmode));
5511 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5513 emit_move_insn (stack_slot, operands[1]);
5514 emit_move_insn (operands[0], stack_slot);
5519 if (GET_CODE (operands[0]) == MEM)
5521 /* If operands[1] is a register, it may have double-precision data
5522 in it, so truncate it to single precision. We need not do
5523 this for POWERPC. */
5524 if (! TARGET_POWERPC && TARGET_HARD_FLOAT
5525 && GET_CODE (operands[1]) == REG)
5528 = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
5529 emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
5530 operands[1] = newreg;
5533 operands[1] = force_reg (SFmode, operands[1]);
5536 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
5538 if (GET_CODE (operands[1]) == MEM
5539 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
5540 || GET_CODE (operands[1]) == CONST_DOUBLE
5542 || (GET_CODE (operands[1]) == REG
5543 && (REGNO (operands[1]) < 32
5544 || (reload_in_progress
5545 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))))
5547 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
5548 operand_subword (operands[1], 0, 0, SFmode));
5553 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
5555 emit_move_insn (stack_slot, operands[1]);
5556 emit_move_insn (operands[0], stack_slot);
5562 if (CONSTANT_P (operands[1]) && TARGET_HARD_FLOAT)
5564 operands[1] = force_const_mem (SFmode, operands[1]);
5565 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
5566 && ! reload_in_progress)
5567 operands[1] = change_address (operands[1], SFmode,
5568 XEXP (operands[1], 0));
5573 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5574 (match_operand:SF 1 "const_double_operand" ""))]
5575 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], SFmode) <= 1
5576 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5577 || (GET_CODE (operands[0]) == SUBREG
5578 && GET_CODE (SUBREG_REG (operands[0])) == REG
5579 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5580 [(set (match_dup 2) (match_dup 3))]
5586 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
5587 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
5589 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
5590 operands[3] = GEN_INT(l);
5594 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5595 (match_operand:SF 1 "const_double_operand" ""))]
5596 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], SFmode) == 2
5597 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5598 || (GET_CODE (operands[0]) == SUBREG
5599 && GET_CODE (SUBREG_REG (operands[0])) == REG
5600 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5601 [(set (match_dup 2) (match_dup 3))
5602 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 4)))]
5608 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
5609 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
5611 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
5612 operands[3] = GEN_INT(l & 0xffff0000);
5613 operands[4] = GEN_INT(l & 0x0000ffff);
5616 (define_insn "*movsf_hardfloat"
5617 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,m,!r,!r")
5618 (match_operand:SF 1 "input_operand" "f,m,f,G,Fn"))]
5619 "(gpc_reg_operand (operands[0], SFmode)
5620 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
5627 [(set_attr "type" "fp,fpload,fpstore,*,*")
5628 (set_attr "length" "4,4,4,4,8")])
5630 (define_insn "*movsf_softfloat"
5631 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,r")
5632 (match_operand:SF 1 "input_operand" "r,m,r,I,J,R,G,Fn"))]
5633 "(gpc_reg_operand (operands[0], SFmode)
5634 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
5637 {l%U1%X1|lwz%U1%X1} %0,%1
5638 {st%U0%X0|stw%U0%X0} %1,%0
5644 [(set_attr "type" "*,load,store,*,*,*,*,*")
5645 (set_attr "length" "4,4,4,4,4,4,4,8")])
5648 (define_expand "movdf"
5649 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5650 (match_operand:DF 1 "any_operand" ""))]
5654 if (GET_CODE (operands[0]) != REG)
5655 operands[1] = force_reg (DFmode, operands[1]);
5657 /* Stores between FPR and any non-FPR registers must go through a
5658 temporary stack slot. */
5660 if (TARGET_POWERPC64
5661 && GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
5662 && ((FP_REGNO_P (REGNO (operands[0]))
5663 && ! FP_REGNO_P (REGNO (operands[1])))
5664 || (FP_REGNO_P (REGNO (operands[1]))
5665 && ! FP_REGNO_P (REGNO (operands[0])))))
5667 rtx stack_slot = assign_stack_temp (DFmode, 8, 0);
5669 emit_move_insn (stack_slot, operands[1]);
5670 emit_move_insn (operands[0], stack_slot);
5674 if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
5676 operands[1] = force_const_mem (DFmode, operands[1]);
5677 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
5678 && ! reload_in_progress)
5679 operands[1] = change_address (operands[1], DFmode,
5680 XEXP (operands[1], 0));
5685 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5686 (match_operand:DF 1 "const_int_operand" ""))]
5687 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) <= 1
5688 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5689 || (GET_CODE (operands[0]) == SUBREG
5690 && GET_CODE (SUBREG_REG (operands[0])) == REG
5691 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5692 [(set (match_dup 2) (match_dup 4))
5693 (set (match_dup 3) (match_dup 1))]
5696 int endian = (WORDS_BIG_ENDIAN == 0);
5697 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5698 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5699 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
5703 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5704 (match_operand:DF 1 "const_int_operand" ""))]
5705 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) >= 2
5706 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5707 || (GET_CODE (operands[0]) == SUBREG
5708 && GET_CODE (SUBREG_REG (operands[0])) == REG
5709 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5710 [(set (match_dup 3) (match_dup 5))
5711 (set (match_dup 2) (match_dup 4))
5712 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 6)))]
5715 HOST_WIDE_INT value = INTVAL (operands[1]);
5716 int endian = (WORDS_BIG_ENDIAN == 0);
5717 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5718 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5719 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
5720 operands[5] = GEN_INT (value & 0xffff0000);
5721 operands[6] = GEN_INT (value & 0x0000ffff);
5725 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5726 (match_operand:DF 1 "const_double_operand" ""))]
5727 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) <= 2
5728 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5729 || (GET_CODE (operands[0]) == SUBREG
5730 && GET_CODE (SUBREG_REG (operands[0])) == REG
5731 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5732 [(set (match_dup 2) (match_dup 4))
5733 (set (match_dup 3) (match_dup 5))]
5736 int endian = (WORDS_BIG_ENDIAN == 0);
5740 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
5741 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
5743 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5744 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5745 operands[4] = GEN_INT (l[endian]);
5746 operands[5] = GEN_INT (l[1 - endian]);
5750 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5751 (match_operand:DF 1 "const_double_operand" ""))]
5752 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) == 3
5753 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5754 || (GET_CODE (operands[0]) == SUBREG
5755 && GET_CODE (SUBREG_REG (operands[0])) == REG
5756 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5757 [(set (match_dup 2) (match_dup 4))
5758 (set (match_dup 3) (match_dup 5))
5759 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))]
5764 int endian = (WORDS_BIG_ENDIAN == 0);
5767 rtx high_reg = operand_subword (operands[0], endian, 0, DFmode);
5768 rtx low_reg = operand_subword (operands[0], 1 - endian, 0, DFmode);
5770 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
5771 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
5773 low = l[1 - endian];
5775 if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
5776 || (low & 0xffff) == 0)
5778 operands[2] = high_reg;
5779 operands[3] = low_reg;
5780 operands[4] = GEN_INT (high & 0xffff0000);
5781 operands[5] = GEN_INT (low);
5782 operands[6] = GEN_INT (high & 0x0000ffff);
5786 operands[2] = low_reg;
5787 operands[3] = high_reg;
5788 operands[4] = GEN_INT (low & 0xffff0000);
5789 operands[5] = GEN_INT (high);
5790 operands[6] = GEN_INT (low & 0x0000ffff);
5795 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5796 (match_operand:DF 1 "const_double_operand" ""))]
5797 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DFmode) >= 4
5798 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5799 || (GET_CODE (operands[0]) == SUBREG
5800 && GET_CODE (SUBREG_REG (operands[0])) == REG
5801 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5802 [(set (match_dup 2) (match_dup 4))
5803 (set (match_dup 3) (match_dup 5))
5804 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))
5805 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
5812 int endian = (WORDS_BIG_ENDIAN == 0);
5814 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
5815 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
5817 low = l[1 - endian];
5819 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
5820 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
5821 operands[4] = GEN_INT (high & 0xffff0000);
5822 operands[5] = GEN_INT (low & 0xffff0000);
5823 operands[6] = GEN_INT (high & 0x0000ffff);
5824 operands[7] = GEN_INT (low & 0x0000ffff);
5828 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5829 (match_operand:DF 1 "easy_fp_constant" ""))]
5830 "TARGET_64BIT && reload_completed
5831 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
5832 || (GET_CODE (operands[0]) == SUBREG
5833 && GET_CODE (SUBREG_REG (operands[0])) == REG
5834 && REGNO (SUBREG_REG (operands[0])) <= 31))"
5835 [(set (match_dup 2) (subreg:DI (match_dup 1) 0))]
5837 { operands[2] = gen_lowpart (DImode, operands[0]); }")
5839 ;; Don't have reload use general registers to load a constant. First,
5840 ;; it might not work if the output operand has is the equivalent of
5841 ;; a non-offsettable memref, but also it is less efficient than loading
5842 ;; the constant into an FP register, since it will probably be used there.
5843 ;; The "??" is a kludge until we can figure out a more reasonable way
5844 ;; of handling these non-offsettable values.
5845 (define_insn "*movdf_hardfloat32"
5846 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
5847 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
5848 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
5849 && (register_operand (operands[0], DFmode)
5850 || register_operand (operands[1], DFmode))"
5853 switch (which_alternative)
5856 /* We normally copy the low-numbered register first. However, if
5857 the first register operand 0 is the same as the second register of
5858 operand 1, we must copy in the opposite order. */
5859 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5860 return \"mr %L0,%L1\;mr %0,%1\";
5862 return \"mr %0,%1\;mr %L0,%L1\";
5864 /* If the low-address word is used in the address, we must load it
5865 last. Otherwise, load it first. Note that we cannot have
5866 auto-increment in that case since the address register is known to be
5868 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5870 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5872 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5874 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5880 return \"fmr %0,%1\";
5882 return \"lfd%U1%X1 %0,%1\";
5884 return \"stfd%U0%X0 %1,%0\";
5887 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
5888 (set_attr "length" "8,8,8,8,12,16,*,*,*")])
5890 (define_insn "*movdf_softfloat32"
5891 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r,r,r")
5892 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F"))]
5893 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5894 && (register_operand (operands[0], DFmode)
5895 || register_operand (operands[1], DFmode))"
5898 switch (which_alternative)
5901 /* We normally copy the low-numbered register first. However, if
5902 the first register operand 0 is the same as the second register of
5903 operand 1, we must copy in the opposite order. */
5904 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
5905 return \"mr %L0,%L1\;mr %0,%1\";
5907 return \"mr %0,%1\;mr %L0,%L1\";
5909 /* If the low-address word is used in the address, we must load it
5910 last. Otherwise, load it first. Note that we cannot have
5911 auto-increment in that case since the address register is known to be
5913 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
5915 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
5917 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
5919 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
5926 [(set_attr "type" "*,load,store,*,*,*")
5927 (set_attr "length" "8,8,8,8,12,16")])
5929 (define_insn "*movdf_hardfloat64"
5930 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,!r,!r,f,f,m")
5931 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F,f,m,f"))]
5932 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
5933 && (register_operand (operands[0], DFmode)
5934 || register_operand (operands[1], DFmode))"
5945 [(set_attr "type" "*,load,store,*,*,*,fp,fpload,fpstore")
5946 (set_attr "length" "4,4,4,8,12,16,4,4,4")])
5948 (define_insn "*movdf_softfloat64"
5949 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r,r,r")
5950 (match_operand:DF 1 "input_operand" "r,o,r,G,H,F"))]
5951 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
5952 && (register_operand (operands[0], DFmode)
5953 || register_operand (operands[1], DFmode))"
5961 [(set_attr "type" "*,load,store,*,*,*")
5962 (set_attr "length" "*,*,*,8,12,16")])
5964 ;; Next come the multi-word integer load and store and the load and store
5966 (define_expand "movdi"
5967 [(set (match_operand:DI 0 "general_operand" "")
5968 (match_operand:DI 1 "any_operand" ""))]
5972 if (GET_CODE (operands[0]) != REG)
5973 operands[1] = force_reg (DImode, operands[1]);
5976 && (GET_CODE (operands[1]) == CONST_DOUBLE
5977 || GET_CODE (operands[1]) == CONST_INT))
5982 if (GET_CODE (operands[1]) == CONST_DOUBLE)
5984 low = CONST_DOUBLE_LOW (operands[1]);
5985 high = CONST_DOUBLE_HIGH (operands[1]);
5988 #if HOST_BITS_PER_WIDE_INT == 32
5990 low = INTVAL (operands[1]);
5991 high = (low < 0) ? ~0 : 0;
5995 low = INTVAL (operands[1]) & 0xffffffff;
5996 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
6002 emit_move_insn (operands[0], GEN_INT (high));
6003 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT(32)));
6006 HOST_WIDE_INT low_low = low & 0xffff;
6007 HOST_WIDE_INT low_high = low & (~ (HOST_WIDE_INT) 0xffff);
6009 emit_insn (gen_iordi3 (operands[0], operands[0],
6010 GEN_INT (low_high)));
6012 emit_insn (gen_iordi3 (operands[0], operands[0],
6013 GEN_INT (low_low)));
6019 /* Stores between FPR and any non-FPR registers must go through a
6020 temporary stack slot. */
6022 if (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
6023 && ((FP_REGNO_P (REGNO (operands[0]))
6024 && ! FP_REGNO_P (REGNO (operands[1])))
6025 || (FP_REGNO_P (REGNO (operands[1]))
6026 && ! FP_REGNO_P (REGNO (operands[0])))))
6028 rtx stack_slot = assign_stack_temp (DImode, 8, 0);
6030 emit_move_insn (stack_slot, operands[1]);
6031 emit_move_insn (operands[0], stack_slot);
6036 (define_insn "*movdi_32"
6037 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
6038 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
6040 && (gpc_reg_operand (operands[0], DImode)
6041 || gpc_reg_operand (operands[1], DImode))"
6044 switch (which_alternative)
6047 /* We normally copy the low-numbered register first. However, if
6048 the first register operand 0 is the same as the second register of
6049 operand 1, we must copy in the opposite order. */
6050 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
6051 return \"mr %L0,%L1\;mr %0,%1\";
6053 return \"mr %0,%1\;mr %L0,%L1\";
6055 /* If the low-address word is used in the address, we must load it
6056 last. Otherwise, load it first. Note that we cannot have
6057 auto-increment in that case since the address register is known to be
6059 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6061 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
6063 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
6065 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
6067 return \"fmr %0,%1\";
6069 return \"lfd%U1%X1 %0,%1\";
6071 return \"stfd%U0%X0 %1,%0\";
6080 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
6081 (set_attr "length" "8,8,8,*,*,*,8,12,8,12,16")])
6084 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6085 (match_operand:DI 1 "const_int_operand" ""))]
6086 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) <= 1"
6087 [(set (match_dup 2) (match_dup 4))
6088 (set (match_dup 3) (match_dup 1))]
6091 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6092 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6093 operands[4] = (INTVAL (operands[1]) & 0x80000000) ? constm1_rtx : const0_rtx;
6097 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6098 (match_operand:DI 1 "const_int_operand" ""))]
6099 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) >= 2"
6100 [(set (match_dup 3) (match_dup 5))
6101 (set (match_dup 2) (match_dup 4))
6102 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 6)))]
6105 HOST_WIDE_INT value = INTVAL (operands[1]);
6106 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6107 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6108 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
6109 operands[5] = GEN_INT (value & 0xffff0000);
6110 operands[6] = GEN_INT (value & 0x0000ffff);
6114 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6115 (match_operand:DI 1 "const_double_operand" ""))]
6116 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) <= 2"
6117 [(set (match_dup 2) (match_dup 4))
6118 (set (match_dup 3) (match_dup 5))]
6121 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6122 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6123 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
6124 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
6128 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6129 (match_operand:DI 1 "const_double_operand" ""))]
6130 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) == 3"
6131 [(set (match_dup 2) (match_dup 4))
6132 (set (match_dup 3) (match_dup 5))
6133 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))]
6136 HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
6137 HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
6138 rtx high_reg = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6139 rtx low_reg = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6141 if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
6142 || (low & 0xffff) == 0)
6144 operands[2] = high_reg;
6145 operands[3] = low_reg;
6146 operands[4] = GEN_INT (high & 0xffff0000);
6147 operands[5] = GEN_INT (low);
6148 operands[6] = GEN_INT (high & 0x0000ffff);
6152 operands[2] = low_reg;
6153 operands[3] = high_reg;
6154 operands[4] = GEN_INT (low & 0xffff0000);
6155 operands[5] = GEN_INT (high);
6156 operands[6] = GEN_INT (low & 0x0000ffff);
6161 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6162 (match_operand:DI 1 "const_double_operand" ""))]
6163 "TARGET_32BIT && reload_completed && num_insns_constant (operands[1], DImode) >= 4"
6164 [(set (match_dup 2) (match_dup 4))
6165 (set (match_dup 3) (match_dup 5))
6166 (set (match_dup 2) (ior:SI (match_dup 2) (match_dup 6)))
6167 (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
6170 HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
6171 HOST_WIDE_INT low = CONST_DOUBLE_LOW (operands[1]);
6173 operands[2] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN == 0);
6174 operands[3] = gen_rtx (SUBREG, SImode, operands[0], WORDS_BIG_ENDIAN != 0);
6175 operands[4] = GEN_INT (high & 0xffff0000);
6176 operands[5] = GEN_INT (low & 0xffff0000);
6177 operands[6] = GEN_INT (high & 0x0000ffff);
6178 operands[7] = GEN_INT (low & 0x0000ffff);
6181 (define_insn "*movdi_64"
6182 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,f,f,m,r,*h,*h")
6183 (match_operand:DI 1 "input_operand" "r,m,r,I,J,nF,R,f,m,f,*h,r,0"))]
6185 && (gpc_reg_operand (operands[0], DImode)
6186 || gpc_reg_operand (operands[1], DImode))"
6201 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
6202 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
6204 ;; Split a load of a large constant into the appropriate five-instruction
6205 ;; sequence. The expansion in movdi tries to perform the minimum number of
6206 ;; steps, but here we have to handle anything in a constant number of insns.
6209 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6210 (match_operand:DI 1 "const_double_operand" ""))]
6211 "TARGET_64BIT && num_insns_constant (operands[1], DImode) > 1"
6215 (ior:DI (match_dup 0)
6218 (ashift:DI (match_dup 0)
6221 (ior:DI (match_dup 0)
6224 (ior:DI (match_dup 0)
6231 if (GET_CODE (operands[1]) == CONST_DOUBLE)
6233 low = CONST_DOUBLE_LOW (operands[1]);
6234 high = CONST_DOUBLE_HIGH (operands[1]);
6237 #if HOST_BITS_PER_WIDE_INT == 32
6239 low = INTVAL (operands[1]);
6240 high = (low < 0) ? ~0 : 0;
6244 low = INTVAL (operands[1]) & 0xffffffff;
6245 high = (HOST_WIDE_INT) INTVAL (operands[1]) >> 32;
6249 if ((high + 0x8000) < 0x10000
6250 && ((low & 0xffff) == 0 || (low & (~ (HOST_WIDE_INT) 0xffff)) == 0))
6253 operands[2] = GEN_INT (high & (~ (HOST_WIDE_INT) 0xffff));
6254 operands[3] = GEN_INT (high & 0xffff);
6255 operands[4] = GEN_INT (low & (~ (HOST_WIDE_INT) 0xffff));
6256 operands[5] = GEN_INT (low & 0xffff);
6260 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
6261 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
6263 (set (match_operand:DI 0 "gpc_reg_operand" "=r") (match_dup 1))]
6266 [(set_attr "type" "compare")])
6268 ;; TImode is similar, except that we usually want to compute the address into
6269 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
6270 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
6271 (define_expand "movti"
6272 [(parallel [(set (match_operand:TI 0 "general_operand" "")
6273 (match_operand:TI 1 "general_operand" ""))
6274 (clobber (scratch:SI))])]
6275 "TARGET_STRING || TARGET_POWERPC64"
6278 if (GET_CODE (operands[0]) == MEM)
6279 operands[1] = force_reg (TImode, operands[1]);
6281 if (GET_CODE (operands[0]) == MEM
6282 && GET_CODE (XEXP (operands[0], 0)) != REG
6283 && ! reload_in_progress)
6284 operands[0] = change_address (operands[0], TImode,
6285 copy_addr_to_reg (XEXP (operands[0], 0)));
6287 if (GET_CODE (operands[1]) == MEM
6288 && GET_CODE (XEXP (operands[1], 0)) != REG
6289 && ! reload_in_progress)
6290 operands[1] = change_address (operands[1], TImode,
6291 copy_addr_to_reg (XEXP (operands[1], 0)));
6294 ;; We say that MQ is clobbered in the last alternative because the first
6295 ;; alternative would never get used otherwise since it would need a reload
6296 ;; while the 2nd alternative would not. We put memory cases first so they
6297 ;; are preferred. Otherwise, we'd try to reload the output instead of
6298 ;; giving the SCRATCH mq.
6300 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
6301 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
6302 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
6303 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
6304 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
6307 switch (which_alternative)
6313 return \"{stsi|stswi} %1,%P0,16\";
6316 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
6319 /* Normally copy registers with lowest numbered register copied first.
6320 But copy in the other order if the first register of the output
6321 is the second, third, or fourth register in the input. */
6322 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
6323 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
6324 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
6326 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
6328 /* If the address is not used in the output, we can use lsi. Otherwise,
6329 fall through to generating four loads. */
6330 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
6331 return \"{lsi|lswi} %0,%P1,16\";
6332 /* ... fall through ... */
6334 /* If the address register is the same as the register for the lowest-
6335 addressed word, load it last. Similarly for the next two words.
6336 Otherwise load lowest address to highest. */
6337 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6339 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
6340 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
6341 REGNO (operands[0]) + 2, operands[1], 0))
6342 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
6343 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
6344 REGNO (operands[0]) + 3, operands[1], 0))
6345 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
6347 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
6350 [(set_attr "type" "store,store,*,load,load")
6351 (set_attr "length" "*,16,16,*,16")])
6354 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
6355 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
6356 (clobber (match_scratch:SI 2 "=X,X,X"))]
6357 "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
6358 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
6361 switch (which_alternative)
6367 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
6370 /* Normally copy registers with lowest numbered register copied first.
6371 But copy in the other order if the first register of the output
6372 is the second, third, or fourth register in the input. */
6373 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
6374 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
6375 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
6377 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
6379 /* If the address register is the same as the register for the lowest-
6380 addressed word, load it last. Similarly for the next two words.
6381 Otherwise load lowest address to highest. */
6382 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6384 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
6385 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
6386 REGNO (operands[0]) + 2, operands[1], 0))
6387 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
6388 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
6389 REGNO (operands[0]) + 3, operands[1], 0))
6390 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
6392 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
6395 [(set_attr "type" "store,*,load")
6396 (set_attr "length" "16,16,16")])
6399 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
6400 (match_operand:TI 1 "input_operand" "r,m,r"))]
6401 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
6402 || gpc_reg_operand (operands[1], TImode))"
6405 switch (which_alternative)
6408 /* We normally copy the low-numbered register first. However, if
6409 the first register operand 0 is the same as the second register of
6410 operand 1, we must copy in the opposite order. */
6411 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
6412 return \"mr %L0,%L1\;mr %0,%1\";
6414 return \"mr %0,%1\;mr %L0,%L1\";
6416 /* If the low-address word is used in the address, we must load it
6417 last. Otherwise, load it first. Note that we cannot have
6418 auto-increment in that case since the address register is known to be
6420 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
6422 return \"ld %L0,%L1\;ld %0,%1\";
6424 return \"ld%U1 %0,%1\;ld %L0,%L1\";
6426 return \"std%U0 %1,%0\;std %L1,%L0\";
6429 [(set_attr "type" "*,load,store")
6430 (set_attr "length" "8,8,8")])
6432 (define_expand "load_multiple"
6433 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
6434 (match_operand:SI 1 "" ""))
6435 (use (match_operand:SI 2 "" ""))])]
6444 /* Support only loading a constant number of fixed-point registers from
6445 memory and only bother with this if more than two; the machine
6446 doesn't support more than eight. */
6447 if (GET_CODE (operands[2]) != CONST_INT
6448 || INTVAL (operands[2]) <= 2
6449 || INTVAL (operands[2]) > 8
6450 || GET_CODE (operands[1]) != MEM
6451 || GET_CODE (operands[0]) != REG
6452 || REGNO (operands[0]) >= 32)
6455 count = INTVAL (operands[2]);
6456 regno = REGNO (operands[0]);
6458 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
6459 from = force_reg (SImode, XEXP (operands[1], 0));
6461 for (i = 0; i < count; i++)
6462 XVECEXP (operands[3], 0, i)
6463 = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
6464 change_address (operands[1], SImode,
6465 plus_constant (from, i * 4)));
6469 [(match_parallel 0 "load_multiple_operation"
6470 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
6471 (mem:SI (match_operand:SI 2 "register_operand" "b")))])]
6475 /* We have to handle the case where the pseudo used to contain the address
6476 is assigned to one of the output registers. */
6478 int words = XVECLEN (operands[0], 0);
6481 if (XVECLEN (operands[0], 0) == 1)
6482 return \"{l|lwz} %1,0(%2)\";
6484 for (i = 0; i < words; i++)
6485 if (refers_to_regno_p (REGNO (operands[1]) + i,
6486 REGNO (operands[1]) + i + 1, operands[2], 0))
6490 xop[0] = operands[1];
6491 xop[1] = operands[2];
6492 xop[2] = GEN_INT (4 * (words-1));
6493 output_asm_insn (\"{lsi|lswi} %0,%1,%2\;{l|lwz} %1,%2(%1)\", xop);
6498 xop[0] = operands[1];
6499 xop[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
6500 xop[2] = GEN_INT (4 * (words-1));
6501 output_asm_insn (\"{cal %0,4(%0)|addi %0,%0,4}\;{lsi|lswi} %1,%0,%2\;{l|lwz} %0,-4(%0)\", xop);
6506 for (j = 0; j < words; j++)
6509 xop[0] = gen_rtx (REG, SImode, REGNO (operands[1]) + j);
6510 xop[1] = operands[2];
6511 xop[2] = GEN_INT (j * 4);
6512 output_asm_insn (\"{l|lwz} %0,%2(%1)\", xop);
6514 xop[0] = operands[2];
6515 xop[1] = GEN_INT (i * 4);
6516 output_asm_insn (\"{l|lwz} %0,%1(%0)\", xop);
6521 return \"{lsi|lswi} %1,%2,%N0\";
6523 [(set_attr "type" "load")
6524 (set_attr "length" "32")])
6527 (define_expand "store_multiple"
6528 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
6529 (match_operand:SI 1 "" ""))
6530 (clobber (scratch:SI))
6531 (use (match_operand:SI 2 "" ""))])]
6540 /* Support only storing a constant number of fixed-point registers to
6541 memory and only bother with this if more than two; the machine
6542 doesn't support more than eight. */
6543 if (GET_CODE (operands[2]) != CONST_INT
6544 || INTVAL (operands[2]) <= 2
6545 || INTVAL (operands[2]) > 8
6546 || GET_CODE (operands[0]) != MEM
6547 || GET_CODE (operands[1]) != REG
6548 || REGNO (operands[1]) >= 32)
6551 count = INTVAL (operands[2]);
6552 regno = REGNO (operands[1]);
6554 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
6555 to = force_reg (SImode, XEXP (operands[0], 0));
6557 XVECEXP (operands[3], 0, 0)
6558 = gen_rtx (SET, VOIDmode, change_address (operands[0], SImode, to),
6560 XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
6561 gen_rtx (SCRATCH, SImode));
6563 for (i = 1; i < count; i++)
6564 XVECEXP (operands[3], 0, i + 1)
6565 = gen_rtx (SET, VOIDmode,
6566 change_address (operands[0], SImode,
6567 plus_constant (to, i * 4)),
6568 gen_rtx (REG, SImode, regno + i));
6572 [(match_parallel 0 "store_multiple_operation"
6573 [(set (match_operand:SI 1 "indirect_operand" "=Q")
6574 (match_operand:SI 2 "gpc_reg_operand" "r"))
6575 (clobber (match_scratch:SI 3 "=q"))])]
6576 "TARGET_STRING && TARGET_POWER"
6577 "{stsi|stswi} %2,%P1,%O0"
6578 [(set_attr "type" "store")])
6581 [(match_parallel 0 "store_multiple_operation"
6582 [(set (mem:SI (match_operand:SI 1 "register_operand" "b"))
6583 (match_operand:SI 2 "gpc_reg_operand" "r"))
6584 (clobber (match_scratch:SI 3 "X"))])]
6585 "TARGET_STRING && !TARGET_POWER"
6586 "{stsi|stswi} %2,%1,%O0"
6587 [(set_attr "type" "store")])
6590 ;; String/block move insn.
6591 ;; Argument 0 is the destination
6592 ;; Argument 1 is the source
6593 ;; Argument 2 is the length
6594 ;; Argument 3 is the alignment
6596 (define_expand "movstrsi"
6597 [(parallel [(set (match_operand:BLK 0 "" "")
6598 (match_operand:BLK 1 "" ""))
6599 (use (match_operand:SI 2 "" ""))
6600 (use (match_operand:SI 3 "" ""))])]
6604 if (expand_block_move (operands))
6610 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
6611 ;; register allocator doesn't have a clue about allocating 8 word registers
6612 (define_expand "movstrsi_8reg"
6613 [(parallel [(set (match_operand 0 "" "")
6614 (match_operand 1 "" ""))
6615 (use (match_operand 2 "" ""))
6616 (use (match_operand 3 "" ""))
6617 (clobber (reg:SI 5))
6618 (clobber (reg:SI 6))
6619 (clobber (reg:SI 7))
6620 (clobber (reg:SI 8))
6621 (clobber (reg:SI 9))
6622 (clobber (reg:SI 10))
6623 (clobber (reg:SI 11))
6624 (clobber (reg:SI 12))
6625 (clobber (match_scratch:SI 4 ""))])]
6630 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6631 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6632 (use (match_operand:SI 2 "immediate_operand" "i"))
6633 (use (match_operand:SI 3 "immediate_operand" "i"))
6634 (clobber (match_operand:SI 4 "register_operand" "=r"))
6635 (clobber (reg:SI 6))
6636 (clobber (reg:SI 7))
6637 (clobber (reg:SI 8))
6638 (clobber (reg:SI 9))
6639 (clobber (reg:SI 10))
6640 (clobber (reg:SI 11))
6641 (clobber (reg:SI 12))
6642 (clobber (match_scratch:SI 5 "=q"))]
6643 "TARGET_STRING && TARGET_POWER
6644 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
6645 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
6646 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
6647 && REGNO (operands[4]) == 5"
6648 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6649 [(set_attr "type" "load")
6650 (set_attr "length" "8")])
6653 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6654 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6655 (use (match_operand:SI 2 "immediate_operand" "i"))
6656 (use (match_operand:SI 3 "immediate_operand" "i"))
6657 (clobber (match_operand:SI 4 "register_operand" "=r"))
6658 (clobber (reg:SI 6))
6659 (clobber (reg:SI 7))
6660 (clobber (reg:SI 8))
6661 (clobber (reg:SI 9))
6662 (clobber (reg:SI 10))
6663 (clobber (reg:SI 11))
6664 (clobber (reg:SI 12))
6665 (clobber (match_scratch:SI 5 "X"))]
6666 "TARGET_STRING && !TARGET_POWER
6667 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
6668 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
6669 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
6670 && REGNO (operands[4]) == 5"
6671 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6672 [(set_attr "type" "load")
6673 (set_attr "length" "8")])
6675 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
6676 ;; register allocator doesn't have a clue about allocating 6 word registers
6677 (define_expand "movstrsi_6reg"
6678 [(parallel [(set (match_operand 0 "" "")
6679 (match_operand 1 "" ""))
6680 (use (match_operand 2 "" ""))
6681 (use (match_operand 3 "" ""))
6682 (clobber (reg:SI 7))
6683 (clobber (reg:SI 8))
6684 (clobber (reg:SI 9))
6685 (clobber (reg:SI 10))
6686 (clobber (reg:SI 11))
6687 (clobber (reg:SI 12))
6688 (clobber (match_scratch:SI 4 ""))])]
6693 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6694 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6695 (use (match_operand:SI 2 "immediate_operand" "i"))
6696 (use (match_operand:SI 3 "immediate_operand" "i"))
6697 (clobber (match_operand:SI 4 "register_operand" "=r"))
6698 (clobber (reg:SI 8))
6699 (clobber (reg:SI 9))
6700 (clobber (reg:SI 10))
6701 (clobber (reg:SI 11))
6702 (clobber (reg:SI 12))
6703 (clobber (match_scratch:SI 5 "=q"))]
6704 "TARGET_STRING && TARGET_POWER
6705 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
6706 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
6707 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
6708 && REGNO (operands[4]) == 7"
6709 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6710 [(set_attr "type" "load")
6711 (set_attr "length" "8")])
6714 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6715 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6716 (use (match_operand:SI 2 "immediate_operand" "i"))
6717 (use (match_operand:SI 3 "immediate_operand" "i"))
6718 (clobber (match_operand:SI 4 "register_operand" "=r"))
6719 (clobber (reg:SI 8))
6720 (clobber (reg:SI 9))
6721 (clobber (reg:SI 10))
6722 (clobber (reg:SI 11))
6723 (clobber (reg:SI 12))
6724 (clobber (match_scratch:SI 5 "X"))]
6725 "TARGET_STRING && !TARGET_POWER
6726 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
6727 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
6728 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
6729 && REGNO (operands[4]) == 7"
6730 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6731 [(set_attr "type" "load")
6732 (set_attr "length" "8")])
6734 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
6736 (define_expand "movstrsi_4reg"
6737 [(parallel [(set (match_operand 0 "" "")
6738 (match_operand 1 "" ""))
6739 (use (match_operand 2 "" ""))
6740 (use (match_operand 3 "" ""))
6741 (clobber (reg:SI 9))
6742 (clobber (reg:SI 10))
6743 (clobber (reg:SI 11))
6744 (clobber (reg:SI 12))
6745 (clobber (match_scratch:SI 4 ""))])]
6750 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6751 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6752 (use (match_operand:SI 2 "immediate_operand" "i"))
6753 (use (match_operand:SI 3 "immediate_operand" "i"))
6754 (clobber (match_operand:SI 4 "register_operand" "=r"))
6755 (clobber (reg:SI 10))
6756 (clobber (reg:SI 11))
6757 (clobber (reg:SI 12))
6758 (clobber (match_scratch:SI 5 "=q"))]
6759 "TARGET_STRING && TARGET_POWER
6760 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
6761 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
6762 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
6763 && REGNO (operands[4]) == 9"
6764 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6765 [(set_attr "type" "load")
6766 (set_attr "length" "8")])
6769 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6770 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6771 (use (match_operand:SI 2 "immediate_operand" "i"))
6772 (use (match_operand:SI 3 "immediate_operand" "i"))
6773 (clobber (match_operand:SI 4 "register_operand" "=r"))
6774 (clobber (reg:SI 10))
6775 (clobber (reg:SI 11))
6776 (clobber (reg:SI 12))
6777 (clobber (match_scratch:SI 5 "X"))]
6778 "TARGET_STRING && !TARGET_POWER
6779 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
6780 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
6781 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
6782 && REGNO (operands[4]) == 9"
6783 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6784 [(set_attr "type" "load")
6785 (set_attr "length" "8")])
6787 ;; Move up to 8 bytes at a time.
6788 (define_expand "movstrsi_2reg"
6789 [(parallel [(set (match_operand 0 "" "")
6790 (match_operand 1 "" ""))
6791 (use (match_operand 2 "" ""))
6792 (use (match_operand 3 "" ""))
6793 (clobber (match_scratch:DI 4 ""))
6794 (clobber (match_scratch:SI 5 ""))])]
6795 "TARGET_STRING && !TARGET_64BIT"
6799 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6800 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6801 (use (match_operand:SI 2 "immediate_operand" "i"))
6802 (use (match_operand:SI 3 "immediate_operand" "i"))
6803 (clobber (match_scratch:DI 4 "=&r"))
6804 (clobber (match_scratch:SI 5 "=q"))]
6805 "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
6806 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
6807 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6808 [(set_attr "type" "load")
6809 (set_attr "length" "8")])
6812 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6813 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6814 (use (match_operand:SI 2 "immediate_operand" "i"))
6815 (use (match_operand:SI 3 "immediate_operand" "i"))
6816 (clobber (match_scratch:DI 4 "=&r"))
6817 (clobber (match_scratch:SI 5 "X"))]
6818 "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
6819 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
6820 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6821 [(set_attr "type" "load")
6822 (set_attr "length" "8")])
6824 ;; Move up to 4 bytes at a time.
6825 (define_expand "movstrsi_1reg"
6826 [(parallel [(set (match_operand 0 "" "")
6827 (match_operand 1 "" ""))
6828 (use (match_operand 2 "" ""))
6829 (use (match_operand 3 "" ""))
6830 (clobber (match_scratch:SI 4 ""))
6831 (clobber (match_scratch:SI 5 ""))])]
6836 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6837 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6838 (use (match_operand:SI 2 "immediate_operand" "i"))
6839 (use (match_operand:SI 3 "immediate_operand" "i"))
6840 (clobber (match_scratch:SI 4 "=&r"))
6841 (clobber (match_scratch:SI 5 "=q"))]
6842 "TARGET_STRING && TARGET_POWER
6843 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
6844 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6845 [(set_attr "type" "load")
6846 (set_attr "length" "8")])
6849 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
6850 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
6851 (use (match_operand:SI 2 "immediate_operand" "i"))
6852 (use (match_operand:SI 3 "immediate_operand" "i"))
6853 (clobber (match_scratch:SI 4 "=&r"))
6854 (clobber (match_scratch:SI 5 "X"))]
6855 "TARGET_STRING && !TARGET_POWER
6856 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
6857 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
6858 [(set_attr "type" "load")
6859 (set_attr "length" "8")])
6862 ;; Define insns that do load or store with update. Some of these we can
6863 ;; get by using pre-decrement or pre-increment, but the hardware can also
6864 ;; do cases where the increment is not the size of the object.
6866 ;; In all these cases, we use operands 0 and 1 for the register being
6867 ;; incremented because those are the operands that local-alloc will
6868 ;; tie and these are the pair most likely to be tieable (and the ones
6869 ;; that will benefit the most).
6871 (define_insn "*movdi_update1"
6872 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
6873 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
6874 (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
6875 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
6876 (plus:DI (match_dup 1) (match_dup 2)))]
6877 "TARGET_POWERPC64 && TARGET_UPDATE"
6881 [(set_attr "type" "load")])
6883 (define_insn "*movdi_update2"
6884 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
6886 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
6887 (match_operand:DI 2 "gpc_reg_operand" "r")))))
6888 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
6889 (plus:DI (match_dup 1) (match_dup 2)))]
6892 [(set_attr "type" "load")])
6894 (define_insn "movdi_update"
6895 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
6896 (match_operand:DI 2 "reg_or_short_operand" "r,I")))
6897 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
6898 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
6899 (plus:DI (match_dup 1) (match_dup 2)))]
6900 "TARGET_POWERPC64 && TARGET_UPDATE"
6904 [(set_attr "type" "store")])
6906 (define_insn "*movsi_update1"
6907 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6908 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6909 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6910 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6911 (plus:SI (match_dup 1) (match_dup 2)))]
6914 {lux|lwzux} %3,%0,%2
6915 {lu|lwzu} %3,%2(%0)"
6916 [(set_attr "type" "load")])
6918 (define_insn "movsi_update"
6919 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6920 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6921 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6922 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6923 (plus:SI (match_dup 1) (match_dup 2)))]
6926 {stux|stwux} %3,%0,%2
6927 {stu|stwu} %3,%2(%0)"
6928 [(set_attr "type" "store")])
6930 (define_insn "*movhi_update"
6931 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
6932 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6933 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6934 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6935 (plus:SI (match_dup 1) (match_dup 2)))]
6940 [(set_attr "type" "load")])
6942 (define_insn "*movhi_update2"
6943 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6945 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6946 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6947 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6948 (plus:SI (match_dup 1) (match_dup 2)))]
6953 [(set_attr "type" "load")])
6955 (define_insn "*movhi_update3"
6956 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6958 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6959 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6960 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6961 (plus:SI (match_dup 1) (match_dup 2)))]
6966 [(set_attr "type" "load")])
6968 (define_insn "*movhi_update4"
6969 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6970 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
6971 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
6972 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6973 (plus:SI (match_dup 1) (match_dup 2)))]
6978 [(set_attr "type" "store")])
6980 (define_insn "*movqi_update1"
6981 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
6982 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6983 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
6984 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6985 (plus:SI (match_dup 1) (match_dup 2)))]
6990 [(set_attr "type" "load")])
6992 (define_insn "*movqi_update2"
6993 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
6995 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
6996 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
6997 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
6998 (plus:SI (match_dup 1) (match_dup 2)))]
7003 [(set_attr "type" "load")])
7005 (define_insn "*movqi_update3"
7006 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7007 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7008 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
7009 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7010 (plus:SI (match_dup 1) (match_dup 2)))]
7015 [(set_attr "type" "store")])
7017 (define_insn "*movsf_update1"
7018 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
7019 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7020 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7021 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7022 (plus:SI (match_dup 1) (match_dup 2)))]
7023 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7027 [(set_attr "type" "fpload")])
7029 (define_insn "*movsf_update2"
7030 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7031 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7032 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
7033 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7034 (plus:SI (match_dup 1) (match_dup 2)))]
7035 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7039 [(set_attr "type" "fpstore")])
7041 (define_insn "*movsf_update3"
7042 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
7043 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7044 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7045 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7046 (plus:SI (match_dup 1) (match_dup 2)))]
7047 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
7049 {lux|lwzux} %3,%0,%2
7050 {lu|lwzu} %3,%2(%0)"
7051 [(set_attr "type" "load")])
7053 (define_insn "*movsf_update4"
7054 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7055 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7056 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
7057 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7058 (plus:SI (match_dup 1) (match_dup 2)))]
7059 "TARGET_SOFT_FLOAT && TARGET_UPDATE"
7061 {stux|stwux} %3,%0,%2
7062 {stu|stwu} %3,%2(%0)"
7063 [(set_attr "type" "store")])
7065 (define_insn "*movdf_update1"
7066 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
7067 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7068 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
7069 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7070 (plus:SI (match_dup 1) (match_dup 2)))]
7071 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7075 [(set_attr "type" "fpload")])
7077 (define_insn "*movdf_update2"
7078 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
7079 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
7080 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
7081 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
7082 (plus:SI (match_dup 1) (match_dup 2)))]
7083 "TARGET_HARD_FLOAT && TARGET_UPDATE"
7087 [(set_attr "type" "fpstore")])
7089 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
7092 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7093 (match_operand:DF 1 "memory_operand" ""))
7094 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
7095 (match_operand:DF 3 "memory_operand" ""))]
7097 && TARGET_HARD_FLOAT
7098 && registers_ok_for_quad_peep (operands[0], operands[2])
7099 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
7100 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
7104 [(set (match_operand:DF 0 "memory_operand" "")
7105 (match_operand:DF 1 "gpc_reg_operand" "f"))
7106 (set (match_operand:DF 2 "memory_operand" "")
7107 (match_operand:DF 3 "gpc_reg_operand" "f"))]
7109 && TARGET_HARD_FLOAT
7110 && registers_ok_for_quad_peep (operands[1], operands[3])
7111 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
7112 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
7115 ;; Next come insns related to the calling sequence.
7117 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
7118 ;; We move the back-chain and decrement the stack pointer.
7120 (define_expand "allocate_stack"
7121 [(set (match_operand:SI 0 "register_operand" "=r")
7122 (minus:SI (reg:SI 1) (match_operand:SI 1 "reg_or_short_operand" "")))
7124 (minus:SI (reg:SI 1) (match_dup 1)))]
7127 { rtx chain = gen_reg_rtx (Pmode);
7128 rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
7131 emit_move_insn (chain, stack_bot);
7133 /* Under Windows NT, we need to add stack probes for large/variable
7134 allocations, so do it via a call to the external function alloca
7135 instead of doing it inline. */
7136 if (DEFAULT_ABI == ABI_NT
7137 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 4096))
7139 rtx tmp = gen_reg_rtx (SImode);
7140 emit_library_call_value (gen_rtx (SYMBOL_REF, Pmode, \"__allocate_stack\"),
7141 tmp, 0, SImode, 1, operands[1], Pmode);
7142 emit_insn (gen_set_sp (tmp));
7143 emit_move_insn (operands[0], tmp);
7147 if (GET_CODE (operands[1]) != CONST_INT
7148 || INTVAL (operands[1]) < -32767
7149 || INTVAL (operands[1]) > 32768)
7151 neg_op0 = gen_reg_rtx (Pmode);
7153 emit_insn (gen_negsi2 (neg_op0, operands[1]));
7155 emit_insn (gen_negdi2 (neg_op0, operands[1]));
7158 neg_op0 = GEN_INT (- INTVAL (operands[1]));
7161 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
7162 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
7166 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
7167 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
7168 emit_move_insn (gen_rtx (MEM, (TARGET_32BIT) ? SImode : DImode,
7173 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
7177 ;; Marker to indicate that the stack pointer was changed under NT in
7178 ;; ways not known to the compiler
7180 (define_insn "set_sp"
7182 (unspec [(match_operand:SI 0 "register_operand" "r")] 7))]
7185 [(set_attr "length" "0")])
7187 ;; These patterns say how to save and restore the stack pointer. We need not
7188 ;; save the stack pointer at function level since we are careful to
7189 ;; preserve the backchain. At block level, we have to restore the backchain
7190 ;; when we restore the stack pointer.
7192 ;; For nonlocal gotos, we must save both the stack pointer and its
7193 ;; backchain and restore both. Note that in the nonlocal case, the
7194 ;; save area is a memory location.
7196 (define_expand "save_stack_function"
7197 [(use (const_int 0))]
7201 (define_expand "restore_stack_function"
7202 [(use (const_int 0))]
7206 (define_expand "restore_stack_block"
7207 [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
7208 (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
7209 (set (mem:SI (match_dup 0)) (match_dup 2))]
7212 { operands[2] = gen_reg_rtx (SImode); }")
7214 (define_expand "save_stack_nonlocal"
7215 [(match_operand:DI 0 "memory_operand" "")
7216 (match_operand:SI 1 "register_operand" "")]
7220 rtx temp = gen_reg_rtx (SImode);
7222 /* Copy the backchain to the first word, sp to the second. */
7223 emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
7224 emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
7225 emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
7229 (define_expand "restore_stack_nonlocal"
7230 [(match_operand:SI 0 "register_operand" "")
7231 (match_operand:DI 1 "memory_operand" "")]
7235 rtx temp = gen_reg_rtx (SImode);
7237 /* Restore the backchain from the first word, sp from the second. */
7238 emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
7239 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
7240 emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
7244 ;; If we have -mminimal-toc, we need to reload r30 after a nonlocal goto.
7246 (define_insn "nonlocal_goto_receiver"
7247 [(unspec_volatile [(const_int 0)] 1)]
7248 "TARGET_TOC && TARGET_MINIMAL_TOC"
7251 rs6000_output_load_toc_table (asm_out_file, 30);
7254 [(set_attr "type" "load")])
7256 ;; A function pointer under AIX is a pointer to a data area whose first word
7257 ;; contains the actual address of the function, whose second word contains a
7258 ;; pointer to its TOC, and whose third word contains a value to place in the
7259 ;; static chain register (r11). Note that if we load the static chain, our
7260 ;; "trampoline" need not have any executable code.
7262 ;; operands[0] is a register pointing to the 3 word descriptor (aka, the function address)
7263 ;; operands[1] is the stack size to clean up
7264 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for AIX)
7265 ;; operands[3] is location to store the TOC
7266 ;; operands[4] is the TOC register
7267 ;; operands[5] is the static chain register
7269 ;; We do not break this into separate insns, so that the scheduler will not try
7270 ;; to move the load of the new TOC before any loads from the TOC.
7272 (define_insn "call_indirect_aix"
7273 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
7274 (match_operand 1 "const_int_operand" "n"))
7275 (use (match_operand 2 "const_int_operand" "n"))
7276 (use (match_operand 3 "offsettable_addr_operand" "p"))
7277 (use (match_operand 4 "register_operand" "r"))
7278 (clobber (match_operand 5 "register_operand" "=r"))
7279 (clobber (match_scratch:SI 6 "=&r"))
7280 (clobber (match_scratch:SI 7 "=l"))]
7281 "DEFAULT_ABI == ABI_AIX
7282 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
7283 "{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"
7284 [(set_attr "type" "load")
7285 (set_attr "length" "28")])
7287 (define_insn "call_value_indirect_aix"
7288 [(set (match_operand 0 "register_operand" "fg")
7289 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
7290 (match_operand 2 "const_int_operand" "n")))
7291 (use (match_operand 3 "const_int_operand" "n"))
7292 (use (match_operand 4 "offsettable_addr_operand" "p"))
7293 (use (match_operand 5 "register_operand" "r"))
7294 (clobber (match_operand 6 "register_operand" "=r"))
7295 (clobber (match_scratch:SI 7 "=&r"))
7296 (clobber (match_scratch:SI 8 "=l"))]
7297 "DEFAULT_ABI == ABI_AIX
7298 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
7299 "{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"
7300 [(set_attr "type" "load")
7301 (set_attr "length" "28")])
7303 ;; A function pointer undef NT is a pointer to a data area whose first word
7304 ;; contains the actual address of the function, whose second word contains a
7305 ;; pointer to its TOC. The static chain is not stored under NT, which means
7306 ;; that we need a trampoline.
7308 ;; operands[0] is an SImode pseudo in which we place the address of the function.
7309 ;; operands[1] is the stack size to clean up
7310 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument (must be 0 for NT)
7311 ;; operands[3] is location to store the TOC
7312 ;; operands[4] is the TOC register
7314 ;; We do not break this into separate insns, so that the scheduler will not try
7315 ;; to move the load of the new TOC before any loads from the TOC.
7317 (define_insn "call_indirect_nt"
7318 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
7319 (match_operand 1 "const_int_operand" "n"))
7320 (use (match_operand 2 "const_int_operand" "n"))
7321 (use (match_operand 3 "offsettable_addr_operand" "p"))
7322 (use (match_operand 4 "register_operand" "r"))
7323 (clobber (match_scratch:SI 5 "=&r"))
7324 (clobber (match_scratch:SI 6 "=l"))]
7325 "DEFAULT_ABI == ABI_NT
7326 && (INTVAL (operands[2]) == CALL_NORMAL || (INTVAL (operands[2]) & CALL_LONG) != 0)"
7327 "{st|stw} %4,%a3\;{l|lwz} %5,0(%0)\;{l|lwz} %4,4(%0)\;mt%6 %5\;{brl|blrl}\;{l|lwz} %4,%a3"
7328 [(set_attr "type" "load")
7329 (set_attr "length" "24")])
7331 (define_insn "call_value_indirect_nt"
7332 [(set (match_operand 0 "register_operand" "fg")
7333 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
7334 (match_operand 2 "const_int_operand" "n")))
7335 (use (match_operand 3 "const_int_operand" "n"))
7336 (use (match_operand 4 "offsettable_addr_operand" "p"))
7337 (use (match_operand 5 "register_operand" "r"))
7338 (clobber (match_scratch:SI 6 "=&r"))
7339 (clobber (match_scratch:SI 7 "=l"))]
7340 "DEFAULT_ABI == ABI_NT
7341 && (INTVAL (operands[3]) == CALL_NORMAL || (INTVAL (operands[3]) & CALL_LONG) != 0)"
7342 "{st|stw} %5,%a4\;{l|lwz} %6,0(%1)\;{l|lwz} %5,4(%1)\;mt%7 %6\;{brl|blrl}\;{l|lwz} %5,%a4"
7343 [(set_attr "type" "load")
7344 (set_attr "length" "24")])
7346 ;; A function pointer under System V is just a normal pointer
7347 ;; operands[0] is the function pointer
7348 ;; operands[1] is the stack size to clean up
7349 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument which indicates how to set cr1
7351 (define_insn "call_indirect_sysv"
7352 [(call (mem:SI (match_operand:SI 0 "register_operand" "l,l"))
7353 (match_operand 1 "const_int_operand" "n,n"))
7354 (use (match_operand 2 "const_int_operand" "O,n"))
7355 (clobber (match_scratch:SI 3 "=l,l"))]
7356 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
7359 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7360 output_asm_insn (\"crxor 6,6,6\", operands);
7362 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7363 output_asm_insn (\"creqv 6,6,6\", operands);
7365 return \"{brl|blrl}\";
7367 [(set_attr "type" "jmpreg")
7368 (set_attr "length" "4,8")])
7370 (define_insn "call_value_indirect_sysv"
7371 [(set (match_operand 0 "register_operand" "=fg,fg")
7372 (call (mem:SI (match_operand:SI 1 "register_operand" "l,l"))
7373 (match_operand 2 "const_int_operand" "n,n")))
7374 (use (match_operand 3 "const_int_operand" "O,n"))
7375 (clobber (match_scratch:SI 4 "=l,l"))]
7376 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
7379 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7380 output_asm_insn (\"crxor 6,6,6\", operands);
7382 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7383 output_asm_insn (\"creqv 6,6,6\", operands);
7385 return \"{brl|blrl}\";
7387 [(set_attr "type" "jmpreg")
7388 (set_attr "length" "4,8")])
7390 ;; Now the definitions for the call and call_value insns
7391 (define_expand "call"
7392 [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
7393 (match_operand 1 "" ""))
7394 (use (match_operand 2 "" ""))
7395 (clobber (scratch:SI))])]
7399 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
7402 operands[0] = XEXP (operands[0], 0);
7404 /* Convert NT DLL imports into an indirect call. */
7405 if (GET_CODE (operands[0]) == SYMBOL_REF
7406 && (INTVAL (operands[2]) & CALL_NT_DLLIMPORT) != 0)
7408 operands[0] = rs6000_dll_import_ref (operands[0]);
7409 operands[2] = GEN_INT ((int)CALL_NORMAL);
7412 if (GET_CODE (operands[0]) != SYMBOL_REF
7413 || (INTVAL (operands[2]) & CALL_LONG) != 0)
7415 if (INTVAL (operands[2]) & CALL_LONG)
7416 operands[0] = rs6000_longcall_ref (operands[0]);
7418 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
7419 emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
7420 operands[1], operands[2]));
7423 rtx toc_reg = gen_rtx (REG, Pmode, 2);
7424 rtx toc_addr = RS6000_SAVE_TOC;
7426 if (DEFAULT_ABI == ABI_AIX)
7428 /* AIX function pointers are really pointers to a three word area */
7429 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
7430 emit_call_insn (gen_call_indirect_aix (force_reg (Pmode, operands[0]),
7431 operands[1], operands[2],
7432 toc_addr, toc_reg, static_chain));
7434 else if (DEFAULT_ABI == ABI_NT)
7436 /* NT function pointers are really pointers to a two word area */
7437 emit_call_insn (gen_call_indirect_nt (force_reg (Pmode, operands[0]),
7438 operands[1], operands[2],
7439 toc_addr, toc_reg));
7448 (define_expand "call_value"
7449 [(parallel [(set (match_operand 0 "" "")
7450 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
7451 (match_operand 2 "" "")))
7452 (use (match_operand 3 "" ""))
7453 (clobber (scratch:SI))])]
7457 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
7460 operands[1] = XEXP (operands[1], 0);
7462 /* Convert NT DLL imports into an indirect call. */
7463 if (GET_CODE (operands[1]) == SYMBOL_REF
7464 && (INTVAL (operands[3]) & CALL_NT_DLLIMPORT) != 0)
7466 operands[1] = rs6000_dll_import_ref (operands[1]);
7467 operands[3] = GEN_INT ((int)CALL_NORMAL);
7470 if (GET_CODE (operands[1]) != SYMBOL_REF
7471 || (INTVAL (operands[3]) & CALL_LONG) != 0)
7473 if (INTVAL (operands[2]) & CALL_LONG)
7474 operands[1] = rs6000_longcall_ref (operands[1]);
7476 if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
7477 emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
7478 operands[2], operands[3]));
7481 rtx toc_reg = gen_rtx (REG, Pmode, 2);
7482 rtx toc_addr = RS6000_SAVE_TOC;
7484 if (DEFAULT_ABI == ABI_AIX)
7486 /* AIX function pointers are really pointers to a three word area */
7487 rtx static_chain = gen_rtx (REG, Pmode, STATIC_CHAIN_REGNUM);
7488 emit_call_insn (gen_call_value_indirect_aix (operands[0],
7489 force_reg (Pmode, operands[1]),
7490 operands[2], operands[3],
7491 toc_addr, toc_reg, static_chain));
7493 else if (DEFAULT_ABI == ABI_NT)
7495 /* NT function pointers are really pointers to a two word area */
7496 emit_call_insn (gen_call_value_indirect_nt (operands[0],
7497 force_reg (Pmode, operands[1]),
7498 operands[2], operands[3],
7499 toc_addr, toc_reg));
7508 ;; Call to function in current module. No TOC pointer reload needed.
7509 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
7510 ;; either the function was not prototyped, or it was prototyped as a
7511 ;; variable argument function. It is > 0 if FP registers were passed
7512 ;; and < 0 if they were not.
7515 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
7516 (match_operand 1 "" "g,g"))
7517 (use (match_operand:SI 2 "immediate_operand" "O,n"))
7518 (clobber (match_scratch:SI 3 "=l,l"))]
7519 "(INTVAL (operands[2]) & CALL_LONG) == 0"
7522 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7523 output_asm_insn (\"crxor 6,6,6\", operands);
7525 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7526 output_asm_insn (\"creqv 6,6,6\", operands);
7528 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
7530 [(set_attr "type" "branch")
7531 (set_attr "length" "4,8")])
7533 ;; Call to function which may be in another module. Restore the TOC
7534 ;; pointer (r2) after the call unless this is System V.
7535 ;; Operand2 is non-zero if we are using the V.4 calling sequence and
7536 ;; either the function was not prototyped, or it was prototyped as a
7537 ;; variable argument function. It is > 0 if FP registers were passed
7538 ;; and < 0 if they were not.
7541 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
7542 (match_operand 1 "" "fg,fg"))
7543 (use (match_operand:SI 2 "immediate_operand" "O,n"))
7544 (clobber (match_scratch:SI 3 "=l,l"))]
7545 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
7546 && (INTVAL (operands[2]) & CALL_LONG) == 0"
7549 /* Indirect calls should go through call_indirect */
7550 if (GET_CODE (operands[0]) == REG)
7553 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7554 output_asm_insn (\"crxor 6,6,6\", operands);
7556 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7557 output_asm_insn (\"creqv 6,6,6\", operands);
7559 return (TARGET_WINDOWS_NT) ? \"bl %z0\;.znop %z0\" : \"bl %z0\;%.\";
7561 [(set_attr "type" "branch")
7562 (set_attr "length" "8,12")])
7565 [(call (mem:SI (match_operand:SI 0 "call_operand" "s,s"))
7566 (match_operand 1 "" "fg,fg"))
7567 (use (match_operand:SI 2 "immediate_operand" "O,n"))
7568 (clobber (match_scratch:SI 3 "=l,l"))]
7569 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
7570 && (INTVAL (operands[2]) & CALL_LONG) == 0"
7573 /* Indirect calls should go through call_indirect */
7574 if (GET_CODE (operands[0]) == REG)
7577 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
7578 output_asm_insn (\"crxor 6,6,6\", operands);
7580 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
7581 output_asm_insn (\"creqv 6,6,6\", operands);
7583 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@plt\" : \"bl %z0\";
7585 [(set_attr "type" "branch")
7586 (set_attr "length" "4,8")])
7589 [(set (match_operand 0 "" "=fg,fg")
7590 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
7591 (match_operand 2 "" "g,g")))
7592 (use (match_operand:SI 3 "immediate_operand" "O,n"))
7593 (clobber (match_scratch:SI 4 "=l,l"))]
7594 "(INTVAL (operands[3]) & CALL_LONG) == 0"
7597 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7598 output_asm_insn (\"crxor 6,6,6\", operands);
7600 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7601 output_asm_insn (\"creqv 6,6,6\", operands);
7603 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
7605 [(set_attr "type" "branch")
7606 (set_attr "length" "4,8")])
7609 [(set (match_operand 0 "" "=fg,fg")
7610 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
7611 (match_operand 2 "" "fg,fg")))
7612 (use (match_operand:SI 3 "immediate_operand" "O,n"))
7613 (clobber (match_scratch:SI 4 "=l,l"))]
7614 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)
7615 && (INTVAL (operands[3]) & CALL_LONG) == 0"
7618 /* This should be handled by call_value_indirect */
7619 if (GET_CODE (operands[1]) == REG)
7622 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7623 output_asm_insn (\"crxor 6,6,6\", operands);
7625 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7626 output_asm_insn (\"creqv 6,6,6\", operands);
7628 return (TARGET_WINDOWS_NT) ? \"bl %z1\;.znop %z1\" : \"bl %z1\;%.\";
7630 [(set_attr "type" "branch")
7631 (set_attr "length" "8,12")])
7634 [(set (match_operand 0 "" "=fg,fg")
7635 (call (mem:SI (match_operand:SI 1 "call_operand" "s,s"))
7636 (match_operand 2 "" "fg,fg")))
7637 (use (match_operand:SI 3 "immediate_operand" "O,n"))
7638 (clobber (match_scratch:SI 4 "=l,l"))]
7639 "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
7640 && (INTVAL (operands[3]) & CALL_LONG) == 0"
7643 /* This should be handled by call_value_indirect */
7644 if (GET_CODE (operands[1]) == REG)
7647 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
7648 output_asm_insn (\"crxor 6,6,6\", operands);
7650 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
7651 output_asm_insn (\"creqv 6,6,6\", operands);
7653 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@plt\" : \"bl %z1\";
7655 [(set_attr "type" "branch")
7656 (set_attr "length" "4,8")])
7658 ;; Call subroutine returning any type.
7659 (define_expand "untyped_call"
7660 [(parallel [(call (match_operand 0 "" "")
7662 (match_operand 1 "" "")
7663 (match_operand 2 "" "")])]
7669 emit_call_insn (gen_call (operands[0], const0_rtx, const0_rtx, const0_rtx));
7671 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7673 rtx set = XVECEXP (operands[2], 0, i);
7674 emit_move_insn (SET_DEST (set), SET_SRC (set));
7677 /* The optimizer does not know that the call sets the function value
7678 registers we stored in the result block. We avoid problems by
7679 claiming that all hard registers are used and clobbered at this
7681 emit_insn (gen_blockage ());
7686 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7687 ;; all of memory. This blocks insns from being moved across this point.
7689 (define_insn "blockage"
7690 [(unspec_volatile [(const_int 0)] 0)]
7694 ;; V.4 specific code to initialize the PIC register
7696 (define_insn "init_v4_pic"
7697 [(set (match_operand:SI 0 "register_operand" "=l")
7698 (unspec [(const_int 0)] 7))]
7699 "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS"
7700 "bl _GLOBAL_OFFSET_TABLE_@local-4"
7701 [(set_attr "type" "branch")
7702 (set_attr "length" "4")])
7705 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
7706 ;; signed & unsigned, and one type of branch.
7708 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
7709 ;; insns, and branches. We store the operands of compares until we see
7711 (define_expand "cmpsi"
7713 (compare (match_operand:SI 0 "gpc_reg_operand" "")
7714 (match_operand:SI 1 "reg_or_short_operand" "")))]
7718 /* Take care of the possibility that operands[1] might be negative but
7719 this might be a logical operation. That insn doesn't exist. */
7720 if (GET_CODE (operands[1]) == CONST_INT
7721 && INTVAL (operands[1]) < 0)
7722 operands[1] = force_reg (SImode, operands[1]);
7724 rs6000_compare_op0 = operands[0];
7725 rs6000_compare_op1 = operands[1];
7726 rs6000_compare_fp_p = 0;
7730 (define_expand "cmpdi"
7732 (compare (match_operand:DI 0 "gpc_reg_operand" "")
7733 (match_operand:DI 1 "reg_or_short_operand" "")))]
7737 /* Take care of the possibility that operands[1] might be negative but
7738 this might be a logical operation. That insn doesn't exist. */
7739 if (GET_CODE (operands[1]) == CONST_INT
7740 && INTVAL (operands[1]) < 0)
7741 operands[1] = force_reg (DImode, operands[1]);
7743 rs6000_compare_op0 = operands[0];
7744 rs6000_compare_op1 = operands[1];
7745 rs6000_compare_fp_p = 0;
7749 (define_expand "cmpsf"
7750 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
7751 (match_operand:SF 1 "gpc_reg_operand" "")))]
7755 rs6000_compare_op0 = operands[0];
7756 rs6000_compare_op1 = operands[1];
7757 rs6000_compare_fp_p = 1;
7761 (define_expand "cmpdf"
7762 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
7763 (match_operand:DF 1 "gpc_reg_operand" "")))]
7767 rs6000_compare_op0 = operands[0];
7768 rs6000_compare_op1 = operands[1];
7769 rs6000_compare_fp_p = 1;
7773 (define_expand "beq"
7774 [(set (match_dup 2) (match_dup 1))
7776 (if_then_else (eq (match_dup 2)
7778 (label_ref (match_operand 0 "" ""))
7782 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7783 operands[1] = gen_rtx (COMPARE, mode,
7784 rs6000_compare_op0, rs6000_compare_op1);
7785 operands[2] = gen_reg_rtx (mode);
7788 (define_expand "bne"
7789 [(set (match_dup 2) (match_dup 1))
7791 (if_then_else (ne (match_dup 2)
7793 (label_ref (match_operand 0 "" ""))
7797 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7798 operands[1] = gen_rtx (COMPARE, mode,
7799 rs6000_compare_op0, rs6000_compare_op1);
7800 operands[2] = gen_reg_rtx (mode);
7803 (define_expand "blt"
7804 [(set (match_dup 2) (match_dup 1))
7806 (if_then_else (lt (match_dup 2)
7808 (label_ref (match_operand 0 "" ""))
7812 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7813 operands[1] = gen_rtx (COMPARE, mode,
7814 rs6000_compare_op0, rs6000_compare_op1);
7815 operands[2] = gen_reg_rtx (mode);
7818 (define_expand "bgt"
7819 [(set (match_dup 2) (match_dup 1))
7821 (if_then_else (gt (match_dup 2)
7823 (label_ref (match_operand 0 "" ""))
7827 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7828 operands[1] = gen_rtx (COMPARE, mode,
7829 rs6000_compare_op0, rs6000_compare_op1);
7830 operands[2] = gen_reg_rtx (mode);
7833 (define_expand "ble"
7834 [(set (match_dup 2) (match_dup 1))
7836 (if_then_else (le (match_dup 2)
7838 (label_ref (match_operand 0 "" ""))
7842 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7843 operands[1] = gen_rtx (COMPARE, mode,
7844 rs6000_compare_op0, rs6000_compare_op1);
7845 operands[2] = gen_reg_rtx (mode);
7848 (define_expand "bge"
7849 [(set (match_dup 2) (match_dup 1))
7851 (if_then_else (ge (match_dup 2)
7853 (label_ref (match_operand 0 "" ""))
7857 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7858 operands[1] = gen_rtx (COMPARE, mode,
7859 rs6000_compare_op0, rs6000_compare_op1);
7860 operands[2] = gen_reg_rtx (mode);
7863 (define_expand "bgtu"
7864 [(set (match_dup 2) (match_dup 1))
7866 (if_then_else (gtu (match_dup 2)
7868 (label_ref (match_operand 0 "" ""))
7872 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7873 rs6000_compare_op0, rs6000_compare_op1);
7874 operands[2] = gen_reg_rtx (CCUNSmode);
7877 (define_expand "bltu"
7878 [(set (match_dup 2) (match_dup 1))
7880 (if_then_else (ltu (match_dup 2)
7882 (label_ref (match_operand 0 "" ""))
7886 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7887 rs6000_compare_op0, rs6000_compare_op1);
7888 operands[2] = gen_reg_rtx (CCUNSmode);
7891 (define_expand "bgeu"
7892 [(set (match_dup 2) (match_dup 1))
7894 (if_then_else (geu (match_dup 2)
7896 (label_ref (match_operand 0 "" ""))
7900 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7901 rs6000_compare_op0, rs6000_compare_op1);
7902 operands[2] = gen_reg_rtx (CCUNSmode);
7905 (define_expand "bleu"
7906 [(set (match_dup 2) (match_dup 1))
7908 (if_then_else (leu (match_dup 2)
7910 (label_ref (match_operand 0 "" ""))
7914 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
7915 rs6000_compare_op0, rs6000_compare_op1);
7916 operands[2] = gen_reg_rtx (CCUNSmode);
7919 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
7920 ;; For SEQ, likewise, except that comparisons with zero should be done
7921 ;; with an scc insns. However, due to the order that combine see the
7922 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
7923 ;; the cases we don't want to handle.
7924 (define_expand "seq"
7925 [(set (match_dup 2) (match_dup 1))
7926 (set (match_operand:SI 0 "gpc_reg_operand" "")
7927 (eq:SI (match_dup 2) (const_int 0)))]
7930 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7931 operands[1] = gen_rtx (COMPARE, mode,
7932 rs6000_compare_op0, rs6000_compare_op1);
7933 operands[2] = gen_reg_rtx (mode);
7936 (define_expand "sne"
7937 [(set (match_dup 2) (match_dup 1))
7938 (set (match_operand:SI 0 "gpc_reg_operand" "")
7939 (ne:SI (match_dup 2) (const_int 0)))]
7942 { if (! rs6000_compare_fp_p)
7945 operands[1] = gen_rtx (COMPARE, CCFPmode,
7946 rs6000_compare_op0, rs6000_compare_op1);
7947 operands[2] = gen_reg_rtx (CCFPmode);
7950 ;; A > 0 is best done using the portable sequence, so fail in that case.
7951 (define_expand "sgt"
7952 [(set (match_dup 2) (match_dup 1))
7953 (set (match_operand:SI 0 "gpc_reg_operand" "")
7954 (gt:SI (match_dup 2) (const_int 0)))]
7957 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7959 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7962 operands[1] = gen_rtx (COMPARE, mode,
7963 rs6000_compare_op0, rs6000_compare_op1);
7964 operands[2] = gen_reg_rtx (mode);
7967 ;; A < 0 is best done in the portable way for A an integer.
7968 (define_expand "slt"
7969 [(set (match_dup 2) (match_dup 1))
7970 (set (match_operand:SI 0 "gpc_reg_operand" "")
7971 (lt:SI (match_dup 2) (const_int 0)))]
7974 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7976 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
7979 operands[1] = gen_rtx (COMPARE, mode,
7980 rs6000_compare_op0, rs6000_compare_op1);
7981 operands[2] = gen_reg_rtx (mode);
7984 (define_expand "sge"
7985 [(set (match_dup 2) (match_dup 1))
7986 (set (match_operand:SI 0 "gpc_reg_operand" "")
7987 (ge:SI (match_dup 2) (const_int 0)))]
7990 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
7991 operands[1] = gen_rtx (COMPARE, mode,
7992 rs6000_compare_op0, rs6000_compare_op1);
7993 operands[2] = gen_reg_rtx (mode);
7996 ;; A <= 0 is best done the portable way for A an integer.
7997 (define_expand "sle"
7998 [(set (match_dup 2) (match_dup 1))
7999 (set (match_operand:SI 0 "gpc_reg_operand" "")
8000 (le:SI (match_dup 2) (const_int 0)))]
8003 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
8005 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
8008 operands[1] = gen_rtx (COMPARE, mode,
8009 rs6000_compare_op0, rs6000_compare_op1);
8010 operands[2] = gen_reg_rtx (mode);
8013 (define_expand "sgtu"
8014 [(set (match_dup 2) (match_dup 1))
8015 (set (match_operand:SI 0 "gpc_reg_operand" "")
8016 (gtu:SI (match_dup 2) (const_int 0)))]
8019 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
8020 rs6000_compare_op0, rs6000_compare_op1);
8021 operands[2] = gen_reg_rtx (CCUNSmode);
8024 (define_expand "sltu"
8025 [(set (match_dup 2) (match_dup 1))
8026 (set (match_operand:SI 0 "gpc_reg_operand" "")
8027 (ltu:SI (match_dup 2) (const_int 0)))]
8030 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
8031 rs6000_compare_op0, rs6000_compare_op1);
8032 operands[2] = gen_reg_rtx (CCUNSmode);
8035 (define_expand "sgeu"
8036 [(set (match_dup 2) (match_dup 1))
8037 (set (match_operand:SI 0 "gpc_reg_operand" "")
8038 (geu:SI (match_dup 2) (const_int 0)))]
8041 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
8042 rs6000_compare_op0, rs6000_compare_op1);
8043 operands[2] = gen_reg_rtx (CCUNSmode);
8046 (define_expand "sleu"
8047 [(set (match_dup 2) (match_dup 1))
8048 (set (match_operand:SI 0 "gpc_reg_operand" "")
8049 (leu:SI (match_dup 2) (const_int 0)))]
8052 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
8053 rs6000_compare_op0, rs6000_compare_op1);
8054 operands[2] = gen_reg_rtx (CCUNSmode);
8057 ;; Here are the actual compare insns.
8059 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
8060 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
8061 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8063 "{cmp%I2|cmpw%I2} %0,%1,%2"
8064 [(set_attr "type" "compare")])
8067 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
8068 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
8069 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
8072 [(set_attr "type" "compare")])
8074 ;; If we are comparing a register for equality with a large constant,
8075 ;; we can do this with an XOR followed by a compare. But we need a scratch
8076 ;; register for the result of the XOR.
8079 [(set (match_operand:CC 0 "cc_reg_operand" "")
8080 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8081 (match_operand:SI 2 "non_short_cint_operand" "")))
8082 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
8083 "find_single_use (operands[0], insn, 0)
8084 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
8085 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
8086 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
8087 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
8090 /* Get the constant we are comparing against, C, and see what it looks like
8091 sign-extended to 16 bits. Then see what constant could be XOR'ed
8092 with C to get the sign-extended value. */
8094 int c = INTVAL (operands[2]);
8095 int sextc = (c << 16) >> 16;
8096 int xorv = c ^ sextc;
8098 operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
8099 operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
8103 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
8104 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
8105 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
8107 "{cmpl%I2|cmplw%I2} %0,%1,%W2"
8108 [(set_attr "type" "compare")])
8111 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
8112 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
8113 (match_operand:DI 2 "reg_or_u_short_operand" "rI")))]
8115 "cmpld%I2 %0,%1,%W2"
8116 [(set_attr "type" "compare")])
8118 ;; The following two insns don't exist as single insns, but if we provide
8119 ;; them, we can swap an add and compare, which will enable us to overlap more
8120 ;; of the required delay between a compare and branch. We generate code for
8121 ;; them by splitting.
8124 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
8125 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
8126 (match_operand:SI 2 "short_cint_operand" "i")))
8127 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8128 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
8131 [(set_attr "length" "8")])
8134 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
8135 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
8136 (match_operand:SI 2 "u_short_cint_operand" "i")))
8137 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8138 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
8141 [(set_attr "length" "8")])
8144 [(set (match_operand:CC 3 "cc_reg_operand" "")
8145 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
8146 (match_operand:SI 2 "short_cint_operand" "")))
8147 (set (match_operand:SI 0 "gpc_reg_operand" "")
8148 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
8150 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
8151 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
8154 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
8155 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
8156 (match_operand:SI 2 "u_short_cint_operand" "")))
8157 (set (match_operand:SI 0 "gpc_reg_operand" "")
8158 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
8160 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
8161 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
8164 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
8165 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
8166 (match_operand:SF 2 "gpc_reg_operand" "f")))]
8169 [(set_attr "type" "fpcompare")])
8172 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
8173 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
8174 (match_operand:DF 2 "gpc_reg_operand" "f")))]
8177 [(set_attr "type" "fpcompare")])
8179 ;; Now we have the scc insns. We can do some combinations because of the
8180 ;; way the machine works.
8182 ;; Note that this is probably faster if we can put an insn between the
8183 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
8184 ;; cases the insns below which don't use an intermediate CR field will
8187 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8188 (match_operator:SI 1 "scc_comparison_operator"
8189 [(match_operand 2 "cc_reg_operand" "y")
8192 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
8193 [(set_attr "length" "12")])
8196 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8197 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
8198 [(match_operand 2 "cc_reg_operand" "y")
8201 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
8202 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
8204 "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
8205 [(set_attr "type" "delayed_compare")
8206 (set_attr "length" "12")])
8209 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8210 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
8211 [(match_operand 2 "cc_reg_operand" "y")
8213 (match_operand:SI 3 "const_int_operand" "n")))]
8217 int is_bit = ccr_bit (operands[1], 1);
8218 int put_bit = 31 - (INTVAL (operands[3]) & 31);
8221 if (is_bit >= put_bit)
8222 count = is_bit - put_bit;
8224 count = 32 - (put_bit - is_bit);
8226 operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
8227 operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
8229 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
8231 [(set_attr "length" "12")])
8234 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8236 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
8237 [(match_operand 2 "cc_reg_operand" "y")
8239 (match_operand:SI 3 "const_int_operand" "n"))
8241 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
8242 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
8247 int is_bit = ccr_bit (operands[1], 1);
8248 int put_bit = 31 - (INTVAL (operands[3]) & 31);
8251 if (is_bit >= put_bit)
8252 count = is_bit - put_bit;
8254 count = 32 - (put_bit - is_bit);
8256 operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
8257 operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
8259 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
8261 [(set_attr "type" "delayed_compare")
8262 (set_attr "length" "12")])
8264 ;; If we are comparing the result of two comparisons, this can be done
8265 ;; using creqv or crxor.
8268 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
8269 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
8270 [(match_operand 2 "cc_reg_operand" "y")
8272 (match_operator 3 "scc_comparison_operator"
8273 [(match_operand 4 "cc_reg_operand" "y")
8275 "REGNO (operands[2]) != REGNO (operands[4])"
8278 enum rtx_code code1, code2;
8280 code1 = GET_CODE (operands[1]);
8281 code2 = GET_CODE (operands[3]);
8283 if ((code1 == EQ || code1 == LT || code1 == GT
8284 || code1 == LTU || code1 == GTU
8285 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
8287 (code2 == EQ || code2 == LT || code2 == GT
8288 || code2 == LTU || code2 == GTU
8289 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
8290 return \"%C1%C3crxor %E0,%j1,%j3\";
8292 return \"%C1%C3creqv %E0,%j1,%j3\";
8294 [(set_attr "length" "12")])
8296 ;; There is a 3 cycle delay between consecutive mfcr instructions
8297 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
8300 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8301 (match_operator:SI 1 "scc_comparison_operator"
8302 [(match_operand 2 "cc_reg_operand" "y")
8304 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
8305 (match_operator:SI 4 "scc_comparison_operator"
8306 [(match_operand 5 "cc_reg_operand" "y")
8308 "REGNO (operands[2]) != REGNO (operands[5])"
8309 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
8310 [(set_attr "length" "20")])
8312 ;; There are some scc insns that can be done directly, without a compare.
8313 ;; These are faster because they don't involve the communications between
8314 ;; the FXU and branch units. In fact, we will be replacing all of the
8315 ;; integer scc insns here or in the portable methods in emit_store_flag.
8317 ;; Also support (neg (scc ..)) since that construct is used to replace
8318 ;; branches, (plus (scc ..) ..) since that construct is common and
8319 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
8320 ;; cases where it is no more expensive than (neg (scc ..)).
8322 ;; Have reload force a constant into a register for the simple insns that
8323 ;; otherwise won't accept constants. We do this because it is faster than
8324 ;; the cmp/mfcr sequence we would otherwise generate.
8327 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8328 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8329 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
8330 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
8333 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8334 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
8335 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8336 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
8337 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
8338 [(set_attr "length" "12,8,12,12,12")])
8341 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
8343 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8344 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8346 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8347 (eq:SI (match_dup 1) (match_dup 2)))
8348 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
8351 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
8352 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
8353 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
8354 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
8355 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
8356 [(set_attr "type" "compare")
8357 (set_attr "length" "12,8,12,12,12")])
8359 ;; We have insns of the form shown by the first define_insn below. If
8360 ;; there is something inside the comparison operation, we must split it.
8362 [(set (match_operand:SI 0 "gpc_reg_operand" "")
8363 (plus:SI (match_operator 1 "comparison_operator"
8364 [(match_operand:SI 2 "" "")
8366 "reg_or_cint_operand" "")])
8367 (match_operand:SI 4 "gpc_reg_operand" "")))
8368 (clobber (match_operand:SI 5 "register_operand" ""))]
8369 "! gpc_reg_operand (operands[2], SImode)"
8370 [(set (match_dup 5) (match_dup 2))
8371 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
8375 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8376 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8377 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8378 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
8379 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
8382 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8383 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
8384 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8385 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8386 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
8387 [(set_attr "length" "12,8,12,12,12")])
8390 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
8393 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8394 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8395 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
8397 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
8400 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8401 {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
8402 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8403 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8404 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
8405 [(set_attr "type" "compare")
8406 (set_attr "length" "12,8,12,12,12")])
8409 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
8412 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8413 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
8414 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
8416 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8417 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8418 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
8421 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8422 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
8423 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8424 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8425 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
8426 [(set_attr "type" "compare")
8427 (set_attr "length" "12,8,12,12,12")])
8430 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
8431 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
8432 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
8435 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8436 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
8437 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8438 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8439 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
8440 [(set_attr "length" "12,8,12,12,12")])
8442 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
8443 ;; since it nabs/sr is just as fast.
8445 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8446 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8448 (clobber (match_scratch:SI 2 "=&r"))]
8450 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
8451 [(set_attr "length" "8")])
8453 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
8455 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8456 (plus:SI (lshiftrt:SI
8457 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8459 (match_operand:SI 2 "gpc_reg_operand" "r")))
8460 (clobber (match_scratch:SI 3 "=&r"))]
8462 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
8463 [(set_attr "length" "8")])
8466 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8468 (plus:SI (lshiftrt:SI
8469 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8471 (match_operand:SI 2 "gpc_reg_operand" "r"))
8473 (clobber (match_scratch:SI 3 "=&r"))]
8475 "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
8476 [(set_attr "type" "compare")
8477 (set_attr "length" "8")])
8480 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8482 (plus:SI (lshiftrt:SI
8483 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
8485 (match_operand:SI 2 "gpc_reg_operand" "r"))
8487 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8488 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
8490 (clobber (match_scratch:SI 3 "=&r"))]
8492 "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
8493 [(set_attr "type" "compare")
8494 (set_attr "length" "8")])
8497 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8498 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8499 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
8500 (clobber (match_scratch:SI 3 "=r,X"))]
8503 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
8504 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
8505 [(set_attr "length" "12")])
8508 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
8510 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8511 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8513 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8514 (le:SI (match_dup 1) (match_dup 2)))
8515 (clobber (match_scratch:SI 3 "=r,X"))]
8518 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
8519 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
8520 [(set_attr "type" "compare,delayed_compare")
8521 (set_attr "length" "12")])
8524 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8525 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8526 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8527 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8528 (clobber (match_scratch:SI 4 "=&r,&r"))]
8531 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
8532 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
8533 [(set_attr "length" "12")])
8536 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8538 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8539 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8540 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8542 (clobber (match_scratch:SI 4 "=&r,&r"))]
8545 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
8546 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
8547 [(set_attr "type" "compare")
8548 (set_attr "length" "12")])
8551 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8553 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8554 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
8555 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8557 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8558 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8559 (clobber (match_scratch:SI 4 "=&r,&r"))]
8562 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
8563 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
8564 [(set_attr "type" "compare")
8565 (set_attr "length" "12")])
8568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8569 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8570 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
8573 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
8574 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
8575 [(set_attr "length" "12")])
8578 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8579 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8580 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8582 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
8583 [(set_attr "length" "12")])
8586 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8588 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8589 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8591 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8592 (leu:SI (match_dup 1) (match_dup 2)))]
8594 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
8595 [(set_attr "type" "compare")
8596 (set_attr "length" "12")])
8599 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8600 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8601 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8602 (match_operand:SI 3 "gpc_reg_operand" "r")))
8603 (clobber (match_scratch:SI 4 "=&r"))]
8605 "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
8606 [(set_attr "length" "8")])
8609 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8611 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8612 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8613 (match_operand:SI 3 "gpc_reg_operand" "r"))
8615 (clobber (match_scratch:SI 4 "=&r"))]
8617 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
8618 [(set_attr "type" "compare")
8619 (set_attr "length" "8")])
8622 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8624 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8625 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8626 (match_operand:SI 3 "gpc_reg_operand" "r"))
8628 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8629 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8630 (clobber (match_scratch:SI 4 "=&r"))]
8632 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
8633 [(set_attr "type" "compare")
8634 (set_attr "length" "8")])
8637 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8638 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8639 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8641 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
8642 [(set_attr "length" "12")])
8645 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8647 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8648 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8649 (match_operand:SI 3 "gpc_reg_operand" "r")))
8650 (clobber (match_scratch:SI 4 "=&r"))]
8652 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
8653 [(set_attr "length" "12")])
8656 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8659 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8660 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8661 (match_operand:SI 3 "gpc_reg_operand" "r"))
8663 (clobber (match_scratch:SI 4 "=&r"))]
8665 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
8666 [(set_attr "type" "compare")
8667 (set_attr "length" "12")])
8670 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8673 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8674 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8675 (match_operand:SI 3 "gpc_reg_operand" "r"))
8677 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8678 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
8679 (clobber (match_scratch:SI 4 "=&r"))]
8681 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
8682 [(set_attr "type" "compare")
8683 (set_attr "length" "12")])
8686 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8687 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8688 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
8690 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
8691 [(set_attr "length" "12")])
8694 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
8696 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8697 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8699 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8700 (lt:SI (match_dup 1) (match_dup 2)))]
8702 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
8703 [(set_attr "type" "delayed_compare")
8704 (set_attr "length" "12")])
8707 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8708 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8709 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8710 (match_operand:SI 3 "gpc_reg_operand" "r")))
8711 (clobber (match_scratch:SI 4 "=&r"))]
8713 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
8714 [(set_attr "length" "12")])
8717 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8719 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8720 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8721 (match_operand:SI 3 "gpc_reg_operand" "r"))
8723 (clobber (match_scratch:SI 4 "=&r"))]
8725 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
8726 [(set_attr "type" "compare")
8727 (set_attr "length" "12")])
8730 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8732 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8733 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8734 (match_operand:SI 3 "gpc_reg_operand" "r"))
8736 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8737 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8738 (clobber (match_scratch:SI 4 "=&r"))]
8740 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
8741 [(set_attr "type" "compare")
8742 (set_attr "length" "12")])
8745 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8746 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8747 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8749 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
8750 [(set_attr "length" "12")])
8753 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8754 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8755 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
8758 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
8759 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
8760 [(set_attr "length" "12")])
8763 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
8765 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8766 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8768 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8769 (ltu:SI (match_dup 1) (match_dup 2)))]
8772 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
8773 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
8774 [(set_attr "type" "compare")
8775 (set_attr "length" "12")])
8778 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
8779 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
8780 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
8781 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
8782 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
8785 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8786 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8787 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
8788 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
8789 [(set_attr "length" "12")])
8792 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8794 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8795 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8796 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8798 (clobber (match_scratch:SI 4 "=&r,&r"))]
8801 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
8802 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
8803 [(set_attr "type" "compare")
8804 (set_attr "length" "12")])
8807 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
8809 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8810 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8811 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8813 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8814 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8815 (clobber (match_scratch:SI 4 "=&r,&r"))]
8818 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
8819 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
8820 [(set_attr "type" "compare")
8821 (set_attr "length" "12")])
8824 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8825 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8826 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
8829 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
8830 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
8831 [(set_attr "length" "8")])
8834 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8835 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8836 (match_operand:SI 2 "reg_or_short_operand" "rI")))
8837 (clobber (match_scratch:SI 3 "=r"))]
8839 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
8840 [(set_attr "length" "12")])
8843 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8845 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8846 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8848 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8849 (ge:SI (match_dup 1) (match_dup 2)))
8850 (clobber (match_scratch:SI 3 "=r"))]
8852 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
8853 [(set_attr "type" "compare")
8854 (set_attr "length" "12")])
8857 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8858 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8859 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8860 (match_operand:SI 3 "gpc_reg_operand" "r")))
8861 (clobber (match_scratch:SI 4 "=&r"))]
8863 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
8864 [(set_attr "length" "12")])
8867 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8869 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8870 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8871 (match_operand:SI 3 "gpc_reg_operand" "r"))
8873 (clobber (match_scratch:SI 4 "=&r"))]
8875 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
8876 [(set_attr "type" "compare")
8877 (set_attr "length" "12")])
8880 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
8882 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8883 (match_operand:SI 2 "reg_or_short_operand" "rI"))
8884 (match_operand:SI 3 "gpc_reg_operand" "r"))
8886 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8887 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
8888 (clobber (match_scratch:SI 4 "=&r"))]
8890 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
8891 [(set_attr "type" "compare")
8892 (set_attr "length" "12")])
8895 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8896 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
8897 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
8899 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
8900 [(set_attr "length" "12")])
8902 ;; This is (and (neg (ge X (const_int 0))) Y).
8904 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8907 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8909 (match_operand:SI 2 "gpc_reg_operand" "r")))
8910 (clobber (match_scratch:SI 3 "=&r"))]
8912 "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
8913 [(set_attr "length" "8")])
8916 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
8920 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8922 (match_operand:SI 2 "gpc_reg_operand" "r"))
8924 (clobber (match_scratch:SI 3 "=&r"))]
8926 "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
8927 [(set_attr "type" "compare")
8928 (set_attr "length" "8")])
8931 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
8935 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
8937 (match_operand:SI 2 "gpc_reg_operand" "r"))
8939 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
8940 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
8943 (clobber (match_scratch:SI 3 "=&r"))]
8945 "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
8946 [(set_attr "type" "compare")
8947 (set_attr "length" "8")])
8950 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8951 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8952 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
8955 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
8956 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
8957 [(set_attr "length" "12")])
8960 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
8962 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8963 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8965 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8966 (geu:SI (match_dup 1) (match_dup 2)))]
8969 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
8970 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
8971 [(set_attr "type" "compare")
8972 (set_attr "length" "12")])
8975 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
8976 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8977 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8978 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
8979 (clobber (match_scratch:SI 4 "=&r,&r"))]
8982 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
8983 {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
8984 [(set_attr "length" "8")])
8987 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
8989 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
8990 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
8991 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8993 (clobber (match_scratch:SI 4 "=&r,&r"))]
8996 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
8997 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
8998 [(set_attr "type" "compare")
8999 (set_attr "length" "8")])
9002 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9004 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9005 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
9006 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9008 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9009 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9010 (clobber (match_scratch:SI 4 "=&r,&r"))]
9013 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
9014 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
9015 [(set_attr "type" "compare")
9016 (set_attr "length" "8")])
9019 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9020 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9021 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
9024 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
9025 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
9026 [(set_attr "length" "12")])
9029 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9031 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9032 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
9033 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
9034 (clobber (match_scratch:SI 4 "=&r,&r"))]
9037 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
9038 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
9039 [(set_attr "length" "12")])
9042 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9045 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9046 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
9047 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9049 (clobber (match_scratch:SI 4 "=&r,&r"))]
9052 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
9053 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
9054 [(set_attr "type" "compare")
9055 (set_attr "length" "12")])
9058 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9061 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9062 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
9063 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9065 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9066 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
9067 (clobber (match_scratch:SI 4 "=&r,&r"))]
9070 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
9071 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
9072 [(set_attr "type" "compare")
9073 (set_attr "length" "12")])
9076 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9077 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9080 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
9081 [(set_attr "length" "12")])
9084 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
9086 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9089 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9090 (gt:SI (match_dup 1) (const_int 0)))]
9092 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
9093 [(set_attr "type" "delayed_compare")
9094 (set_attr "length" "12")])
9097 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9098 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9099 (match_operand:SI 2 "reg_or_short_operand" "r")))]
9101 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
9102 [(set_attr "length" "12")])
9105 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
9107 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9108 (match_operand:SI 2 "reg_or_short_operand" "r"))
9110 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9111 (gt:SI (match_dup 1) (match_dup 2)))]
9113 "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
9114 [(set_attr "type" "delayed_compare")
9115 (set_attr "length" "12")])
9118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9119 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9121 (match_operand:SI 2 "gpc_reg_operand" "r")))
9122 (clobber (match_scratch:SI 3 "=&r"))]
9124 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
9125 [(set_attr "length" "12")])
9128 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9130 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9132 (match_operand:SI 2 "gpc_reg_operand" "r"))
9134 (clobber (match_scratch:SI 3 "=&r"))]
9136 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
9137 [(set_attr "type" "compare")
9138 (set_attr "length" "12")])
9141 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
9143 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9145 (match_operand:SI 2 "gpc_reg_operand" "r"))
9147 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9148 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
9149 (clobber (match_scratch:SI 3 "=&r"))]
9151 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
9152 [(set_attr "type" "compare")
9153 (set_attr "length" "12")])
9156 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9157 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9158 (match_operand:SI 2 "reg_or_short_operand" "r"))
9159 (match_operand:SI 3 "gpc_reg_operand" "r")))
9160 (clobber (match_scratch:SI 4 "=&r"))]
9162 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
9163 [(set_attr "length" "12")])
9166 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
9168 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9169 (match_operand:SI 2 "reg_or_short_operand" "r"))
9170 (match_operand:SI 3 "gpc_reg_operand" "r"))
9172 (clobber (match_scratch:SI 4 "=&r"))]
9174 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
9175 [(set_attr "type" "compare")
9176 (set_attr "length" "12")])
9179 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
9181 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9182 (match_operand:SI 2 "reg_or_short_operand" "r"))
9183 (match_operand:SI 3 "gpc_reg_operand" "r"))
9185 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9186 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9187 (clobber (match_scratch:SI 4 "=&r"))]
9189 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
9190 [(set_attr "type" "compare")
9191 (set_attr "length" "12")])
9194 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9195 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9198 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
9199 [(set_attr "length" "12")])
9202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9203 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9204 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
9206 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
9207 [(set_attr "length" "12")])
9210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9211 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9212 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
9214 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
9215 [(set_attr "length" "12")])
9218 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
9220 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9221 (match_operand:SI 2 "reg_or_short_operand" "rI"))
9223 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
9224 (gtu:SI (match_dup 1) (match_dup 2)))]
9226 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
9227 [(set_attr "type" "compare")
9228 (set_attr "length" "12")])
9231 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
9232 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
9233 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
9234 (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
9235 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
9238 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
9239 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
9240 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
9241 [(set_attr "length" "8,12,12")])
9244 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
9246 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9247 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
9248 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9250 (clobber (match_scratch:SI 4 "=&r,&r"))]
9253 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
9254 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
9255 [(set_attr "type" "compare")
9256 (set_attr "length" "8,12")])
9259 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
9261 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
9262 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
9263 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9265 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9266 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
9267 (clobber (match_scratch:SI 4 "=&r,&r"))]
9270 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
9271 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
9272 [(set_attr "type" "compare")
9273 (set_attr "length" "8,12")])
9276 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9277 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9278 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
9280 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
9281 [(set_attr "length" "8")])
9283 ;; Define both directions of branch and return. If we need a reload
9284 ;; register, we'd rather use CR0 since it is much easier to copy a
9285 ;; register CC value to there.
9289 (if_then_else (match_operator 1 "branch_comparison_operator"
9291 "cc_reg_operand" "x,?y")
9293 (label_ref (match_operand 0 "" ""))
9298 if (get_attr_length (insn) == 8)
9299 return \"%C1bc %t1,%j1,%l0\";
9301 return \"%C1bc %T1,%j1,%$+8\;b %l0\";
9304 [(set_attr "type" "branch")])
9308 (if_then_else (match_operator 0 "branch_comparison_operator"
9310 "cc_reg_operand" "x,?y")
9315 "{%C0bcr|%C0bclr} %t0,%j0"
9316 [(set_attr "type" "branch")
9317 (set_attr "length" "8")])
9321 (if_then_else (match_operator 1 "branch_comparison_operator"
9323 "cc_reg_operand" "x,?y")
9326 (label_ref (match_operand 0 "" ""))))]
9330 if (get_attr_length (insn) == 8)
9331 return \"%C1bc %T1,%j1,%l0\";
9333 return \"%C1bc %t1,%j1,%$+8\;b %l0\";
9335 [(set_attr "type" "branch")])
9339 (if_then_else (match_operator 0 "branch_comparison_operator"
9341 "cc_reg_operand" "x,?y")
9346 "{%C0bcr|%C0bclr} %T0,%j0"
9347 [(set_attr "type" "branch")
9348 (set_attr "length" "8")])
9350 ;; Unconditional branch and return.
9354 (label_ref (match_operand 0 "" "")))]
9357 [(set_attr "type" "branch")])
9359 (define_insn "return"
9363 [(set_attr "type" "jmpreg")])
9365 (define_insn "indirect_jump"
9366 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
9371 [(set_attr "type" "jmpreg")])
9374 [(set (pc) (match_operand:DI 0 "register_operand" "c,l"))]
9379 [(set_attr "type" "jmpreg")])
9381 ;; Table jump for switch statements:
9382 (define_expand "tablejump"
9383 [(use (match_operand 0 "" ""))
9384 (use (label_ref (match_operand 1 "" "")))]
9389 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
9391 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
9395 (define_expand "tablejumpsi"
9397 (plus:SI (match_operand:SI 0 "" "")
9399 (parallel [(set (pc) (match_dup 3))
9400 (use (label_ref (match_operand 1 "" "")))])]
9403 { operands[0] = force_reg (SImode, operands[0]);
9404 operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
9405 operands[3] = gen_reg_rtx (SImode);
9408 (define_expand "tablejumpdi"
9410 (plus:DI (match_operand:DI 0 "" "")
9412 (parallel [(set (pc) (match_dup 3))
9413 (use (label_ref (match_operand 1 "" "")))])]
9416 { operands[0] = force_reg (DImode, operands[0]);
9417 operands[2] = force_reg (DImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
9418 operands[3] = gen_reg_rtx (DImode);
9423 (match_operand:SI 0 "register_operand" "c,l"))
9424 (use (label_ref (match_operand 1 "" "")))]
9429 [(set_attr "type" "jmpreg")])
9433 (match_operand:DI 0 "register_operand" "c,l"))
9434 (use (label_ref (match_operand 1 "" "")))]
9439 [(set_attr "type" "jmpreg")])
9446 ;; Define the subtract-one-and-jump insns, starting with the template
9447 ;; so loop.c knows what to generate.
9449 (define_expand "decrement_and_branch_on_count"
9450 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "")
9452 (label_ref (match_operand 1 "" ""))
9455 (plus:SI (match_dup 0)
9457 (clobber (match_scratch:CC 2 ""))
9458 (clobber (match_scratch:SI 3 ""))])]
9462 ;; We need to be able to do this for any operand, including MEM, or we
9463 ;; will cause reload to blow up since we don't allow output reloads on
9465 ;; In order that the length attribute is calculated correctly, the
9466 ;; label MUST be operand 0.
9470 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
9472 (label_ref (match_operand 0 "" ""))
9474 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9475 (plus:SI (match_dup 1)
9477 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9478 (clobber (match_scratch:SI 4 "=X,X,r"))]
9482 if (which_alternative != 0)
9484 else if (get_attr_length (insn) == 8)
9485 return \"{bdn|bdnz} %l0\";
9487 return \"bdz %$+8\;b %l0\";
9489 [(set_attr "type" "branch")
9490 (set_attr "length" "*,12,16")])
9494 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
9497 (label_ref (match_operand 0 "" ""))))
9498 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9499 (plus:SI (match_dup 1)
9501 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9502 (clobber (match_scratch:SI 4 "=X,X,r"))]
9506 if (which_alternative != 0)
9508 else if (get_attr_length (insn) == 8)
9511 return \"{bdn|bdnz} %$+8\;b %l0\";
9513 [(set_attr "type" "branch")
9514 (set_attr "length" "*,12,16")])
9516 ;; Similar, but we can use GE since we have a REG_NONNEG.
9519 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
9521 (label_ref (match_operand 0 "" ""))
9523 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9524 (plus:SI (match_dup 1)
9526 (clobber (match_scratch:CC 3 "=X,&x,&X"))
9527 (clobber (match_scratch:SI 4 "=X,X,r"))]
9528 "find_reg_note (insn, REG_NONNEG, 0)"
9531 if (which_alternative != 0)
9533 else if (get_attr_length (insn) == 8)
9534 return \"{bdn|bdnz} %l0\";
9536 return \"bdz %$+8\;b %l0\";
9538 [(set_attr "type" "branch")
9539 (set_attr "length" "*,12,16")])
9543 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
9546 (label_ref (match_operand 0 "" ""))))
9547 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9548 (plus:SI (match_dup 1)
9550 (clobber (match_scratch:CC 3 "=X,&x,&X"))
9551 (clobber (match_scratch:SI 4 "=X,X,r"))]
9552 "find_reg_note (insn, REG_NONNEG, 0)"
9555 if (which_alternative != 0)
9557 else if (get_attr_length (insn) == 8)
9560 return \"{bdn|bdnz} %$+8\;b %l0\";
9562 [(set_attr "type" "branch")
9563 (set_attr "length" "*,12,16")])
9567 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
9569 (label_ref (match_operand 0 "" ""))
9571 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9572 (plus:SI (match_dup 1)
9574 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9575 (clobber (match_scratch:SI 4 "=X,X,r"))]
9579 if (which_alternative != 0)
9581 else if (get_attr_length (insn) == 8)
9584 return \"{bdn|bdnz} %$+8\;b %l0\";
9586 [(set_attr "type" "branch")
9587 (set_attr "length" "*,12,16")])
9591 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
9594 (label_ref (match_operand 0 "" ""))))
9595 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
9596 (plus:SI (match_dup 1)
9598 (clobber (match_scratch:CC 3 "=X,&x,&x"))
9599 (clobber (match_scratch:SI 4 "=X,X,r"))]
9603 if (which_alternative != 0)
9605 else if (get_attr_length (insn) == 8)
9606 return \"{bdn|bdnz} %l0\";
9608 return \"bdz %$+8\;b %l0\";
9610 [(set_attr "type" "branch")
9611 (set_attr "length" "*,12,16")])
9615 (if_then_else (match_operator 2 "comparison_operator"
9616 [(match_operand:SI 1 "gpc_reg_operand" "")
9618 (match_operand 5 "" "")
9619 (match_operand 6 "" "")))
9620 (set (match_operand:SI 0 "gpc_reg_operand" "")
9621 (plus:SI (match_dup 1)
9623 (clobber (match_scratch:CC 3 ""))
9624 (clobber (match_scratch:SI 4 ""))]
9626 [(parallel [(set (match_dup 3)
9627 (compare:CC (plus:SI (match_dup 1)
9631 (plus:SI (match_dup 1)
9633 (set (pc) (if_then_else (match_dup 7)
9637 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
9642 (if_then_else (match_operator 2 "comparison_operator"
9643 [(match_operand:SI 1 "gpc_reg_operand" "")
9645 (match_operand 5 "" "")
9646 (match_operand 6 "" "")))
9647 (set (match_operand:SI 0 "general_operand" "")
9648 (plus:SI (match_dup 1) (const_int -1)))
9649 (clobber (match_scratch:CC 3 ""))
9650 (clobber (match_scratch:SI 4 ""))]
9651 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
9652 [(parallel [(set (match_dup 3)
9653 (compare:CC (plus:SI (match_dup 1)
9657 (plus:SI (match_dup 1)
9661 (set (pc) (if_then_else (match_dup 7)
9665 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],